UROverview Plus (URO+)

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

当前为 2024-10-05 提交的版本,查看 最新版本

  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.9
  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.9",
  43. date : "20241005",
  44. changes :
  45. [
  46. "Compatibility updates"
  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/Y7ux4zK5Wfz6T8O4R3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llcj4KICAgPHBsdXM6SW1hZ2VDcmVhdG9yPgogICAgPHJkZjpTZXEvPgogICA8L3BsdXM6SW1hZ2VDcmVhdG9yPgogICA8cGx1czpDb3B5cmlnaHRPd25lcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkNvcHlyaWdodE93bmVyPgogICA8cGx1czpMaWNlbnNvcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkxpY2Vuc29yPgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgIAo8P3hwYWNrZXQgZW5kPSJ3Ij8+txeqYAAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAuIwAALiMBeKU/dgAAAAd0SU1FB+IDAw8pAmNZfO0AAA7kSURBVHja1Zx5kB1FHcc/8459b+9N2GSPhBiBBAQBBeVSI4GEoFQFSIASj+CRshDFQstAgXiiJcT7SLQKUVkQhOIIRVFA1gSSYCFHAgIakFSwSNjdhGU3yR7v7b43M/7Rr/N6erpn3stuTJyqrp7p6Zk3/X2/4/v7dc84HLrNiTme6ObHHFe1pQ4hOM4kA+cfpL4H5V+sFiS9LepY7W+SFj/mGEvbYQuUqTYVUx8bOL7Wphci6sNa9UzAJLRaBSdhuZ9nAMjTah0s50BUL3WI1M4ETkI5Thr6mFRPB8Qt9fdKfVXQdJWrCrDUIbJRaEAkI2onRvUkQJ4Ckqv09wygOP8PqudoUpRUSkqrdUlzNJA8pbhAUQHJjfB0h43qOTF2SZWYVEQxSRYGSZIgJUt1Aihoz+FrNs2pBrTUQQZHB0qXIhWUtFJSSp3UpApNmiRIhVJJWOgHBlV0KpWy1CQC5MRQgYRmf1SQarZv5w3fB1k8L1hHtet9fB/OOovZMUTTq4aMpg6SemFx/zpIUoJqAk+qPKrjBAEwtct97foaC+cqWoioE6WSziRJkWPwZI7B9auGO60BlQEyr7/OUyCkxCQpNgnzfXBdOPNMPgSMKWW8VAqawXc1ahFJSlOTpHI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m7tNFcQAdMpAqASoOLCzA2L5kYXPJPvHfdzpkIFUKVKXeUQcpCiio7KthhwVI1QBVCWDV3rMSiTnkAO0P3/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/JxCSc4ScoZGf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gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgCjw/eHBhY2tldCBlbmQ9InciPz73ndT8AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH4gMDDykcmVZBjgAADbFJREFUeNrtXGuMVcUd/805595z774X9gWlIFIVl0dJUWEhtSD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VTdXBwbGllcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkltYWdlU3VwcGxpZXI+CiAgIDxwbHVzOkltYWdlQ3JlYXRvcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkltYWdlQ3JlYXRvcj4KICAgPHBsdXM6Q29weXJpZ2h0T3duZXI+CiAgICA8cmRmOlNlcS8+CiAgIDwvcGx1czpDb3B5cmlnaHRPd25lcj4KICAgPHBsdXM6TGljZW5zb3I+CiAgICA8cmRmOlNlcS8+CiAgIDwvcGx1czpMaWNlbnNvcj4KICA8L3JkZjpEZXNjcmlwdGlvbj4KIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAKPD94cGFja2V0IGVuZD0idyI/PvOQ5mMAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQfiAwMPKBseKeVsAAAJfElEQVR42u1bXWgcxx3/ze7e7VnWl2vJ0jnCrkiKbRUbxw92nFIwwQ0plIIcDCmUvMQUTB+DyAfkrU8u5K0USvISQp5KbUoJIa2NnbYPwSGxQxI3NdhWPmxJOTknyWeddLe7eZjb3Oz//vNxurtEDxkYdnfuP7czv/l/z6xAd4vQ3Ls820rSxnPSycB7AQJtMz2r9NwkE8tzR2D0AgjuylWORjf5hLTRCsPVqQQ9Eg1u4h65qpP3NP8XMwDE5ErBEBsRjaBHYsFN3lOefYaGEw064ahBHzdoVVCoSLQFSNAjHQEyUd9wFRbRSAGIFRAihT5mJi02g2gIwgW+UgNypZwiCAixUiMAdQWEqJtWI+iSKFAQ1BUPDJXjDDCckILgN64egBoZR0J0imgHlKDDyVMgKBeok84pNVCuPuEKEG5IQag1qqcxz2BERbhySdCmJTCZSo/IvwpC/sYN3EwSIK1xnL2a2ilNkgCPPoofW5yu2NExswJhYn9ozCMFIeWAfGYkylCEyE6Qa0/vSf+8xueoaxwtYRIZsUHnyGOUIlWMOQJECCC8fh3/AeQqcyut45AkAaIIOHoUPwOw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AEXogXvkMuFCyg3ChJGlbgPg7UH5fsweh0JU/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. GetUserNameAndRank: function(userID)
  510. {
  511. let userName;
  512. let userLevel;
  513. if(W.model.users.objects[userID] != null)
  514. {
  515. userName = W.model.users.objects[userID].attributes.userName;
  516. if(userName === undefined)
  517. {
  518. userName = userID;
  519. }
  520. else
  521. {
  522. userName = '<a href="' + (W.Config.user_profile.url + userName) + '" target="_blank">' + userName + '</a>';
  523. }
  524. userLevel = W.model.users.objects[userID].attributes.rank + 1;
  525. }
  526. else
  527. {
  528. userName = userID;
  529. userLevel = '?';
  530. }
  531. return userName + ' (' + userLevel + ')';
  532. },
  533. GetDateTimeString: function(ts)
  534. {
  535. let tDateObj = new Date(ts);
  536. let dateLocale;
  537. let timeLocale;
  538. if(uroUtils.GetCBChecked('_cbDateFmtDDMMYY')) dateLocale = 'en-gb';
  539. if(uroUtils.GetCBChecked('_cbDateFmtMMDDYY')) dateLocale = 'en-us';
  540. if(uroUtils.GetCBChecked('_cbDateFmtYYMMDD')) dateLocale = 'ja';
  541. if(uroUtils.GetCBChecked('_cbTimeFmt24H')) timeLocale = 'en-gb';
  542. if(uroUtils.GetCBChecked('_cbTimeFmt12H')) timeLocale = 'en-us';
  543. return tDateObj.toLocaleDateString(dateLocale) + ' ' + tDateObj.toLocaleTimeString(timeLocale);
  544. },
  545. ParsePxString: function(pxString)
  546. {
  547. return parseInt(pxString.split("px")[0]);
  548. },
  549. TypeCast: function(varin)
  550. {
  551. if(varin == "null") return null;
  552. if(typeof varin == "string") return parseInt(varin);
  553. return varin;
  554. },
  555. Truncate: function(val)
  556. {
  557. if(val === null) return val;
  558. if(val < 0) return Math.ceil(val);
  559. return Math.floor(val);
  560. },
  561. KeywordPresent: function(desc, keyword, caseInsensitive)
  562. {
  563. let re;
  564. if(caseInsensitive) re = RegExp(keyword,'i');
  565. else re = RegExp(keyword);
  566. if(desc.search(re) != -1) return true;
  567. else return false;
  568. },
  569. AddStyle: function(ID, css)
  570. {
  571. let head, style;
  572. head = document.getElementsByTagName('head')[0];
  573. if (!head)
  574. {
  575. return;
  576. }
  577. uroUtils.RemoveStyle(ID); // in case it is already there
  578. style = document.createElement('style');
  579. style.type = 'text/css';
  580. style.innerHTML = uroUtils.ModifyHTML(css);
  581. style.id = ID;
  582. head.appendChild(style);
  583. },
  584. RemoveStyle: function(ID)
  585. {
  586. let style = document.getElementById(ID);
  587. if (style)
  588. {
  589. style.parentNode.removeChild(style);
  590. }
  591. },
  592. GetTS: function(day, month, year, hours, mins)
  593. {
  594. let retval = new Date(0);
  595. retval.setDate(day);
  596. retval.setMonth(month - 1);
  597. retval.setYear(year);
  598. retval.setHours(hours);
  599. retval.setMinutes(mins);
  600. return retval.getTime();
  601. },
  602. ToHex: function(decValue, digits)
  603. {
  604. let modifier = 1;
  605. for(let i=0; i < digits; i++)
  606. {
  607. modifier *= 16;
  608. }
  609. // make sure decValue actually is an integer
  610. decValue = parseInt(decValue);
  611. // adding the modifier ensures we have enough digits, including
  612. // any leading zeros which may be required, for the required output
  613. decValue += modifier;
  614. let retval = decValue.toString(16);
  615. // after converting to hex with the modifier included, we'll have
  616. // as many digits as we need to represent decValue, but also an
  617. // extra leading 1, which now needs to be removed before returning
  618. // the result...
  619. retval = retval.substr(-digits);
  620. retval = retval.toUpperCase();
  621. return retval;
  622. },
  623. GetActiveSidebarTab: function()
  624. {
  625. let retval = null;
  626.  
  627. let tabIcons = document.querySelectorAll('wz-navigation-item');
  628. for(let i = 0; i < tabIcons.length; ++i)
  629. {
  630. if(tabIcons[i].selected === true)
  631. {
  632. retval = tabIcons[i].attributes['data-for'].value;
  633. break;
  634. }
  635. }
  636. return retval;
  637. },
  638. IsClosureUIActive: function()
  639. {
  640. let retval = false;
  641.  
  642. if(W.selectionManager.getSelectedWMEFeatures()[0]?.featureType === 'segment')
  643. {
  644. let ast = uroUtils.GetActiveSidebarTab();
  645. if(ast === 'feature_editor')
  646. {
  647. retval = document.querySelector('wz-tab.closures-tab').attributes['is-active'].value !== 'false';
  648. }
  649. }
  650.  
  651. return retval;
  652. },
  653. ConvertWGS84ToMercator: function(point)
  654. {
  655. return point.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
  656. },
  657. ConvertMercatorToWGS84: function(point)
  658. {
  659. return point.transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326"));
  660. }
  661. };
  662. const uroTabs = // script tab handling
  663. {
  664. MAX_PER_ROW: 6,
  665. IDS:
  666. {
  667. URS: 0,
  668. MPS: 1,
  669. MCS: 2,
  670. RTCS: 3,
  671. RAS: 4,
  672. PLACES: 5,
  673. CAMS: 6,
  674. OWL: 7,
  675. MISC: 8
  676. },
  677. FIELDS:
  678. {
  679. TABHEADER: 0,
  680. TABBODY: 1,
  681. LINKID: 2,
  682. TABTITLE: 3,
  683. SHOWFN: 4,
  684. CLICKFN: 5,
  685. STORAGE: 6,
  686. POPULATEFN: 7
  687. },
  688. CtrlTabs: [],
  689. selectedOWLGroup: null,
  690.  
  691. SetStyleDisplay: function(elm,style)
  692. {
  693. try
  694. {
  695. if(typeof elm == 'object')
  696. {
  697. elm.style.display = style;
  698. }
  699. else
  700. {
  701. document.getElementById(elm).style.display = style;
  702. }
  703. }
  704. catch(err)
  705. {
  706. uroDBG.AddLog('SetStyleDisplay() - '+elm+' not found!');
  707. }
  708. },
  709. PopulateMP: function()
  710. {
  711. let tHTML = '';
  712. tHTML += '<input type="checkbox" id="_cbMPFilterOutsideArea">Hide MPs outside my editable area</input><br><br>';
  713. tHTML += '<b>Filter MPs by type:</b><br>';
  714. let i;
  715. for(i=0; i<uroKnownProblemTypeNames.length; i++)
  716. {
  717. tHTML += '<input type="checkbox" id="_cbMPFilter_T'+uroKnownProblemTypeIDs[i]+'">'+uroKnownProblemTypeNames[i]+'</input><br>';
  718. }
  719. tHTML += '<br><input type="checkbox" id="_cbMPFilterUnknownProblem">Unknown problem type</input><br><br>';
  720.  
  721. tHTML += '&nbsp;&nbsp;<i>Specially tagged types</i><br>';
  722. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterElgin">[Elgin]</input><br>';
  723. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterTrafficCast">[TrafficCast]</input><br>';
  724. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterTrafficMaster">[TM]</input><br>';
  725. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterCaltrans">[Caltrans]</input><br>';
  726. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterTFL">TfL</input><br>';
  727.  
  728. tHTML += '<input type="checkbox" id="_cbMPFilterReopenedProblem">Reopened Problems</input><br><br>';
  729.  
  730. tHTML += '<input type="checkbox" id="_cbInvertMPFilter">Invert operation of type filters?</input><br>';
  731.  
  732. tHTML += '<br><b>Hide closed/solved/unidentified Problems:</b><br>';
  733. tHTML += '<input type="checkbox" id="_cbMPFilterClosed">Closed</input><br>';
  734. tHTML += '<input type="checkbox" id="_cbMPFilterSolved">Solved</input><br>';
  735. tHTML += '<input type="checkbox" id="_cbMPFilterUnidentified">Not identified</input><br><br>';
  736.  
  737. tHTML += '<input type="checkbox" id="_cbMPClosedUserIDFilter" pairedWith="_cbMPNotClosedUserIDFilter">Closed</input> or ';
  738. tHTML += '<input type="checkbox" id="_cbMPNotClosedUserIDFilter" pairedWith="_cbMPClosedUserIDFilter">Not Closed</input> by user';
  739. tHTML += '<select id="_selectMPUserID" style="width:80%; height:22px;"></select><br>';
  740.  
  741. tHTML += '<br><b>Hide problems (not turn) by severity:</b><br>';
  742. tHTML += '<input type="checkbox" id="_cbMPFilterLowSeverity">Low</input>&nbsp;&nbsp;';
  743. tHTML += '<input type="checkbox" id="_cbMPFilterMediumSeverity">Medium</input>&nbsp;&nbsp;';
  744. tHTML += '<input type="checkbox" id="_cbMPFilterHighSeverity">High</input><br>';
  745.  
  746. tHTML += '<br><b>Show MPs based on start/end dates:</b><br>';
  747. tHTML += '<input type="checkbox" id="_cbMPFilterStartDate">Start</input>&nbsp;&nbsp;';
  748. tHTML += '<input type="number" min="1" max="31" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterStartDay"> / ';
  749. tHTML += '<input type="number" min="1" max="12" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterStartMonth"> / ';
  750. tHTML += '<input type="number" min="2010" max="2100" size="4" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterStartYear"><br>';
  751. tHTML += '<input type="checkbox" id="_cbMPFilterEndDate">End</input>&nbsp;&nbsp;';
  752. tHTML += '<input type="number" min="1" max="31" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterEndDay"> / ';
  753. tHTML += '<input type="number" min="1" max="12" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterEndMonth"> / ';
  754. tHTML += '<input type="number" min="2010" max="2100" size="4" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterEndYear"><br>';
  755. tHTML += '<input type="checkbox" id="_cbMPFilterEndDatePassed">End date in the past</input>';
  756.  
  757. return tHTML;
  758. },
  759. PopulatePlaces: function()
  760. {
  761. let tHTML = '';
  762. tHTML += '<b>Filter PURs by category/status:</b><br>';
  763. tHTML += '<input type="checkbox" id="_cbFilterUneditablePlaceUpdates">Ones I can\'t edit</input><br>';
  764. tHTML += '<input type="checkbox" id="_cbPURFilterInsideManagedAreas">Ones within AM areas</input>';
  765. tHTML += '&nbsp;(<input type="checkbox" id="_cbPURExcludeUserArea">except my area)</input><br>';
  766. tHTML += '<i>Requires Area Manager layer to be enabled</i><br>';
  767. tHTML += '<input type="checkbox" id="_cbFilterLockRankedPlaceUpdates">Ones with non-zero lockRanks</input><br>';
  768. tHTML += '<input type="checkbox" id="_cbFilterNewPlacePUR">Ones for new places</input><br>';
  769. tHTML += '<input type="checkbox" id="_cbFilterUpdatedDetailsPUR">Ones for updated place details</input><br>';
  770.  
  771. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFPhone">Phone number</input><br>';
  772. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFName">Name</input><br>';
  773. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFEntryExitPoints">Entry//exit points</input><br>';
  774. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFOpeningHours">Opening hours</input><br>';
  775. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFAliases">Aliases</input><br>';
  776. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFServices">Services</input><br>';
  777. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFGeometry">Geometry</input><br>';
  778. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFHouseNumber">House number</input><br>';
  779. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFCategories">Categories</input><br>';
  780. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFDescription">Description</input><br>';
  781.  
  782. tHTML += '<input type="checkbox" id="_cbFilterNewPhotoPUR">Ones for new photos</input><br>';
  783. tHTML += '<input type="checkbox" id="_cbFilterFlaggedPUR">Ones flagged for attention</input><br>';
  784. tHTML += '<br><input type="checkbox" id="_cbInvertPURFilters">Invert PUR filters</input><br>';
  785.  
  786. tHTML += '<br><b>Filter PURs by age of submission:</b><br>';
  787. tHTML += '<input type="checkbox" id="_cbEnablePURMinAgeFilter">Hide PURs less than </input>';
  788. tHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputPURFilterMinDays"> days old<br>';
  789. tHTML += '<input type="checkbox" id="_cbEnablePURMaxAgeFilter">Hide PURs more than </input>';
  790. tHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputPURFilterMaxDays"> days old<br>';
  791.  
  792. tHTML += '<hr>';
  793.  
  794. tHTML += '<br><b>Filter Places by state:</b><br>';
  795. tHTML += 'Hide if last edited<br>';
  796. tHTML += '<input type="checkbox" id="_cbPlaceFilterEditedLessThan"> less than </input>';
  797. tHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterPlaceEditMinDays"> days ago<br>';
  798. tHTML += '<input type="checkbox" id="_cbPlaceFilterEditedMoreThan"> more than </input>';
  799. tHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterPlaceEditMaxDays"> days ago<br>';
  800.  
  801. tHTML += '<br>Hide if locked at level:<br>';
  802. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL0">1</input>';
  803. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL1">2</input>';
  804. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL2">3</input>';
  805. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL3">4</input>';
  806. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL4">5</input>';
  807. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL5">6</input>';
  808. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesStaff">Staff</input>';
  809. tHTML += '<br>&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesAdLocked">AdLocked</input><br>';
  810.  
  811. tHTML += '<br>Hide by geometry:<br>';
  812. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideAreaPlaces">Areas</input>';
  813. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePointPlaces">Points</input>';
  814.  
  815. tHTML += '<br><br><input type="checkbox" id="_cbHidePhotoPlaces" pairedWith="_cbHideNoPhotoPlaces">Hide or </input>';
  816. tHTML += '<input type="checkbox" id="_cbHideNoPhotoPlaces" pairedWith="_cbHidePhotoPlaces">show ones with photos</input><br>';
  817.  
  818. tHTML += '<input type="checkbox" id="_cbHideLinkedPlaces" pairedWith="_cbHideNoLinkedPlaces">Hide or </input>';
  819. tHTML += '<input type="checkbox" id="_cbHideNoLinkedPlaces" pairedWith="_cbHideLinkedPlaces">show ones with external links</input><br>';
  820.  
  821. tHTML += '<input type="checkbox" id="_cbHideDescribedPlaces" pairedWith="_cbHideNonDescribedPlaces">Hide or </input>';
  822. tHTML += '<input type="checkbox" id="_cbHideNonDescribedPlaces" pairedWith="_cbHideDescribedPlaces">show ones with descriptive text</input><br>';
  823.  
  824. tHTML += '<input type="checkbox" id="_cbHideKeywordPlaces" pairedWith="_cbHideNoKeywordPlaces">Hide or </input>';
  825. tHTML += '<input type="checkbox" id="_cbHideNoKeywordPlaces" pairedWith="_cbHideKeywordPlaces">show ones with a name including</input><br>';
  826. tHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textKeywordPlace"><br>';
  827.  
  828. tHTML += '<br><b>Show Places touched by a specific editor:</b><br>';
  829. tHTML += '<input type="checkbox" id="_cbShowOnlyPlacesCreatedBy">Created by</input>&nbsp;/&nbsp;';
  830. tHTML += '<input type="checkbox" id="_cbShowOnlyPlacesEditedBy">edited by</input><br>';
  831. tHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textPlacesEditor"><br>';
  832. tHTML += '<select id="_selectPlacesUserID" style="width:80%; height:22px;"></select><br>';
  833.  
  834. tHTML += '<br><b>Hide Places touched by a specific editor:</b><br>';
  835. tHTML += '<input type="checkbox" id="_cbHideOnlyPlacesCreatedBy">Created by</input>&nbsp;/&nbsp;';
  836. tHTML += '<input type="checkbox" id="_cbHideOnlyPlacesEditedBy">edited by</input><br>';
  837. tHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textHidePlacesEditor"><br>';
  838. tHTML += '<select id="_selectHidePlacesUserID" style="width:80%; height:22px;"></select><br>';
  839.  
  840. tHTML += '<br><br><b>Filter Places by category:</b><br>';
  841. tHTML += '<input type="checkbox" id="_cbLeavePURGeos" pairedWith="_cbHidePURsForFilteredPlaces">Keep place visible if linked PUR is hidden, or</input><br>';
  842. tHTML += '<input type="checkbox" id="_cbHidePURsForFilteredPlaces" pairedWith="_cbLeavePURGeos">Hide PURs linked to hidden places</input><br><br>';
  843.  
  844. let nCategories = W.Config.venues.categories.length;
  845. let i;
  846. if(uroPlacesGroupsCollapsed.length != nCategories)
  847. {
  848. for(i=0; i<nCategories; i++)
  849. {
  850. uroPlacesGroupsCollapsed.push(false);
  851. }
  852. }
  853.  
  854. for(i=0; i<nCategories; i++)
  855. {
  856. let parentCategory = W.Config.venues.categories[i];
  857. let localisedName = I18n.lookup("venues.categories." + parentCategory);
  858.  
  859. if(uroPlacesGroupsCollapsed[i] === true)
  860. {
  861. tHTML += '<i class="fa fa-plus-square-o" style="cursor:pointer;font-size:14px;" id="_uroPlacesGroupState-'+i+'"></i>';
  862. }
  863. else
  864. {
  865. tHTML += '<i class="fa fa-minus-square-o" style="cursor:pointer;font-size:14px;" id="_uroPlacesGroupState-'+i+'"></i>';
  866. }
  867.  
  868. tHTML += '&nbsp;<input type="checkbox" id="_cbPlacesFilter-'+parentCategory+'"><b>'+localisedName+'</b></input><br>';
  869. tHTML += '<div id="_uroPlacesGroup-'+i+'" style="padding:3px;border-width:2px;border-style:solid;border-color:#FFFFFF">';
  870.  
  871. for(let ii=0; ii<W.Config.venues.subcategories[parentCategory].length; ii++)
  872. {
  873. let subCategory = W.Config.venues.subcategories[parentCategory][ii];
  874. localisedName = I18n.lookup("venues.categories." + subCategory);
  875. tHTML += '&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbPlacesFilter-'+subCategory+'">'+localisedName+'</input><br>';
  876. }
  877. tHTML += '</div>';
  878. }
  879. tHTML += '<input type="checkbox" id="_cbFilterPrivatePlaces"><b>Residential Places</b></input><br>';
  880. tHTML += '<br><input type="checkbox" id="_cbInvertPlacesFilter">Invert Place filters?</input>';
  881.  
  882. return tHTML;
  883. },
  884. PopulateUR: function()
  885. {
  886. let iHTML = '';
  887. iHTML = '<br>';
  888.  
  889. iHTML += '<input type="checkbox" id="_cbURFilterOutsideArea">Hide URs outside my editable area</input><br>';
  890. iHTML += '<input type="checkbox" id="_cbURFilterInsideManagedAreas">Hide URs within AM areas</input>';
  891. iHTML += '&nbsp;(<input type="checkbox" id="_cbURExcludeUserArea">except my area)</input><br>';
  892. iHTML += '&nbsp;<i>Requires Area Manager layer to be enabled</i><br>';
  893. iHTML += '<input type="checkbox" id="_cbNoFilterForURInURL">Don\'t filter selected UR</input><br><br>';
  894. iHTML += '<input type="checkbox" id="_cbURFilterDupes">Show only duplicate URs</input><br><br>';
  895.  
  896. iHTML += '<b>Filter by type:</b><br>';
  897. iHTML += '<input type="checkbox" id="_cbFilterWazeAuto">Waze Automatic</input><br>';
  898. iHTML += '<input type="checkbox" id="_cbFilterIncorrectTurn">Incorrect turn</input><br>';
  899. iHTML += '<input type="checkbox" id="_cbFilterIncorrectAddress">Incorrect address</input><br>';
  900. iHTML += '<input type="checkbox" id="_cbFilterIncorrectRoute">Incorrect route</input><br>';
  901. iHTML += '<input type="checkbox" id="_cbFilterMissingRoundabout">Missing roundabout</input><br>';
  902. iHTML += '<input type="checkbox" id="_cbFilterGeneralError">General error</input><br>';
  903. iHTML += '<input type="checkbox" id="_cbFilterTurnNotAllowed">Turn not allowed</input><br>';
  904. iHTML += '<input type="checkbox" id="_cbFilterIncorrectJunction">Incorrect junction</input><br>';
  905. iHTML += '<input type="checkbox" id="_cbFilterMissingBridgeOverpass">Missing bridge overpass</input><br>';
  906. iHTML += '<input type="checkbox" id="_cbFilterWrongDrivingDirection">Wrong driving direction</input><br>';
  907. iHTML += '<input type="checkbox" id="_cbFilterMissingExit">Missing exit</input><br>';
  908. iHTML += '<input type="checkbox" id="_cbFilterMissingRoad">Missing road</input><br>';
  909. iHTML += '<input type="checkbox" id="_cbFilterBlockedRoad">Blocked road</input><br>';
  910. iHTML += '<input type="checkbox" id="_cbFilterMissingLandmark">Missing Landmark</input><br>';
  911. iHTML += '<input type="checkbox" id="_cbFilterSpeedLimits">Missing or Invalid Speed limit</input><br>';
  912. iHTML += '<input type="checkbox" id="_cbFilterUndefined">Undefined</input><br>';
  913.  
  914. iHTML += '&nbsp;&nbsp;<i>Specially tagged types</i><br>';
  915. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterRoadworks">[ROADWORKS]</input><br>';
  916. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterConstruction">[CONSTRUCTION]</input><br>';
  917. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterClosure">[CLOSURE]</input><br>';
  918. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterEvent">[EVENT]</input><br>';
  919. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterNote">[NOTE]</input><br>';
  920. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterBOG">[BOG]</input><br>';
  921. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterDifficult">[DIFFICULT]</input><br>';
  922. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterWSLM">[WSLM]</input><br><br>';
  923. iHTML += '<input type="checkbox" id="_cbInvertURFilter">Invert operation of type filters?</input><br>';
  924.  
  925. iHTML += '<hr>';
  926.  
  927. iHTML += '<br><b>Hide by state:</b><br>';
  928. iHTML += '<input type="checkbox" id="_cbFilterOpenUR">Open</input><br>';
  929. iHTML += '<input type="checkbox" id="_cbFilterClosedUR">Closed</input><br>';
  930. iHTML += '<input type="checkbox" id="_cbFilterSolved">Solved</input><br>';
  931. iHTML += '<input type="checkbox" id="_cbFilterUnidentified">Not identified</input><br><br>';
  932.  
  933.  
  934. iHTML += '<br><b>Filter by age of submission:</b><br>';
  935. iHTML += '<input type="checkbox" id="_cbEnableMinAgeFilter">Hide URs less than </input>';
  936. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMinDays"> days old<br>';
  937. iHTML += '<input type="checkbox" id="_cbEnableMaxAgeFilter">Hide URs more than </input>';
  938. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMaxDays"> days old<br>';
  939.  
  940. iHTML += '<br><b>Filter by other details:</b><br>';
  941. iHTML += '<input type="checkbox" id="_cbHideMyFollowed" pairedWith="_cbHideMyUnfollowed">Hide</input> or ';
  942. iHTML += '<input type="checkbox" id="_cbHideMyUnfollowed" pairedWith="_cbHideMyFollowed">show</input> URs I\'m following<br><br>';
  943.  
  944. iHTML += '<input type="checkbox" id="_cbURDescriptionMustBePresent" pairedWith="_cbURDescriptionMustBeAbsent">Hide</input> or ';
  945. iHTML += '<input type="checkbox" id="_cbURDescriptionMustBeAbsent" pairedWith="_cbURDescriptionMustBePresent">show</input> URs with no description<br>';
  946. iHTML += '<input type="checkbox" id="_cbEnableKeywordMustBePresent">Hide URs not including </input>';
  947. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textKeywordPresent"><br>';
  948. iHTML += '<input type="checkbox" id="_cbEnableKeywordMustBeAbsent">Hide URs including </input>';
  949. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textKeywordAbsent"><br>';
  950. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbCaseInsensitive"><i>Case-insensitive matches?</i></input><br><br>';
  951.  
  952. iHTML += 'With comments from me?<br>';
  953. iHTML += '<input type="checkbox" id="_cbHideMyComments" pairedWith="_cbHideAnyComments">Yes </input>';
  954. iHTML += '<input type="checkbox" id="_cbHideAnyComments" pairedWith="_cbHideMyComments">No</input><br>';
  955. iHTML += 'If last comment made by me?<br>';
  956. iHTML += '<input type="checkbox" id="_cbHideIfLastCommenter" pairedWith="_cbHideIfNotLastCommenter">Yes </input>';
  957. iHTML += '<input type="checkbox" id="_cbHideIfNotLastCommenter" pairedWith="_cbHideIfLastCommenter">No </input><br>';
  958. iHTML += 'If last comment made by UR reporter?<br>';
  959. iHTML += '<input type="checkbox" id="_cbHideIfReporterLastCommenter" pairedWith="_cbHideIfReporterNotLastCommenter">Yes </input>';
  960. iHTML += '<input type="checkbox" id="_cbHideIfReporterNotLastCommenter" pairedWith="_cbHideIfReporterLastCommenter">No</input><br>';
  961.  
  962. iHTML += '<input type="checkbox" id="_cbEnableMinCommentsFilter">With less than </input>';
  963. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMinComments"> comments<br>';
  964. iHTML += '<input type="checkbox" id="_cbEnableMaxCommentsFilter">With more than </input>';
  965. iHTML += '<input type="number" min="0" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMaxComments"> comments<br><br>';
  966.  
  967. iHTML += '<input type="checkbox" id="_cbEnableCommentAgeFilter2">Last comment less than </input>';
  968. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterCommentDays2"> days ago<br>';
  969. iHTML += '<input type="checkbox" id="_cbEnableCommentAgeFilter">Last comment more than </input>';
  970. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterCommentDays"> days ago<br>';
  971. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbIgnoreOtherEditorComments"><i>Ignore other editor comments?</i></input><br><br>';
  972.  
  973. iHTML += '<input type="checkbox" id="_cbURUserIDFilter">Without comments from user</input>';
  974. iHTML += '<select id="_selectURUserID" style="width:80%; height:22px;"></select><br>';
  975. iHTML += '<input type="checkbox" id="_cbURResolverIDFilter">Not resolved by user</input>';
  976. iHTML += '<select id="_selectURResolverID" style="width:80%; height:22px;"></select>';
  977.  
  978. iHTML += '<br><br><input type="checkbox" id="_cbInvertURStateFilter">Invert operation of state/age filters?</input><br>';
  979. iHTML += '<input type="checkbox" id="_cbNoFilterForTaggedURs">Don\'t apply state/age filters to tagged URs</input><br>';
  980.  
  981. return iHTML;
  982. },
  983. PopulateMC: function()
  984. {
  985. let iHTML = '';
  986. iHTML = '<br>';
  987.  
  988. iHTML += '&nbsp;&nbsp;<i>Specially tagged types</i><br>';
  989. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterRoadworks">[ROADWORKS]</input><br>';
  990. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterConstruction">[CONSTRUCTION]</input><br>';
  991. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterClosure">[CLOSURE]</input><br>';
  992. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterEvent">[EVENT]</input><br>';
  993. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterNote">[NOTE]</input><br>';
  994. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterBOG">[BOG]</input><br>';
  995. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterDifficult">[DIFFICULT]</input><br>';
  996. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterWSLM">[WSLM]</input><br><br>';
  997. iHTML += '<input type="checkbox" id="_cbInvertMCFilter">Invert operation of type filters?</input><br>';
  998.  
  999. iHTML += '<hr>';
  1000.  
  1001. iHTML += '<br><b>Filter by description/comments/following:</b><br>';
  1002. iHTML += '<input type="checkbox" id="_cbMCHideMyFollowed" pairedWith="_cbMCHideMyUnfollowed">Ones I am or </input>';
  1003. iHTML += '<input type="checkbox" id="_cbMCHideMyUnfollowed" pairedWith="_cbMCHideMyFollowed">am not following</input><br><br>';
  1004.  
  1005. iHTML += '<input type="checkbox" id="_cbMCDescriptionMustBePresent" pairedWith="_cbMCDescriptionMustBeAbsent">Hide</input> or ';
  1006. iHTML += '<input type="checkbox" id="_cbMCDescriptionMustBeAbsent" pairedWith="_cbMCDescriptionMustBePresent">show</input> MCs with no description<br>';
  1007. iHTML += '<input type="checkbox" id="_cbMCCommentsMustBePresent" pairedWith="_cbMCCommentsMustBeAbsent">Hide</input> or ';
  1008. iHTML += '<input type="checkbox" id="_cbMCCommentsMustBeAbsent" pairedWith="_cbMCCommentsMustBePresent">show</input> MCs with no comments<br>';
  1009. iHTML += '<input type="checkbox" id="_cbMCExpiryMustBePresent" pairedWith="_cbMCExpiryMustBeAbsent">Hide</input> or ';
  1010. iHTML += '<input type="checkbox" id="_cbMCExpiryMustBeAbsent" pairedWith="_cbMCExpiryMustBePresent">show</input> MCs with no expiry date<br>';
  1011. iHTML += '<input type="checkbox" id="_cbMCEnableKeywordMustBePresent">Hide MCs not including </input>';
  1012. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textMCKeywordPresent"><br>';
  1013. iHTML += '<input type="checkbox" id="_cbMCEnableKeywordMustBeAbsent">Hide MCs including </input>';
  1014. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textMCKeywordAbsent"><br>';
  1015. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCCaseInsensitive"><i>Case-insensitive matches?</i></input><br>';
  1016. iHTML += '<input type="checkbox" id="_cbMCCreatorIDFilter">Show MCs created by user</input>';
  1017. iHTML += '<select id="_selectMCCreatorID" style="width:80%; height:22px;"></select><br>';
  1018.  
  1019. iHTML += '<br><input type="checkbox" id="_cbHideWRCMCs"><b>Hide Waze_roadclosures MCs</b></input><br>';
  1020.  
  1021. iHTML += '<br><b>Hide MCs with lock level:</b><br>';
  1022. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank0">L1</input>';
  1023. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank1">L2</input>';
  1024. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank2">L3</input>';
  1025. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank3">L4</input>';
  1026. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank4">L5</input>';
  1027. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank5">L6</input>';
  1028. iHTML += '<hr>';
  1029. iHTML += '<input type="checkbox" id="_cbMCEnhancePointMCVisibility">Enhance visibility of point MCs</input>';
  1030.  
  1031. return iHTML;
  1032. },
  1033. PopulateCams: function()
  1034. {
  1035. let iHTML = '';
  1036. iHTML = '<br><b>Show Cameras created by:</b><br>';
  1037. iHTML += '<input type="checkbox" id="_cbShowWorldCams" checked>world_* users</input><br>';
  1038. iHTML += '<input type="checkbox" id="_cbShowUSACams" checked>usa_* users</input><br>';
  1039. iHTML += '<input type="checkbox" id="_cbShowNonWorldCams" checked>other users</input><br>';
  1040.  
  1041. iHTML += '<br><b>Show Cameras touched by a specific editor:</b><br>';
  1042. iHTML += '<input type="checkbox" id="_cbShowOnlyCamsCreatedBy">Created by</input>&nbsp;/&nbsp;';
  1043. iHTML += '<input type="checkbox" id="_cbShowOnlyCamsEditedBy">edited by</input><br>';
  1044. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textCameraEditor"><br>';
  1045. iHTML += '<select id="_selectCameraUserID" style="width:80%; height:22px;"></select><br>';
  1046. iHTML += '<br><input type="checkbox" id="_cbShowOnlyMyCams">Show ONLY cameras created/edited by me</input><br>';
  1047.  
  1048. iHTML += '<br><b>Show Cameras by type:</b><br>';
  1049. iHTML += '<input type="checkbox" id="_cbShowSpeedCams" checked>Speed</input><br>';
  1050. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowIfSpeedSet" checked> with speed data</input><br>';
  1051. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowIfNoSpeedSet" checked> with no speed data</input><br>';
  1052. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowIfInvalidSpeedSet" checked> with invalid speed data (zoom 16+)</input><br>';
  1053. iHTML += '&nbsp;&nbsp;&nbsp;<i>NOTE: slows down WME when deselected</i><br>';
  1054. iHTML += '<input type="checkbox" id="_cbShowRedLightCams" checked>Red Light</input><br>';
  1055. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowRLCIfZeroSpeedSet" checked> with speed limit = 0</input><br>';
  1056. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowRLCIfNonZeroSpeedSet" checked> with speed limit > 0</input><br>';
  1057. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowRLCIfNoSpeedSet" checked> with no speed data</input><br>';
  1058. iHTML += '<input type="checkbox" id="_cbShowDummyCams" checked>Dummy</input><br>';
  1059.  
  1060. iHTML += '<br><b>Hide Cameras by creator:</b><br>';
  1061. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByMe">me</input>';
  1062. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank0">L1</input>';
  1063. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank1">L2</input>';
  1064. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank2">L3</input>';
  1065. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank3">L4</input>';
  1066. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank4">L5</input>';
  1067. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank5">L6</input>';
  1068.  
  1069. iHTML += '<br><b>Hide Cameras by updater:</b><br>';
  1070. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByMe">me</input>';
  1071. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank0">L1</input>';
  1072. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank1">L2</input>';
  1073. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank2">L3</input>';
  1074. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank3">L4</input>';
  1075. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank4">L5</input>';
  1076. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank5">L6</input>';
  1077.  
  1078. iHTML += '<br><br><b><input type="checkbox" id="_cbHideManualLockedCams">Show only auto-locked cameras</input></b><br>';
  1079.  
  1080. iHTML += '<br><b><input type="checkbox" id="_cbHideCWLCams">Hide cameras on watchlist</input></b><br>';
  1081.  
  1082. iHTML += '<br><b><input type="checkbox" id="_cbInvertCamFilters">Invert operation of camera filters?</input></b><br>';
  1083.  
  1084. iHTML += '<b><input type="checkbox" id="_cbHighlightInsteadOfHideCams">Highlight instead of hide</input></b><br>';
  1085. return iHTML;
  1086. },
  1087. PopulateRTC: function()
  1088. {
  1089. let iHTML = '';
  1090. iHTML = '<br><b>Hide Road Closures:</b><br>';
  1091. // Hidden checkbox to avoid errors when applying settings from previous versions of the script where this was an active control...
  1092. iHTML += '<input type="checkbox" id="_cbHideUserRTCs" style="display: none;" />';
  1093.  
  1094. iHTML += '<table style="text-align:center;">';
  1095. 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>';
  1096. 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>';
  1097. 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>';
  1098. 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>';
  1099. 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>';
  1100. iHTML += '</table><br>';
  1101.  
  1102. iHTML += '<input type="checkbox" id="_cbShowMTERTCs" pairedWith="_cbHideMTERTCs">Show</input> or ';
  1103. iHTML += '<input type="checkbox" id="_cbHideMTERTCs" pairedWith="_cbShowMTERTCs">hide RTCs associated with MTE: </input>';
  1104. iHTML += '<select id="_selectRTCMTE" style="width:80%; height:22px;"></select><br>';
  1105. iHTML += '<br>';
  1106. iHTML += 'Hide if:<br>';
  1107. iHTML += '<input type="checkbox" id="_cbEnableRTCDurationFilterLessThan">Duration less than </input>';
  1108. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterRTCDurationLessThan"> days<br>';
  1109. iHTML += '<input type="checkbox" id="_cbEnableRTCDurationFilterMoreThan">Duration more than </input>';
  1110. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterRTCDurationMoreThan"> days<br>';
  1111. iHTML += '<br><b>Filter by date/time:</b><br>';
  1112. iHTML += '<input type="checkbox" id="_cbRTCFilterShowForTS" pairedWith="_cbRTCFilterHideForTS">Show</input> or ';
  1113. iHTML += '<input type="checkbox" id="_cbRTCFilterHideForTS" pairedWith="_cbRTCFilterShowForTS">hide</input> RTCs active at<br>';
  1114. iHTML += 'Date: <input type="number" min="1" max="31" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterDay"> / ';
  1115. iHTML += '<input type="number" min="1" max="12" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterMonth"> / ';
  1116. iHTML += '<input type="number" min="2010" max="2100" size="4" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterYear"><br>';
  1117. iHTML += 'Time: <input type="number" min="0" max="23" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterHour">:';
  1118. iHTML += '<input type="number" min="0" max="59" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterMin">';
  1119. return iHTML;
  1120. },
  1121. PopulateRA: function()
  1122. {
  1123. let iHTML = '';
  1124. iHTML = '<br><b>Filter Restricted Areas:</b><br>';
  1125. iHTML += '<input type="checkbox" id="_cbShowSpecificRA">Show a specific area: </input>';
  1126. iHTML += '<select id="_selectRA" style="width:80%; height:22px;"></select><br><br>';
  1127.  
  1128. iHTML += '<input type="checkbox" id="_cbRAEditorIDFilter">Show areas edited by user: </input>';
  1129. iHTML += '<select id="_selectRAEditorID" style="width:80%; height:22px;"></select><br><br>';
  1130.  
  1131. iHTML += 'Hide if:<br>';
  1132. iHTML += '<input type="checkbox" id="_cbEnableRAAgeFilterLessThan">Last modified less than </input>';
  1133. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterRAAgeLessThan"> days ago<br>';
  1134. iHTML += '<input type="checkbox" id="_cbEnableRAAgeFilterMoreThan">Last modified more than </input>';
  1135. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterRAAgeMoreThan"> days ago<br>';
  1136. return iHTML;
  1137. },
  1138. PopulateMisc: function()
  1139. {
  1140. let iHTML = '';
  1141. iHTML += '<br><b><input type="checkbox" id="_cbHideSegmentsWhenRoadsHidden" />Hide segment layer when road layer is hidden</b><br>';
  1142. iHTML += '<br><b><input type="checkbox" id="_cbKillInertialPanning" />Stop inertial panning when mouse moves out of map area</b><br>';
  1143.  
  1144. iHTML += '<br><br><b><input type="checkbox" id="_cbCommentCount" />Show comment count on UR markers</b><br>';
  1145.  
  1146. iHTML += '<br><br><b><input type="checkbox" id="_cbAutoApplyClonedClosure" />Auto-apply cloned closures</b><br>';
  1147. iHTML += '<b><input type="checkbox" id="_cbAutoScrollClosureList" />Auto-scroll to end of closures</b><br>';
  1148.  
  1149. iHTML += '<br><br><b>Disable filtering above zoom level </b>';
  1150. 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>';
  1151.  
  1152. iHTML += '<br><br><b>Marker Unstacking:</b><br>';
  1153. 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>';
  1154. 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>';
  1155.  
  1156. iHTML += '<br><br><b>Popup mouse behaviour:</b><br>';
  1157. 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>';
  1158. 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>';
  1159. 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>';
  1160.  
  1161. iHTML += '<br><br><b>Disable clustering for:</b><br>';
  1162. iHTML += '<input type="checkbox" id="_cbInhibitURClusters" />URs<br>';
  1163. iHTML += '<input type="checkbox" id="_cbInhibitMPClusters" />MPs<br>';
  1164. iHTML += '<input type="checkbox" id="_cbInhibitPUClusters" />PURs<br>';
  1165. iHTML += '<input type="checkbox" id="_cbInhibitESClusters" />ESs<br>';
  1166.  
  1167. iHTML += '<br><br><b>Disable popup for:</b><br>';
  1168. iHTML += '<input type="checkbox" id="_cbInhibitURPopup" />URs<br>';
  1169. iHTML += '<input type="checkbox" id="_cbInhibitMPPopup" />MPs<br>';
  1170. iHTML += '<input type="checkbox" id="_cbInhibitCamPopup" />Cameras<br>';
  1171. iHTML += '<input type="checkbox" id="_cbInhibitSegPopup" />Segments<br>';
  1172. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbInhibitSegGenericPopup" />Speed limit info<br>';
  1173. iHTML += '<input type="checkbox" id="_cbInhibitLandmarkPopup" />Places<br>';
  1174. iHTML += '<input type="checkbox" id="_cbInhibitPUPopup" />Place Updates<br>';
  1175. iHTML += '<input type="checkbox" id="_cbInhibitMapCommentPopup" />Map Comments<br>';
  1176. iHTML += '<input type="checkbox" id="_cbInhibitNodesPopup" />Junction Nodes<br>';
  1177.  
  1178. iHTML += '<br><br><b>Date/Time formatting for popups:</b><br>';
  1179. iHTML += '<input type="checkbox" id="_cbDateFmtDDMMYY" pairedWith="_cbDateFmtMMDDYY,_cbDateFmtYYMMDD" checked />day/month/year<br>';
  1180. iHTML += '<input type="checkbox" id="_cbDateFmtMMDDYY" pairedWith="_cbDateFmtDDMMYY,_cbDateFmtYYMMDD" />month/day/year<br>';
  1181. iHTML += '<input type="checkbox" id="_cbDateFmtYYMMDD" pairedWith="_cbDateFmtMMDDYY,_cbDateFmtDDMMYY" />year/month/day<br><br>';
  1182. iHTML += '<input type="checkbox" id="_cbTimeFmt24H" pairedWith="_cbTimeFmt12H" checked />24 hour<br>';
  1183. iHTML += '<input type="checkbox" id="_cbTimeFmt12H" pairedWith="_cbTimeFmt24H" />12 hour<br><br>';
  1184. iHTML += '<i>Unticked uses browser default setting</i>';
  1185.  
  1186. iHTML += '<br><br><b><input type="checkbox" id="_cbWhiteBackground" />Use custom background colour</b><br>';
  1187. 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" />';
  1188. 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" />';
  1189. 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>';
  1190.  
  1191. iHTML += '<br><br><b>Replace "Next ..." button with "Done" for:</b><br>';
  1192. iHTML += '<input type="checkbox" id="_cbInhibitNURButton" />URs<br>';
  1193. iHTML += '<input type="checkbox" id="_cbInhibitNMPButton" />MPs<br>';
  1194. iHTML += '<input type="checkbox" id="_cbInhibitNPURButton" />PURs<br>';
  1195.  
  1196. iHTML += '<br><br><b>Disable on-click recentering for:</b><br>';
  1197. iHTML += '<input type="checkbox" id="_cbInhibitURCentering" />URs<br>';
  1198. iHTML += '<input type="checkbox" id="_cbInhibitMPCentering" />MPs<br>';
  1199. iHTML += '<input type="checkbox" id="_cbInhibitPURCentering" />PURs<br>';
  1200. iHTML += '<input type="checkbox" id="_cbInhibitPPURCentering" />PPURs<br>';
  1201. iHTML += '<input type="checkbox" id="_cbInhibitRPURCentering" />RPURs<br>';
  1202.  
  1203. iHTML += '<br><br><b><input type="checkbox" id="_cbHideAMLayer" />Hide Area Manager polygons</b><br>';
  1204. iHTML += '<b><input type="checkbox" id="_cbMoveAMList" />Show AMs in topbar when AM layer is active</b><br>';
  1205. iHTML += '<br><b><input type="checkbox" id="_cbDisablePlacesFiltering" />Disable Places filtering</b><br>';
  1206.  
  1207. iHTML += '<br><br><b>Settings backup/restore/reset:</b><br>';
  1208. iHTML += '<input type="button" id="_btnSettingsToText" value="Backup" />&nbsp;&nbsp;&nbsp;';
  1209. iHTML += '<input type="button" id="_btnTextToSettings" value="Restore" />&nbsp;&nbsp;|&nbsp;&nbsp;';
  1210. iHTML += '<input type="button" id="_btnResetSettings" value="Reset" /><br><br>';
  1211. iHTML += '<textarea id="_txtSettings" value=""></textarea><br>';
  1212. iHTML += '<input type="button" id="_btnClearSettingsText" value="Clear" /><br>';
  1213.  
  1214. /*
  1215. iHTML += '<br><br><b>Debug:</b><br>';
  1216. iHTML += '<input type="button" id="_btnDebugToScreen" value="Show debug data" />';
  1217. */
  1218. return iHTML;
  1219. },
  1220. PopulateOWL()
  1221. {
  1222. let camTypes = new Array("","","Speed", "Dummy", "Red Light");
  1223. let iHTML = '';
  1224. if(document.getElementById('_uroCWLGroupSelect') !== null)
  1225. {
  1226. uroTabs.selectedOWLGroup = document.getElementById('_uroCWLGroupSelect').selectedIndex;
  1227. }
  1228. iHTML = '<br><b>Camera Watchlist:</b><br><br>';
  1229. iHTML += '<div id="_uroCWLCamList" style="height:65%;overflow:auto;">';
  1230. if(uroOWL.CWLGroups.length > 0)
  1231. {
  1232. let camidx;
  1233. for(let groupidx=0;groupidx<uroOWL.CWLGroups.length;groupidx++)
  1234. {
  1235. let groupObj = uroOWL.CWLGroups[groupidx];
  1236. iHTML += '<div id="_uroCWLGroup-'+groupidx+'">';
  1237. if(groupObj.groupCollapsed === true)
  1238. {
  1239. iHTML += '<i class="fa fa-plus-square-o" style="cursor:pointer;font-size:14px;" id="_uroCWLGroupState-'+groupidx+'"></i>';
  1240. }
  1241. else
  1242. {
  1243. iHTML += '<i class="fa fa-minus-square-o" style="cursor:pointer;font-size:14px;" id="_uroCWLGroupState-'+groupidx+'"></i>';
  1244. }
  1245. iHTML += '<b>'+groupObj.groupName+'</b><br>';
  1246. groupObj.groupCount = 0;
  1247. if(uroOWL.CamWatchObjects.length > 0)
  1248. {
  1249. for(camidx=0;camidx<uroOWL.CamWatchObjects.length;camidx++)
  1250. {
  1251. let camObj = uroOWL.CamWatchObjects[camidx];
  1252. if(camObj.groupID == groupObj.groupID)
  1253. {
  1254. groupObj.groupCount++;
  1255. let changed = uroOWL.CamDataChanged(camidx);
  1256. let deleted = (camObj.loaded === false);
  1257. iHTML += '<div id="_uroCWL-'+camidx+'" style="padding:3px;border-width:2px;border-style:solid;border-color:#FFFFFF;background-color:';
  1258. if(camObj.server != W.app.getAppRegionCode())
  1259. {
  1260. if(camObj.server == '??') iHTML += '#A0A0A0;';
  1261. else iHTML += '#AAFFAA;';
  1262. }
  1263. else if(changed) iHTML += '#AAAAFF;';
  1264. else if(deleted) iHTML += '#FFAAAA;';
  1265. else iHTML += '#FFFFFF;';
  1266. if(groupObj.groupCollapsed === true) iHTML += 'display:none;">';
  1267. else iHTML += 'display:block;">';
  1268. iHTML += 'ID: '+camObj.fid;
  1269. iHTML += ' ('+camObj.server+')';
  1270. iHTML += ' Type: '+camTypes[camObj.watch.type];
  1271. if(camObj.server != W.app.getAppRegionCode())
  1272. {
  1273. if(camObj.server == '??')
  1274. {
  1275. iHTML += '<br><i>Unknown server</i>';
  1276. }
  1277. else
  1278. {
  1279. iHTML += '<br><i>Not on this server</i>';
  1280. }
  1281. }
  1282. else if(deleted)
  1283. {
  1284. iHTML += '<br>DELETED';
  1285. }
  1286. else if(changed)
  1287. {
  1288. if(camObj.current.type != camObj.watch.type)
  1289. {
  1290. iHTML += '<br>&nbsp;&nbsp;Type changed';
  1291. iHTML += ' ('+camObj.watch.type+' to '+camObj.current.type+')';
  1292. }
  1293. if(camObj.current.azymuth != camObj.watch.azymuth)
  1294. {
  1295. iHTML += '<br>&nbsp;&nbsp;Azimuth changed';
  1296. iHTML += ' ('+camObj.watch.azymuth+' to '+camObj.current.azymuth+')';
  1297. }
  1298. if(camObj.current.speed != camObj.watch.speed)
  1299. {
  1300. iHTML += '<br>&nbsp;&nbsp;Speed changed';
  1301. iHTML += ' ('+camObj.watch.speed+' to '+camObj.current.speed+')';
  1302. }
  1303. if(camObj.current.lat != camObj.watch.lat)
  1304. {
  1305. iHTML += '<br>&nbsp;&nbsp;Latitude changed';
  1306. iHTML += ' ('+camObj.watch.lat+' to '+camObj.current.lat+')';
  1307. }
  1308. if(camObj.current.lon != camObj.watch.lon)
  1309. {
  1310. iHTML += '<br>&nbsp;&nbsp;Longitude changed';
  1311. iHTML += ' ('+camObj.watch.lon+' to '+camObj.current.lon+')';
  1312. }
  1313. }
  1314. if(camObj.server == W.app.getAppRegionCode())
  1315. {
  1316. if(deleted === false)
  1317. {
  1318. iHTML += '&nbsp;<i class="fa fa-group" style="cursor:pointer;font-size:14px;color:#ccccff;" id="_uroCWLIcon1-'+camidx+'"></i>';
  1319. }
  1320. iHTML += '&nbsp;<i class="fa fa-arrow-circle-right" style="cursor:pointer;font-size:14px;color:#ccccff;" id="_uroCWLIcon2-'+camidx+'"></i>';
  1321. }
  1322. iHTML += '</div>';
  1323. }
  1324. }
  1325. }
  1326. iHTML += '</div>';
  1327. }
  1328. }
  1329. iHTML += '</div><div id="_uroCWLControls">';
  1330. iHTML += '<hr>Group control:<br>';
  1331. iHTML += '<select id="_uroCWLGroupSelect" style="width:40%;height:22px;"></select>&nbsp;<input type="button" id="_btnCWLGroupDel" value="Delete group"><br>';
  1332. iHTML += '<input type="text" id="_uroCWLGroupEntry" style="width:40%;height:22px;">&nbsp;<input type="button" id="_btnCWLGroupAdd" value="Add group">';
  1333. iHTML += '<br><input type="button" id="_btnRescanCamWatchList" value="Refresh camera data"><br><br>';
  1334. iHTML += '<input type="button" id="_btnUpdateCamValues" value="Accept all changes"><br><br>';
  1335. iHTML += '<b>Remove cameras from OWL:</b><br>';
  1336. iHTML += '<input type="button" id="_btnRemoveDeletedCameras" value="Deleted">&nbsp;&nbsp;';
  1337. iHTML += '<input type="button" id="_btnRemoveUnknownServerCameras" value="Unknown Server">&nbsp;&nbsp;';
  1338. iHTML += '<input type="button" id="_btnClearCamWatchList" value="ALL Cameras">';
  1339. iHTML += '</div>';
  1340. uroTabs.CtrlTabs[uroTabs.IDS.OWL][uroTabs.FIELDS.TABBODY].innerHTML = uroUtils.ModifyHTML(iHTML);
  1341. uroTabs.FinaliseOWLTab();
  1342. },
  1343. FinaliseOWLTab: function()
  1344. {
  1345. if(uroOWL.CamWatchObjects.length > 0)
  1346. {
  1347. if(document.getElementById("_uroCWL-0") == null)
  1348. {
  1349. window.setTimeout(uroTabs.FinaliseOWLTab,100);
  1350. return;
  1351. }
  1352. for(let camidx=0;camidx<uroOWL.CamWatchObjects.length;camidx++)
  1353. {
  1354. document.getElementById("_uroCWL-"+camidx).onmouseover = uroOWL.HighlightCWLEntry;
  1355. document.getElementById("_uroCWL-"+camidx).onmouseleave = uroOWL.UnhighlightCWLEntry;
  1356. if(uroOWL.CamWatchObjects[camidx].server == W.app.getAppRegionCode())
  1357. {
  1358. let icon1 = document.getElementById("_uroCWLIcon1-"+camidx);
  1359. let icon2 = document.getElementById("_uroCWLIcon2-"+camidx);
  1360. if(icon1 !== null)
  1361. {
  1362. icon1.onmouseover = uroOWL.CWLIconHighlight;
  1363. icon1.onmouseleave = uroOWL.CWLIconLowlight;
  1364. icon1.onclick = uroOWL.AssignCameraToGroup;
  1365. }
  1366. if(icon2 !== null)
  1367. {
  1368. icon2.onmouseover = uroOWL.CWLIconHighlight;
  1369. icon2.onmouseleave = uroOWL.CWLIconLowlight;
  1370. icon2.onclick = uroOWL.GotoCam;
  1371. }
  1372. }
  1373. }
  1374. }
  1375. if(document.getElementById('_btnClearCamWatchList') == null)
  1376. {
  1377. window.setTimeout(uroTabs.FinaliseOWLTab, 100);
  1378. return;
  1379. }
  1380. uroUtils.AddEventListener('_btnClearCamWatchList', 'click', uroOWL.ClearCamWatchList, true);
  1381. uroUtils.AddEventListener('_btnRemoveDeletedCameras', 'click', uroOWL.ClearDeletedCameras, true);
  1382. uroUtils.AddEventListener('_btnRemoveUnknownServerCameras', 'click', uroOWL.ClearUnknownServerCameras, true);
  1383. uroUtils.AddEventListener('_btnRescanCamWatchList', 'click', uroOWL.RescanCamWatchList, true);
  1384. uroUtils.AddEventListener('_btnUpdateCamValues', 'click', uroOWL.AcceptCameraChanges, true);
  1385. uroUtils.AddEventListener('_btnCWLGroupDel', 'click', uroOWL.RemoveCWLGroup, true);
  1386. uroUtils.AddEventListener('_btnCWLGroupAdd', 'click', uroOWL.AddCWLGroup, true);
  1387. if(document.getElementById('_uroCWLGroupSelect') !== null)
  1388. {
  1389. uroDBG.AddLog('populating CWL group list');
  1390. uroOWL.PopulateCWLGroupSelect();
  1391. let selector = document.getElementById('_uroCWLGroupSelect');
  1392. if(uroTabs.selectedOWLGroup >= selector.length)
  1393. {
  1394. uroTabs.selectedOWLGroup = 0;
  1395. }
  1396. selector.selectedIndex = uroTabs.selectedOWLGroup;
  1397. }
  1398. if(uroOWL.CWLGroups.length > 0)
  1399. {
  1400. for(let groupidx=0;groupidx<uroOWL.CWLGroups.length;groupidx++)
  1401. {
  1402. if(uroOWL.CWLGroups[groupidx].groupCount === 0)
  1403. {
  1404. uroTabs.SetStyleDisplay('_uroCWLGroup-'+groupidx,'none');
  1405. }
  1406. else
  1407. {
  1408. uroUtils.SetOnClick('_uroCWLGroupState-'+groupidx,uroOWL.CWLGroupCollapseExpand);
  1409. }
  1410. }
  1411. }
  1412. },
  1413. ActiveTab: function(_id)
  1414. {
  1415. let e = document.getElementById(_id);
  1416. e.style.backgroundColor = "greenyellow";
  1417. e.style.borderTop = "1px solid";
  1418. e.style.borderLeft = "1px solid";
  1419. e.style.borderRight = "1px solid";
  1420. e.style.borderBottom = "0px solid";
  1421. },
  1422. InactiveTab: function(_id)
  1423. {
  1424. let e = document.getElementById(_id);
  1425. e.style.backgroundColor = "gainsboro";
  1426. e.style.borderTop = "0px solid";
  1427. e.style.borderLeft = "0px solid";
  1428. e.style.borderRight = "0px solid";
  1429. e.style.borderBottom = "1px solid";
  1430. },
  1431. InactiveAllTabs: function()
  1432. {
  1433. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  1434. {
  1435. uroTabs.InactiveTab(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABHEADER]);
  1436. uroTabs.SetStyleDisplay(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY], 'none');
  1437. }
  1438. },
  1439. ShowTab: function(tabID)
  1440. {
  1441. uroTabs.InactiveAllTabs();
  1442. uroTabs.ActiveTab(uroTabs.CtrlTabs[tabID][uroTabs.FIELDS.TABHEADER]);
  1443. uroTabs.SetStyleDisplay(uroTabs.CtrlTabs[tabID][uroTabs.FIELDS.TABBODY], 'block');
  1444. return false;
  1445. },
  1446. ShowURs: function()
  1447. {
  1448. uroTabs.ShowTab(uroTabs.IDS.URS);
  1449. return false;
  1450. },
  1451. ShowMPs: function()
  1452. {
  1453. uroTabs.ShowTab(uroTabs.IDS.MPS);
  1454. return false;
  1455. },
  1456. ShowMCs: function()
  1457. {
  1458. uroTabs.ShowTab(uroTabs.IDS.MCS);
  1459. return false;
  1460. },
  1461. ShowPlaces: function()
  1462. {
  1463. uroTabs.ShowTab(uroTabs.IDS.PLACES);
  1464. for(let idx=0;idx<uroPlacesGroupsCollapsed.length;idx++)
  1465. {
  1466. uroPlacesGroupCEHandler(idx);
  1467. }
  1468. return false;
  1469. },
  1470. ShowCams: function()
  1471. {
  1472. uroTabs.ShowTab(uroTabs.IDS.CAMS);
  1473. return false;
  1474. },
  1475. ShowOWL: function()
  1476. {
  1477. uroTabs.ShowTab(uroTabs.IDS.OWL);
  1478. uroTabs.PopulateOWL();
  1479. return false;
  1480. },
  1481. ShowMisc: function()
  1482. {
  1483. uroTabs.ShowTab(uroTabs.IDS.MISC);
  1484. return false;
  1485. },
  1486. ShowRTCs: function()
  1487. {
  1488. uroTabs.ShowTab(uroTabs.IDS.RTCS);
  1489. return false;
  1490. },
  1491. ShowRAs: function()
  1492. {
  1493. uroTabs.ShowTab(uroTabs.IDS.RAS);
  1494. return false;
  1495. },
  1496. ClickURs: function()
  1497. {
  1498. uroFilterURs();
  1499. },
  1500. ClickMPs: function()
  1501. {
  1502. uroFilterProblems();
  1503. },
  1504. ClickMCs: function()
  1505. {
  1506. uroFilterMapComments();
  1507. uroLayers.MCLayerChanged();
  1508. },
  1509. ClickPlaces: function()
  1510. {
  1511. uroFilterPlaces();
  1512. },
  1513. ClickCams: function()
  1514. {
  1515. uroFilterCameras();
  1516. },
  1517. ClickOWL: function()
  1518. {
  1519. // no action required
  1520. },
  1521. ClickMisc: function()
  1522. {
  1523. uroFilterItems();
  1524. uroUITweaks.ChangeMapBGColour();
  1525. uroUITweaks.HideAMLayer();
  1526. uroUITweaks.HideSegments();
  1527. uroUITweaks.ChangeClustering();
  1528. },
  1529. ClickRTCs: function()
  1530. {
  1531. uroFilterRTCs();
  1532. uroClosureListHandler();
  1533. },
  1534. ClickRAs: function()
  1535. {
  1536. uroFilterRAs();
  1537. },
  1538. CreateTabHeaders: function()
  1539. {
  1540. uroTabs.CtrlTabs =
  1541. [
  1542. ['_tabURs', null, '_linkURs', 'URs', uroTabs.ShowURs, uroTabs.ClickURs, 'UROverviewUROptions', uroTabs.PopulateUR],
  1543. ['_tabMPs', null, '_linkMPs', 'MPs', uroTabs.ShowMPs, uroTabs.ClickMPs, 'UROverviewMPOptions', uroTabs.PopulateMP],
  1544. ['_tabMCs', null, '_linkMCs', 'MCs', uroTabs.ShowMCs, uroTabs.ClickMCs, 'UROverviewMCOptions', uroTabs.PopulateMC],
  1545. ['_tabRTCs', null, '_linkRTCs', 'RTCs', uroTabs.ShowRTCs, uroTabs.ClickRTCs, 'UROverviewRTCOptions', uroTabs.PopulateRTC],
  1546. ['_tabRAs', null, '_linkRAs', 'RAs', uroTabs.ShowRAs, uroTabs.ClickRAs, 'UROverviewRAOptions', uroTabs.PopulateRA],
  1547. ['_tabPlaces', null, '_linkPlaces', 'Places', uroTabs.ShowPlaces, uroTabs.ClickPlaces, 'UROverviewPlacesOptions', uroTabs.PopulatePlaces],
  1548. ['_tabCams', null, '_linkCams', 'Cams', uroTabs.ShowCams, uroTabs.ClickCams, 'UROverviewCameraOptions', uroTabs.PopulateCams],
  1549. ['_tabOWL', null, '_linkOWL', 'OWL', uroTabs.ShowOWL, uroTabs.ClickOWL, null, null],
  1550. ['_tabMisc', null, '_linkMisc', 'Misc', uroTabs.ShowMisc, uroTabs.ClickMisc, 'UROverviewMiscOptions', uroTabs.PopulateMisc]
  1551. ];
  1552.  
  1553. let i;
  1554. let tabsTotal = uroTabs.CtrlTabs.length;
  1555. let tabsPerRow = Math.ceil(tabsTotal / Math.ceil(tabsTotal / uroTabs.MAX_PER_ROW));
  1556. let tabCount = 0;
  1557. let tabbyHTML = '';
  1558. for(i = 0; i < tabsTotal; ++i)
  1559. {
  1560. if(tabCount == 0)
  1561. {
  1562. tabbyHTML += '<table border=0 width="100%"><tr>';
  1563. }
  1564. tabbyHTML += '<td valign="center" align="center" id="'+uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABHEADER]+'">';
  1565. 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>';
  1566. if(((++tabCount == tabsPerRow) && (i < (tabsTotal - 1))) || (i == (tabsTotal - 1)))
  1567. {
  1568. tabbyHTML += '</tr></table>';
  1569. tabCount = 0;
  1570. }
  1571. }
  1572. return tabbyHTML;
  1573. },
  1574. CreateTabBodies: function()
  1575. {
  1576. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  1577. {
  1578. uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY] = document.createElement('div');
  1579. }
  1580. },
  1581. AddToDOM: function()
  1582. {
  1583. let i;
  1584. for(i = 0; i < uroTabs.CtrlTabs.length; ++i)
  1585. {
  1586. if(uroTabs.CtrlTabs[i][uroTabs.FIELDS.POPULATEFN] != null)
  1587. {
  1588. uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY].innerHTML = uroTabs.CtrlTabs[i][uroTabs.FIELDS.POPULATEFN]();
  1589. }
  1590. document.getElementById('uroControlsContainer').appendChild(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY]);
  1591. uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY].onclick = uroTabs.CtrlTabs[i][uroTabs.FIELDS.CLICKFN];
  1592. }
  1593. }
  1594. };
  1595. const uroDBG = // debug output handling
  1596. {
  1597. // true enables debug output during script startup
  1598. showDebugOutput: true,
  1599. // true keeps debug output enabled after script startup
  1600. persistentDebugOutput: false,
  1601. // true enables performance monitoring debug output
  1602. performanceMonitoringOutput: false,
  1603.  
  1604. recentDebug: [],
  1605.  
  1606. Add: function(debugtext)
  1607. {
  1608. let ts = Math.round(performance.now());
  1609. if(uroDBG.recentDebug.length == 100)
  1610. {
  1611. uroDBG.recentDebug.shift();
  1612. }
  1613. uroDBG.recentDebug.push(ts+': '+debugtext);
  1614. console.debug('URO+DBG '+ts+':'+debugtext);
  1615. },
  1616. Dump: function()
  1617. {
  1618. if(uroDBG.recentDebug.length > 0)
  1619. {
  1620. document.getElementById('WazeMap').innerHTML = uroUtils.ModifyHTML('<textarea id="uroDbgOutput" style="width:100%;height:100%">');
  1621. let dbgOutput = '';
  1622. for(let i = 0; i < uroDBG.recentDebug.length; i++)
  1623. {
  1624. dbgOutput += uroDBG.recentDebug[i]+'\n';
  1625. }
  1626. document.getElementById('uroDbgOutput').textContent = dbgOutput;
  1627. }
  1628. },
  1629. Toggle: function()
  1630. {
  1631. uroDBG.showDebugOutput = !uroDBG.showDebugOutput;
  1632. let dbgMode = "none";
  1633. if(uroDBG.showDebugOutput)
  1634. {
  1635. dbgMode = "inline";
  1636. }
  1637. document.getElementById('_uroDebugMode').style.display = dbgMode;
  1638. },
  1639. PerfMon: function(source, ts)
  1640. {
  1641. if(uroDBG.performanceMonitoringOutput === true)
  1642. {
  1643. console.log(source+': '+(performance.now() - ts));
  1644. }
  1645. },
  1646. AddLog: function(logtext)
  1647. {
  1648. if(uroDBG.showDebugOutput) console.log('URO+: '+Date()+' '+logtext);
  1649. }
  1650. };
  1651. const uroAFN = // area friendly name functions
  1652. {
  1653. friendlyNames: [],
  1654. hoverTime: -1,
  1655. hoverObj: null,
  1656. overlayShown: false,
  1657. editHovered: false,
  1658. editBox: null,
  1659. friendlyAreaNames: null,
  1660. AFNObject: function(fName, area, server)
  1661. {
  1662. this.fName = fName;
  1663. this.area = area;
  1664. this.server = server;
  1665. },
  1666. UpdateName: function(name, server, area)
  1667. {
  1668. let foundExisting = false;
  1669. for(let i = 0; i < uroAFN.friendlyNames.length; i++)
  1670. {
  1671. if((uroAFN.friendlyNames[i].server == server) && (uroAFN.friendlyNames[i].area == area))
  1672. {
  1673. if(name === "")
  1674. {
  1675. this.friendlyNames.splice(i, 1);
  1676. foundExisting = true;
  1677. }
  1678. else
  1679. {
  1680. uroAFN.friendlyNames[i].fName = name;
  1681. foundExisting = true;
  1682. }
  1683. }
  1684. }
  1685. if((foundExisting === false) && (name !== ""))
  1686. {
  1687. uroAFN.friendlyNames.push(new uroAFN.AFNObject(name, area, server));
  1688. }
  1689. uroAFN.ReplaceAreaNames(true);
  1690. },
  1691. AreaNameHover: function()
  1692. {
  1693. if((uroAFN.hoverObj === null) || (uroAFN.hoverObj != this))
  1694. {
  1695. uroAFN.hoverTime = 0;
  1696. }
  1697. uroAFN.hoverObj = this;
  1698. },
  1699. AreaNameUnHover: function()
  1700. {
  1701. if(uroAFN.editHovered === true)
  1702. {
  1703. return false;
  1704. }
  1705. if(uroAFN.overlayShown)
  1706. {
  1707. uroAFN.hoverObj.removeChild(uroAFN.editBox);
  1708. }
  1709. uroAFN.hoverObj = null;
  1710. uroAFN.hoverTime = -1;
  1711. uroAFN.overlayShown = false;
  1712. },
  1713. EditHover: function()
  1714. {
  1715. uroAFN.editHovered = true;
  1716. uroUtils.AddEventListener('uroANEditBox', 'mouseout', uroAFN.EditUnHover, false);
  1717. uroUtils.AddEventListener('uroANEditBox', 'click', uroAFN.EditClick, false);
  1718. },
  1719. EditUnHover: function()
  1720. {
  1721. let newName = document.getElementById('_textAreaName').value;
  1722. // sanitise name to avoid conflicts with config storage delimiters...
  1723. newName = newName.replace(',','');
  1724. newName = newName.replace(':','');
  1725. let server = W.app.getAppRegionCode();
  1726. let area = uroAFN.GetAreaArea(uroAFN.hoverObj.parentNode.children[1].innerText);
  1727. uroAFN.hoverObj.removeChild(uroAFN.editBox);
  1728. uroAFN.overlayShown = false;
  1729. uroAFN.editHovered = false;
  1730. uroAFN.UpdateName(newName, server, area);
  1731. },
  1732. EditClick: function(e)
  1733. {
  1734. // this traps the click to prevent it falling through to the underlying area name element and
  1735. // potentially causing the map view to be relocated to that area...
  1736. e.stopPropagation();
  1737. },
  1738. GetAreaArea: function(area)
  1739. {
  1740. area = parseFloat(area.split(' ')[0]);
  1741. return area;
  1742. },
  1743. OverlaySetup: function()
  1744. {
  1745. uroAFN.overlayShown = true;
  1746. uroAFN.editBox = document.createElement('div');
  1747. uroAFN.editBox.id = "uroANEditBox";
  1748. uroAFN.editBox.style.position = "absolute";
  1749. uroAFN.editBox.style.top = '0px';
  1750. uroAFN.editBox.style.left = '0px';
  1751. uroAFN.editBox.style.width = "99%";
  1752. uroAFN.hoverObj.appendChild(uroAFN.editBox);
  1753. uroAFN.editBox.onmouseover = uroAFN.EditHover();
  1754. let existingName = uroAFN.hoverObj.innerHTML;
  1755. let italicTagPos = existingName.indexOf(' <i>');
  1756. if(italicTagPos == -1)
  1757. {
  1758. existingName = "";
  1759. }
  1760. else
  1761. {
  1762. existingName = existingName.substr(0,italicTagPos);
  1763. }
  1764. uroAFN.editBox.innerHTML = uroUtils.ModifyHTML('<input type="text" style="font-size:14px; line-height:16px; height:22px; width:100%" id="_textAreaName" value="'+existingName+'">');
  1765. },
  1766. ReplaceAreaNames: function(replaceAfterNameChange)
  1767. {
  1768. if(document.getElementById('sidepanel-areas') === undefined)
  1769. {
  1770. return;
  1771. }
  1772. if(document.getElementById('sidepanel-areas').getElementsByClassName('result-list').length === 0)
  1773. {
  1774. return;
  1775. }
  1776. if(replaceAfterNameChange === false)
  1777. {
  1778. if(document.getElementById('sidepanel-areas').getElementsByClassName('result-list')[0].id == "friendlyNamed")
  1779. {
  1780. return;
  1781. }
  1782. }
  1783. let panelRootObj = document.getElementById('sidepanel-areas').getElementsByClassName('result-list')[0];
  1784. if(panelRootObj === undefined)
  1785. {
  1786. // we get here if the user doesn't have any areas defined...
  1787. return;
  1788. }
  1789. let areaNameObjs = panelRootObj.getElementsByClassName('list-item-card-info');
  1790. if(areaNameObjs.length === 0)
  1791. {
  1792. return;
  1793. }
  1794. let localisedManagedArea = I18n.lookup("user.areas.managed_area");
  1795. for(let loop=0; loop < areaNameObjs.length; loop++)
  1796. {
  1797. if(areaNameObjs[loop].children.length === 2)
  1798. {
  1799. let title = areaNameObjs[loop].children[0].innerText;
  1800. if(title.indexOf(localisedManagedArea) > -1)
  1801. {
  1802. let area = uroAFN.GetAreaArea(areaNameObjs[loop].children[1].innerText);
  1803. areaNameObjs[loop].children[0].innerHTML = uroUtils.ModifyHTML(localisedManagedArea);
  1804. for(let fnIdx=0; fnIdx < uroAFN.friendlyNames.length; fnIdx++)
  1805. {
  1806. let fnObj = uroAFN.friendlyNames[fnIdx];
  1807. if((fnObj.area == area) && (fnObj.server == W.app.getAppRegionCode()))
  1808. {
  1809. areaNameObjs[loop].children[0].innerHTML = uroUtils.ModifyHTML(fnObj.fName +' <i>('+localisedManagedArea+')</i>');
  1810. break;
  1811. }
  1812. }
  1813. let titleObj = areaNameObjs[loop].getElementsByClassName('list-item-card-title')[0];
  1814. titleObj.addEventListener("mouseover", uroAFN.AreaNameHover, false);
  1815. titleObj.addEventListener("mouseout", uroAFN.AreaNameUnHover, false);
  1816. titleObj.style.cursor = "text";
  1817. }
  1818. }
  1819. }
  1820. document.getElementById('sidepanel-areas').getElementsByClassName('result-list')[0].id = "friendlyNamed";
  1821. },
  1822. ApplyNames: function()
  1823. {
  1824. let objects = localStorage.UROverviewFriendlyAreaNames.split(':');
  1825. uroAFN.friendlyNames = [];
  1826. for(let objIdx=0;objIdx<objects.length;objIdx++)
  1827. {
  1828. let fields = objects[objIdx].split(',');
  1829. uroAFN.friendlyNames.push(new uroAFN.AFNObject(fields[0],parseFloat(fields[1]),fields[2]));
  1830. }
  1831. uroAFN.ReplaceAreaNames(true);
  1832. }
  1833. };
  1834. const uroMarkers = // marker-related function
  1835. {
  1836. elm : null,
  1837. obj : null,
  1838. id : null,
  1839. type : null,
  1840. lastOver : null,
  1841.  
  1842. mouseX : null,
  1843. mouseY : null,
  1844. mouseButtons : null,
  1845. clientX : null,
  1846. clientY : null,
  1847. armHover : false,
  1848. entryTimeout : null,
  1849. inhibitSetCenter : false,
  1850. clickedOnCenter : null,
  1851. clickedOnID : null,
  1852.  
  1853. EntryTimeout: function()
  1854. {
  1855. uroMarkers.armHover = false;
  1856. if(uroMarkers.lastOver !== null)
  1857. {
  1858. if(uroMarkers.type === 'cam')
  1859. {
  1860. if(uroUtils.GetCBChecked('_cbHighlightInsteadOfHideCams') === true)
  1861. {
  1862. if(uroMarkers.lastOver !== uroMarkers.id)
  1863. {
  1864. window.setTimeout(uroFilterCameras, 50);
  1865. }
  1866. }
  1867. }
  1868. else if((uroMarkers.type == uroLayers.ID.UR) || (uroMarkers.type == uroLayers.ID.MP))
  1869. {
  1870. if(uroMarkers.type == uroLayers.ID.UR) uroHoveredURID = uroMarkers.id;
  1871. }
  1872.  
  1873. uroDBG.AddLog('hover over marker (Type ' + uroMarkers.type + ' / ID ' + uroMarkers.id + ')');
  1874. uroPopup.Generate();
  1875. }
  1876. },
  1877. MouseMove: function(e)
  1878. {
  1879. uroMarkers.buttons = e.buttons;
  1880. uroMarkers.mouseX = e.pageX - document.getElementById('map').getBoundingClientRect().left;
  1881. uroMarkers.mouseY = e.pageY - document.getElementById('map').getBoundingClientRect().top;
  1882. uroMarkers.clientX = e.clientX;
  1883. uroMarkers.clientY = e.clientY;
  1884.  
  1885. if(uroMarkers.armHover === true)
  1886. {
  1887. let eto = uroUtils.GetElmValue('_inputPopupEntryTimeout') * 100;
  1888. if(uroMarkers.entryTimeout !== null)
  1889. {
  1890. window.clearTimeout(uroMarkers.entryTimeout);
  1891. }
  1892. uroMarkers.entryTimeout = window.setTimeout(uroMarkers.EntryTimeout, eto);
  1893. }
  1894. },
  1895. TranslateType: function(ft)
  1896. {
  1897. const TLU =
  1898. [
  1899. ["mapProblem", uroLayers.ID.MP],
  1900. ["mapUpdateRequest", uroLayers.ID.UR],
  1901. ["placeUpdate", uroLayers.ID.PUR],
  1902. ["segmentSuggestionGeoIcon", uroLayers.ID.SegSug],
  1903. ["camera", "cam"],
  1904. ["node", "node"],
  1905. ["comment", "comment"],
  1906. ["venue", "venue"],
  1907. ["segment", "segment"]
  1908. ];
  1909.  
  1910. let retval = null;
  1911. for(let i = 0; i < TLU.length; ++i)
  1912. {
  1913. if(ft == TLU[i][0])
  1914. {
  1915. retval = TLU[i][1];
  1916. break;
  1917. }
  1918. }
  1919. return retval;
  1920. },
  1921. MouseOver: function(e)
  1922. {
  1923. let elm = null;
  1924. let obj = null;
  1925. let id = null;
  1926. let markerType = null;
  1927. let ft = e?.feature?.attributes?.wazeFeature?.featureType;
  1928. if(ft !== undefined)
  1929. {
  1930. // single marker...
  1931. obj = e.feature.attributes.wazeFeature._wmeObject;
  1932. elm = W.userscripts.getMapElementByDataModel(obj);
  1933. id = e.feature.attributes.wazeFeature.id;
  1934. markerType = uroMarkers.TranslateType(ft);
  1935.  
  1936. uroMarkers.elm = elm;
  1937. uroMarkers.obj = obj;
  1938. uroMarkers.id = id;
  1939. uroMarkers.type = markerType;
  1940. uroMarkers.lastOver = id;
  1941. uroMarkers.armHover = true;
  1942.  
  1943. uroMarkers.AddMarkerEventHandler();
  1944. }
  1945. /*
  1946. else
  1947. {
  1948. if(e?.feature?.cluster !== undefined)
  1949. {
  1950. // cluster marker...
  1951. let cm = e.feature.cluster;
  1952. if(cm.length > 0)
  1953. {
  1954. // clusters are always of the same type, so just need to check the
  1955. // first marker within the cluster to see what the type is for all
  1956. // of them...
  1957. ft = cm[0].attributes.wazeFeature.featureType;
  1958. markerType = uroMarkers.TranslateType(ft);
  1959.  
  1960. console.debug("Cluster Marker:");
  1961. console.debug(" Type = " + ft);
  1962. console.debug(" Cluster size = " + cm.length);
  1963. console.debug(e);
  1964. }
  1965. }
  1966. }
  1967. */
  1968. },
  1969. MouseOver2: function(e)
  1970. {
  1971. let elm = null;
  1972. let obj = null;
  1973. let id = null;
  1974. let markerType = null;
  1975. let ft = e?.currentTarget?.attributes?.class?.value;
  1976. if(ft !== undefined)
  1977. {
  1978. elm = e.currentTarget;
  1979. if(ft.indexOf("permanentHazardMarker") !== -1)
  1980. {
  1981. elm = elm.parentNode;
  1982. markerType = "phCam";
  1983. }
  1984. obj = W.userscripts.getDataModelByMapElement(elm);
  1985. id = elm.attributes["data-id"].value;
  1986.  
  1987. console.debug(ft);
  1988. console.debug(id);
  1989.  
  1990. uroMarkers.elm = elm;
  1991. uroMarkers.obj = obj;
  1992. uroMarkers.id = id;
  1993. uroMarkers.type = markerType;
  1994. uroMarkers.lastOver = id;
  1995. uroMarkers.armHover = true;
  1996. }
  1997. },
  1998. MouseOut: function()
  1999. {
  2000. uroMarkers.lastOver = null;
  2001. if(uroMarkers.type !== null)
  2002. {
  2003. if(uroMarkers.type === 'cam')
  2004. {
  2005. if(uroUtils.GetCBChecked('_cbHighlightInsteadOfHideCams') === true)
  2006. {
  2007. window.setTimeout(uroFilterCameras, 50);
  2008. }
  2009. }
  2010. uroDBG.AddLog('hover off '+uroMarkers.type+' ID '+uroMarkers.id);
  2011. uroHoveredURID = null;
  2012.  
  2013. uroFID = -1;
  2014. if(uroStackType !== null)
  2015. {
  2016. let tStackType = uroStackType;
  2017. uroRestackMarkers();
  2018. if(tStackType == 1)
  2019. {
  2020. uroFilterURs();
  2021. }
  2022. else if(tStackType == 2)
  2023. {
  2024. uroFilterProblems();
  2025. }
  2026. else if(tStackType == 3)
  2027. {
  2028. uroFilterPlaces();
  2029. }
  2030. }
  2031.  
  2032. if(uroPopup.timer == -1)
  2033. {
  2034. uroPopup.timer = uroUtils.GetElmValue('_inputPopupExitTimeout');
  2035. }
  2036. }
  2037. else
  2038. {
  2039. uroDBG.AddLog('hover off unknown object...');
  2040. }
  2041. },
  2042. MouseOut2: function()
  2043. {
  2044. uroMarkers.lastOver = null;
  2045. if(uroMarkers.type !== null)
  2046. {
  2047. uroDBG.AddLog('hover off '+uroMarkers.type+' ID '+uroMarkers.id);
  2048. uroHoveredURID = null;
  2049. uroFID = -1;
  2050. if(uroPopup.timer == -1)
  2051. {
  2052. uroPopup.timer = uroUtils.GetElmValue('_inputPopupExitTimeout');
  2053. }
  2054. }
  2055. else
  2056. {
  2057. uroDBG.AddLog('hover off unknown object...');
  2058. }
  2059. },
  2060. MouseDown: function()
  2061. {
  2062. // Do this stuff in the mousedown event rather than the click event so we fire before any of the native
  2063. // click events - we need to ensure this happens for inhibiting marker centering, as we need to capture
  2064. // the markerType ahead of our interceptor function being called to deal with the centering...
  2065. if(uroMarkers.type !== null)
  2066. {
  2067. uroDBG.AddLog('clicked on '+uroMarkers.type+' marker '+uroMarkers.id);
  2068. uroMarkers.clickedOnID = uroMarkers.id;
  2069. uroMarkers.clickedOnCenter = W.map.getCenter();
  2070. uroInhibitURFiltering = true;
  2071. if(uroMarkers.inhibitSetCenter === false)
  2072. {
  2073. if(uroMarkers.Decentre() === true)
  2074. {
  2075. uroMarkers.inhibitSetCenter = true;
  2076. }
  2077. }
  2078. }
  2079. },
  2080. Decentre: function()
  2081. {
  2082. let inhibit = false;
  2083. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.UR) && (uroUtils.GetCBChecked("_cbInhibitURCentering")));
  2084. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.MP) && (uroUtils.GetCBChecked("_cbInhibitMPCentering")));
  2085. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.PUR) && (uroUtils.GetCBChecked("_cbInhibitPURCentering")));
  2086. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.PPUR) && (uroUtils.GetCBChecked("_cbInhibitPPURCentering")));
  2087. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.RPUR) && (uroUtils.GetCBChecked("_cbInhibitRPURCentering")));
  2088. return inhibit;
  2089. },
  2090. RegisterEvents: function()
  2091. {
  2092. for(let i = 0; i < uroLayers.layers.length; ++i)
  2093. {
  2094. if(uroLayers.layers[i].regEvt === true)
  2095. {
  2096. if((uroLayers.layers[i].isFeature === true) || (uroLayers.layers[i].isFeature === null))
  2097. {
  2098. uroLayers.layers[i].l.events.register("fe-feature-in", null, uroMarkers.MouseOver);
  2099. uroLayers.layers[i].l.events.register("fe-feature-out", null, uroMarkers.MouseOut);
  2100. }
  2101. else if(uroLayers.layers[i].isFeature === false)
  2102. {
  2103. for(let j = 0; j < uroLayers.layers[i].mf.length; ++j)
  2104. {
  2105. let mMarker = uroLayers.layers[i].mf[j];
  2106. if(mMarker !== null)
  2107. {
  2108. let mIcon = null;
  2109. if(mMarker.element !== undefined)
  2110. {
  2111. if(uroLayers.layers[i].moChild === true)
  2112. {
  2113. mIcon = mMarker.element.firstChild;
  2114. }
  2115. else
  2116. {
  2117. mIcon = mMarker.element;
  2118. }
  2119. }
  2120. else if(mMarker.geometry !== undefined)
  2121. {
  2122. mIcon = document.querySelector('#'+mMarker.geometry.id);
  2123. }
  2124. else if(mMarker.tagName === "image")
  2125. {
  2126. mIcon = mMarker;
  2127. }
  2128. if((mIcon !== null) && (mIcon !== undefined))
  2129. {
  2130. mIcon.addEventListener("mouseover", uroMarkers.MouseOver2, true);
  2131. mIcon.addEventListener("mouseout", uroMarkers.MouseOut2, true);
  2132. }
  2133. }
  2134. }
  2135. }
  2136. }
  2137. }
  2138. },
  2139. AddMarkerEventHandler: function()
  2140. {
  2141. if
  2142. (
  2143. (uroMarkers.type === uroLayers.ID.UR) ||
  2144. (uroMarkers.type === uroLayers.ID.MP) ||
  2145. (uroMarkers.type === uroLayers.ID.PUR) ||
  2146. (uroMarkers.type === uroLayers.ID.PPUR) ||
  2147. (uroMarkers.type === uroLayers.ID.RPUR)
  2148. )
  2149. {
  2150. let mMarker = uroGetMarker(uroMarkers.type, uroMarkers.id);
  2151. if(mMarker !== null)
  2152. {
  2153. let mIcon = null;
  2154. if(mMarker.element !== undefined)
  2155. {
  2156. mIcon = mMarker.element;
  2157. }
  2158. else if(mMarker.geometry !== undefined)
  2159. {
  2160. mIcon = document.querySelector('#'+mMarker.geometry.id);
  2161. }
  2162. else if(mMarker.tagName === "image")
  2163. {
  2164. mIcon = mMarker;
  2165. }
  2166. if((mIcon !== null) && (mIcon !== undefined))
  2167. {
  2168. mIcon.addEventListener("mousedown", uroMarkers.MouseDown, false);
  2169. }
  2170. }
  2171. }
  2172. }
  2173. };
  2174. const uroLayers = // layer functions
  2175. {
  2176. // -----------------------------------------------------------------
  2177. // NOTE CAREFULLY!
  2178. // The contents of layers and ID MUST, MUST, MUST, remain
  2179. // in sync at all times...
  2180. layers :
  2181. [
  2182. {name: "update_requests", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2183. {name: "mapProblems", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2184. {name: "place_updates", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2185. {name: "PARKING_PLACE_UPDATES", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2186. {name: "RESIDENTIAL_PLACE_UPDATES", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2187. {name: "closures", l: null, mf: null, isFeature: null, MO: null, regEvt: false, moChild: false, getMF: true},
  2188. {name: "nodes", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: false},
  2189. {name: "segments", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: false},
  2190. {name: "venues", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: false},
  2191. {name: "mapComments", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: false},
  2192. {name: "speed_cameras", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: false},
  2193. {name: "closure_nodes", l: null, mf: null, isFeature: null, MO: null, regEvt: false, moChild: false, getMF: true},
  2194. {name: "turn_closure", l: null, mf: null, isFeature: null, MO: null, regEvt: false, moChild: false, getMF: true},
  2195. {name: "segment_suggestions_markers", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2196. {name: "edit_suggestions_markers", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2197. {name: "permanent_hazard_camera_markers", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: true, getMF: true}
  2198. ],
  2199. ID :
  2200. {
  2201. UR: 0,
  2202. MP: 1,
  2203. PUR: 2,
  2204. PPUR: 3,
  2205. RPUR: 4,
  2206. RTC: 5,
  2207. node: 6,
  2208. seg: 7,
  2209. venue: 8,
  2210. MC: 9,
  2211. cam: 10,
  2212. RTCnode: 11,
  2213. TRTCnode: 12,
  2214. SegSug: 13,
  2215. EditSug: 14,
  2216. phCamera: 15
  2217. },
  2218. // -----------------------------------------------------------------
  2219.  
  2220. BlobMouseOut: function()
  2221. {
  2222. let blobType = this.attributes.uroBlobType;
  2223. if(blobType !== undefined)
  2224. {
  2225. let blobID = this.attributes.uroBlobID;
  2226. uroDBG.AddLog('hover off '+blobType+' ID '+blobID);
  2227. if(blobType == 'map_comment')
  2228. {
  2229. if(W.model.mapComments.objects[blobID] != undefined)
  2230. {
  2231. let geoID = W.model.mapComments.objects[blobID].attributes.geometry.id;
  2232. if(geoID.indexOf('Point') != -1)
  2233. {
  2234. // reapply visibility mods
  2235. let svgElm = document.getElementById(uroMCLayer.div.id+'_vroot');
  2236. for(let svgIdx = 0; svgIdx < svgElm.children.length; svgIdx++)
  2237. {
  2238. if(svgElm.children[svgIdx].id === geoID)
  2239. {
  2240. window.setTimeout(uroLayers.ReapplyPointMCVisibilityMods,10);
  2241. }
  2242. }
  2243. }
  2244. }
  2245. }
  2246. }
  2247. else
  2248. {
  2249. uroDBG.AddLog('hover off unknown blob...');
  2250. }
  2251. },
  2252. MCLayerChanged_changed: function()
  2253. {
  2254. uroLayers.MCLayerChanged();
  2255. },
  2256. MCLayerChanged_added: function()
  2257. {
  2258. uroLayers.MCLayerChanged();
  2259. },
  2260. MCLayerChanged_removed: function()
  2261. {
  2262. uroLayers.MCLayerChanged();
  2263. },
  2264. ReapplyPointMCVisibilityMods: function()
  2265. {
  2266. if(uroLayers.ApplyPointMCVisibilityMods() === false)
  2267. {
  2268. window.setTimeout(uroLayers.ReapplyPointMCVisibilityMods,100);
  2269. }
  2270. },
  2271. ApplyPointMCVisibilityMods: function()
  2272. {
  2273. let retval = true;
  2274. if(uroLayers.HasSelectedMCs() === true)
  2275. {
  2276. retval = false;
  2277. }
  2278. else
  2279. {
  2280. let svgElm = document.getElementById(uroMCLayer.div.id+'_vroot');
  2281. for(let svgIdx = 0; svgIdx < svgElm.children.length; svgIdx++)
  2282. {
  2283. let svgChild = svgElm.children[svgIdx];
  2284. if(svgChild.id.indexOf('Point') != -1)
  2285. {
  2286. if(uroUtils.GetCBChecked('_cbMCEnhancePointMCVisibility') === true)
  2287. {
  2288. if(svgChild.getAttribute('r') == 6)
  2289. {
  2290. svgChild.setAttribute('fill','#ffff00');
  2291. svgChild.setAttribute('fill-opacity',0.75);
  2292. svgChild.setAttribute('r',12);
  2293. svgChild.setAttribute('touchedByURO',true);
  2294. }
  2295. else if((svgChild.getAttribute('touchedByURO') === "true")&&(svgChild.getAttribute('fill') === '#ffff00'))
  2296. {
  2297. // do nothing...
  2298. }
  2299. else
  2300. {
  2301. retval = false;
  2302. break;
  2303. }
  2304. }
  2305. else
  2306. {
  2307. if((svgChild.getAttribute('touchedByURO') === "true")&&(svgChild.getAttribute('fill') === '#ffff00'))
  2308. {
  2309. svgChild.setAttribute('fill','#ffffff');
  2310. svgChild.setAttribute('fill-opacity',1);
  2311. svgChild.setAttribute('r',6);
  2312. svgChild.setAttribute('touchedByURO',false);
  2313. }
  2314. }
  2315. }
  2316. }
  2317. }
  2318. return retval;
  2319. },
  2320. HasSelectedMCs: function()
  2321. {
  2322. let retval = false;
  2323. for(let mcObj in W.model.mapComments.objects)
  2324. {
  2325. if(W.model.mapComments.objects[mcObj].isSelected() === true)
  2326. {
  2327. retval = true;
  2328. break;
  2329. }
  2330. }
  2331. return retval;
  2332. },
  2333. MCLayerChanged: function()
  2334. {
  2335. uroInit.WazeBits();
  2336. if(uroMCLayer != null)
  2337. {
  2338. if(uroLayers.HasSelectedMCs() === false)
  2339. {
  2340. uroDBG.AddLog('adding MC blob event handlers');
  2341. let mcModel = null;
  2342. for(let mObj=0; mObj<uroMCLayer.features.length; mObj++)
  2343. {
  2344. if(uroMCLayer.features[mObj]?.attributes?.wazeFeature?._wmeObject !== undefined)
  2345. {
  2346. mcModel = uroMCLayer.features[mObj].attributes.wazeFeature._wmeObject;
  2347. {
  2348. if(mcModel.selected !== true)
  2349. {
  2350. let mcBlobID = mcModel.attributes.geometry.id;
  2351. let mcID = mcModel.attributes.id;
  2352. let mcBlob = document.getElementById(mcBlobID);
  2353. if(mcBlob !== null)
  2354. {
  2355. mcBlob.addEventListener("mouseout", uroLayers.blobMouseOut, false);
  2356. mcBlob.attributes.uroBlobID = mcID;
  2357. mcBlob.attributes.uroBlobType = "map_comment";
  2358. uroDBG.AddLog('added handlers to MC '+mcID);
  2359. }
  2360. }
  2361. }
  2362. }
  2363. }
  2364. uroLayers.ApplyPointMCVisibilityMods();
  2365. }
  2366. else
  2367. {
  2368. uroDBG.AddLog('MC selected, handlers not added yet...');
  2369. }
  2370. uroFilterMapComments();
  2371. }
  2372. },
  2373. VenueLayerChanged: function()
  2374. {
  2375. uroDBG.AddLog('adding place blob event handlers');
  2376. for(let mObj=0; mObj<uroVenueLayer.features.length; mObj++)
  2377. {
  2378. // clicking on an area place now adds the polygon drag handles into the features[] array, so we need to test that
  2379. // the current array entry isn't referring to one of these handles before trying to access the attributes...
  2380. if(uroVenueLayer.features[mObj]?.attributes?.wazeFeature?._wmeObject !== undefined)
  2381. {
  2382. let mcBlobID = uroVenueLayer.features[mObj].attributes.wazeFeature._wmeObject.attributes.geometry.id;
  2383. let mcID = uroVenueLayer.features[mObj].attributes.wazeFeature._wmeObject.attributes.id;
  2384. let mcBlob = document.getElementById(mcBlobID);
  2385. if(mcBlob !== null)
  2386. {
  2387. mcBlob.addEventListener("mouseout", uroLayers.blobMouseOut, false);
  2388. mcBlob.attributes.uroBlobID = mcID;
  2389. mcBlob.attributes.uroBlobType = "place";
  2390. }
  2391. }
  2392. }
  2393. },
  2394. Observe_VenueLayer: function()
  2395. {
  2396. uroLayers.layers[uroLayers.ID.venue].MO.observe(uroVenueLayer.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2397. },
  2398. Observe_URLayer: function()
  2399. {
  2400. // As URs are now displayed as SVG image elements rather than HTML elements, and as WME likes to re-render them seemingly
  2401. // at random after they've been initially displayed, we hang the mutation observer off of the vectorRoot element, as this
  2402. // is the parent SVG element for the markers, and the MO therefore seems to trigger reliably on each change to that level
  2403. // of the SVG, including these random re-renders. It's obvious if these re-renders aren't being captured correctly, as it
  2404. // causes the comment count markers to randomly show up behind UR markers instead of always being in front of them...
  2405. uroLayers.layers[uroLayers.ID.UR].MO.observe(uroLayers.layers[uroLayers.ID.UR].l.renderer.vectorRoot,{childList: true, attributes : true, characterData : true, subtree: true});
  2406. },
  2407. URLayerChanged: function()
  2408. {
  2409. uroDBG.AddLog('UR layer change detected');
  2410. uroLayers.layers[uroLayers.ID.UR].MO.disconnect();
  2411. uroFilterURs();
  2412. uroLayers.Observe_URLayer();
  2413. },
  2414. PURLayerChanged: function()
  2415. {
  2416. uroDBG.AddLog('PUR layer change detected');
  2417. uroLayers.layers[uroLayers.ID.PUR].MO.disconnect();
  2418. uroFilterProblems();
  2419. uroLayers.Observe_PURLayer();
  2420. },
  2421. Observe_PURLayer: function()
  2422. {
  2423. uroLayers.layers[uroLayers.ID.PUR].MO.observe(uroLayers.layers[uroLayers.ID.PUR].l.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2424. },
  2425. PPURLayerChanged: function()
  2426. {
  2427. uroDBG.AddLog('PPUR layer change detected');
  2428. uroLayers.layers[uroLayers.ID.PPUR].MO.disconnect();
  2429. uroFilterProblems();
  2430. uroLayers.Observe_PPURLayer();
  2431. },
  2432. Observe_PPURLayer: function()
  2433. {
  2434. uroLayers.layers[uroLayers.ID.PPUR].MO.observe(uroLayers.layers[uroLayers.ID.PPUR].l.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2435. },
  2436. RPURLayerChanged: function()
  2437. {
  2438. uroDBG.AddLog('RPUR layer change detected');
  2439. uroLayers.layers[uroLayers.ID.RPUR].MO.disconnect();
  2440. uroFilterProblems();
  2441. uroLayers.Observe_RPURLayer();
  2442. },
  2443. Observe_RPURLayer: function()
  2444. {
  2445. uroLayers.layers[uroLayers.ID.RPUR].MO.observe(uroLayers.layers[uroLayers.ID.RPUR].l.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2446. },
  2447.  
  2448. RTCLayerChanged: function()
  2449. {
  2450. uroDBG.AddLog('reapplying closures filter');
  2451. uroLayers.layers[uroLayers.ID.RTC].MO.disconnect();
  2452. uroFilterRTCs();
  2453. uroLayers.Observe_RTCLayer();
  2454. },
  2455. Observe_RTCLayer: function()
  2456. {
  2457. uroLayers.layers[uroLayers.ID.RTC].MO.observe(uroLayers.layers[uroLayers.ID.RTC].l.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2458. },
  2459. RunChangeHandlers: function()
  2460. {
  2461. uroLayers.URLayerChanged();
  2462. uroLayers.PURLayerChanged();
  2463. uroLayers.PPURLayerChanged();
  2464. uroLayers.RPURLayerChanged();
  2465. uroLayers.VenueLayerChanged();
  2466. uroLayers.RTCLayerChanged();
  2467.  
  2468. uroLayers.MCLayerChanged();
  2469. },
  2470. InitialiseMOs: function()
  2471. {
  2472. uroLayers.layers[uroLayers.ID.UR].MO = new MutationObserver(uroLayers.URLayerChanged);
  2473. uroLayers.layers[uroLayers.ID.PUR].MO = new MutationObserver(uroLayers.PURLayerChanged);
  2474. uroLayers.layers[uroLayers.ID.PPUR].MO = new MutationObserver(uroLayers.PPURLayerChanged);
  2475. uroLayers.layers[uroLayers.ID.RPUR].MO = new MutationObserver(uroLayers.RPURLayerChanged);
  2476. uroLayers.layers[uroLayers.ID.venue].MO = new MutationObserver(uroLayers.VenueLayerChanged);
  2477. uroLayers.layers[uroLayers.ID.RTC].MO = new MutationObserver(uroLayers.RTCLayerChanged);
  2478. uroLayers.Observe_URLayer();
  2479. uroLayers.Observe_PURLayer();
  2480. uroLayers.Observe_PPURLayer();
  2481. uroLayers.Observe_RPURLayer();
  2482. uroLayers.Observe_VenueLayer();
  2483. uroLayers.Observe_RTCLayer();
  2484. },
  2485. GetMarkersOrFeatures: function(layerID)
  2486. {
  2487. let retval = null;
  2488. let findit = uroLayers.layers[layerID].l.features;
  2489. if(findit !== undefined)
  2490. {
  2491. retval = findit;
  2492. uroLayers.layers[layerID].isFeature = true;
  2493. uroDBG.AddLog(uroLayers.layers[layerID].name + ' = features');
  2494. }
  2495. else
  2496. {
  2497. findit = uroLayers.layers[layerID].l.markers;
  2498. if(findit !== undefined)
  2499. {
  2500. retval = findit;
  2501. uroLayers.layers[layerID].isFeature = false;
  2502. uroDBG.AddLog(uroLayers.layers[layerID].name + ' = markers');
  2503. }
  2504. }
  2505. if(retval === null)
  2506. {
  2507. uroLayers.layers[layerID].isFeature = null;
  2508. uroDBG.AddLog(uroLayers.layers[layerID].name + ' = unknown :-/');
  2509. }
  2510. return retval;
  2511. },
  2512. Init: function()
  2513. {
  2514. for(let i = 0; i < uroLayers.layers.length; ++i)
  2515. {
  2516. uroLayers.layers[i].l = W.map.getLayerByUniqueName(uroLayers.layers[i].name);
  2517. if(uroLayers.layers[i].getMF === true)
  2518. {
  2519. uroLayers.layers[i].mf = uroLayers.GetMarkersOrFeatures(i);
  2520. }
  2521. }
  2522. }
  2523. };
  2524. const uroAlertBox = // alert box handling
  2525. {
  2526. stack: [],
  2527. tickAction: null,
  2528. crossAction: null,
  2529. inUse: false,
  2530. ABObj: function(headericon, title, content, hasCross, tickText, crossText, tickAction, crossAction)
  2531. {
  2532. this.headericon = headericon;
  2533. this.title = title;
  2534. this.content = content;
  2535. this.hasCross = hasCross;
  2536. this.tickText = tickText;
  2537. this.crossText = crossText;
  2538. this.tickAction = tickAction;
  2539. this.crossAction = crossAction;
  2540. },
  2541. Close: function()
  2542. {
  2543. document.getElementById('uroAlerts').childNodes[0].innerHTML = uroUtils.ModifyHTML('');
  2544. document.getElementById('uroAlerts').childNodes[1].innerHTML = uroUtils.ModifyHTML('');
  2545. document.getElementById('uroAlertTickBtnCaption').innerHTML = uroUtils.ModifyHTML('');
  2546. document.getElementById('uroAlertCrossBtnCaption').innerHTML = uroUtils.ModifyHTML('');
  2547. uroAlertBox.tickAction = null;
  2548. uroAlertBox.crossAction = null;
  2549. document.getElementById('uroAlerts').style.visibility = "hidden";
  2550. document.getElementById('uroAlertCrossBtn').style.visibility = "hidden";
  2551. uroAlertBox.inUse = false;
  2552. if(uroAlertBox.stack.length > 0)
  2553. {
  2554. uroAlertBox.BuildFromStack();
  2555. }
  2556. },
  2557. CloseWithTick: function()
  2558. {
  2559. if(typeof uroAlertBox.tickAction === 'function')
  2560. {
  2561. uroAlertBox.tickAction();
  2562. }
  2563. uroAlertBox.Close();
  2564. },
  2565. CloseWithCross: function()
  2566. {
  2567. if(typeof uroAlertBox.crossAction === 'function')
  2568. {
  2569. uroAlertBox.crossAction();
  2570. }
  2571. uroAlertBox.Close();
  2572. },
  2573. Show: function(headericon, title, content, hasCross, tickText, crossText, tickAction, crossAction)
  2574. {
  2575. uroAlertBox.stack.push(new uroAlertBox.ABObj(headericon, title, content, hasCross, tickText, crossText, tickAction, crossAction));
  2576. if(uroAlertBox.inUse === false)
  2577. {
  2578. uroAlertBox.BuildFromStack();
  2579. }
  2580. },
  2581. BuildFromStack: function()
  2582. {
  2583. uroAlertBox.inUse = true;
  2584. uroAlertBox.tickAction = null;
  2585. uroAlertBox.crossAction = null;
  2586. let titleContent = '<span style="font-size:14px;padding:2px;">';
  2587. titleContent += '<i class="fa '+uroAlertBox.stack[0].headericon+'"> </i>&nbsp;';
  2588. titleContent += uroAlertBox.stack[0].title;
  2589. titleContent += '</span>';
  2590. document.getElementById('uroAlerts').childNodes[0].innerHTML = uroUtils.ModifyHTML(titleContent);
  2591. document.getElementById('uroAlerts').childNodes[1].innerHTML = uroUtils.ModifyHTML(uroAlertBox.stack[0].content);
  2592. document.getElementById('uroAlertTickBtnCaption').innerHTML = uroUtils.ModifyHTML(uroAlertBox.stack[0].tickText);
  2593. if(uroAlertBox.stack[0].hasCross)
  2594. {
  2595. document.getElementById('uroAlertCrossBtnCaption').innerHTML = uroUtils.ModifyHTML(uroAlertBox.stack[0].crossText);
  2596. document.getElementById('uroAlertCrossBtn').style.visibility = "visible";
  2597. if(typeof uroAlertBox.stack[0].crossAction === "function")
  2598. {
  2599. uroAlertBox.crossAction = uroAlertBox.stack[0].crossAction;
  2600. }
  2601. }
  2602. else
  2603. {
  2604. document.getElementById('uroAlertCrossBtn').style.visibility = "hidden";
  2605. }
  2606. if(typeof uroAlertBox.stack[0].tickAction === "function")
  2607. {
  2608. uroAlertBox.tickAction = uroAlertBox.stack[0].tickAction;
  2609. }
  2610. document.getElementById('uroAlerts').style.visibility = "";
  2611. uroAlertBox.stack.shift();
  2612. }
  2613. };
  2614. const uroStartup = // startup messaging to users
  2615. {
  2616. ShowUpgradeNotes: function()
  2617. {
  2618. uroDBG.AddLog('let users know what\'s new in this release');
  2619.  
  2620. let releaseNotes = '';
  2621. releaseNotes += '<p>Thanks for installing URO+ '+uroRelease.version+' ('+uroRelease.date+')</p>';
  2622.  
  2623. let loop;
  2624. if(uroRelease.changes.length > 0)
  2625. {
  2626. releaseNotes += '<br>Changes since the last release:<br>';
  2627. releaseNotes += '<ul>';
  2628. for(loop=0; loop < uroRelease.changes.length; loop++)
  2629. {
  2630. releaseNotes += '<li>'+uroRelease.changes[loop];
  2631. }
  2632. releaseNotes += '</ul>';
  2633. }
  2634.  
  2635. uroAlertBox.Show('fa-info-circle', 'URO+ Release Notes', releaseNotes, false, "OK", "", null, null);
  2636. }
  2637. };
  2638. const uroConfig = // configuration handling
  2639. {
  2640. GatherSettings: function(container)
  2641. {
  2642. let options = '';
  2643. if(typeof(container) == 'string')
  2644. {
  2645. container = document.getElementById(container);
  2646. }
  2647. let urOptions = container.getElementsByTagName('input');
  2648. for (let optIdx=0;optIdx<urOptions.length;optIdx++)
  2649. {
  2650. // Don't save settings for any of the legacy input elements we've now hidden...
  2651. if(urOptions[optIdx].style.display != "none")
  2652. {
  2653. let id = urOptions[optIdx].id;
  2654. if((id.indexOf('_cb') === 0)||(id.indexOf('_text') === 0)||(id.indexOf('_input') === 0))
  2655. {
  2656. options += ':' + id;
  2657. if(urOptions[optIdx].type == 'checkbox') options += ',' + urOptions[optIdx].checked.toString();
  2658. else if((urOptions[optIdx].type == 'text')||(urOptions[optIdx].type == 'number')) options += ',' + urOptions[optIdx].value.toString();
  2659. }
  2660. }
  2661. }
  2662. return options;
  2663. },
  2664. GatherCamWatchList: function()
  2665. {
  2666. let liststr = '';
  2667. for(let loop=0;loop<uroOWL.CamWatchObjects.length;loop++)
  2668. {
  2669. let camObj = uroOWL.CamWatchObjects[loop];
  2670. if((camObj.fid != null) && (camObj.persistent === true))
  2671. {
  2672. if(loop > 0) liststr += ':';
  2673.  
  2674. liststr += camObj.fid+',';
  2675. liststr += camObj.watch.lon+',';
  2676. liststr += camObj.watch.lat+',';
  2677. liststr += camObj.watch.type+',';
  2678. liststr += camObj.watch.azymuth+',';
  2679. liststr += camObj.watch.speed+',';
  2680. liststr += camObj.groupID+',';
  2681. liststr += camObj.server;
  2682. }
  2683. }
  2684. return liststr;
  2685. },
  2686. GatherCWLGroups: function()
  2687. {
  2688. let liststr = '';
  2689. for(let loop=0;loop<uroOWL.CWLGroups.length;loop++)
  2690. {
  2691. let groupObj = uroOWL.CWLGroups[loop];
  2692. if(groupObj.groupID != -1)
  2693. {
  2694. if(loop > 0) liststr += ':';
  2695.  
  2696. liststr += groupObj.groupID+',';
  2697. liststr += groupObj.groupName+',';
  2698. liststr += groupObj.groupCollapsed;
  2699. }
  2700. }
  2701. return liststr;
  2702. },
  2703. GatherPlacesGroups: function()
  2704. {
  2705. let liststr = '';
  2706. for(let loop=0;loop<uroPlacesGroupsCollapsed.length;loop++)
  2707. {
  2708. if(loop > 0) liststr += ':';
  2709. liststr += uroPlacesGroupsCollapsed[loop];
  2710. }
  2711. return liststr;
  2712. },
  2713. GatherAFNs: function()
  2714. {
  2715. let liststr = '';
  2716. for(let loop=0; loop < uroAFN.friendlyNames.length; loop++)
  2717. {
  2718. let fnObj = uroAFN.friendlyNames[loop];
  2719. if(loop > 0) liststr += ':';
  2720.  
  2721. liststr += fnObj.fName+',';
  2722. liststr += fnObj.area+',';
  2723. liststr += fnObj.server;
  2724. }
  2725. return liststr;
  2726. },
  2727. SaveSettings: function()
  2728. {
  2729. if((uroInhibitSave) || (uroMTEMode === true) || (uroSettingsApplied === false))
  2730. {
  2731. uroDBG.AddLog('save inhibited');
  2732. return;
  2733. }
  2734.  
  2735. if (localStorage)
  2736. {
  2737. try
  2738. {
  2739. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  2740. {
  2741. localStorage[uroTabs.CtrlTabs[i][uroTabs.FIELDS.STORAGE]] = uroConfig.GatherSettings(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY]);
  2742. }
  2743.  
  2744. localStorage.UROverviewCamWatchList = uroConfig.GatherCamWatchList();
  2745. localStorage.UROverviewCWLGroups = uroConfig.GatherCWLGroups();
  2746. localStorage.UROverviewFriendlyAreaNames = uroConfig.GatherAFNs();
  2747. localStorage.UROverviewPlacesGroups = uroConfig.GatherPlacesGroups();
  2748.  
  2749. localStorage.UROverviewMasterEnable = uroUtils.GetCBChecked('_cbMasterEnable');
  2750. localStorage.UROverviewCurrentVersion = uroRelease.version;
  2751.  
  2752. uroDBG.AddLog('save complete');
  2753. }
  2754. catch(err)
  2755. {
  2756. uroDBG.AddLog('exception thrown during save - probably script reload whilst in MTE mode...');
  2757. }
  2758. }
  2759. else
  2760. {
  2761. uroDBG.AddLog('no localStorage, save blocked');
  2762. }
  2763. },
  2764. ApplySettings: function(settings)
  2765. {
  2766. uroSettingsApplied = true;
  2767. if(settings != undefined)
  2768. {
  2769. if(document.querySelector('#_cbMasterEnable') === null)
  2770. {
  2771. uroSettingsApplied = false;
  2772. }
  2773. else
  2774. {
  2775. let options = settings.split(':');
  2776. for(let optIdx=0;optIdx<options.length;optIdx++)
  2777. {
  2778. let fields = options[optIdx].split(',');
  2779. if(fields[0].indexOf('_cb') === 0)
  2780. {
  2781. if(document.getElementById(fields[0]) !== null)
  2782. {
  2783. uroUtils.SetCBChecked(fields[0], (fields[1] == 'true'));
  2784. }
  2785. }
  2786. else if((fields[0].indexOf('_input') === 0)||(fields[0].indexOf('_text') === 0))
  2787. {
  2788. if(document.getElementById(fields[0]) !== null) document.getElementById(fields[0]).value = fields[1];
  2789. }
  2790. }
  2791. }
  2792. }
  2793. },
  2794. ApplyCamWatchList: function()
  2795. {
  2796. let objects = localStorage.UROverviewCamWatchList.split(':');
  2797. uroOWL.CamWatchObjects = [];
  2798. if(objects.length > 0)
  2799. {
  2800. for(let objIdx=0;objIdx<objects.length;objIdx++)
  2801. {
  2802. let fields = objects[objIdx].split(',');
  2803. if(fields.length == 9)
  2804. {
  2805. // CWL entries with 9 fields include the validated property which is now redundant, so we need to strip this property before adding
  2806. // the camera to the object collection. Whilst WME no longer displays unapproved cameras, it's preferable at this stage to leave
  2807. // any watched unapproved cameras in the object collection, just in case any of them were approved (and will therefore still be
  2808. // present in WME) inbetween the last time the user ran URO and now. For those unapproved cameras which were still unapproved when
  2809. // removed from WME, URO will then list them as deleted and the user can then perform a single manual tidy-up of their watchlist to
  2810. // remove them there as well.
  2811. uroOWL.CamWatchObjects.push(new uroOWL.CamWatchObj(true,fields[0],fields[1],fields[2],fields[3],fields[4],fields[5],fields[7],fields[8]));
  2812. }
  2813. else if(fields.length == 8)
  2814. {
  2815. uroOWL.CamWatchObjects.push(new uroOWL.CamWatchObj(true,fields[0],fields[1],fields[2],fields[3],fields[4],fields[5],fields[6],fields[7]));
  2816. }
  2817. }
  2818. }
  2819. },
  2820. ApplyCWLGroups: function()
  2821. {
  2822. let objects = localStorage.UROverviewCWLGroups.split(':');
  2823. uroOWL.CWLGroups = [];
  2824.  
  2825. if(objects.length === 0)
  2826. {
  2827. uroOWL.CWLGroups.push(new uroOWL.GroupObj(0,'No group',false));
  2828. }
  2829. else
  2830. {
  2831. for(let objIdx=0;objIdx<objects.length;objIdx++)
  2832. {
  2833. let fields = objects[objIdx].split(',');
  2834. if(fields.length < 2)
  2835. {
  2836. fields.push(false);
  2837. }
  2838. uroOWL.CWLGroups.push(new uroOWL.GroupObj(fields[0],fields[1],(fields[2] == 'true')));
  2839. }
  2840. }
  2841. },
  2842. TranslateLegacyMPTab: function()
  2843. {
  2844. let options = localStorage.UROverviewMPOptions.split(':');
  2845. for(let optIdx=0;optIdx<options.length;optIdx++)
  2846. {
  2847. let fields = options[optIdx].split(',');
  2848. if(fields[0].indexOf('_cb') === 0)
  2849. {
  2850. if(fields[0] == '_cbMPFilterParkingLotInputAsPoint') uroUtils.SetCBChecked('_cbMPFilter_T50', (fields[1] == 'true'));
  2851. if(fields[0] == '_cbMPMissingPLP_T70') uroUtils.SetCBChecked('_cbMPFilter_T70', (fields[1] == 'true'));
  2852. if(fields[0] == '_cbMPMissingPLP_T71') uroUtils.SetCBChecked('_cbMPFilter_T71', (fields[1] == 'true'));
  2853. if(fields[0] == '_cbMPFilterDrivingDirectionMismatch') uroUtils.SetCBChecked('_cbMPFilter_T101', (fields[1] == 'true'));
  2854. if(fields[0] == '_cbMPFilterMissingJunction') uroUtils.SetCBChecked('_cbMPFilter_T102', (fields[1] == 'true'));
  2855. if(fields[0] == '_cbMPFilterMissingRoad') uroUtils.SetCBChecked('_cbMPFilter_T103', (fields[1] == 'true'));
  2856. if(fields[0] == '_cbMPFilterCrossroadsJunctionMissing') uroUtils.SetCBChecked('_cbMPFilter_T104', (fields[1] == 'true'));
  2857. if(fields[0] == '_cbMPFilterRoadTypeMismatch') uroUtils.SetCBChecked('_cbMPFilter_T105', (fields[1] == 'true'));
  2858. if(fields[0] == '_cbMPFilterRestrictedTurn') uroUtils.SetCBChecked('_cbMPFilter_T106', (fields[1] == 'true'));
  2859. if(fields[0] == '_cbMPFilterTurnProblem') uroUtils.SetCBChecked('_cbMPFilter_T200', (fields[1] == 'true'));
  2860. if(fields[0] == '_cbMPFilterRoadClosureProblem') uroUtils.SetCBChecked('_cbMPFilter_T300', (fields[1] == 'true'));
  2861. }
  2862. }
  2863. },
  2864. TranslateLegacyZoom: function()
  2865. {
  2866. let tZoom = parseInt(document.getElementById("_inputFilterMinZoomLevel").value);
  2867. if(tZoom < 12)
  2868. {
  2869. tZoom += 12;
  2870. document.getElementById("_inputFilterMinZoomLevel").value = tZoom;
  2871. }
  2872. tZoom = parseInt(document.getElementById("_inputUnstackZoomLevel").value);
  2873. if(tZoom < 12)
  2874. {
  2875. tZoom += 12;
  2876. document.getElementById("_inputUnstackZoomLevel").value = tZoom;
  2877. }
  2878. },
  2879. LoadSettings: function()
  2880. {
  2881. let isNewInstall = true;
  2882. let isUpgradeInstall = true;
  2883.  
  2884. uroDBG.AddLog('loadSettings()');
  2885. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  2886. {
  2887. if (uroTabs.CtrlTabs[i][uroTabs.FIELDS.STORAGE] != null)
  2888. {
  2889. uroDBG.AddLog('recover '+uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABTITLE]+' tab settings');
  2890. uroConfig.ApplySettings(localStorage[uroTabs.CtrlTabs[i][uroTabs.FIELDS.STORAGE]]);
  2891. isNewInstall = false;
  2892. }
  2893. }
  2894. if (localStorage.UROverviewMPOptions != null)
  2895. {
  2896. uroConfig.TranslateLegacyMPTab();
  2897. }
  2898. if (localStorage.UROverviewMiscOptions != null)
  2899. {
  2900. uroConfig.TranslateLegacyZoom();
  2901. }
  2902.  
  2903. if(localStorage.UROverviewCWLGroups != null)
  2904. {
  2905. uroDBG.AddLog('recover CWL groups');
  2906. uroConfig.ApplyCWLGroups();
  2907. isNewInstall = false;
  2908. }
  2909. else
  2910. {
  2911. uroDBG.AddLog('set default CWL group');
  2912. uroOWL.CWLGroups.push(new uroOWL.GroupObj(0,'No group',false));
  2913. }
  2914.  
  2915. if(localStorage.UROverviewCamWatchList != null)
  2916. {
  2917. uroDBG.AddLog('recover camera watchlist');
  2918. uroConfig.ApplyCamWatchList();
  2919. uroOWL.GetCurrentCamWatchListObjects();
  2920. isNewInstall = false;
  2921. }
  2922. /*
  2923. if(localStorage.UROverviewSegWatchList != null)
  2924. {
  2925. uroDBG.AddLog('recover segment watchlist');
  2926. uroApplySegWatchList();
  2927. uroGetCurrentSegWatchListObjects();
  2928. isNewInstall = false;
  2929. }
  2930.  
  2931. if(localStorage.UROverviewPlaceWatchList != null)
  2932. {
  2933. uroDBG.AddLog('recover places watchlist');
  2934. uroApplyPlaceWatchList();
  2935. //uroGetCurrentPlaceWatchListObjects();
  2936. isNewInstall = false;
  2937. }
  2938.  
  2939. if(localStorage.UROverviewPlacesGroups != null)
  2940. {
  2941. uroDBG.AddLog('recover places groups');
  2942. uroApplyPlacesGroups();
  2943. isNewInstall = false;
  2944. }
  2945. */
  2946. if(localStorage.UROverviewCurrentVersion != null)
  2947. {
  2948. uroDBG.AddLog('comparing install versions');
  2949. if(localStorage.UROverviewCurrentVersion == uroRelease.version)
  2950. {
  2951. isUpgradeInstall = false;
  2952. }
  2953. }
  2954.  
  2955. if(localStorage.UROverviewFriendlyAreaNames != null)
  2956. {
  2957. uroDBG.AddLog('recover friendly area names');
  2958. uroAFN.ApplyNames();
  2959. isNewInstall = false;
  2960. }
  2961.  
  2962. if(localStorage.UROverviewMasterEnable != null)
  2963. {
  2964. uroDBG.AddLog('recover master enable state');
  2965. document.getElementById('_cbMasterEnable').checked = (localStorage.UROverviewMasterEnable == "true");
  2966. uroDBG.AddLog('enable checkbox state set...');
  2967. }
  2968.  
  2969. if((isNewInstall)||(isUpgradeInstall))
  2970. {
  2971. uroStartup.ShowUpgradeNotes();
  2972. }
  2973.  
  2974. uroInhibitSave = false;
  2975. },
  2976. DefaultSettings: function()
  2977. {
  2978. 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);
  2979. },
  2980. DefaultSettingsAction: function()
  2981. {
  2982. let defaultSettings = '';
  2983.  
  2984. 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]';
  2985. 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]';
  2986. 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]';
  2987. defaultSettings += '[UROverviewPlacesGroups][len=71]false:false:false:false:false:false:false:false:false:false:false:false[END]';
  2988. 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]';
  2989. defaultSettings += '[UROverviewMasterEnable][len=4]true[END]';
  2990. defaultSettings += '[UROverviewCWLGroups][len=16]0,No group,false[END]';
  2991. 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]';
  2992. 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]';
  2993. 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]';
  2994. defaultSettings += '[UROverviewRAOptions][len=178]:_cbShowSpecificRA,false:_cbRAEditorIDFilter,false:_cbEnableRAAgeFilterLessThan,false:_inputFilterRAAgeLessThan,39:_cbEnableRAAgeFilterMoreThan,false:_inputFilterRAAgeMoreThan,38[END]';
  2995. defaultSettings += '[UROverviewCurrentVersion][len=3]4.5[END]';
  2996. defaultSettings += '[UROverviewCamWatchList][len=0][END]';
  2997. defaultSettings += '[UROverviewFriendlyAreaNames][len=0][END]';
  2998. defaultSettings += '[UROverviewPlaceWatchList][len=0][END]';
  2999. defaultSettings += '[UROverviewSegWatchList][len=0][END]';
  3000.  
  3001. document.getElementById('_txtSettings').value = defaultSettings;
  3002. uroConfig.TextToSettings();
  3003. document.getElementById('_txtSettings').value = '';
  3004. },
  3005. SettingsToText: function()
  3006. {
  3007. let txtSettings = '';
  3008.  
  3009. uroConfig.SaveSettings();
  3010.  
  3011. for(let lsEntry in localStorage)
  3012. {
  3013. if(lsEntry.indexOf('UROverview') === 0)
  3014. {
  3015. txtSettings += '['+lsEntry+'][len=' + localStorage[lsEntry].length + ']' + localStorage[lsEntry] + '[END]\n';
  3016. }
  3017. }
  3018.  
  3019. document.getElementById('_txtSettings').value = txtSettings;
  3020. document.getElementById('_txtSettings').focus();
  3021. document.getElementById('_txtSettings').select();
  3022. },
  3023. TextToSettings: function()
  3024. {
  3025. let txtSettings = '';
  3026. txtSettings = uroUtils.GetElmValue('_txtSettings');
  3027. if(txtSettings.indexOf('[END]') == -1) return;
  3028.  
  3029. let subText = txtSettings.split('[END]');
  3030. for(let i=0;i<subText.length;i++)
  3031. {
  3032. let aPos = subText[i].indexOf('[');
  3033. let bPos = subText[i].indexOf(']');
  3034. if((aPos != -1) && (bPos != -1))
  3035. {
  3036. let settingID = subText[i].substr(aPos+1,bPos-1-aPos);
  3037. subText[i] = subText[i].substr(bPos+1);
  3038. bPos = subText[i].indexOf(']');
  3039. if(bPos != -1)
  3040. {
  3041. let settingLength = subText[i].substr(5,bPos-5);
  3042. subText[i] = subText[i].substr(bPos+1);
  3043. if(subText[i].length == settingLength)
  3044. {
  3045. localStorage[settingID] = subText[i];
  3046. }
  3047. }
  3048. }
  3049. }
  3050. uroConfig.LoadSettings();
  3051. },
  3052. ClearSettingsText: function()
  3053. {
  3054. document.getElementById('_txtSettings').value = '';
  3055. }
  3056. };
  3057. const uroRTCClone = // RTC cloning
  3058. {
  3059. ConfirmDelete : true,
  3060. ToDelete : 0,
  3061. Reason : null,
  3062. Event : null,
  3063. Direction : null,
  3064. StartDate : null,
  3065. StartTime : null,
  3066. EndDate : null,
  3067. EndTime : null,
  3068. IgnoreTraffic : null,
  3069. ClosedNodes : null,
  3070. PendingClone : -1,
  3071. PendingCloneIncrement : 0,
  3072.  
  3073. Complete: function()
  3074. {
  3075. let loop;
  3076. if(document.getElementsByClassName('edit-closure').length === 0)
  3077. {
  3078. window.setTimeout(uroRTCClone.Complete,100);
  3079. return;
  3080. }
  3081.  
  3082. if(uroFixMTEDropDown(document.getElementById('closure_eventId')) == false)
  3083. {
  3084. window.setTimeout(uroRTCClone.Complete,100);
  3085. return;
  3086. }
  3087.  
  3088. // need to generate a change event on each of the form fields, because WME appears to be silently populating some hidden
  3089. // closure object with the details as they're entered manually, and if we just set the form values without then forcing
  3090. // the change event as well then WME will end up using its default values instead of the ones we've so lovingly copied...
  3091. let form = $('#edit-panel .closures .edit-closure form');
  3092.  
  3093. if(uroRTCClone.Reason !== null)
  3094. {
  3095. let fObj = form.find('wz-text-input#closure_reason');
  3096. fObj.val(uroRTCClone.Reason);
  3097. fObj.change();
  3098. }
  3099. if(uroRTCClone.Direction !== null)
  3100. {
  3101. let fObj = form.find('wz-select#closure_direction');
  3102. fObj[0].value = uroRTCClone.Direction;
  3103. fObj.change();
  3104. }
  3105. if(uroRTCClone.StartDate !== null)
  3106. {
  3107. let fObj = form.find('input#closure_startDate');
  3108. fObj.val(uroRTCClone.StartDate);
  3109. fObj.change();
  3110. }
  3111. if(uroRTCClone.StartTime !== null)
  3112. {
  3113. let fObj = form.find('div.form-group.start-date-form-group input.time-picker-input');
  3114. fObj.focus();
  3115. fObj.val(uroRTCClone.StartTime);
  3116. fObj.change();
  3117. }
  3118.  
  3119. if(uroRTCClone.IgnoreTraffic !== null)
  3120. {
  3121. let fObj = form.find('wz-checkbox#closure_permanent');
  3122. fObj.val(uroRTCClone.IgnoreTraffic);
  3123. fObj.change();
  3124. }
  3125. if(uroRTCClone.EndTime !== null)
  3126. {
  3127. let fObj = form.find('div.form-group.end-date-form-group input.time-picker-input');
  3128. fObj.focus();
  3129. fObj.val(uroRTCClone.EndTime);
  3130. fObj.change();
  3131. }
  3132.  
  3133. // the current version of WME wipes any existing end date as soon as the end time is altered, so we now need
  3134. // to set the date after the time instead of before as in earlier versions of this function...
  3135. if(uroRTCClone.EndDate !== null)
  3136. {
  3137. let fObj = form.find('input#closure_endDate');
  3138. fObj.val(uroRTCClone.EndDate);
  3139. fObj.change();
  3140. }
  3141.  
  3142. // the old method of setting the MTE just by changing the value attribute on closure_eventId no longer
  3143. // seems to work as expected (it runs OK from the dev console, but not within the scope of the userscript),
  3144. // so just as we do for setting the event to None, we set the event to the desired value here by finding
  3145. // the appropriate menu entry and clicking on it...
  3146. let cEvents = document.getElementById('closure_eventId').getElementsByTagName('wz-option');
  3147. for(let i of cEvents)
  3148. {
  3149. if(i.value == uroRTCClone.Event)
  3150. {
  3151. i.click();
  3152. break;
  3153. }
  3154. }
  3155.  
  3156. let nNodes = uroRTCClone.ClosedNodes.length;
  3157. if(nNodes > 0)
  3158. {
  3159. let fObj = form.find('wz-toggle-switch');
  3160. for(loop = 0; loop < nNodes; ++loop)
  3161. {
  3162. if(uroRTCClone.ClosedNodes[loop] === true)
  3163. {
  3164. fObj[loop].click();
  3165. }
  3166. }
  3167. }
  3168. if(uroUtils.GetCBChecked('_cbAutoApplyClonedClosure') == true)
  3169. {
  3170. window.setTimeout(uroRTCClone.ClickSave,100);
  3171. }
  3172.  
  3173. uroRTCClone.PendingClone = -1;
  3174. },
  3175. ClickSave: function()
  3176. {
  3177. document.getElementsByClassName('closures')[0].getElementsByClassName('save-button')[0].click();
  3178. },
  3179. Copy: function()
  3180. {
  3181. // grab the current closure details from the UI...
  3182. uroRTCClone.Reason = uroGetShadowElementProperty('closure_reason', 'input', 'value');
  3183. uroRTCClone.Direction = uroGetElementProperty('closure_direction', 0, 'value');
  3184. uroRTCClone.StartDate = uroGetElementProperty('closure_startDate', 0, 'value');
  3185. uroRTCClone.StartTime = document.querySelector('.start-date-form-group').querySelector('.time-picker-input').value;
  3186. uroRTCClone.EndDate = uroGetElementProperty('closure_endDate', 0, 'value');
  3187. uroRTCClone.EndTime = document.querySelector('.end-date-form-group').querySelector('.time-picker-input').value;
  3188. uroRTCClone.Event = uroGetElementProperty('closure_eventId', 0, 'value');
  3189. uroRTCClone.IgnoreTraffic = uroGetElementProperty('closure_permanent', 0, 'checked');
  3190. uroRTCClone.ClosedNodes = [];
  3191. let nNodes = document.getElementsByClassName('fromNodeClosed').length;
  3192. if(nNodes > 0)
  3193. {
  3194. for(let loop = 0; loop < nNodes; ++loop)
  3195. {
  3196. uroRTCClone.ClosedNodes.push(document.getElementsByClassName('fromNodeClosed')[loop].checked);
  3197. }
  3198. }
  3199.  
  3200. document.getElementsByClassName('closures')[0].getElementsByClassName('cancel-button')[0].click();
  3201.  
  3202. // auto-increment the start and end dates
  3203. uroRTCClone.StartDate = uroIncrementClosureDate(uroRTCClone.StartDate,uroRTCClone.PendingCloneIncrement);
  3204. uroRTCClone.EndDate = uroIncrementClosureDate(uroRTCClone.EndDate,uroRTCClone.PendingCloneIncrement);
  3205.  
  3206. uroRTCClone.PendingClone = -2;
  3207. },
  3208. Clone: function()
  3209. {
  3210. uroRTCClone.PendingCloneIncrement = parseInt(this.id.split('-')[1]);
  3211. uroRTCClone.PendingClone = parseInt(this.id.split('-')[2]);
  3212. },
  3213. DeleteNextOnList: function()
  3214. {
  3215. let nClosures = document.querySelectorAll('.closure-item.is-editable').length;
  3216. if(nClosures > 0)
  3217. {
  3218. if (nClosures != uroRTCClone.ToDelete)
  3219. {
  3220. uroRTCClone.ToDelete = nClosures;
  3221. let ctObj = document.querySelector('.closure-item.is-editable');
  3222. let deleteMenuEntry = ctObj.querySelector('wz-menu-item.delete');
  3223. if(deleteMenuEntry !== null)
  3224. {
  3225. deleteMenuEntry.click();
  3226. }
  3227. }
  3228. window.setTimeout(uroRTCClone.DeleteNextOnList,100);
  3229. }
  3230. else
  3231. {
  3232. uroRTCClone.ConfirmDelete = true;
  3233. }
  3234. },
  3235. DeleteAll: function()
  3236. {
  3237. uroRTCClone.ConfirmDelete = true;
  3238. 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);
  3239. },
  3240. DeleteAllAction: function()
  3241. {
  3242. uroRTCClone.ConfirmDelete = false;
  3243. let nClosures = document.getElementsByClassName('closure-item').length;
  3244. if(nClosures > 0)
  3245. {
  3246. uroRTCClone.ToDelete = -1;
  3247. uroRTCClone.DeleteNextOnList();
  3248. }
  3249. else
  3250. {
  3251. uroRTCClone.ConfirmDelete = true;
  3252. }
  3253. }
  3254. };
  3255. const uroOWL = /// camera watchlist
  3256. {
  3257. CWLGroups : [],
  3258. CamWatchObjects : [],
  3259.  
  3260. GroupObj: function(groupID, groupName, groupCollapsed)
  3261. {
  3262. groupID = uroUtils.TypeCast(groupID);
  3263. this.groupID = groupID;
  3264. this.groupName = groupName;
  3265. this.groupCount = 0;
  3266. this.groupCollapsed = groupCollapsed;
  3267. },
  3268. CamWatchObjCheckProps: function(type, azymuth, speed, lat, lon)
  3269. {
  3270. if(type !== null) type = uroUtils.TypeCast(type);
  3271. if(azymuth !== null) azymuth = uroUtils.Truncate(uroUtils.TypeCast(azymuth)%360);
  3272. if(speed !== null) speed = uroUtils.Truncate(uroUtils.TypeCast(speed));
  3273. if(lat !== null) lat = uroUtils.Truncate(uroUtils.TypeCast(lat));
  3274. if(lon !== null) lon = uroUtils.Truncate(uroUtils.TypeCast(lon));
  3275.  
  3276. this.type = type;
  3277. this.azymuth = azymuth;
  3278. this.speed = speed;
  3279. this.lat = lat;
  3280. this.lon = lon;
  3281. },
  3282. CamWatchObj: function(persistent, fid, lon, lat, type, azymuth, speed, groupID, server)
  3283. {
  3284. fid = uroUtils.TypeCast(fid);
  3285. groupID = uroUtils.TypeCast(groupID);
  3286. if(typeof persistent == "string") persistent = (persistent == "true");
  3287. if(server === "undefined") server = "??";
  3288.  
  3289. this.fid = fid;
  3290. this.persistent = persistent;
  3291. this.loaded = false;
  3292. this.server = server;
  3293. this.groupID = groupID;
  3294. this.watch = new uroOWL.CamWatchObjCheckProps(type, azymuth, speed, lat, lon);
  3295. this.current = new uroOWL.CamWatchObjCheckProps(null, null, null, null, null);
  3296. },
  3297. CamDataChanged: function(idx)
  3298. {
  3299. let camObj = uroOWL.CamWatchObjects[idx];
  3300. if(camObj.loaded === false) return false;
  3301. if(camObj.current.type != camObj.watch.type) return true;
  3302. if(camObj.current.azymuth != camObj.watch.azymuth) return true;
  3303. if(camObj.current.speed != camObj.watch.speed) return true;
  3304. if(camObj.current.lat != camObj.watch.lat) return true;
  3305. if(camObj.current.lon != camObj.watch.lon) return true;
  3306. return false;
  3307. },
  3308. FindCWLGroupByIdx: function(groupIdx)
  3309. {
  3310. let groupName = '';
  3311. for(let loop=0;loop<uroOWL.CWLGroups.length;loop++)
  3312. {
  3313. if(uroOWL.CWLGroups[loop].groupID == groupIdx)
  3314. {
  3315. groupName = uroOWL.CWLGroups[loop].groupName;
  3316. break;
  3317. }
  3318. }
  3319. return groupName;
  3320. },
  3321. IsCamOnWatchList: function(fid)
  3322. {
  3323. for(let loop=0;loop<uroOWL.CamWatchObjects.length;loop++)
  3324. {
  3325. if(uroOWL.CamWatchObjects[loop].fid == fid) return loop;
  3326. }
  3327. return -1;
  3328. },
  3329. AddCurrentCamWatchData: function(idx, lat, lon, type, azymuth, speed, server)
  3330. {
  3331. let camObj = uroOWL.CamWatchObjects[idx];
  3332. camObj.loaded = true;
  3333. camObj.server = server;
  3334. camObj.current = new uroOWL.CamWatchObjCheckProps(type, azymuth, speed, lat, lon);
  3335. return(uroOWL.CamDataChanged(idx));
  3336. },
  3337. AddCamToWatchList: function()
  3338. {
  3339. if(uroOWL.IsCamOnWatchList(uroShownFID) == -1)
  3340. {
  3341. let camObj = W.model.cameras.objects[uroShownFID];
  3342. uroOWL.CamWatchObjects.push(new uroOWL.CamWatchObj(true, uroShownFID, camObj.geometry.x, camObj.geometry.y, camObj.attributes.type, camObj.attributes.azymuth, camObj.attributes.speed, 0, W.app.getAppRegionCode()));
  3343. uroOWL.AddCurrentCamWatchData(uroOWL.CamWatchObjects.length-1, camObj.geometry.y, camObj.geometry.x, camObj.attributes.type, camObj.attributes.azymuth, camObj.attributes.speed, W.app.getAppRegionCode());
  3344. uroDBG.AddLog('added camera '+uroShownFID+' to watchlist');
  3345. uroTabs.PopulateOWL();
  3346. }
  3347. },
  3348. RemoveCamFromWatchList: function()
  3349. {
  3350. let camidx = uroOWL.IsCamOnWatchList(uroShownFID);
  3351. if(camidx != -1)
  3352. {
  3353. uroOWL.CamWatchObjects.splice(camidx,1);
  3354. uroDBG.AddLog('removed camera '+uroShownFID+' from watchlist');
  3355. uroTabs.PopulateOWL();
  3356. }
  3357. },
  3358. UpdateCamWatchList: function()
  3359. {
  3360. let camIdx = uroOWL.IsCamOnWatchList(uroShownFID);
  3361. if(camIdx != -1)
  3362. {
  3363. let camObj = W.model.cameras.objects[uroShownFID];
  3364. uroOWL.CamWatchObjects[camIdx].watch = new uroOWL.CamWatchObjCheckProps(camObj.attributes.type, camObj.attributes.azymuth, camObj.attributes.speed, camObj.geometry.y, camObj.geometry.x);
  3365. }
  3366. },
  3367. ClearCamWatchList: function()
  3368. {
  3369. uroAlertBox.Show("fa-warning", "URO+ Warning", "Removing all cameras from the OWL <b>cannot</b> be undone.<br>Are you <i>sure</i> you want to do this?", true, "Delete ALL Cameras", "Keep Cameras", uroOWL.ClearCamWatchListAction, null);
  3370. },
  3371. ClearCamWatchListAction: function()
  3372. {
  3373. uroOWL.CamWatchObjects = [];
  3374. uroTabs.PopulateOWL();
  3375. },
  3376. RetrieveCameras: function(lat, lon)
  3377. {
  3378. let camPos = new OpenLayers.LonLat();
  3379. let camChanged = false;
  3380.  
  3381. camPos.lon = lon;
  3382. camPos.lat = lat;
  3383. camPos = uroUtils.ConvertMercatorToWGS84(camPos);
  3384.  
  3385. let camURL = 'https://' + document.location.host;
  3386. camURL += W.Config.api_base;
  3387. camURL += '/Features?language=en&cameras=true&bbox=';
  3388. let latl = camPos.lat - 0.25;
  3389. let latu = camPos.lat + 0.25;
  3390. let lonl = camPos.lon - 0.25;
  3391. let lonr = camPos.lon + 0.25;
  3392. camURL += lonl+','+latl+','+lonr+','+latu;
  3393. uroDBG.AddLog('retrieving camera data around '+camPos.lon+','+camPos.lat);
  3394.  
  3395. let camReq = new XMLHttpRequest();
  3396. camReq.open('GET',camURL,false);
  3397. try
  3398. {
  3399. camReq.send();
  3400. uroDBG.AddLog('response '+camReq.status+' received for camera data request');
  3401. if (camReq.status === 200)
  3402. {
  3403. let camData = JSON.parse(camReq.responseText);
  3404. for(let camIdx = 0; camIdx < camData.cameras.objects.length; camIdx++)
  3405. {
  3406. let camObj = camData.cameras.objects[camIdx];
  3407. let listIdx = uroOWL.IsCamOnWatchList(camObj.id);
  3408. if(listIdx != -1)
  3409. {
  3410. camPos.lon = camObj.geometry.coordinates[0];
  3411. camPos.lat = camObj.geometry.coordinates[1];
  3412. camPos = uroUtils.ConvertWGS84ToMercator(camPos);
  3413. camPos.lon = uroUtils.Truncate(camPos.lon);
  3414. camPos.lat = uroUtils.Truncate(camPos.lat);
  3415. camChanged = (uroOWL.AddCurrentCamWatchData(listIdx, camPos.lat, camPos.lon, camObj.type, camObj.azymuth, camObj.speed, W.app.getAppRegionCode()) || camChanged);
  3416. }
  3417. }
  3418. }
  3419. else
  3420. {
  3421. uroDBG.AddLog('camera data request failed (status != 200)');
  3422. }
  3423. }
  3424. catch(err)
  3425. {
  3426. uroDBG.AddLog('camera data request failed (exception '+err+' caught)');
  3427. }
  3428. return camChanged;
  3429. },
  3430. GetCurrentCamWatchListObjects: function()
  3431. {
  3432. let camChanged = false;
  3433. let camsChanged = [];
  3434. let camsDeleted = [];
  3435. let camidx;
  3436. let camObj;
  3437. for(camidx=0;camidx<uroOWL.CamWatchObjects.length;camidx++)
  3438. {
  3439. camObj = uroOWL.CamWatchObjects[camidx];
  3440. if((camObj.loaded === false) && ((camObj.server == W.app.getAppRegionCode()) || (camObj.server == '??')))
  3441. {
  3442. if(typeof W.model.cameras.objects[camObj.fid] == 'object')
  3443. {
  3444. if(W.model.cameras.objects[camObj.fid].state != "Delete")
  3445. {
  3446. let wazeObj = W.model.cameras.objects[camObj.fid];
  3447. camChanged = (uroOWL.AddCurrentCamWatchData(camidx, wazeObj.geometry.y, wazeObj.geometry.x, wazeObj.attributes.type, wazeObj.attributes.azymuth, wazeObj.attributes.speed, W.app.getAppRegionCode()) || camChanged);
  3448. }
  3449. else
  3450. {
  3451. camChanged = (uroOWL.RetrieveCameras(camObj.watch.lat, camObj.watch.lon) || camChanged);
  3452. }
  3453. }
  3454. else
  3455. {
  3456. camChanged = (uroOWL.RetrieveCameras(camObj.watch.lat, camObj.watch.lon) || camChanged);
  3457. }
  3458. }
  3459. }
  3460.  
  3461. if(camChanged)
  3462. {
  3463. for(camidx=0;camidx<uroOWL.CamWatchObjects.length;camidx++)
  3464. {
  3465. if(uroOWL.CamDataChanged(camidx))
  3466. {
  3467. camsChanged.push(uroOWL.CamWatchObjects[camidx]);
  3468. }
  3469. }
  3470. }
  3471.  
  3472. for(camidx=0;camidx<uroOWL.CamWatchObjects.length;camidx++)
  3473. {
  3474. camObj = uroOWL.CamWatchObjects[camidx];
  3475. if((camObj.loaded === false) && (camObj.server == W.app.getAppRegionCode()))
  3476. {
  3477. camsDeleted.push(camObj);
  3478. }
  3479. }
  3480. if((camsChanged.length > 0) || (camsDeleted.length > 0))
  3481. {
  3482. let alertStr = '';
  3483. for(camidx=0;camidx<camsChanged.length;camidx++)
  3484. {
  3485. alertStr += 'Camera ID '+camsChanged[camidx].fid+' in group "'+uroOWL.FindCWLGroupByIdx(camsChanged[camidx].groupID)+'" has been changed<br>';
  3486. }
  3487. alertStr += '<br>';
  3488. for(camidx=0;camidx<camsDeleted.length;camidx++)
  3489. {
  3490. alertStr += 'Camera ID '+camsDeleted[camidx].fid+' in group "'+uroOWL.FindCWLGroupByIdx(camsDeleted[camidx].groupID)+'" has been deleted<br>';
  3491. }
  3492. uroAlertBox.Show("fa-info-circle", "URO+ Camera Watchlist Alert", alertStr, false, "OK", null, null, null);
  3493. }
  3494. },
  3495. ClearDeletedCameras: function()
  3496. {
  3497. for(let camidx=uroOWL.CamWatchObjects.length-1;camidx>=0;camidx--)
  3498. {
  3499. if(uroOWL.CamWatchObjects[camidx].loaded === false)
  3500. {
  3501. uroShownFID = uroOWL.CamWatchObjects[camidx].fid;
  3502. uroOWL.RemoveCamFromWatchList();
  3503. }
  3504. }
  3505. },
  3506. AcceptCameraChanges: function()
  3507. {
  3508. for(let camidx=0; camidx < uroOWL.CamWatchObjects.length; camidx++)
  3509. {
  3510. if(uroOWL.CamDataChanged(camidx))
  3511. {
  3512. uroOWL.CamWatchObjects[camidx].watch.type = uroOWL.CamWatchObjects[camidx].current.type;
  3513. uroOWL.CamWatchObjects[camidx].watch.azymuth = uroOWL.CamWatchObjects[camidx].current.azymuth;
  3514. uroOWL.CamWatchObjects[camidx].watch.speed = uroOWL.CamWatchObjects[camidx].current.speed;
  3515. uroOWL.CamWatchObjects[camidx].watch.lat = uroOWL.CamWatchObjects[camidx].current.lat;
  3516. uroOWL.CamWatchObjects[camidx].watch.lon = uroOWL.CamWatchObjects[camidx].current.lon;
  3517. }
  3518. }
  3519. uroTabs.PopulateOWL();
  3520. },
  3521. ClearUnknownServerCameras: function()
  3522. {
  3523. let confirmMsg = '<p>Cameras with an unknown server <i>cannot</i> be automatically verified by URO+</p>';
  3524. confirmMsg += 'It is recommended that you manually load WME from each server (World, USA/Canada and Israel) to give URO+ a chance of locating these cameras.<br>';
  3525. confirmMsg += 'If the cameras then continue to show up as an unknown server, it is safe to delete them...<br><br>';
  3526. confirmMsg += 'Do you still wish to proceed with deleting all unknown server cameras?';
  3527.  
  3528. uroAlertBox.Show("fa-warning", "URO+ Warning", confirmMsg, true, "Delete unknown cameras", "Keep unknown cameras", uroOWL.ClearUnknownServerCamerasAction, null);
  3529. },
  3530. ClearUnknownServerCamerasAction: function()
  3531. {
  3532. for(let camidx=uroOWL.CamWatchObjects.length-1;camidx>=0;camidx--)
  3533. {
  3534. if(uroOWL.CamWatchObjects[camidx].server == '??')
  3535. {
  3536. uroShownFID = uroOWL.CamWatchObjects[camidx].fid;
  3537. uroOWL.RemoveCamFromWatchList();
  3538. }
  3539. }
  3540. },
  3541. RescanCamWatchList: function()
  3542. {
  3543. for(let camidx=0;camidx<uroOWL.CamWatchObjects.length;camidx++)
  3544. {
  3545. uroOWL.CamWatchObjects[camidx].loaded = false;
  3546. }
  3547. uroOWL.GetCurrentCamWatchListObjects();
  3548. uroTabs.PopulateOWL();
  3549. },
  3550. GotoCam: function()
  3551. {
  3552. let camidx = this.id.substr(13);
  3553. let camPos = new OpenLayers.LonLat();
  3554. camPos.lon = uroOWL.CamWatchObjects[camidx].watch.lon;
  3555. camPos.lat = uroOWL.CamWatchObjects[camidx].watch.lat;
  3556. W.map.setCenter(camPos,16);
  3557. W.map.camerasLayer.setVisibility(true);
  3558. return false;
  3559. },
  3560. HighlightCWLEntry: function()
  3561. {
  3562. this.style.backgroundColor = '#FFFFAA';
  3563. return false;
  3564. },
  3565. UnhighlightCWLEntry: function()
  3566. {
  3567. let camidx = this.id.substr(8);
  3568. let changed = uroOWL.CamDataChanged(camidx);
  3569. let deleted = (uroOWL.CamWatchObjects[camidx].loaded === false);
  3570.  
  3571. if(uroOWL.CamWatchObjects[camidx].server != W.app.getAppRegionCode())
  3572. {
  3573. if(uroOWL.CamWatchObjects[camidx].server == '??') this.style.backgroundColor = '#A0A0A0';
  3574. else this.style.backgroundColor = '#AAFFAA';
  3575. }
  3576. else if(changed) this.style.backgroundColor = '#AAAAFF';
  3577. else if(deleted) this.style.backgroundColor = '#FFAAAA';
  3578. else this.style.backgroundColor = '#FFFFFF';
  3579. return false;
  3580. },
  3581. CWLIconHighlight: function()
  3582. {
  3583. this.style.color="#0000ff";
  3584. return false;
  3585. },
  3586. CWLIconLowlight: function()
  3587. {
  3588. this.style.color="#ccccff";
  3589. return false;
  3590. },
  3591. PopulateCWLGroupSelect: function()
  3592. {
  3593. let selector = document.getElementById('_uroCWLGroupSelect');
  3594. while(selector.options.length > 0)
  3595. {
  3596. selector.options.remove(0);
  3597. }
  3598. for(let loop=0;loop<uroOWL.CWLGroups.length;loop++)
  3599. {
  3600. let groupObj = uroOWL.CWLGroups[loop];
  3601. if(groupObj.groupID != -1)
  3602. {
  3603. selector.options.add(new Option(groupObj.groupName,groupObj.groupID));
  3604. }
  3605. }
  3606. },
  3607. GetNextCWLGroupID: function()
  3608. {
  3609. let nextID = 1;
  3610. for(let loop=0;loop<uroOWL.CWLGroups.length;loop++)
  3611. {
  3612. if(uroOWL.CWLGroups[loop].groupID >= nextID)
  3613. {
  3614. nextID = uroOWL.CWLGroups[loop].groupID + 1;
  3615. }
  3616. }
  3617. return nextID;
  3618. },
  3619. FindCWLGroupByName: function(groupName)
  3620. {
  3621. let groupID = -1;
  3622. for(let loop=0;loop<uroOWL.CWLGroups.length;loop++)
  3623. {
  3624. if((uroOWL.CWLGroups[loop].groupName == groupName) && (uroOWL.CWLGroups[loop].groupID != -1))
  3625. {
  3626. groupID = uroOWL.CWLGroups[loop].groupID;
  3627. break;
  3628. }
  3629. }
  3630. return groupID;
  3631. },
  3632. AddCWLGroup: function()
  3633. {
  3634. let groupID = uroOWL.GetNextCWLGroupID();
  3635. let groupName = uroUtils.GetElmValue('_uroCWLGroupEntry');
  3636. if(uroOWL.FindCWLGroupByName(groupName) == -1)
  3637. {
  3638. uroOWL.CWLGroups.push(new uroOWL.GroupObj(groupID,groupName,false));
  3639. uroOWL.PopulateCWLGroupSelect();
  3640. }
  3641. },
  3642. RemoveCWLGroup: function()
  3643. {
  3644. let loop;
  3645. let selector = document.getElementById('_uroCWLGroupSelect');
  3646. let groupID = parseInt(selector.selectedOptions[0].value);
  3647. if(groupID === 0) return false; // prevent deletion of the default group
  3648.  
  3649. for(loop=0;loop<uroOWL.CamWatchObjects.length;loop++)
  3650. {
  3651. let cwObj = uroOWL.CamWatchObjects[loop];
  3652. if(cwObj.groupID == groupID)
  3653. {
  3654. cwObj.groupID = 0;
  3655. }
  3656. }
  3657. for(loop=0;loop<uroOWL.CWLGroups.length;loop++)
  3658. {
  3659. let groupObj = uroOWL.CWLGroups[loop];
  3660. if(groupObj.groupID == groupID)
  3661. {
  3662. groupObj.groupID = -1;
  3663. }
  3664. }
  3665. uroTabs.PopulateOWL();
  3666. },
  3667. AssignCameraToGroup: function()
  3668. {
  3669. let camidx = this.id.substr(13);
  3670. let selector = document.getElementById('_uroCWLGroupSelect');
  3671. uroOWL.CamWatchObjects[camidx].groupID = parseInt(selector.selectedOptions[0].value);
  3672. uroTabs.PopulateOWL();
  3673. return false;
  3674. },
  3675. CWLGroupCollapseExpand: function()
  3676. {
  3677. let groupidx = this.id.substr(18);
  3678. if(uroOWL.CWLGroups[groupidx].groupCollapsed === true) uroOWL.CWLGroups[groupidx].groupCollapsed = false;
  3679. else uroOWL.CWLGroups[groupidx].groupCollapsed = true;
  3680. uroTabs.PopulateOWL();
  3681. return false;
  3682. }
  3683. };
  3684. const uroIgnore = // ignore list
  3685. {
  3686. IsOnList: function(fid)
  3687. {
  3688. if(sessionStorage.UROverview_FID_IgnoreList.indexOf('fid:'+fid) == -1) return false;
  3689. else return true;
  3690. },
  3691. EnableControls: function()
  3692. {
  3693. let btnState = "visible";
  3694. if(sessionStorage.UROverview_FID_IgnoreList === '')
  3695. {
  3696. btnState = "hidden";
  3697. }
  3698. try
  3699. {
  3700. document.getElementById('_btnUndoLastHide').style.visibility = btnState;
  3701. document.getElementById('_btnClearSessionHides').style.visibility = btnState;
  3702. uroFilterItems();
  3703. }
  3704. catch(err)
  3705. {
  3706. uroDBG.AddLog('exception thrown in uroIgnore.EnableControls()');
  3707. }
  3708. },
  3709. Add: function()
  3710. {
  3711. if(!uroIgnore.IsOnList(uroShownFID))
  3712. {
  3713. sessionStorage.UROverview_FID_IgnoreList += 'fid:'+uroShownFID;
  3714. uroDBG.AddLog('added fid '+uroShownFID+' to ignore list');
  3715. uroDBG.AddLog(sessionStorage.UROverview_FID_IgnoreList);
  3716. uroDiv.style.visibility = 'hidden';
  3717. uroIgnore.EnableControls();
  3718.  
  3719. W.map.events.register("mousemove", null, uroFilterItemsOnMove);
  3720. }
  3721. return false;
  3722. },
  3723. RemoveLastAdded: function()
  3724. {
  3725. let ignorelist = sessionStorage.UROverview_FID_IgnoreList;
  3726. let fidpos = ignorelist.lastIndexOf('fid:');
  3727. if(fidpos != -1)
  3728. {
  3729. ignorelist = ignorelist.slice(0,fidpos);
  3730. sessionStorage.UROverview_FID_IgnoreList = ignorelist;
  3731. uroDBG.AddLog('removed last fid from ignore list');
  3732. uroDBG.AddLog(sessionStorage.UROverview_FID_IgnoreList);
  3733. uroIgnore.EnableControls();
  3734. }
  3735. },
  3736. RemoveAll: function()
  3737. {
  3738. sessionStorage.UROverview_FID_IgnoreList = '';
  3739. uroIgnore.EnableControls();
  3740. }
  3741. };
  3742. const uroPopup = // map object popup handling
  3743. {
  3744. hasIgnoreLink : null,
  3745. hasDeleteLink : null,
  3746. hasAddWatchLink : null,
  3747. hasRemoveWatchLink : null,
  3748. hasUpdateWatchLink : null,
  3749. hasRecentreSessionLink : null,
  3750. hasOpenInNewTabLink : null,
  3751.  
  3752. isVenue : null,
  3753. isMapComment : null,
  3754. isUR : null,
  3755. isProblem : null,
  3756. isTurnProb : null,
  3757. isPlaceUpdate : null,
  3758. timer : -2,
  3759. autoHideTimer : 0,
  3760. mouseIn : false,
  3761. shown : false,
  3762. shownType : null,
  3763. newType : null,
  3764. hovered : null,
  3765. unstackedX : null,
  3766. unstackedY : null,
  3767. renderIntent : null,
  3768. pX : null,
  3769. pY : null,
  3770. suppressed : false,
  3771.  
  3772. GetFormattedLocks: function(attrs)
  3773. {
  3774. let autoLock = attrs.rank;
  3775. let userLock = attrs.lockRank;
  3776. let retval = '<b>' + I18n.lookup("edit.segment.fields.lock") + ': </b>';
  3777. if(userLock !== null)
  3778. {
  3779. retval += 'M' + (userLock+1) + ' / ';
  3780. }
  3781. retval += 'A' + (autoLock+1);
  3782. return retval;
  3783. },
  3784. UR: function()
  3785. {
  3786. let result = '';
  3787.  
  3788. uroPopup.unstackedX = uroUtils.ParsePxString(uroMarkers.elm.style.left);
  3789. uroPopup.unstackedY = uroUtils.ParsePxString(uroMarkers.elm.style.top);
  3790. // check for stacking...
  3791. if(uroShownFID != uroMarkers.id)
  3792. {
  3793. uroCheckStacking(uroLayers.ID.UR,uroMarkers.id, uroPopup.unstackedX, uroPopup.unstackedY);
  3794. }
  3795.  
  3796. if(uroUtils.GetCBChecked('_cbInhibitURPopup') === false)
  3797. {
  3798. if(uroMousedOverMapComment !== null)
  3799. {
  3800. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for UR highlight');
  3801. uroMousedOverOtherObjectWithinMapComment = true;
  3802. }
  3803.  
  3804. uroPopup.isUR = true;
  3805. uroPopup.newPopupType = uroMarkers.type;
  3806. let ureq = W.model.mapUpdateRequests.objects[uroMarkers.id];
  3807.  
  3808. if(ureq.attributes != undefined)
  3809. {
  3810. uroFID = uroMarkers.id;
  3811.  
  3812. uroDBG.AddLog('building popup for UR '+uroMarkers.id);
  3813. result = '<b>Update Request ('+uroMarkers.id+'): ' + I18n.lookup("update_requests.types." + ureq.attributes.type) + '</b><br>';
  3814.  
  3815. result += uroUtils.Clickify(ureq.attributes.description, '<br>');
  3816. let uroDaysOld = uroUtils.GetURAge(ureq,0,false);
  3817. let uroSubmittedTS = uroUtils.GetURAge(ureq,0,true);
  3818. if(uroSubmittedTS != -1)
  3819. {
  3820. uroSubmittedTS = uroUtils.GetDateTimeString(uroSubmittedTS);
  3821. }
  3822. if(uroDaysOld != -1)
  3823. {
  3824. result += '<i>Submitted ' + uroUtils.ParseDaysAgo(uroDaysOld) + ' ';
  3825. if(uroSubmittedTS != -1) result += '(' + uroSubmittedTS + ') ';
  3826. if(ureq.attributes.guestUserName != null)
  3827. {
  3828. result += 'via Livemap';
  3829. if(ureq.attributes.guestUserName !== '')
  3830. {
  3831. result += ' by '+ureq.attributes.guestUserName.replace(/<\/?[^>]+(>|$)/g, "");
  3832. }
  3833. }
  3834. result += '</i>';
  3835. }
  3836. if(ureq.attributes.resolvedOn !== null)
  3837. {
  3838. let daysResolved = uroUtils.GetURAge(ureq,1,false);
  3839. let uroResolvedTS = uroUtils.GetURAge(ureq,1,true);
  3840. if(uroResolvedTS != -1)
  3841. {
  3842. uroResolvedTS = uroUtils.GetDateTimeString(uroResolvedTS);
  3843. }
  3844.  
  3845. if(daysResolved != -1)
  3846. {
  3847. result += '<br><i>Closed ' + uroUtils.ParseDaysAgo(daysResolved) + ' ';
  3848. if(uroResolvedTS != -1) result += '(' + uroResolvedTS + ')</i>';
  3849.  
  3850. result += '<br><i>Marked as ';
  3851. if(ureq.attributes.resolution === 0) result += 'solved';
  3852. else if(ureq.attributes.resolution == 1) result += 'not identified';
  3853. else result += 'unknown';
  3854. if(ureq.attributes.resolvedBy !== null)
  3855. {
  3856. result += ' by '+uroUtils.GetUserNameAndRank(ureq.attributes.resolvedBy);
  3857. }
  3858. result += '</i>';
  3859. }
  3860. }
  3861. if(W.model.updateRequestSessions.objects[uroMarkers.id] != null)
  3862. {
  3863. let hasMyComments = uroURHasMyComments(uroMarkers.id);
  3864. let nComments = W.model.updateRequestSessions.objects[uroMarkers.id].attributes.comments.length;
  3865. result += '<br>' + nComments + ' comment';
  3866. if(nComments != 1) result += 's';
  3867. if((hasMyComments === false) && (nComments > 0)) result += ' (none by me)';
  3868. if(nComments > 0)
  3869. {
  3870. let commentDaysOld = uroUtils.GetCommentAge(W.model.updateRequestSessions.objects[uroMarkers.id].attributes.comments[nComments-1]);
  3871. if(commentDaysOld != -1)
  3872. {
  3873. result += ', last update '+uroUtils.ParseDaysAgo(commentDaysOld);
  3874. }
  3875. }
  3876. }
  3877. if(uroURDupes.length > 0)
  3878. {
  3879. let thisID = parseInt(uroMarkers.id);
  3880. for(let i = 0; i < uroURDupes.length; ++i)
  3881. {
  3882. if(uroURDupes[i][0] === thisID)
  3883. {
  3884. result += '<br><br>Duplicate of: ';
  3885. let dupes = 0;
  3886. for(let j = 0; j < uroURDupes[i][1].length; ++j)
  3887. {
  3888. if(uroURDupes[i][1][j] !== thisID)
  3889. {
  3890. if(dupes > 0)
  3891. {
  3892. result += ', ';
  3893. }
  3894. result += uroURDupes[i][1][j];
  3895. ++dupes;
  3896. }
  3897. }
  3898. }
  3899. }
  3900. }
  3901. uroPopup.result += result;
  3902. uroPopup.UMPExtras(ureq);
  3903. uroPopup.Show();
  3904. }
  3905. }
  3906. },
  3907. MP: function()
  3908. {
  3909. let result = '';
  3910.  
  3911. uroPopup.unstackedX = uroUtils.ParsePxString(uroMarkers.elm.style.left);
  3912. uroPopup.unstackedY = uroUtils.ParsePxString(uroMarkers.elm.style.top);
  3913. // check for stacking...
  3914. if(uroShownFID != uroMarkers.id)
  3915. {
  3916. ////uroCheckStacking(uroLayers.ID.MP,uroMarkers.id, uroPopup.unstackedX, uroPopup.unstackedY);
  3917. }
  3918.  
  3919. if(uroUtils.GetCBChecked('_cbInhibitMPPopup') === false)
  3920. {
  3921. if(uroMousedOverMapComment !== null)
  3922. {
  3923. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for MP highlight');
  3924. uroMousedOverOtherObjectWithinMapComment = true;
  3925. }
  3926.  
  3927. uroPopup.isProblem = true;
  3928. uroPopup.newPopupType = uroMarkers.type;
  3929. let ureq = W.model.mapProblems.objects[uroMarkers.id];
  3930.  
  3931. uroFID = uroMarkers.id;
  3932. uroDBG.AddLog('building popup for problem '+uroMarkers.id);
  3933. if(uroPopup.isTurnProb) result = '<b>Turn Problem ('+uroMarkers.id+'): ' + I18n.lookup("problems.types.turn.title");
  3934. else
  3935. {
  3936. result = '<b>Map Problem ('+uroMarkers.id+'): ';
  3937.  
  3938. let problemType = ureq.attributes.subType;
  3939. if(problemType == 300)
  3940. {
  3941. result += I18n.lookup("problems.panel.closure.title");
  3942. }
  3943. else
  3944. {
  3945. if(I18n.lookup("problems.types." + problemType) === undefined) result += 'Unknown problem type ('+problemType+')';
  3946. else result += I18n.lookup("problems.types." + problemType + ".title");
  3947. }
  3948. }
  3949. result += '</b><br>';
  3950.  
  3951. if(ureq.attributes.description != null)
  3952. {
  3953. result += 'Description: ' + ureq.attributes.description + '<br>';
  3954. }
  3955. if(ureq.attributes.extraInfo != null)
  3956. {
  3957. result += 'ExtraInfo: ' + uroUtils.Clickify(ureq.attributes.extraInfo, '<br>');
  3958. }
  3959. if(ureq.attributes.provider != null)
  3960. {
  3961. result += 'Provider: ' + ureq.attributes.provider + '<br>';
  3962. }
  3963. if(ureq.attributes.startTime != null)
  3964. {
  3965. result += 'From: ' + uroUtils.GetDateTimeString(ureq.attributes.startTime) + '<br>';
  3966. }
  3967. if(ureq.attributes.endTime != null)
  3968. {
  3969. result += 'To: ' + uroUtils.GetDateTimeString(ureq.attributes.endTime) + '<br>';
  3970. }
  3971. if(ureq.attributes.resolvedOn != null)
  3972. {
  3973. let daysResolved = uroUtils.GetURAge(ureq,1,false);
  3974. if(daysResolved != -1)
  3975. {
  3976. result += '<br><i>Closed ' + uroUtils.ParseDaysAgo(daysResolved) + ' ';
  3977. if(ureq.attributes.resolvedBy != null)
  3978. {
  3979. result += ' by '+uroUtils.GetUserNameAndRank(ureq.attributes.resolvedBy);
  3980. }
  3981.  
  3982. if((ureq.attributes.open === true) && (ureq.attributes.resolvedOn != null))
  3983. {
  3984. result += '<br>Reopened by Waze';
  3985. }
  3986. result += '</i>';
  3987. }
  3988. }
  3989. uroPopup.result += result;
  3990. uroPopup.UMPExtras(ureq);
  3991. }
  3992. },
  3993. PUR: function()
  3994. {
  3995. if(uroMarkers?.elm?.style == undefined)
  3996. {
  3997. return;
  3998. }
  3999.  
  4000. let result = '';
  4001.  
  4002. uroPopup.unstackedX = uroUtils.ParsePxString(uroMarkers.elm.style.left);
  4003. uroPopup.unstackedY = uroUtils.ParsePxString(uroMarkers.elm.style.top);
  4004.  
  4005. if(uroShownFID != uroMarkers.id)
  4006. {
  4007. // check for stacking...
  4008. uroCheckStacking(uroMarkers.type, uroMarkers.id, uroPopup.unstackedX, uroPopup.unstackedY);
  4009. }
  4010.  
  4011. if(uroUtils.GetCBChecked('_cbInhibitPUPopup') === false)
  4012. {
  4013. let ureq = W.model.venues.objects[uroMarkers.id];
  4014.  
  4015. uroPopup.newPopupType = uroMarkers.type;
  4016. if(uroMousedOverMapComment !== null)
  4017. {
  4018. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for PUR highlight');
  4019. uroMousedOverOtherObjectWithinMapComment = true;
  4020. }
  4021.  
  4022. uroPopup.isPlaceUpdate = true;
  4023.  
  4024. uroFID = uroMarkers.id;
  4025.  
  4026. if(uroMarkers.type == uroLayers.ID.PUR)
  4027. {
  4028. uroDBG.AddLog('building popup for placeUpdate '+uroMarkers.id);
  4029. }
  4030. else if(uroMarkers.type == uroLayers.ID.RPUR)
  4031. {
  4032. uroDBG.AddLog('building popup for residentialPlaceUpdate '+uroMarkers.id);
  4033. }
  4034. else
  4035. {
  4036. uroDBG.AddLog('building popup for parkingPlaceUpdate '+uroMarkers.id);
  4037. }
  4038.  
  4039. result = '<b>';
  4040. if(ureq.attributes.name === '') result += 'Unnamed landmark';
  4041. else result += ureq.attributes.name;
  4042. result += '</b><br>';
  4043.  
  4044. result += '<ul>';
  4045. for(let idx = 0; idx < ureq.attributes.categories.length; idx++)
  4046. {
  4047. result += '<li>' + I18n.lookup("venues.categories." + ureq.attributes.categories[idx]);
  4048. }
  4049. result += '</ul>';
  4050.  
  4051. if(ureq.attributes.residential === true)
  4052. {
  4053. result += '<i>Residential</i>';
  4054. }
  4055.  
  4056. let daysOld = uroUtils.GetPURAge(ureq);
  4057. if(daysOld != -1)
  4058. {
  4059. result += '<br><i>Submitted '+uroUtils.ParseDaysAgo(daysOld)+'</i>';
  4060. }
  4061.  
  4062. uroPopup.result += result;
  4063. uroPopup.UMPExtras(ureq);
  4064. }
  4065. },
  4066. Venue: function()
  4067. {
  4068. if(uroUtils.GetCBChecked('_cbInhibitLandmarkPopup') === false)
  4069. {
  4070. let result = '';
  4071. let navpointPos=new OpenLayers.LonLat();
  4072. {
  4073. if(uroPopup.renderIntent === 'highlight')
  4074. {
  4075. if(uroUtils.GetExtent().intersectsBounds(uroMarkers.obj.attributes.geometry.getBounds()))
  4076. {
  4077. if(uroMousedOverMapComment !== null)
  4078. {
  4079. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for place highlight');
  4080. uroMousedOverOtherObjectWithinMapComment = true;
  4081. }
  4082.  
  4083. if(uroPopup.newPopupType === null)
  4084. {
  4085. uroFID = uroMarkers.obj.attributes.id;
  4086. uroDBG.AddLog('building popup for place '+uroFID);
  4087.  
  4088. navpointPos = uroGetVenueNavPoint(uroFID);
  4089. result += '<b>';
  4090. if(uroMarkers.obj.attributes.name === '')
  4091. {
  4092. if(uroMarkers.obj.attributes.residential === true) result += '<i>Residential</i>';
  4093. else result += '<i>Unnamed</i>';
  4094. }
  4095. else result += uroUtils.Clickify(uroMarkers.obj.attributes.name, '');
  4096. if(uroMarkers.obj.attributes.externalProviderIDs.length > 0)
  4097. {
  4098. result += ' <i>(linked)</i>';
  4099. }
  4100. if(uroMarkers.obj.attributes.adLocked)
  4101. {
  4102. result += ' <i>(AdLocked)</i>';
  4103. }
  4104. result += '</b><br>';
  4105. if(uroMarkers.obj.attributes.brand !== null)
  4106. {
  4107. result += '<i>Brand: ' + uroMarkers.obj.attributes.brand + '</i><br>';
  4108. }
  4109. let vDesc = uroMarkers.obj.attributes.description;
  4110. if(vDesc !== '')
  4111. {
  4112. result += '"<i>' + uroUtils.Clickify(vDesc, '') + '</i>"<br>';
  4113. }
  4114.  
  4115. let userLock = uroMarkers.obj.attributes.lockRank;
  4116. result += '<b>Lock: </b>' + (userLock+1);
  4117.  
  4118. result += '<hr>';
  4119. result += uroGetAddress(uroMarkers.obj.attributes.streetID, uroMarkers.obj.attributes.houseNumber, false, false, false);
  4120. result += '<ul>';
  4121. for(let idx = 0; idx < uroMarkers.obj.attributes.categories.length; idx++)
  4122. {
  4123. result += '<li>' + I18n.lookup("venues.categories." + uroMarkers.obj.attributes.categories[idx]);
  4124. }
  4125. result += '</ul>';
  4126.  
  4127. let npLink = document.location.href;
  4128. let npLayers = '';
  4129. npLink = npLink.substr(0,npLink.indexOf('?zoomLevel'));
  4130. npLink += '?zoomLevel=17&lat='+navpointPos.lat+'&lon='+navpointPos.lon+npLayers;
  4131.  
  4132. let targetTab = "_uroTab_" + Math.round(Math.random()*1000000);
  4133. result += '<hr>Jump to nav point: <a href="'+npLink+'" id="_openInNewTab" target="'+targetTab+'">in new tab</a> - ';
  4134. uroPopup.hasOpenInNewTabLink = true;
  4135. result += '<a href="#" id="_recentreSession">in this tab</a>';
  4136. uroPopup.hasRecentreSessionLink = true;
  4137.  
  4138. uroPopup.newPopupType = 'venue';
  4139. uroPopup.isVenue = true;
  4140.  
  4141. uroPopup.result += result;
  4142. uroPopup.Show();
  4143. }
  4144. else
  4145. {
  4146. let otherID = uroMarkers.obj.attributes.id;
  4147. uroDBG.AddLog('venue '+otherID+' is also highlighted');
  4148. }
  4149. }
  4150. else
  4151. {
  4152. uroDBG.AddLog('landmark '+uroFID+' has renderIntent==highlight but is offscreen... blocking popup');
  4153. }
  4154. }
  4155. }
  4156. }
  4157. },
  4158. Camera: function()
  4159. {
  4160. if(uroUtils.GetCBChecked('_cbInhibitCamPopup') === false)
  4161. {
  4162. let result = '';
  4163. let ureq = uroMarkers.obj;
  4164.  
  4165. if(uroPopup.renderIntent === "highlight")
  4166. {
  4167. if(uroMousedOverMapComment !== null)
  4168. {
  4169. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for camera highlight');
  4170. uroMousedOverOtherObjectWithinMapComment = true;
  4171. }
  4172. uroPopup.newPopupType = 'camera';
  4173. uroFID = uroMarkers.id;
  4174. uroDBG.AddLog('building popup for camera '+uroFID);
  4175. if(I18n.lookup("edit.camera.fields.type") === undefined)
  4176. {
  4177. result += '<b>Camera: ' + ureq.TYPES[ureq.attributes.type] + '</b>';
  4178. }
  4179. else
  4180. {
  4181. result += '<b>Camera: ' + I18n.lookup("edit.camera.fields.type." + ureq.attributes.type) + '</b>';
  4182. }
  4183. result += '<br>';
  4184. result += '<b>ID:</b> ' + uroFID + ' - ';
  4185. result += uroPopup.GetFormattedLocks(uroMarkers.obj.attributes);
  4186. result += '<br>';
  4187.  
  4188. result += '<b>Created by</b> ';
  4189. let userID;
  4190.  
  4191. if(W.model.users.getByIds([ureq.attributes.createdBy])[0] != null)
  4192. {
  4193. userID = ureq.attributes.createdBy;
  4194. result += uroUtils.GetUserNameAndRank(userID);
  4195. }
  4196. else result += 'unknown';
  4197. result += ', ';
  4198. let camAge = uroUtils.GetCameraAge(ureq,1);
  4199. if(camAge != -1)
  4200. {
  4201. result += uroUtils.ParseDaysAgo(camAge);
  4202. }
  4203. else result += 'unknown days ago';
  4204. result += '<br><b>Updated by</b> ';
  4205. if(W.model.users.getByIds([ureq.attributes.updatedBy])[0] != null)
  4206. {
  4207. userID = ureq.attributes.updatedBy;
  4208. result += uroUtils.GetUserNameAndRank(userID);
  4209. }
  4210. else result += 'unknown';
  4211. result += ', ';
  4212. camAge = uroUtils.GetCameraAge(ureq,0);
  4213. if(camAge != -1)
  4214. {
  4215. result += uroUtils.ParseDaysAgo(camAge);
  4216. }
  4217. else result += 'unknown days ago';
  4218.  
  4219. if(ureq.attributes.type !== 4)
  4220. {
  4221. result += '<br><b>Speed data:</b> ';
  4222. result += uroUtils.GetLocalisedSpeedString(ureq.attributes.speed);
  4223. if(uroIsCamSpeedValid(ureq) === false)
  4224. {
  4225. result += ' (differs to nearest segment)';
  4226. }
  4227. }
  4228. result += '<hr><ul>';
  4229. if(uroOWL.IsCamOnWatchList(uroFID) != -1)
  4230. {
  4231. result += '<li><a href="#" id="_updatewatchlist">Update watchlist entry</a>';
  4232. result += '<li><a href="#" id="_removefromwatchlist">Remove from watchlist</a>';
  4233. uroPopup.hasUpdateWatchLink = true;
  4234. uroPopup.hasRemoveWatchLink = true;
  4235. }
  4236. else
  4237. {
  4238. result += '<li><a href="#" id="_addtowatchlist">Add to watchlist</a>';
  4239. uroPopup.hasAddWatchLink = true;
  4240. }
  4241. if(ureq.attributes.permissions !== 0)
  4242. {
  4243. result += '<li><a href="#" id="_deleteobject">Delete Camera</a>';
  4244. uroPopup.hasDeleteLink = true;
  4245. }
  4246. result += '</ul>';
  4247. uroPopup.result += result;
  4248. uroPopup.Show();
  4249. }
  4250. }
  4251. },
  4252. Comment: function()
  4253. {
  4254. if(uroUtils.GetCBChecked('_cbInhibitMapCommentPopup') === false)
  4255. {
  4256. if(uroMCLayer.name !== 'mapComments')
  4257. {
  4258. uroInit.WazeBits();
  4259. }
  4260. if(uroMCLayer !== null)
  4261. {
  4262. let result = '';
  4263.  
  4264. if(uroPopup.renderIntent == 'highlight')
  4265. {
  4266. let moAttrs = uroMarkers.obj.attributes;
  4267. if(uroUtils.GetExtent().intersectsBounds(moAttrs.geometry.getBounds()))
  4268. {
  4269. if(uroPopup.newPopupType === null)
  4270. {
  4271. if((uroMousedOverMapComment === moAttrs.id) && (uroMousedOverOtherObjectWithinMapComment === true))
  4272. {
  4273. uroDBG.AddLog('inhibit popup for map comment '+uroMousedOverMapComment);
  4274. }
  4275. else
  4276. {
  4277. uroMousedOverOtherObjectWithinMapComment = false;
  4278. if(moAttrs.geometry.id.indexOf('Polygon') !== -1)
  4279. {
  4280. // only capture ID for area comments...
  4281. uroMousedOverMapComment = moAttrs.id;
  4282. }
  4283. uroFID = moAttrs.id;
  4284. uroDBG.AddLog('building popup for map comment '+uroFID);
  4285.  
  4286. result += '<b>';
  4287. if(moAttrs.subject === '')
  4288. {
  4289. result += '<i>No subject</i>';
  4290. }
  4291. else result += uroUtils.Clickify(moAttrs.subject, '');
  4292. result += '</b><br>';
  4293. result += uroUtils.Clickify(moAttrs.body, '<br>');
  4294.  
  4295. let mcDaysOld = uroUtils.GetMCAge(moAttrs, 0, false);
  4296. let mcSubmittedTS = uroUtils.GetMCAge(moAttrs, 0, true);
  4297. if(mcSubmittedTS != -1)
  4298. {
  4299. mcSubmittedTS = uroUtils.GetDateTimeString(mcSubmittedTS);
  4300. }
  4301. if(mcDaysOld != -1)
  4302. {
  4303. result += '<i>Submitted ' + uroUtils.ParseDaysAgo(mcDaysOld) + ' ';
  4304. if(mcSubmittedTS != -1) result += '(' + mcSubmittedTS + ') ';
  4305. if(moAttrs.createdBy != null)
  4306. {
  4307. result += ' by '+uroUtils.GetUserNameAndRank(moAttrs.createdBy);
  4308. }
  4309. result += '</i><br>';
  4310. }
  4311. mcDaysOld = uroUtils.GetMCAge(moAttrs, 1, false);
  4312. mcSubmittedTS = uroUtils.GetMCAge(moAttrs, 1, true);
  4313. if(mcSubmittedTS != -1)
  4314. {
  4315. mcSubmittedTS = uroUtils.GetDateTimeString(mcSubmittedTS);
  4316. }
  4317. if(mcDaysOld != -1)
  4318. {
  4319. result += '<i>Updated ' + uroUtils.ParseDaysAgo(mcDaysOld) + ' ';
  4320. if(mcSubmittedTS != -1) result += '(' + mcSubmittedTS + ') ';
  4321. if(moAttrs.createdBy != null)
  4322. {
  4323. result += ' by '+uroUtils.GetUserNameAndRank(moAttrs.updatedBy);
  4324. }
  4325. result += '</i><br>';
  4326. }
  4327.  
  4328. mcDaysOld = uroUtils.GetMCAge(moAttrs,2,false);
  4329. mcSubmittedTS = uroUtils.GetMCAge(moAttrs,2,true);
  4330. if(mcDaysOld != -1)
  4331. {
  4332. result += '<i>Expires ' + uroUtils.ParseDaysToGo(mcDaysOld) + ' ';
  4333. result += '(' + uroUtils.GetDateTimeString(mcSubmittedTS) +')</i><br>';
  4334. }
  4335.  
  4336. let mcHasMyComments = false;
  4337. let mcNComments = moAttrs.conversation.length;
  4338. if(mcNComments > 0)
  4339. {
  4340. for(let j=0; j<mcNComments; j++)
  4341. {
  4342. if(moAttrs.conversation[j].userID == uroUserID)
  4343. {
  4344. mcHasMyComments = true;
  4345. break;
  4346. }
  4347. }
  4348. }
  4349. result += '<br>' + mcNComments +' comment';
  4350. if(mcNComments != 1) result += 's';
  4351. if((mcHasMyComments === false) && (mcNComments > 0)) result += ' (none by me)';
  4352.  
  4353. // add "ignore for this session" link
  4354. result += '<br><a href="#" id="_addtoignore">Hide for this session</a>';
  4355. uroPopup.hasIgnoreLink = true;
  4356.  
  4357. uroPopup.newPopupType = 'map_comment';
  4358. uroPopup.isMapComment = true;
  4359.  
  4360. uroPopup.result += result;
  4361. uroPopup.Show();
  4362. }
  4363. }
  4364. else
  4365. {
  4366. let mcOtherID = moAttrs.id;
  4367. uroDBG.AddLog('map comment '+mcOtherID+' is also highlighted');
  4368. }
  4369. }
  4370. else
  4371. {
  4372. uroDBG.AddLog('map comment '+uroFID+' has renderIntent==highlight but is offscreen... blocking popup');
  4373. }
  4374. }
  4375. }
  4376. }
  4377. },
  4378. AddClosureRow: function(rcObj)
  4379. {
  4380. let startDate = rcObj.attributes.startDate;
  4381. let endDate = "unknown";
  4382. if(rcObj.attributes.endDate !== null)
  4383. {
  4384. endDate = rcObj.attributes.endDate;
  4385. }
  4386. let provider = "---";
  4387. if(rcObj.attributes.provider !== null)
  4388. {
  4389. provider = rcObj.attributes.provider;
  4390. }
  4391. else if(rcObj.attributes.createdBy !== null)
  4392. {
  4393. provider = uroUtils.GetUserNameAndRank(rcObj.attributes.createdBy);
  4394. }
  4395. let reason = "---";
  4396. if(rcObj.attributes.reason !== null)
  4397. {
  4398. reason = rcObj.attributes.reason;
  4399. }
  4400. let mte = "---";
  4401. if(rcObj.attributes.eventId !== null)
  4402. {
  4403. try
  4404. {
  4405. mte = W.model.majorTrafficEvents.objects[rcObj.attributes.eventId].attributes.names[0].value;
  4406. }
  4407. catch(err)
  4408. {
  4409. }
  4410. }
  4411. let startOffset = uroGetRTCOffset(rcObj.attributes.startDate);
  4412. let duration = uroGetRTCDuration(rcObj);
  4413. let durationStr = '';
  4414.  
  4415. if(duration > 1)
  4416. {
  4417. durationStr = I18n.lookup("datetime.distance_in_words.x_days").other;
  4418. durationStr = durationStr.replace("%{count}", duration);
  4419. }
  4420. else
  4421. {
  4422. durationStr = I18n.lookup("datetime.distance_in_words.x_days").one;
  4423. if(duration === 0)
  4424. {
  4425. durationStr = "<" + durationStr;
  4426. }
  4427. }
  4428. let state = uroGetRTCState(rcObj);
  4429. let status = uroGetRTCStateText(rcObj);
  4430. let bgCol = '';
  4431. if(state === uroEnums.SRTC.EXPIRED)
  4432. {
  4433. bgCol = '#A0A0A0';
  4434. }
  4435. else if(state === uroEnums.SRTC.ACTIVE)
  4436. {
  4437. bgCol = '#FFFFFF';
  4438. }
  4439. else if(state === uroEnums.SRTC.FUTURE)
  4440. {
  4441. // For future closures, override the default status text with an indication
  4442. // of how many days until the start of the closure
  4443. if(startOffset == 0)
  4444. {
  4445. status = I18n.lookup("date.today");
  4446. status = status.charAt(0).toUpperCase() + status.slice(1);
  4447. }
  4448. else if(startOffset == 1)
  4449. {
  4450. status = I18n.lookup("datetime.distance_in_words.x_days").one;
  4451. }
  4452. else
  4453. {
  4454. status = I18n.lookup("datetime.distance_in_words.x_days").other;
  4455. status = status.replace("%{count}", startOffset);
  4456. }
  4457. bgCol = '#C0C0C0';
  4458. }
  4459. let result = '';
  4460. result += '<tr bgcolor="' + bgCol + '">';
  4461. result += '<td nowrap>' + status + '</td>';
  4462. result += '<td nowrap>' + startDate + ' to ' + endDate + ' (' + durationStr + ')</td>';
  4463. result += '<td nowrap>' + provider + '</td>';
  4464. result += '<td nowrap>' + reason + '</td>';
  4465. result += '<td nowrap>' + mte + '</td>';
  4466. result += '</td></tr>';
  4467. return result;
  4468. },
  4469. AddClosureDetails: function(cTypes, addType, addDesc)
  4470. {
  4471. let retval = '';
  4472. if((cTypes & addType) === addType)
  4473. {
  4474. retval += '<tr><td colspan=4><b>' + addDesc + ':</b></td></tr>';
  4475. for(let closure in uroRTCObjs)
  4476. {
  4477. if(uroRTCObjs.hasOwnProperty(closure))
  4478. {
  4479. let cObj = uroRTCObjs[closure];
  4480. if(cObj.direction === addType)
  4481. {
  4482. retval += uroPopup.AddClosureRow(cObj);
  4483. }
  4484. }
  4485. }
  4486. }
  4487. return retval;
  4488. },
  4489. Segment: function()
  4490. {
  4491. if(uroUtils.GetCBChecked('_cbInhibitSegPopup') === false)
  4492. {
  4493. {
  4494. if(uroUtils.GetExtent().intersectsBounds(uroMarkers.obj.attributes.geometry.getBounds()))
  4495. {
  4496. let result = '';
  4497. let doPopUp = false;
  4498. let restObj;
  4499.  
  4500. if(uroMousedOverMapComment !== null)
  4501. {
  4502. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for segment highlight');
  4503. uroMousedOverOtherObjectWithinMapComment = true;
  4504. }
  4505.  
  4506. let streetID = uroMarkers.obj.attributes.primaryStreetID;
  4507. if(streetID !== null)
  4508. {
  4509. // generic segment data
  4510. if(uroUtils.GetCBChecked('_cbInhibitSegGenericPopup') === false)
  4511. {
  4512. doPopUp = true;
  4513. uroDBG.AddLog('building popup for segment '+streetID);
  4514.  
  4515. let isToll = ((uroMarkers.obj.attributes.fwdToll == true) || (uroMarkers.obj.attributes.revToll == true));
  4516. result += uroGetAddress(streetID, null, true, false, isToll);
  4517.  
  4518. if(uroMarkers.obj.attributes.streetIDs.length > 0)
  4519. {
  4520. // list any alternate names
  4521. result += '<br>Alternate names:<br>';
  4522. for(let i = 0; i < uroMarkers.obj.attributes.streetIDs.length; ++i)
  4523. {
  4524. result += '&nbsp;<i>' + W.model.streets.objects[uroMarkers.obj.attributes.streetIDs[i]].attributes.name + ', ';
  4525. let cityName = "";
  4526. if(W.model.cities.objects[W.model.streets.objects[uroMarkers.obj.attributes.streetIDs[i]].attributes.cityID] != undefined)
  4527. {
  4528. cityName = W.model.cities.objects[W.model.streets.objects[uroMarkers.obj.attributes.streetIDs[i]].attributes.cityID].attributes.name;
  4529. }
  4530. if(cityName != "")
  4531. {
  4532. result += cityName;
  4533. }
  4534. else
  4535. {
  4536. result += ' no city';
  4537. }
  4538. result += '</i><br>';
  4539. }
  4540. result += '<br>';
  4541. }
  4542.  
  4543. result += '<b>ID: </b>'+uroMarkers.obj.attributes.id+' - ';
  4544. result += uroPopup.GetFormattedLocks(uroMarkers.obj.attributes);
  4545. result += ' - ';
  4546.  
  4547. let level = uroMarkers.obj.attributes.level;
  4548. result += '<b>' + I18n.lookup("edit.segment.fields.level") +': </b>';
  4549. if(level == 0)
  4550. {
  4551. result += I18n.lookup("edit.segment.levels")[0];
  4552. }
  4553. else
  4554. {
  4555. result += level;
  4556. }
  4557. result += '<br>';
  4558.  
  4559. let leBy = uroMarkers.obj.attributes.updatedBy;
  4560. let leOn = uroMarkers.obj.attributes.updatedOn;
  4561. if(leOn == null)
  4562. {
  4563. leBy = uroMarkers.obj.attributes.createdBy;
  4564. leOn = uroMarkers.obj.attributes.createdOn;
  4565. }
  4566. result += "<b>Last edit by</b> " + uroUtils.GetUserNameAndRank(leBy) + " <b>on</b> " + uroUtils.GetDateTimeString(leOn) + "<br><br>";
  4567.  
  4568. let fwdSpeed = uroMarkers.obj.attributes.fwdMaxSpeed;
  4569. let revSpeed = uroMarkers.obj.attributes.revMaxSpeed;
  4570. let fwdLanes = uroMarkers.obj.attributes.fwdLaneCount;
  4571. let revLanes = uroMarkers.obj.attributes.revLaneCount;
  4572. let fwdWidth = 'Not set';
  4573. let revWidth = 'Not set';
  4574. if(uroMarkers.obj.attributes.fromLanesInfo != null)
  4575. {
  4576. fwdWidth = uroGetLengthString(uroMarkers.obj.attributes.fromLanesInfo.laneWidth);
  4577. }
  4578. if(uroMarkers.obj.attributes.toLanesInfo != null)
  4579. {
  4580. revWidth = uroGetLengthString(uroMarkers.obj.attributes.toLanesInfo.laneWidth);
  4581. }
  4582. let fwdUnverified = uroMarkers.obj.attributes.fwdMaxSpeedUnverified;
  4583. let revUnverified = uroMarkers.obj.attributes.revMaxSpeedUnverified;
  4584. let fwdASC = ((uroMarkers.obj.attributes.fwdFlags & 1) === 1);
  4585. let revASC = ((uroMarkers.obj.attributes.revFlags & 1) === 1);
  4586. let roadType = uroMarkers.obj.attributes.roadType;
  4587. let verifyLimits = true;
  4588. if((roadType === 17) || (roadType === 20))
  4589. {
  4590. verifyLimits = false;
  4591. }
  4592.  
  4593. result += '<table border=1><tr><th>Dir</th><th>Speed</th><th>ASC</th><th>Lanes</th><th>Width</th></tr>';
  4594. if(uroMarkers.obj.attributes.fwdDirection)
  4595. {
  4596. result += '<tr><td><b>A-B</b></td><td>'+uroUtils.GetLocalisedSpeedString(fwdSpeed)+'</td><td>';
  4597. if(fwdASC == true)
  4598. {
  4599. result += 'Yes';
  4600. }
  4601. else
  4602. {
  4603. result += 'No';
  4604. }
  4605. result += '</td><td>';
  4606. if(fwdLanes > 0)
  4607. {
  4608. result += fwdLanes;
  4609. }
  4610. else
  4611. {
  4612. result += 'Not set';
  4613. }
  4614. result += '</td><td>'+fwdWidth+'</td></tr>';
  4615. }
  4616. if(uroMarkers.obj.attributes.revDirection)
  4617. {
  4618. result += '<tr><td><b>B-A</b></td><td>'+uroUtils.GetLocalisedSpeedString(revSpeed)+'</td><td>';
  4619. if(revASC == true)
  4620. {
  4621. result += 'Yes';
  4622. }
  4623. else
  4624. {
  4625. result += 'No';
  4626. }
  4627. result += '</td><td>';
  4628. if(revLanes > 0)
  4629. {
  4630. result += revLanes;
  4631. }
  4632. else
  4633. {
  4634. result += 'Not set';
  4635. }
  4636. result += '</td><td>'+revWidth+'</td></tr>';
  4637. }
  4638. result += '</table>';
  4639.  
  4640. if((uroMarkers.obj.attributes.fwdDirection) && (uroMarkers.obj.attributes.revDirection) && (fwdSpeed != revSpeed) && (!fwdUnverified) && (!revUnverified))
  4641. {
  4642. result += '<br>Two-way segment has different verified speed limits...';
  4643. }
  4644. }
  4645.  
  4646. // segment restrictions
  4647. if(uroMarkers.obj.attributes.restrictions.length > 0)
  4648. {
  4649. result += '<br><table border=1>';
  4650. doPopUp = true;
  4651. let fwdResult = '<tr><td colspan=13><b>A-B restrictions:</b></td></tr>';
  4652. let revResult = '<tr><td colspan=13><b>B-A restrictions:</b></td></tr>';
  4653. let bothResult = '<tr><td colspan=13><b>Two-way restrictions:</b></td></tr>';
  4654.  
  4655. let nABRestrictions = 0;
  4656. let nBARestrictions = 0;
  4657. let nBothRestrictions = 0;
  4658. for(let idx = 0; idx < uroMarkers.obj.attributes.restrictions.length; idx++)
  4659. {
  4660. restObj = uroMarkers.obj.attributes.restrictions[idx];
  4661. if(restObj._direction === "FWD")
  4662. {
  4663. nABRestrictions++;
  4664. fwdResult += uroFormatRestriction(restObj);
  4665. }
  4666. else if(restObj._direction === "REV")
  4667. {
  4668. nBARestrictions++;
  4669. revResult += uroFormatRestriction(restObj);
  4670. }
  4671. else if(restObj._direction === "BOTH")
  4672. {
  4673. nBothRestrictions++;
  4674. bothResult += uroFormatRestriction(restObj);
  4675. }
  4676. else
  4677. {
  4678. uroDBG.AddLog("unknown restriction direction...");
  4679. }
  4680. }
  4681. if(nABRestrictions > 0)
  4682. {
  4683. result += fwdResult;
  4684. }
  4685. if(nBARestrictions > 0)
  4686. {
  4687. result += revResult;
  4688. }
  4689. if(nBothRestrictions > 0)
  4690. {
  4691. result += bothResult;
  4692. }
  4693. result += '</table>';
  4694. }
  4695. if(uroLayers.layers[uroLayers.ID.RTC].l.getVisibility() === true)
  4696. {
  4697. let closureTypes = uroGetSelectedSegmentRTCs(uroMarkers.obj.attributes.id);
  4698. if(closureTypes !== uroEnums.DRTC.NONE)
  4699. {
  4700. result += '<br><table border=1 width="100%">';
  4701.  
  4702. result += uroPopup.AddClosureDetails(closureTypes, uroEnums.DRTC.SEG_AB, "A-B closures");
  4703. result += uroPopup.AddClosureDetails(closureTypes, uroEnums.DRTC.SEG_BA, "B-A closures");
  4704. result += uroPopup.AddClosureDetails(closureTypes, uroEnums.DRTC.SEG_BI, "Two-way closures");
  4705. result += uroPopup.AddClosureDetails(closureTypes, uroEnums.DRTC.TURN_OUT, "Outbound turn closures");
  4706. result += uroPopup.AddClosureDetails(closureTypes, uroEnums.DRTC.TURN_IN, "Inbound turn closures");
  4707. doPopUp = true;
  4708. result += '</table>';
  4709. }
  4710. }
  4711.  
  4712. if(doPopUp === true)
  4713. {
  4714. uroFID = uroMarkers.obj.attributes.id;
  4715. uroPopup.newPopupType = 'segment_restriction';
  4716. }
  4717. }
  4718. uroPopup.result += result;
  4719. uroPopup.Show();
  4720. }
  4721. else
  4722. {
  4723. uroDBG.AddLog('segment '+uroFID+' has renderIntent==highlight but is offscreen... blocking popup');
  4724. }
  4725. }
  4726. }
  4727. },
  4728. Node: function()
  4729. {
  4730. if(uroUtils.GetCBChecked('_cbInhibitNodesPopup') === false)
  4731. {
  4732. let result = '';
  4733. let ureq = W.model.nodes.objects[uroMarkers.id];
  4734. if(ureq === undefined)
  4735. {
  4736. uroMarkers.id = null;
  4737. }
  4738. else
  4739. {
  4740. if(uroMousedOverMapComment !== null)
  4741. {
  4742. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for node highlight');
  4743. uroMousedOverOtherObjectWithinMapComment = true;
  4744. }
  4745. uroPopup.newPopupType = 'node';
  4746. uroFID = uroMarkers.id;
  4747. uroDBG.AddLog('building popup for node '+uroFID);
  4748. result += '<b>Node: ' + uroFID + '</b><br>';
  4749.  
  4750. let nodeSegRTCs = [];
  4751. for(let k=0; k<ureq.attributes.segIDs.length; k++)
  4752. {
  4753. let nodeSegID = ureq.attributes.segIDs[k];
  4754. let nodeSegObj = W.model.segments.objects[nodeSegID];
  4755. if(nodeSegObj !== undefined)
  4756. {
  4757. let nodeStreetID = nodeSegObj.attributes.primaryStreetID;
  4758. result += uroGetAddress(nodeStreetID, null, false, true, false);
  4759. }
  4760. uroGetSelectedSegmentRTCs(nodeSegID);
  4761. nodeSegRTCs = nodeSegRTCs.concat(uroRTCObjs);
  4762. }
  4763. }
  4764. uroPopup.result += result;
  4765. uroPopup.Show();
  4766. }
  4767. },
  4768. UMPExtras: function(ureq)
  4769. {
  4770. // add "open new WME tab" link
  4771. let urPos=new OpenLayers.LonLat();
  4772. if(uroPopup.isPlaceUpdate)
  4773. {
  4774. urPos.lon = ureq.getOLGeometry().getCentroid().x;
  4775. urPos.lat = ureq.getOLGeometry().getCentroid().y;
  4776. }
  4777. else
  4778. {
  4779. if(ureq.attributes.geometry.realX === undefined)
  4780. {
  4781. urPos.lon = ureq.attributes.geometry.x;
  4782. urPos.lat = ureq.attributes.geometry.y;
  4783. }
  4784. else
  4785. {
  4786. urPos.lon = ureq.attributes.geometry.realX;
  4787. urPos.lat = ureq.attributes.geometry.realY;
  4788. }
  4789. }
  4790. urPos = uroUtils.ConvertMercatorToWGS84(urPos);
  4791. let urLink = document.location.href;
  4792. let urLayers = '';
  4793. urLink = urLink.substr(0,urLink.indexOf('?zoomLevel'));
  4794. urLink += '?zoomLevel=17&lat='+urPos.lat+'&lon='+urPos.lon+urLayers;
  4795.  
  4796. if(uroPopup.isUR) urLink += '&mapUpdateRequest='+uroMarkers.id;
  4797. else if(uroPopup.isTurnProb) urLink += '&showturn='+uroMarkers.id+'&endshow';
  4798. else if(uroPopup.isProblem) urLink += '&mapProblem='+uroMarkers.id;
  4799. else if(uroPopup.isPlaceUpdate)
  4800. {
  4801. if(uroMarkers.type == uroLayers.ID.PUR)
  4802. {
  4803. urLink += '&showpur='+uroMarkers.id+'&endshow';
  4804. }
  4805. else
  4806. {
  4807. urLink += '&showppur='+uroMarkers.id+'&endshow';
  4808. }
  4809. }
  4810.  
  4811. let targetTab = "_uroTab_" + Math.round(Math.random()*1000000);
  4812. uroPopup.result += '<hr><ul><li><a href="'+urLink+'" id="_openInNewTab" target="'+targetTab+'">Open in new tab</a> - ';
  4813. uroPopup.hasOpenInNewTabLink = true;
  4814. uroPopup.result += '<a href="#" id="_recentreSession">centre in current tab</a>';
  4815. uroPopup.hasRecentreSessionLink = true;
  4816.  
  4817. // add "open new livemap tab" link
  4818. let lmLink = null;
  4819. if(document.getElementById("livemap-link") != null)
  4820. {
  4821. uroDBG.AddLog('Livemap link in livemap-link id element');
  4822. lmLink = document.getElementById("livemap-link").href;
  4823. }
  4824. else if(document.getElementsByClassName("livemap-link") != null)
  4825. {
  4826. uroDBG.AddLog('Livemap link in livemap-link class element');
  4827. lmLink = document.getElementsByClassName("livemap-link")[0].href;
  4828. }
  4829. else
  4830. {
  4831. uroDBG.AddLog('Livemap link not found...');
  4832. }
  4833. if(lmLink !== null)
  4834. {
  4835. let zpos = lmLink.indexOf('?');
  4836. if(zpos > -1) lmLink = lmLink.substr(0,zpos);
  4837. lmLink += '?zoom=17&lat='+urPos.lat+'&lon='+urPos.lon+'&layers=BTTTT';
  4838. uroPopup.result += '<li><a href="'+lmLink+'" target="_lmTab">Open in new livemap tab</a>';
  4839. }
  4840. if(!uroPopup.isPlaceUpdate)
  4841. {
  4842. // add "ignore for this session" link
  4843. uroPopup.result += '<li><a href="#" id="_addtoignore">Hide for this session</a></ul>';
  4844. uroPopup.hasIgnoreLink = true;
  4845. }
  4846.  
  4847. uroPopup.Show();
  4848. },
  4849. Preamble: function()
  4850. {
  4851. let retval = true;
  4852.  
  4853. if
  4854. (
  4855. (uroMarkers.type === null) &&
  4856. (uroPopup.timer === 0)
  4857. )
  4858. {
  4859. if(uroPopup.shown === true)
  4860. {
  4861. uroPopup.Hide();
  4862. }
  4863. uroMousedOverMapComment = null;
  4864. retval = false;
  4865. }
  4866. if(retval === true)
  4867. {
  4868. if(uroMTEMode)
  4869. {
  4870. retval = false;
  4871. }
  4872. }
  4873.  
  4874. if(retval === true)
  4875. {
  4876. if(!uroInit.initialised)
  4877. {
  4878. retval = false;
  4879. }
  4880. }
  4881.  
  4882. if(retval === true)
  4883. {
  4884. if((uroMouseIsDown) && (uroMarkers.mouseButtons === 0))
  4885. {
  4886. uroDBG.AddLog('trapped erroneous mousedown state');
  4887. uroMouseIsDown = false;
  4888. }
  4889. if(uroMouseIsDown)
  4890. {
  4891. retval = false;
  4892. }
  4893. }
  4894.  
  4895. if(retval === true)
  4896. {
  4897. if(OpenLayers === null)
  4898. {
  4899. if(uroNullOpenLayers === false)
  4900. {
  4901. uroDBG.AddLog('caught null OpenLayers');
  4902. uroNullOpenLayers = true;
  4903. }
  4904. retval = false;
  4905. }
  4906. else
  4907. {
  4908. uroNullOpenLayers = false;
  4909. }
  4910. }
  4911.  
  4912. if(retval === true)
  4913. {
  4914. if(uroLayers.layers[uroLayers.ID.UR].l === null)
  4915. {
  4916. if(uroNullURLayer === false)
  4917. {
  4918. uroDBG.AddLog('caught null UR layer');
  4919. uroNullURLayer = true;
  4920. }
  4921. retval = false;
  4922. }
  4923. else
  4924. {
  4925. uroNullURLayer = false;
  4926. }
  4927. }
  4928.  
  4929. if(retval === true)
  4930. {
  4931. if(uroLayers.layers[uroLayers.ID.MP].l === null)
  4932. {
  4933. if(uroNullProblemLayer === false)
  4934. {
  4935. uroDBG.AddLog('caught null problem layer');
  4936. uroNullProblemLayer = true;
  4937. }
  4938. retval = false;
  4939. }
  4940. else
  4941. {
  4942. uroNullProblemLayer = false;
  4943. }
  4944. }
  4945.  
  4946. if(retval === true)
  4947. {
  4948. if(uroUtils.GetCBChecked('_cbMasterEnable') === false)
  4949. {
  4950. retval = false;
  4951. }
  4952. }
  4953.  
  4954. if(retval === true)
  4955. {
  4956. if(uroTestPointerOutsideMap(uroMarkers.clientX, uroMarkers.clientY))
  4957. {
  4958. retval = false;
  4959. }
  4960. }
  4961.  
  4962.  
  4963. if(retval === true)
  4964. {
  4965. uroPopup.mouseX = uroMarkers.mouseX;
  4966. uroPopup.mouseY = uroMarkers.mouseY;
  4967. uroPopup.result = '';
  4968. uroPopup.hasIgnoreLink = false;
  4969. uroPopup.hasDeleteLink = false;
  4970. uroPopup.hasAddWatchLink = false;
  4971. uroPopup.hasRemoveWatchLink = false;
  4972. uroPopup.hasUpdateWatchLink = false;
  4973. uroPopup.hasRecentreSessionLink = false;
  4974. uroPopup.hasOpenInNewTabLink = false;
  4975. uroPopup.isVenue = false;
  4976. uroPopup.isMapComment = false;
  4977. uroPopup.newPopupType = null;
  4978. uroPopup.ureqID = null;
  4979. uroPopup.isUR = false;
  4980. uroPopup.isProblem = false;
  4981. uroPopup.isTurnProb = false;
  4982. uroPopup.isPlaceUpdate = false;
  4983. uroPopup.renderIntent = uroGetFeatureRenderIntent(uroMarkers.obj);
  4984.  
  4985. uroInit.WazeBits();
  4986.  
  4987. let mouseLonLat = W.map.getLonLatFromViewPortPx(new OpenLayers.Pixel(uroPopup.mouseX, uroPopup.mouseY));
  4988. let mousePoint = new OpenLayers.Geometry.Point(mouseLonLat.lon, mouseLonLat.lat);
  4989. if(uroMousedOverMapComment !== null)
  4990. {
  4991. if(W.model.mapComments.objects[uroMousedOverMapComment] === undefined)
  4992. {
  4993. uroDBG.AddLog('clearing uroMousedOverMapComment: object no longer exists in current map view');
  4994. uroMousedOverMapComment = null;
  4995. }
  4996. else if(W.model.mapComments.objects[uroMousedOverMapComment].attributes.geometry.containsPoint(mousePoint) === false)
  4997. {
  4998. uroDBG.AddLog('clearing uroMousedOverMapComment: pointer no longer within comment boundary');
  4999. uroMousedOverMapComment = null;
  5000. }
  5001. }
  5002. let popupXOffset = document.getElementById('editor-container').getBoundingClientRect().x;
  5003. let popupYOffset = $(document.getElementById("WazeMap")).offset().top;
  5004. uroPopup.pX = uroPopup.mouseX + popupXOffset + 10;
  5005. uroPopup.pY = uroPopup.mouseY + popupYOffset;
  5006. }
  5007.  
  5008. return retval;
  5009. },
  5010. Show: function()
  5011. {
  5012. if(uroPopup.suppressed === false)
  5013. {
  5014. if((uroFID != uroShownFID) || (uroPopup.newPopupType != uroPopup.shownType))
  5015. {
  5016. if(uroFID != uroShownFID) uroDBG.AddLog('FID mismatch, show popup: '+uroFID+'/'+uroShownFID);
  5017. else uroDBG.AddLog('Popup type mismatch: '+uroPopup.newPopupType+'/'+uroPopup.shownType);
  5018. uroShownFID = uroFID;
  5019. uroPopup.shownType = uroPopup.newPopupType;
  5020. uroPopup.shown = false;
  5021. }
  5022. if(uroPopup.shown === false)
  5023. {
  5024. uroPopup.shown = true;
  5025. uroDiv.style.height = "auto";
  5026. uroDiv.style.width = "auto";
  5027. uroDiv.style.overflow = "auto";
  5028. uroDiv.innerHTML = uroUtils.ModifyHTML(uroPopup.result);
  5029. if((uroFID != -1) && (uroPopup.hasIgnoreLink === true))
  5030. {
  5031. uroUtils.AddEventListener('_addtoignore','click', uroIgnore.Add, true);
  5032. }
  5033. if(uroPopup.hasDeleteLink === true)
  5034. {
  5035. uroUtils.AddEventListener('_deleteobject','click', uroDeleteObject, true);
  5036. }
  5037. if(uroPopup.hasRemoveWatchLink === true)
  5038. {
  5039. uroUtils.AddEventListener('_removefromwatchlist','click', uroOWL.RemoveCamFromWatchList, true);
  5040. }
  5041. if(uroPopup.hasAddWatchLink === true)
  5042. {
  5043. uroUtils.AddEventListener('_addtowatchlist','click', uroOWL.AddCamToWatchList, true);
  5044. }
  5045. if(uroPopup.hasUpdateWatchLink === true)
  5046. {
  5047. uroUtils.AddEventListener('_updatewatchlist','click', uroOWL.UpdateCamWatchList, true);
  5048. }
  5049. if(uroPopup.hasOpenInNewTabLink === true)
  5050. {
  5051. uroUtils.AddEventListener('_openInNewTab','mouseup', uroOpenNewTab, true);
  5052. }
  5053. if(uroPopup.hasRecentreSessionLink === true)
  5054. {
  5055. if(uroPopup.isUR) uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnUR, true);
  5056. else if((uroPopup.isProblem)||(uroPopup.isTurnProb)) uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnMP, true);
  5057. else if(uroPopup.isPlaceUpdate)
  5058. {
  5059. if(uroPopup.newPopupType == uroLayers.ID.PUR)
  5060. {
  5061. uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnPUR, true);
  5062. }
  5063. else
  5064. {
  5065. uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnPPUR, true);
  5066. }
  5067. }
  5068. else if(uroPopup.isVenue) uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnVenueNavPoint, true);
  5069. }
  5070. // restrict the popup width to be no wider than just under half the window width to avoid it
  5071. // completely overlapping the marker it's associated with - by keeping it to just below half
  5072. // the window width we guarantee that it'll fit either to the left or the right of the marker
  5073. // no matter how far across the screen the marker is located...
  5074. let rw = parseInt(uroDiv.clientWidth);
  5075. if(rw > (window.innerWidth * 0.45))
  5076. {
  5077. rw = (window.innerWidth * 0.45);
  5078. uroDiv.style.width = rw+'px';
  5079. }
  5080. // get the div height after any adjustment of the width above, to account for whatever content
  5081. // reflow may have occurred as a result of reducing the width...
  5082. let rh = parseInt(uroDiv.clientHeight);
  5083. // similarly restrict the popup height to avoid it dropping of the bottom of the screen if a
  5084. // segment has a bunch of closures/restrictions
  5085. rh = parseInt(uroDiv.clientHeight);
  5086. if(rh > (window.innerHeight * 0.80))
  5087. {
  5088. rh = (window.innerHeight * 0.80);
  5089. uroDiv.style.height = rh+'px';
  5090. uroDiv.style.overflow = 'scroll';
  5091. }
  5092. let origPopupX = uroPopup.pX;
  5093. let movedLeft = false;
  5094. if((uroPopup.pX + rw) > window.innerWidth)
  5095. {
  5096. // where the popup would be off the right hand side of the screen, move it completely over to the
  5097. // other side of the mouse pointer
  5098. uroPopup.pX -= (rw + 20);
  5099. if(uroPopup.pX < 0) uroPopup.pX = 0;
  5100. movedLeft = true;
  5101. }
  5102. if((uroPopup.pY + rh) > window.innerHeight)
  5103. {
  5104. // where the popup would be off the bottom of the screen, shift it up just far enough to be
  5105. // fully visible
  5106. uroPopup.pY -= (((uroPopup.pY + rh) - window.innerHeight) + 30);
  5107. }
  5108. if(uroPopup.pY < 0) uroPopup.pY = 0;
  5109. uroDiv.style.top = uroPopup.pY+'px';
  5110. uroDiv.style.left = uroPopup.pX+'px';
  5111. if(movedLeft === true)
  5112. {
  5113. // after relocating the popup to the left of the pointer, it may end up resizing itself
  5114. // which may then cause it to completely overlap the UR marker, so perform one more check
  5115. // of the div width and nudge to the left if required...
  5116. rw = parseInt(uroDiv.clientWidth);
  5117. if(rw > (window.innerWidth * 0.45))
  5118. {
  5119. rw = (window.innerWidth * 0.45);
  5120. uroDiv.style.width = rw+'px';
  5121. }
  5122. let nudgeDist = parseInt(20 + (uroPopup.pX + rw) - origPopupX);
  5123. if((uroPopup.pX + rw + 30) >= origPopupX)
  5124. {
  5125. uroDiv.style.left = parseInt(uroPopup.pX - nudgeDist)+'px';
  5126. }
  5127. }
  5128.  
  5129. uroDBG.AddLog('display popup at '+uroPopup.pX+','+uroPopup.pY);
  5130. uroDiv.style.visibility = 'visible';
  5131. uroPopup.autoHideTimer = (uroUtils.GetElmValue('_inputPopupAutoHideTimeout') * 10);
  5132. }
  5133. uroPopup.timer = -1;
  5134. }
  5135. },
  5136. Generate: function()
  5137. {
  5138. if(uroPopup.Preamble() === true)
  5139. {
  5140. if(uroMarkers.type === uroLayers.ID.UR) uroPopup.UR();
  5141. else if(uroMarkers.type === uroLayers.ID.MP) uroPopup.MP();
  5142. else if((uroMarkers.type === uroLayers.ID.PUR)||(uroMarkers.type === uroLayers.ID.PPUR)||(uroMarkers.type === uroLayers.ID.RPUR)) uroPopup.PUR();
  5143. else if(uroMarkers.type === "venue") uroPopup.Venue();
  5144. else if(uroMarkers.type === "cam") uroPopup.Camera();
  5145. else if(uroMarkers.type === "comment") uroPopup.Comment();
  5146. else if(uroMarkers.type === "segment") uroPopup.Segment();
  5147. else if(uroMarkers.type === "node") uroPopup.Node();
  5148. else
  5149. {
  5150. uroDBG.AddLog("request to generate popup for unknown type - " + uroMarkers.type);
  5151. }
  5152. }
  5153. },
  5154. Hide: function()
  5155. {
  5156. if(uroPopup.shown)
  5157. {
  5158. uroDiv.style.visibility = 'hidden';
  5159. uroPopup.shown = false;
  5160. uroPopup.timer = -2;
  5161. uroShownFID = -1;
  5162. }
  5163. uroPopup.suppressed = false;
  5164. },
  5165. Suppress: function()
  5166. {
  5167. uroDiv.style.visibility = 'hidden';
  5168. window.getSelection().removeAllRanges();
  5169. uroPopup.suppressed = true;
  5170. },
  5171. MouseOver: function()
  5172. {
  5173. uroPopup.mouseIn = true;
  5174. },
  5175. MouseOut: function()
  5176. {
  5177. uroPopup.mouseIn = false;
  5178. }
  5179. };
  5180. const uroURExtras = // UR marker enhancements
  5181. {
  5182. urList : [],
  5183. URListEntry: function(id, customType, hasMyComments, nComments, ageLastComment)
  5184. {
  5185. this.id = id;
  5186. this.customType = customType;
  5187. this.hasMyComments = hasMyComments;
  5188. this.nComments = nComments;
  5189. this.ageLastComment = ageLastComment;
  5190. },
  5191. AddToList: function(urID, customType, hasMyComments, nComments, ageLastComment)
  5192. {
  5193. uroURExtras.urList.push(new uroURExtras.URListEntry(urID, customType, hasMyComments, nComments, ageLastComment));
  5194. },
  5195. AddCommentCounts: function()
  5196. {
  5197. // Remove existing count elements before (re-)rendering, as WME doesn't automatically do this
  5198. // for us now that the way it handles the marker layers has changed...
  5199. let toRemove = document.querySelectorAll('#uroCommentCount');
  5200. let trCount = toRemove.length;
  5201. while(trCount > 0)
  5202. {
  5203. --trCount;
  5204. toRemove[trCount].remove();
  5205. }
  5206. let addCommentCount = false;
  5207. let nURs = uroURExtras.urList.length;
  5208.  
  5209. if(uroUtils.GetCBChecked('_cbMasterEnable') === true)
  5210. {
  5211. addCommentCount = ((nURs > 0) && (uroUtils.GetCBChecked('_cbCommentCount') === true));
  5212. }
  5213.  
  5214. if(addCommentCount === true)
  5215. {
  5216. for(let i = 0; i < nURs; ++i)
  5217. {
  5218. let uObj = uroURExtras.urList[i];
  5219. let nComments = uObj.nComments;
  5220. let marker = uroGetMarker(uroLayers.ID.UR, uObj.id);
  5221. if((marker !== null) && (nComments !== 0))
  5222. {
  5223. let mx = (marker.x.baseVal.value - 15);
  5224. let my = (marker.y.baseVal.value + 35);
  5225. let newSpan = '<foreignObject id="uroCommentCount" x="' + mx + '" y="' + my + '" width="100%" height="100%" style="pointer-events: none;">';
  5226.  
  5227. newSpan += '<div style="position:absolute;';
  5228. if(uObj.hasMyComments === true)
  5229. {
  5230. newSpan += 'background-color: yellow;';
  5231. }
  5232. else
  5233. {
  5234. newSpan += 'background-color: white;';
  5235. }
  5236. newSpan += 'font-size: 14px;font-weight: 800;';
  5237. newSpan += 'border-width: 1px;border-style: solid;border-radius: 12px;padding-left: 4px;padding-right: 4px;z-index: 1;';
  5238. newSpan += '">';
  5239. newSpan += nComments + 'c ';
  5240. newSpan += uObj.ageLastComment + 'd';
  5241. newSpan += '</div>';
  5242.  
  5243. newSpan += '</foreignObject>';
  5244. marker.insertAdjacentHTML("afterend", newSpan);
  5245. }
  5246. }
  5247. }
  5248. }
  5249. };
  5250. const uroInit = // script initialisation
  5251. {
  5252. initialised : false,
  5253. setupListeners : true,
  5254. finalisingListenerSetup : false,
  5255.  
  5256. WazeBitsAvailable: function()
  5257. {
  5258. uroDBG.AddLog('All WazeBits present and correct...');
  5259. W.prefs.on('change:isImperial', uroInit.Initialise);
  5260. uroLayers.Init();
  5261. // To avoid creating multiple URO tabs in the event that the initialise code
  5262. // gets called more than once, we now test for the presence of our tab and skip
  5263. // if it's already present
  5264. if(document.getElementById('uroTabHeader') === null)
  5265. {
  5266. uroInit.SetupUI();
  5267. }
  5268. },
  5269. WaitForW: function()
  5270. {
  5271. if(document.getElementsByClassName("sandbox").length > 0)
  5272. {
  5273. uroDBG.AddLog('WME practice mode detected, script is disabled...');
  5274. return;
  5275. }
  5276. if(window.W === undefined)
  5277. {
  5278. window.setTimeout(uroInit.WaitForW, 100);
  5279. return;
  5280. }
  5281. if (W.userscripts?.state?.isReady)
  5282. {
  5283. uroInit.WazeBitsAvailable();
  5284. }
  5285. else
  5286. {
  5287. document.addEventListener("wme-ready", uroInit.WazeBitsAvailable, {once: true});
  5288. }
  5289. },
  5290. AddInterceptor: function()
  5291. {
  5292. uroDBG.AddLog('Adding interceptor functions...');
  5293. // add interceptor function for window.confirm(), to inhibit the closure deletion confirmation that would
  5294. // pop up for each individual closure when we're using the delete all button - the user has already
  5295. // confirmed the delete action using our own requester
  5296. let _confirm = window.confirm;
  5297. window.confirm = function(msg)
  5298. {
  5299. let cm_delete_confirm = I18n.lookup("closures.delete_confirm").split('"')[0].trimRight(1);
  5300. if(msg.indexOf(cm_delete_confirm) != -1)
  5301. {
  5302. uroDBG.AddLog('intercepted closure delete confirmation...');
  5303. if(uroRTCClone.ConfirmDelete)
  5304. {
  5305. return _confirm(msg);
  5306. }
  5307. else
  5308. {
  5309. return true;
  5310. }
  5311. }
  5312. else if(typeof(msg) == 'undefined')
  5313. {
  5314. uroDBG.AddLog('Intercepted blank confirmation...');
  5315. return true;
  5316. }
  5317. else
  5318. {
  5319. return _confirm(msg);
  5320. }
  5321. };
  5322. uroConfirmIntercepted = true;
  5323. },
  5324. Initialise: function()
  5325. {
  5326. uroInit.initialised = false;
  5327. uroInit.setupListeners = true;
  5328. uroInit.finalisingListenerSetup = false;
  5329. uroInit.WaitForW();
  5330. },
  5331. WaitForControlsContainer: function()
  5332. {
  5333. if(document.getElementById('uroControlsContainer') === null)
  5334. {
  5335. window.setTimeout(uroInit.WaitForControlsContainer,500);
  5336. }
  5337. else
  5338. {
  5339. let updateURL = 'https://greasyfork.org/scripts/1952-uroverview-plus-uro';
  5340. uroDBG.AddLog('adding controls to sidebar container...');
  5341. let tabbyHTML = '<div id="uroTabHeader"><b><a href="'+updateURL+'" target="_blank">UROverview Plus</a></b> <label id="_uroVersion">'+uroRelease.version+'</label>';
  5342. tabbyHTML += '<label id="_uroDebugMode">(dbg)</label>';
  5343. tabbyHTML += '&nbsp;<input type="checkbox" id="_cbMasterEnable" checked>Enabled</input>';
  5344. tabbyHTML += uroTabs.CreateTabHeaders();
  5345. tabbyHTML += '</div>';
  5346. document.getElementById('uroControlsContainer').innerHTML = uroUtils.ModifyHTML(tabbyHTML);
  5347. uroTabs.CreateTabBodies();
  5348. // other sidebar elements
  5349. uroAMList = document.createElement('div');
  5350. uroAMList.style.color = "#ffff00";
  5351. uroCtrlHides = document.createElement('div');
  5352. // Object watchlist tab
  5353. {
  5354. uroOWL.CWLGroups = [];
  5355. uroTabs.PopulateOWL();
  5356. }
  5357. // footer for tabs container
  5358. uroCtrlHides.id = 'uroCtrlHides';
  5359. let tHTML = '<input type="button" id="_btnUndoLastHide" value="Undo last hide" />&nbsp;&nbsp;&nbsp;';
  5360. tHTML += '<input type="button" id="_btnClearSessionHides" value="Undo all hides" /><p>';
  5361. uroCtrlHides.innerHTML = uroUtils.ModifyHTML(tHTML);
  5362. // footer for AM list
  5363. uroAMList.id = 'uroAMList';
  5364. uroTabs.CtrlTabs[0][uroTabs.FIELDS.SHOWFN]();
  5365. window.addEventListener("beforeunload", uroConfig.SaveSettings, false);
  5366. }
  5367. },
  5368. AddTab_API: async function()
  5369. {
  5370. let {tabLabel, tabPane} = W.userscripts.registerSidebarTab("URO+");
  5371. tabLabel.innerText = "URO+";
  5372. tabPane.innerHTML = uroUtils.ModifyHTML(uroControls.innerHTML);
  5373. await W.userscripts.waitForElementConnected(tabPane);
  5374. uroInit.CompleteUISetup();
  5375. },
  5376. CompleteUISetup: function()
  5377. {
  5378. uroDBG.AddLog('waiting for controls container...');
  5379. uroInit.WaitForControlsContainer();
  5380. uroGetProblemTypes();
  5381. uroTabs.AddToDOM();
  5382. document.getElementById('uroControlsContainer').appendChild(uroCtrlHides);
  5383. uroInit.WazeBits();
  5384. uroDiv.addEventListener("mouseover", uroPopup.MouseOver, false);
  5385. uroDiv.addEventListener("mouseout", uroPopup.MouseOut, false);
  5386. if(sessionStorage.UROverview_FID_IgnoreList === undefined) sessionStorage.UROverview_FID_IgnoreList = '';
  5387. if(sessionStorage.UROverview_FID_WatchList === undefined) sessionStorage.UROverview_FID_WatchList = '';
  5388. if(uroConfirmIntercepted === false) uroInit.AddInterceptor();
  5389. uroUtils.AddStyle('urostyle_UnstackedMarkers', '.map-marker.marker-selected { transform: scale(1) !important; }');
  5390. uroMainTickHandlerID = window.setInterval(uroMainTick,1000);
  5391. },
  5392. SetupUI: function()
  5393. {
  5394. // create a new div to display the UR details floaty-box
  5395. uroDiv = document.createElement('div');
  5396. uroDiv.id = "uroDiv";
  5397. uroDiv.style.position = 'absolute';
  5398. uroDiv.style.visibility = 'hidden';
  5399. uroDiv.style.top = '0';
  5400. uroDiv.style.left = '0';
  5401. uroDiv.style.zIndex = 10000;
  5402. uroDiv.style.backgroundColor = 'aliceblue';
  5403. uroDiv.style.borderWidth = '3px';
  5404. uroDiv.style.borderStyle = 'solid';
  5405. uroDiv.style.borderRadius = '10px';
  5406. uroDiv.style.boxShadow = '5px 5px 10px Silver';
  5407. uroDiv.style.padding = '4px';
  5408. document.body.appendChild(uroDiv);
  5409. // create a new div to display script alerts
  5410. uroAlerts = document.createElement('div');
  5411. uroAlerts.id = "uroAlerts";
  5412. uroAlerts.style.position = 'fixed';
  5413. uroAlerts.style.visibility = 'hidden';
  5414. uroAlerts.style.top = '50%';
  5415. uroAlerts.style.left = '50%';
  5416. uroAlerts.style.zIndex = 10000;
  5417. uroAlerts.style.backgroundColor = 'aliceblue';
  5418. uroAlerts.style.borderWidth = '3px';
  5419. uroAlerts.style.borderStyle = 'solid';
  5420. uroAlerts.style.borderRadius = '10px';
  5421. uroAlerts.style.boxShadow = '5px 5px 10px Silver';
  5422. uroAlerts.style.padding = '4px';
  5423. uroAlerts.style.webkitTransform = "translate(-50%, -50%)";
  5424. uroAlerts.style.transform = "translate(-50%, -50%)";
  5425. let alertsHTML = '<div id="header" style="padding: 4px; background-color:LightGreen; font-weight: bold;">Alert title goes here...</div>';
  5426. alertsHTML += '<div id="content" style="padding: 4px; background-color:White; overflow:auto;max-height:500px">Alert content goes here...</div>';
  5427. alertsHTML += '<div id="controls" align="center" style="padding: 4px;">';
  5428. alertsHTML += '<span id="uroAlertTickBtn" style="cursor:pointer;font-size:14px;border:thin outset black;padding:2px 10px 2px 10px;">';
  5429. alertsHTML += '<i class="fa fa-check"> </i>';
  5430. alertsHTML += '<span id="uroAlertTickBtnCaption" style="font-weight: bold;"></span>';
  5431. alertsHTML += '</span>';
  5432. alertsHTML += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
  5433. alertsHTML += '<span id="uroAlertCrossBtn" style="cursor:pointer;font-size:14px;border:thin outset black;padding:2px 10px 2px 10px;">';
  5434. alertsHTML += '<i class="fa fa-times"> </i>';
  5435. alertsHTML += '<span id="uroAlertCrossBtnCaption" style="font-weight: bold;"></span>';
  5436. alertsHTML += '</span>';
  5437. alertsHTML += '</div>';
  5438. uroAlerts.innerHTML = uroUtils.ModifyHTML(alertsHTML);
  5439. document.body.appendChild(uroAlerts);
  5440. uroControls = document.createElement('section');
  5441. uroControls.style.fontSize = '12px';
  5442. uroControls.style.height = '100%';
  5443. uroControls.id = "sidepanel-uroverview";
  5444. uroControls.className = "tab-pane";
  5445. uroControls.innerHTML = uroUtils.ModifyHTML('<div id="uroControlsContainer" style="display:flex;flex-direction:column;height:80vh;"></div>');
  5446. uroInit.AddTab_API();
  5447. },
  5448. WazeBits: function()
  5449. {
  5450. uroMCLayer = null;
  5451.  
  5452. for(let i=0; i < W.map.layers.length; i++)
  5453. {
  5454. if(W.map.layers[i].name == 'mapComments') uroMCLayer = W.map.layers[i];
  5455. if(W.map.layers[i].name == 'venues') uroVenueLayer = W.map.layers[i];
  5456. }
  5457. },
  5458. FinalizeListenerSetup: function()
  5459. {
  5460. uroInit.finalisingListenerSetup = true;
  5461. // filter markers when the marker objects are modified (this happens whenever WME needs to load fresh marker data
  5462. // due to having panned/zoomed the map beyond the extents of the previously loaded data)
  5463. W.model.mapUpdateRequests.on("objectschanged", uroFilterURs_onObjectsChanged);
  5464. W.model.mapUpdateRequests.on("objectsadded", uroFilterURs_onObjectsAdded);
  5465. W.model.mapUpdateRequests.on("objectsremoved", uroFilterURs_onObjectsRemoved);
  5466. W.model.updateRequestSessions.on("objectsadded", uroUREvent_onObjectsAdded);
  5467. W.model.cameras.on("objectschanged", uroFilterCameras);
  5468. W.model.cameras.on("objectsadded", uroFilterCameras);
  5469. W.model.cameras.on("objectsremoved", uroFilterCameras);
  5470. W.model.mapProblems.on("objectschanged", uroFilterProblems);
  5471. W.model.mapProblems.on("objectsadded", uroFilterProblems);
  5472. W.model.mapProblems.on("objectsremoved", uroFilterProblems);
  5473. W.model.venues.on("objectschanged", uroFilterPlaces);
  5474. W.model.venues.on("objectsadded", uroFilterPlaces);
  5475. W.model.venues.on("objectsremoved", uroFilterPlaces);
  5476. W.model.mapComments.on("objectschanged", uroLayers.MCLayerChanged_changed);
  5477. W.model.mapComments.on("objectsadded", uroLayers.MCLayerChanged_added);
  5478. W.model.mapComments.on("objectsremoved", uroLayers.MCLayerChanged_removed);
  5479. uroMarkers.RegisterEvents();
  5480. uroLayers.InitialiseMOs();
  5481. uroUtils.AddEventListener('_btnUndoLastHide', "click", uroIgnore.RemoveLastAdded, true);
  5482. uroUtils.AddEventListener('_btnClearSessionHides', "click", uroIgnore.RemoveAll, true);
  5483. uroIgnore.EnableControls();
  5484. uroUtils.AddEventListener('_btnClearCamWatchList', "click", uroOWL.ClearCamWatchList, true);
  5485. uroUtils.AddEventListener('_btnSettingsToText', "click", uroConfig.SettingsToText, true);
  5486. uroUtils.AddEventListener('_btnTextToSettings', "click", uroConfig.TextToSettings, true);
  5487. uroUtils.AddEventListener('_btnResetSettings', "click", uroConfig.DefaultSettings, true);
  5488. uroUtils.AddEventListener('_btnClearSettingsText', "click", uroConfig.ClearSettingsText, true);
  5489. uroUtils.AddEventListener('_cbMasterEnable', "click", uroFilterItems_MasterEnableClick, true);
  5490. /*
  5491. uroUtils.AddEventListener('_btnDebugToScreen',"click", uroDBG.Dump, true);
  5492. */
  5493. uroUtils.AddEventListener('uroDiv', "dblclick", uroPopup.Suppress, true);
  5494. uroUtils.AddEventListener('_selectCameraUserID', "change", uroCamEditorSelected, true);
  5495. uroUtils.AddEventListener('_selectPlacesUserID', "change", uroPlacesEditorSelected, true);
  5496. uroUtils.AddEventListener('_selectHidePlacesUserID', "change", uroHidePlacesEditorSelected, true);
  5497. uroUtils.AddEventListener('uroAlertTickBtn', 'click', uroAlertBox.CloseWithTick, true);
  5498. uroUtils.AddEventListener('uroAlertCrossBtn', 'click', uroAlertBox.CloseWithCross, true);
  5499. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  5500. {
  5501. uroUtils.SetOnClick(uroTabs.CtrlTabs[i][uroTabs.FIELDS.LINKID], uroTabs.CtrlTabs[i][uroTabs.FIELDS.SHOWFN]);
  5502. }
  5503. for(let idx=0;idx<W.Config.venues.categories.length;idx++)
  5504. {
  5505. uroUtils.SetOnClick('_uroPlacesGroupState-'+idx,uroPlacesGroupCollapseExpand);
  5506. }
  5507. uroDBG.AddLog('finalise onload');
  5508. uroNewLookCheckDetailsRequest();
  5509. // filter markers as and when the map is moved
  5510. W.map.events.register("moveend", null, uroMapMoveEnd.Handler);
  5511. W.map.events.register("moveend", null, uroGetAMs); // uroGetAMs accesses e, so has to be called directly from the event handler
  5512. W.map.events.register("mousemove", null, uroGetAMs);
  5513. W.map.events.register("mousemove", null, uroMarkers.MouseMove);
  5514. W.map.events.registerPriority("mousedown", null, uroMouseDown);
  5515. // trap mousedown on Streetview marker drag
  5516. if(document.getElementsByClassName('street-view-control').length === 0) return;
  5517. document.getElementsByClassName('street-view-control')[0].onmousedown = uroMouseDown;
  5518. W.map.events.register("mouseup", null, uroMouseUp);
  5519. W.map.events.register("mouseout", null, uroMouseOut);
  5520. uroSetSectionTabStyles();
  5521. uroConfig.LoadSettings();
  5522. uroUITweaks.ChangeClustering();
  5523.  
  5524. uroDBG.AddLog('getting user ID...');
  5525. uroUserID = W.loginManager.user.attributes.id;
  5526. uroDBG.AddLog('...ID is '+uroUserID);
  5527. uroDBG.AddLog('filtering...');
  5528. uroFilterItems();
  5529. uroDBG.AddLog('...done');
  5530. uroDBG.showDebugOutput = uroDBG.persistentDebugOutput;
  5531. let dbgMode = "none";
  5532. if(uroDBG.showDebugOutput)
  5533. {
  5534. dbgMode = "inline";
  5535. }
  5536. document.getElementById('_uroDebugMode').style.display = dbgMode;
  5537. uroUtils.AddEventListener('_uroVersion',"click", uroDBG.Toggle, true);
  5538. // add exclusiveCB click handlers to all checkboxes with a pairedWith attribute
  5539. uroDBG.AddLog('adding exclusiveCB handlers...');
  5540. let cbList = document.getElementsByTagName('input');
  5541. for (let optIdx=0;optIdx<cbList.length;optIdx++)
  5542. {
  5543. if((cbList[optIdx].id.indexOf('_cb') === 0) && (cbList[optIdx].attributes.pairedWith != null))
  5544. {
  5545. uroUtils.SetOnClick(cbList[optIdx].id,uroExclusiveCB);
  5546. }
  5547. }
  5548. uroDBG.AddLog('...done');
  5549. // manually call the layer-change handlers on startup, since there's a good chance WME will already have
  5550. // completed its own startup layer changes before our handlers get registered, preventing the marker handlers
  5551. // from being set up as expected on any markers which are visible in the startup map view before the user forces
  5552. // a layer update by panning/zooming/etc...
  5553. uroLayers.RunChangeHandlers();
  5554.  
  5555. uroUITweaks.Setup();
  5556. uroInit.setupListeners = false;
  5557. uroMainTickStage = 0;
  5558. window.clearInterval(uroMainTickHandlerID);
  5559. window.setInterval(uroMainTick, 10);
  5560. uroInit.initialised = true;
  5561. }
  5562. };
  5563. const uroUITweaks = // native UI enhancements
  5564. {
  5565. MO_SidePanel : null,
  5566. MO_ReportPanel : null,
  5567.  
  5568. ChangeMapBGColour: function()
  5569. {
  5570. let mapviewport = document.getElementById("WazeMap").getElementsByClassName("olMapViewport")[0];
  5571. if((uroUtils.GetCBChecked('_cbWhiteBackground') === true) && (uroUtils.GetCBChecked('_cbMasterEnable') === true))
  5572. {
  5573. let customColour = '#' + uroUtils.ToHex(uroUtils.GetElmValue('_inputCustomBackgroundRed'),2);
  5574. customColour += uroUtils.ToHex(uroUtils.GetElmValue('_inputCustomBackgroundGreen'),2);
  5575. customColour += uroUtils.ToHex(uroUtils.GetElmValue('_inputCustomBackgroundBlue'),2);
  5576. mapviewport.style.setProperty('background',customColour,'important');
  5577. }
  5578. else
  5579. {
  5580. mapviewport.style.setProperty('background',"#354148",'important');
  5581. }
  5582. },
  5583. HideAMLayer: function()
  5584. {
  5585. // If this sounds like a weird function - why not just switch off the layer from the layers menu? - then
  5586. // remember that in order for URO+ to be able to display in its own tab the list of AMs under the current
  5587. // mouse pointer location, which is somewhat more useful than the list given in the topbar, it needs the
  5588. // AM layer to be activated so that the AM areas data is loaded into WME. It doesn't however need the layer
  5589. // to then be visible, and since having a bunch of purple polygons covering the map can make for a rather
  5590. // difficult editing experience, being able to hide the polys whilst retaining the area information is
  5591. // of real benefit...
  5592. if((uroUtils.GetCBChecked('_cbHideAMLayer')) && (uroUtils.GetCBChecked('_cbMasterEnable')))
  5593. {
  5594. W.map.managedAreasLayer.setOpacity(0);
  5595. }
  5596. else
  5597. {
  5598. W.map.managedAreasLayer.setOpacity(1);
  5599. }
  5600. },
  5601. HideSegments: function()
  5602. {
  5603. // Hides the vector segments when the raster segment layer is hidden
  5604. if(uroUtils.GetCBChecked('_cbHideSegmentsWhenRoadsHidden'))
  5605. {
  5606. W.map.segmentLayer.drawn = W.map.roadLayer.visibility;
  5607. W.map.nodeLayer.drawn = W.map.roadLayer.visibility;
  5608. }
  5609. else
  5610. {
  5611. W.map.segmentLayer.drawn = true;
  5612. W.map.nodeLayer.drawn = true;
  5613. }
  5614. },
  5615. SetClusteringFor: function(layerID, toDisable)
  5616. {
  5617. let strat = uroLayers.layers[layerID].l.strategies;
  5618. if((strat !== undefined) && (strat.length > 0))
  5619. {
  5620. if(toDisable === true)
  5621. {
  5622. strat[0].threshold = 100000;
  5623. }
  5624. else
  5625. {
  5626. strat[0].threshold = 10;
  5627. }
  5628. }
  5629. },
  5630. ChangeClustering: function()
  5631. {
  5632. uroUITweaks.SetClusteringFor(uroLayers.ID.UR, uroUtils.GetCBChecked('_cbInhibitURClusters'));
  5633. uroUITweaks.SetClusteringFor(uroLayers.ID.MP, uroUtils.GetCBChecked('_cbInhibitMPClusters'));
  5634. uroUITweaks.SetClusteringFor(uroLayers.ID.PUR, uroUtils.GetCBChecked('_cbInhibitPUClusters'));
  5635. uroUITweaks.SetClusteringFor(uroLayers.ID.PPUR, uroUtils.GetCBChecked('_cbInhibitPUClusters'));
  5636. uroUITweaks.SetClusteringFor(uroLayers.ID.RPUR, uroUtils.GetCBChecked('_cbInhibitPUClusters'));
  5637. uroUITweaks.SetClusteringFor(uroLayers.ID.SegSug, uroUtils.GetCBChecked('_cbInhibitESClusters'));
  5638. uroUITweaks.SetClusteringFor(uroLayers.ID.EditSug, uroUtils.GetCBChecked('_cbInhibitESClusters'));
  5639.  
  5640. // If the map is zoomed out far enough such that clustering could be occurring, perform a
  5641. // zoom in-out to force a redraw of the markers based on whatever the new clustering
  5642. // settings are...
  5643. if(W.map.getZoom() < 16)
  5644. {
  5645. W.map.zoomIn();
  5646. W.map.zoomOut();
  5647. }
  5648. },
  5649. ReportPanelChange: function()
  5650. {
  5651. // Inhibit map re-centering when opening a report
  5652. if(uroMarkers.inhibitSetCenter === true)
  5653. {
  5654. let bcr = document.querySelector('#panel-container').getBoundingClientRect();
  5655. if(bcr.width > 0)
  5656. {
  5657. uroMarkers.inhibitSetCenter = false;
  5658. W.map.setCenter(uroMarkers.clickedOnCenter);
  5659. }
  5660. }
  5661.  
  5662. // "panel-container" now also gets used to show the turn closure UI, so reuse this MO handler
  5663. // as a way to also apply the MTE dropdown fix here...
  5664. let mteDropDown = document.querySelector('#panel-container #closure_eventId');
  5665. if(mteDropDown !== undefined)
  5666. {
  5667. uroFixMTEDropDown(mteDropDown);
  5668. }
  5669. },
  5670. CheckForClosurePanel: function()
  5671. {
  5672. if(uroUtils.IsClosureUIActive() === true)
  5673. {
  5674. // Closure panel active
  5675. let uroMO_ClosureUI = new MutationObserver(uroClosureEditUIChanged);
  5676. uroMO_ClosureUI.disconnect();
  5677. uroMO_ClosureUI.observe(document.querySelector('wz-tab.closures-tab'),{subtree: true, attributes: true});
  5678. uroClosureEditUIChanged();
  5679.  
  5680. let cl = document.querySelector('.closures-list');
  5681. if(cl !== null)
  5682. {
  5683. let uroRO_ClosureUI = new ResizeObserver(uroScrollToEndOfClosures);
  5684. uroRO_ClosureUI.disconnect();
  5685. uroRO_ClosureUI.observe(cl);
  5686. }
  5687. uroScrollToEndOfClosures();
  5688. }
  5689. },
  5690. SidePanelChange: function()
  5691. {
  5692. // The sidepanel MO only fires when the sidepanel changes in bulk - i.e. when first rendered, or
  5693. // when changing to show details for a different type of map object. Once this version of the
  5694. // panel is open, any internal changes, such as selecting a different tab within the panel, do
  5695. // NOT trigger the MO. Consequently, if a segment is selected and the sidepanel doesn't then
  5696. // open with the closures tab already selected, the MO will fire at this point rather than at the
  5697. // point where the closures tab is selected...
  5698. //
  5699. // To ensure the closures UI enhancements are applied consistently, we therefore need to set up an
  5700. // onclick handler to deal with the sidepanel opening into a different tab and the user then
  5701. // clicking through into the closures tab after this MO has already fired, but we ALSO still need
  5702. // to check for the availability of the closures UI here as well just in case the sidepanel opens
  5703. // into the closures tab directly.
  5704. //
  5705. // Easy really...
  5706.  
  5707. let elmToClick = document.querySelector('#edit-panel');
  5708. if(elmToClick !== null)
  5709. {
  5710. uroUtils.SetOnClick(elmToClick, uroUITweaks.CheckForClosurePanel);
  5711. }
  5712. uroUITweaks.CheckForClosurePanel();
  5713. },
  5714. Setup: function()
  5715. {
  5716. uroUITweaks.MO_SidePanel = new MutationObserver(uroUITweaks.SidePanelChange);
  5717. uroUITweaks.MO_SidePanel.observe(document.getElementById('edit-panel'), {childList: true, subtree: true});
  5718. uroUITweaks.MO_ReportPanel = new MutationObserver(uroUITweaks.ReportPanelChange);
  5719. uroUITweaks.MO_ReportPanel.observe(document.getElementById('panel-container'), {childList: true, subtree: true});
  5720.  
  5721. uroUITweaks.ChangeMapBGColour();
  5722. uroUITweaks.HideAMLayer();
  5723. uroUITweaks.HideSegments();
  5724. }
  5725. };
  5726. const uroMapMoveEnd = // things that happen after a move of the map view
  5727. {
  5728. lat : null,
  5729. lon: null,
  5730. zoom: null,
  5731. Handler: function()
  5732. {
  5733. let mc = W.map.getCenter();
  5734. let z = W.map.getZoom();
  5735. if((mc.lat != this.lat) || (mc.lon != this.lon) || (z != this.zoom))
  5736. {
  5737. // Apply any filters which need to be updated when the map view changes,
  5738. // and which won't be applied via an event handler or mutation observer
  5739. // attached to the relevant layer etc...
  5740. uroFilterProblems();
  5741. uroFilterPlaces();
  5742. uroFilterCameras();
  5743. uroFilterURs();
  5744. uroFilterRAs();
  5745. uroFilterMapComments();
  5746.  
  5747. uroMiscUITweaksHandler();
  5748. uroLayers.MCLayerChanged();
  5749. this.lat = mc.lat;
  5750. this.lon = mc.lon;
  5751. this.zoom = z;
  5752. }
  5753. }
  5754. };
  5755.  
  5756.  
  5757. // ================================================================================================
  5758. // Here be the unfactored wilderness...
  5759. // ================================================================================================
  5760.  
  5761.  
  5762. function uroFixMTEDropDown(mteDropDown)
  5763. {
  5764. // Auto-selects the "None" event within the MTE dropdown element passed into the function, to avoid the user having
  5765. // to manually select it - the only time you'd need to select something other than None is when you're assigning a
  5766. // closure to a MTE, at which point you need to manually select the appropriate event from the dropdown anyway, so
  5767. // pre-selecting None doesn't increase the workload for setting up a MTE-related closure, and it reduces the workload
  5768. // for setting up other closures...
  5769. //
  5770. // The only possible negative to this hack is that it means the user can set up a MTE-related closure without being
  5771. // reminded by WME to select the appropriate event from the list, because now that we're defaulting it to None, WME
  5772. // will allow the closure to be set without complaining that no event is set... But TBH, that's a small price to pay
  5773. // compared with the far, FAR, larger irritation of forcing users to always select None for all the closures that
  5774. // get added every single day without ever needing to be associated with a MTE - if a handful of closures end up being
  5775. // added with the user having forgotten to select the MTE, then no biggie. The closure will still at least have been
  5776. // added and its effect on routing around the event will therefore still be just as it would be if the MTE had been
  5777. // associated with the closure - the only difference is that if someone then bothers to look at the overview map of the
  5778. // MTE, they won't see that particular segment listed as a closure. I can live with the tiny risk of that causing any
  5779. // real problems, when weighed up against the millions of extra clicks saved through pre-selecting None...
  5780.  
  5781. let retval = false;
  5782.  
  5783. // Make sure the closure event list is available, and that we haven't already messed with it.
  5784. if((mteDropDown !== null) && (mteDropDown.tag != "touchedByURO"))
  5785. {
  5786. // The event dropdown is now some byzantine piece of DOM manipulation to generate something which looks like a
  5787. // regular select list, but which can't be manipulated like one... The first gotcha is that the selected item
  5788. // exists only within a shadow DOM section within the dropdown rather than simply being part of the list from
  5789. // which we'd be able to read off its selected index. So to check whether or not the user has selected an
  5790. // event already, we need to drill down into this shadow DOM to get its text contents, and compare those against
  5791. // the I18n translation for the choose event text. What a palaver...
  5792. let shadowElm = mteDropDown.shadowRoot.querySelectorAll('.selected-value')[0];
  5793. if(shadowElm !== undefined)
  5794. {
  5795. let eventText = mteDropDown.shadowRoot.querySelectorAll('.selected-value')[0].innerText;
  5796. // Sometimes we get here before WME has finished rendering, so if the event text hasn't been set yet then we
  5797. // need to return false and let the caller deal with it...
  5798. if(eventText !== '')
  5799. {
  5800. if(eventText == I18n.lookup('closures.choose_event'))
  5801. {
  5802. // Having now established that, yes, the closure hasn't yet been associated with any event, it's surprisingly
  5803. // easy to change it to "None" - we just generate a click event on the first child element in the main DOM (not
  5804. // the shadow DOM this time), which replicates what the user would do to select None manually.
  5805. mteDropDown.children[0].click();
  5806. }
  5807. // Tag the event list to prevent further processing attempts whilst the edit UI for this closure remains open.
  5808. mteDropDown.tag = "touchedByURO";
  5809. retval = true;
  5810. }
  5811. }
  5812. }
  5813.  
  5814. return retval;
  5815. }
  5816. let uroPendingURSessionsTotal;
  5817. let uroFinalizeTimeoutHandle = null;
  5818. function uroFinalizeURSessionsGet()
  5819. {
  5820. if(uroPendingURSessionsTotal != uroPendingURSessionIDs.length)
  5821. {
  5822. uroPendingURSessionsTotal = uroPendingURSessionIDs.length;
  5823. if(uroFinalizeTimeoutHandle !== null)
  5824. {
  5825. window.clearTimeout(uroFinalizeTimeoutHandle);
  5826. uroFinalizeTimeoutHandle = null;
  5827. }
  5828. uroFinalizeTimeoutHandle = window.setTimeout(uroFinalizeURSessionsGet, 500);
  5829. return;
  5830. }
  5831.  
  5832. let idList = [];
  5833.  
  5834. while((idList.length < 50) && (uroPendingURSessionIDs.length))
  5835. {
  5836. let id = uroPendingURSessionIDs.shift();
  5837. idList.push(id);
  5838. }
  5839.  
  5840. if(idList.length > 0)
  5841. {
  5842. uroDBG.AddLog('grabbing '+idList.length+' updateRequestSessions, IDs: '+idList);
  5843. W.model.updateRequestSessions.getAsync(idList);
  5844. }
  5845.  
  5846. if((uroPendingURSessionIDs.length) || (uroRequestedURSessionIDs.length))
  5847. {
  5848. window.setTimeout(uroGetUpdateRequestSessions,1000);
  5849. }
  5850. else
  5851. {
  5852. uroPopulatingRequestSessions = false;
  5853. }
  5854. }
  5855. function uroGetUpdateRequestSessions()
  5856. {
  5857. uroPendingURSessionsTotal = uroPendingURSessionIDs.length;
  5858. if(uroFinalizeTimeoutHandle !== null)
  5859. {
  5860. window.clearTimeout(uroFinalizeTimeoutHandle);
  5861. uroFinalizeTimeoutHandle = null;
  5862. }
  5863. uroFinalizeTimeoutHandle = window.setTimeout(uroFinalizeURSessionsGet,500);
  5864. }
  5865. function uroRefreshUpdateRequestSessions()
  5866. {
  5867. let urcount = 0;
  5868. uroPendingURSessionIDs = [];
  5869. uroRequestedURSessionIDs = [];
  5870. uroPopulatingRequestSessions = true;
  5871. for (let urID in W.model.mapUpdateRequests.objects)
  5872. {
  5873. if(W.model.mapUpdateRequests.objects.hasOwnProperty(urID))
  5874. {
  5875. if(W.model.updateRequestSessions.objects[urID] === undefined)
  5876. {
  5877. uroPendingURSessionIDs.push(urID);
  5878. }
  5879. urcount++;
  5880. }
  5881. }
  5882. uroGetUpdateRequestSessions();
  5883. }
  5884. function uroURHasMyComments(fid)
  5885. {
  5886. if(uroUserID === -1)
  5887. {
  5888. return false;
  5889. }
  5890. let nComments = W.model.updateRequestSessions.objects[fid].attributes.comments.length;
  5891. if(nComments === 0)
  5892. {
  5893. return false;
  5894. }
  5895.  
  5896. for(let cidx=0; cidx<nComments; cidx++)
  5897. {
  5898. if(W.model.updateRequestSessions.objects[fid].attributes.comments[cidx].userID == uroUserID)
  5899. {
  5900. return true;
  5901. }
  5902. }
  5903.  
  5904. return false;
  5905. }
  5906. function uroIsFilteringEnabled(ignoreZoom)
  5907. {
  5908. let retval = false;
  5909. if
  5910. (
  5911. (uroUtils.GetCBChecked('_cbMasterEnable') === true) &&
  5912. (
  5913. (ignoreZoom === true) ||
  5914. (W.map.getZoom() <= uroUtils.GetElmValue('_inputFilterMinZoomLevel'))
  5915. )
  5916. )
  5917. {
  5918. retval = true;
  5919. }
  5920. return retval;
  5921. }
  5922. function uroUpdateMTEList()
  5923. {
  5924. if(Object.keys(W.model.majorTrafficEvents.objects).length === 0) return;
  5925.  
  5926. let selectedIdx = null;
  5927. let idx;
  5928. let mteNames = [];
  5929. let mteIDs = [];
  5930. for(idx in W.model.majorTrafficEvents.objects)
  5931. {
  5932. if(W.model.majorTrafficEvents.objects.hasOwnProperty(idx))
  5933. {
  5934. let name = W.model.majorTrafficEvents.objects[idx].attributes.names[0]?.value;
  5935. if(mteNames.indexOf(name) == -1)
  5936. {
  5937. mteNames.push(name);
  5938. mteIDs.push(idx);
  5939. }
  5940. }
  5941. }
  5942. // check for any previously selected ID in the list, then clear it and repopulate
  5943. // using the newly gathered ID collection from above, and finally reselect the
  5944. // previously selected MTE if its still present in the new list...
  5945. let selector;
  5946. let selectedID;
  5947. let selectorEntry;
  5948.  
  5949. selector = document.getElementById('_selectRTCMTE');
  5950. selectedID = null;
  5951. if(selector.selectedOptions[0] != null)
  5952. {
  5953. selectedID = selector.selectedOptions[0].value;
  5954. }
  5955. while(selector.options.length > 0)
  5956. {
  5957. selector.options.remove(0);
  5958. }
  5959. selector.options.add(new Option('<select a MTE>', null));
  5960. if(mteNames.length > 0)
  5961. {
  5962. selectorEntry = '';
  5963. for(idx=0; idx<mteNames.length; idx++)
  5964. {
  5965. selectorEntry = mteNames[idx];
  5966. selector.options.add(new Option(selectorEntry, mteIDs[idx]));
  5967. if(mteIDs[idx] == selectedID)
  5968. {
  5969. selectedIdx = idx+1;
  5970. }
  5971. }
  5972. }
  5973.  
  5974. if(selectedIdx !== null)
  5975. {
  5976. selector.selectedIndex = selectedIdx;
  5977. }
  5978. }
  5979. function uroRTCMarkerInfo(mIdx, isVisible)
  5980. {
  5981. let pri = null;
  5982. let status = null;
  5983. let dir = null;
  5984. let pos = null;
  5985. let mID = null;
  5986.  
  5987. let mObj = uroLayers.layers[uroLayers.ID.RTC].l.markers[mIdx];
  5988. if(mObj !== undefined)
  5989. {
  5990. // Store the marker status - if we've already made a note of the original
  5991. // status by adding an "orig_"-prefixed classname, extract the status from
  5992. // that rather than from the class currently being used to display the
  5993. // marker, to preserve the original status regardless of what we may have
  5994. // done to it subsequently as a result of our RTC filtering setup...
  5995. let cList = mObj.element.classList;
  5996. for(let i = 0; i < cList.length; ++i)
  5997. {
  5998. if(cList[i].indexOf('orig_') != -1)
  5999. {
  6000. status = cList[i].replace('orig_', '');
  6001. }
  6002. }
  6003. if(status === null)
  6004. {
  6005. for(let i = 0; i < cList.length; ++i)
  6006. {
  6007. if(cList[i].indexOf('status-') != -1)
  6008. {
  6009. status = cList[i];
  6010. }
  6011. }
  6012. }
  6013.  
  6014. // Assign a priority level to the marker so we know whether to show or hide
  6015. // it if it's stacked up with others on the same segment - the level set here
  6016. // follows the priority used by WME to decide which closures to show normally.
  6017. if(status == "status-active")
  6018. {
  6019. pri = 2;
  6020. }
  6021. else if(status == "status-not-started")
  6022. {
  6023. pri = 1;
  6024. }
  6025. else
  6026. {
  6027. pri = 0;
  6028. }
  6029.  
  6030. // To avoid the need to cross-reference with the closure model object, use the
  6031. // classname of the arrow attached to this marker to determine if the closure is
  6032. // in the forward or reverse direction.
  6033. if(mObj.element.childNodes.length == 1)
  6034. {
  6035. if(mObj.element.childNodes[0].className.indexOf('forward') != -1)
  6036. {
  6037. dir = "fwd";
  6038. }
  6039. else if(mObj.element.childNodes[0].className.indexOf('backward') != -1)
  6040. {
  6041. dir = "rev";
  6042. }
  6043. }
  6044.  
  6045. pos = mObj.px;
  6046. mID = mObj.element.dataset.id;
  6047. }
  6048.  
  6049. this.isVisible = isVisible;
  6050. this.pos = pos;
  6051. this.pri = pri;
  6052. this.mID = mID;
  6053. this.status = status;
  6054. this.dir = dir;
  6055. }
  6056. function uroFilterRTCs()
  6057. {
  6058. let pmTStart = performance.now();
  6059. let pmFunction = "uroFilterRTCs";
  6060.  
  6061. if(uroFilterPreamble() === false) return;
  6062.  
  6063. let closureLayer = uroLayers.layers[uroLayers.ID.RTC].l;
  6064. if(closureLayer.markers.length === 0) return;
  6065.  
  6066. let uFR_filterActiveFromWME = uroUtils.GetCBChecked('_cbHideEditorRTCs');
  6067. let uFR_filterActiveFromWazeFeed = uroUtils.GetCBChecked('_cbHideWazeFeedRTCs');
  6068. let uFR_filterActiveFromWazeOther = uroUtils.GetCBChecked('_cbHideWazeRTCs');
  6069. let uFR_filterFutureFromWME = uroUtils.GetCBChecked('_cbHideFutureEditorRTCs');
  6070. let uFR_filterFutureFromWazeFeed = uroUtils.GetCBChecked('_cbHideFutureWazeFeedRTCs');
  6071. let uFR_filterFutureFromWazeOther = uroUtils.GetCBChecked('_cbHideFutureWazeRTCs');
  6072. let uFR_filterExpiredFromWME = uroUtils.GetCBChecked('_cbHideExpiredEditorRTCs');
  6073. let uFR_filterExpiredFromWazeFeed = uroUtils.GetCBChecked('_cbHideExpiredWazeFeedRTCs');
  6074. let uFR_filterExpiredFromWazeOther = uroUtils.GetCBChecked('_cbHideExpiredWazeRTCs');
  6075. let uFR_filterUnknownFromWME = uroUtils.GetCBChecked('_cbHideUnknownEditorRTCs');
  6076. let uFR_filterUnknownFromWazeFeed = uroUtils.GetCBChecked('_cbHideUnknownWazeFeedRTCs');
  6077. let uFR_filterUnknownFromWazeOther = uroUtils.GetCBChecked('_cbHideUnknownWazeRTCs');
  6078. let uFR_filterShowForMTE = uroUtils.GetCBChecked('_cbShowMTERTCs');
  6079. let uFR_filterHideForMTE = uroUtils.GetCBChecked('_cbHideMTERTCs');
  6080. let uFR_filterHideDurationLessThan = uroUtils.GetCBChecked('_cbEnableRTCDurationFilterLessThan');
  6081. let uFR_filterHideDurationMoreThan = uroUtils.GetCBChecked('_cbEnableRTCDurationFilterMoreThan');
  6082. let uFR_thresholdDurationLessThan = uroUtils.GetElmValue('_inputFilterRTCDurationLessThan');
  6083. let uFR_thresholdDurationMoreThan = uroUtils.GetElmValue('_inputFilterRTCDurationMoreThan');
  6084.  
  6085. let uFR_filterShowForTS = uroUtils.GetCBChecked('_cbRTCFilterShowForTS');
  6086. let uFR_filterHideForTS = uroUtils.GetCBChecked('_cbRTCFilterHideForTS');
  6087. let tsD = uroUtils.GetElmValue('_inputRTCFilterDay');
  6088. let tsMo = uroUtils.GetElmValue('_inputRTCFilterMonth');
  6089. let tsY = uroUtils.GetElmValue('_inputRTCFilterYear');
  6090. let tsH = uroUtils.GetElmValue('_inputRTCFilterHour');
  6091. let tsMi = uroUtils.GetElmValue('_inputRTCFilterMin');
  6092. let filterTS = uroUtils.GetTS(tsD, tsMo, tsY, tsH, tsMi);
  6093. uroUpdateMTEList();
  6094. let mteID = null;
  6095. let selectorMTE = document.getElementById('_selectRTCMTE');
  6096. if(selectorMTE?.selectedOptions[0] != null)
  6097. {
  6098. mteID = selectorMTE.selectedOptions[0].value;
  6099. }
  6100.  
  6101. let uFR_masterEnable = uroIsFilteringEnabled(false);
  6102.  
  6103. let markerInfo = [];
  6104.  
  6105. // Pass 1 - determine which filtering to apply to each of the RTC markers
  6106. let markerIdx = 0;
  6107. for (let rtcObj in W.model.roadClosures.objects)
  6108. {
  6109. let isVisible = true;
  6110.  
  6111. if(uFR_masterEnable === true)
  6112. {
  6113. let rtcModel = W.model.roadClosures.objects[rtcObj];
  6114.  
  6115. if(mteID !== null)
  6116. {
  6117. if((uFR_filterShowForMTE === true) && (rtcModel.attributes.eventId !== mteID))
  6118. {
  6119. isVisible = false;
  6120. }
  6121. if((uFR_filterHideForMTE === true) && (rtcModel.attributes.eventId === mteID))
  6122. {
  6123. isVisible = false;
  6124. }
  6125. }
  6126.  
  6127. let rtcType = uroGetRTCOrigin(rtcModel);
  6128. let rtcState = uroGetRTCState(rtcModel);
  6129.  
  6130. if(rtcType == uroEnums.TRTC.WAZEFEED)
  6131. {
  6132. if
  6133. (
  6134. ((rtcState === uroEnums.SRTC.ACTIVE) && (uFR_filterActiveFromWazeFeed === true)) ||
  6135. ((rtcState === uroEnums.SRTC.FUTURE) && (uFR_filterFutureFromWazeFeed === true)) ||
  6136. ((rtcState === uroEnums.SRTC.EXPIRED) && (uFR_filterExpiredFromWazeFeed === true)) ||
  6137. ((rtcState === uroEnums.SRTC.UNKNOWN) && (uFR_filterUnknownFromWazeFeed === true))
  6138. )
  6139. {
  6140. isVisible = false;
  6141. }
  6142. }
  6143. else if(rtcType == uroEnums.TRTC.WAZEOTHER)
  6144. {
  6145. if
  6146. (
  6147. ((rtcState === uroEnums.SRTC.ACTIVE) && (uFR_filterActiveFromWazeOther === true)) ||
  6148. ((rtcState === uroEnums.SRTC.FUTURE) && (uFR_filterFutureFromWazeOther === true)) ||
  6149. ((rtcState === uroEnums.SRTC.EXPIRED) && (uFR_filterExpiredFromWazeOther === true)) ||
  6150. ((rtcState === uroEnums.SRTC.UNKNOWN) && (uFR_filterUnknownFromWazeOther === true))
  6151. )
  6152. {
  6153. isVisible = false;
  6154. }
  6155. }
  6156. else
  6157. {
  6158. if
  6159. (
  6160. ((rtcState === uroEnums.SRTC.ACTIVE) && (uFR_filterActiveFromWME === true)) ||
  6161. ((rtcState === uroEnums.SRTC.FUTURE) && (uFR_filterFutureFromWME === true)) ||
  6162. ((rtcState === uroEnums.SRTC.EXPIRED) && (uFR_filterExpiredFromWME === true)) ||
  6163. ((rtcState === uroEnums.SRTC.UNKNOWN) && (uFR_filterUnknownFromWME === true))
  6164. )
  6165. {
  6166. isVisible = false;
  6167. }
  6168. }
  6169. let rtcDuration = uroGetRTCDuration(rtcModel);
  6170. if(uFR_filterHideDurationLessThan === true)
  6171. {
  6172. if(rtcDuration < uFR_thresholdDurationLessThan)
  6173. {
  6174. isVisible = false;
  6175. }
  6176. }
  6177. if(uFR_filterHideDurationMoreThan === true)
  6178. {
  6179. if(rtcDuration > uFR_thresholdDurationMoreThan)
  6180. {
  6181. isVisible = false;
  6182. }
  6183. }
  6184. if((uFR_filterShowForTS === true) || (uFR_filterHideForTS === true))
  6185. {
  6186. let startTS = new Date(rtcModel.attributes.startDate).getTime();
  6187. let endTS = new Date(rtcModel.attributes.endDate).getTime();
  6188. if(uFR_filterShowForTS === true)
  6189. {
  6190. if((filterTS < startTS) || (filterTS > endTS))
  6191. {
  6192. isVisible = false;
  6193. }
  6194. }
  6195. if (uFR_filterHideForTS === true)
  6196. {
  6197. if((filterTS >= startTS) && (filterTS <= endTS))
  6198. {
  6199. isVisible = false;
  6200. }
  6201. }
  6202. }
  6203. }
  6204.  
  6205. markerInfo.push(new uroRTCMarkerInfo(markerIdx, isVisible));
  6206. ++markerIdx;
  6207. }
  6208.  
  6209. // Pass 2 - based on the initial filtering results, determine which markers *actually* should be
  6210. // made visible or hidden according both to our filtering settings AND any masking of this marker
  6211. // due to the presence of other higher priority markers at the same position which have also been
  6212. // marked as visible following the filtering pass...
  6213. //
  6214. // For added merriment, we also deal with the WME limitation that prevents it displaying two
  6215. // different types of closure arrow if a segment has a one-way closure which is a higher priority
  6216. // than a closure in the opposite direction.
  6217.  
  6218. let cNodesDiv = uroLayers.layers[uroLayers.ID.RTCnode].l.div;
  6219. for (let i = 0; i < markerIdx; ++i)
  6220. {
  6221. let status = markerInfo[i].status;
  6222.  
  6223. // Only apply this pass to closures which haven't already been hidden in pass 1, AND which
  6224. // have a valid marker position
  6225. if((markerInfo[i].isVisible === true) && (markerInfo[i].pos !== null))
  6226. {
  6227. // Iterate through all the other markers, looking for any which are also still visible
  6228. // and have the same marker position as the one we're currently processing
  6229. for (let j = 0; j < markerIdx; ++j)
  6230. {
  6231. if(j != i)
  6232. {
  6233. if((markerInfo[j].isVisible === true) && (markerInfo[j].pos !== null))
  6234. {
  6235. if((markerInfo[i].pos.x == markerInfo[j].pos.x) && (markerInfo[i].pos.y == markerInfo[j].pos.y))
  6236. {
  6237. if(markerInfo[j].pri > markerInfo[i].pri)
  6238. {
  6239. if(markerInfo[j].dir == markerInfo[i].dir)
  6240. {
  6241. // Mark the currently processed marker to be hidden only if this higher priority
  6242. // marker is for a closure in the same direction - if it's not, then we need to
  6243. // leave the current marker visible so that its arrow remains visible...
  6244. markerInfo[i].isVisible = false;
  6245. break;
  6246. }
  6247. else
  6248. {
  6249. // Otherwise, if we're leaving the current marker visible then we'll need to
  6250. // alter its status class to match this higher-priority marker, so that the
  6251. // marker which is shown to the user remains correct regardless of what the
  6252. // relative stacking order of the markers is on this segment.
  6253. status = markerInfo[j].status;
  6254. }
  6255. }
  6256. }
  6257. }
  6258. }
  6259. }
  6260. }
  6261.  
  6262. let marker = closureLayer.markers[i].element;
  6263. let markerClass = marker.className;
  6264.  
  6265. // Remove the hidden class if present - this allows markers natively hidden by WME due to being masked
  6266. // by higher priority markers to become visible again if our own filtering settings have hidden those
  6267. // higher priority marker...
  6268. markerClass = markerClass.replace(" road-closure-hidden", "");
  6269. if(markerInfo[i].isVisible == false)
  6270. {
  6271. // Apply the hidden class for any markers WE'VE decided need to be hidden
  6272. markerClass += " road-closure-hidden";
  6273. }
  6274. else
  6275. {
  6276. // For any markers which we're leaving visible, first check to see if it's a marker we haven't yet
  6277. // seen. If so, then we need to store its original status class for future reference.
  6278. if(markerClass.indexOf('orig_') == -1)
  6279. {
  6280. markerClass += (' orig_'+markerInfo[i].status);
  6281. }
  6282. // Now, to ensure this segment displays the appropriate marker for the highest priority closure
  6283. // still visible on it, we remove the existing status class and replace it with the one we
  6284. // chose above
  6285. markerClass = markerClass.replace(" status-finished"," ");
  6286. markerClass = markerClass.replace(" status-active"," ");
  6287. markerClass = markerClass.replace(" status-not-started"," ");
  6288. markerClass += ' '+status;
  6289. }
  6290. marker.className = markerClass;
  6291. let toHide = cNodesDiv.querySelectorAll("[data-id='"+markerInfo[i].mID+"']");
  6292. for(let j = 0; j < toHide.length; ++j)
  6293. {
  6294. if(markerInfo[i].isVisible === false)
  6295. {
  6296. toHide[j].style.visibility = "hidden";
  6297. }
  6298. else
  6299. {
  6300. toHide[j].style.visibility = "";
  6301. }
  6302. }
  6303. }
  6304.  
  6305. uroDBG.PerfMon(pmFunction, pmTStart);
  6306. }
  6307. function uroUpdateRAList()
  6308. {
  6309. if(Object.keys(W.model.restrictedDrivingAreas.objects).length === 0) return;
  6310.  
  6311. let selectedIdx = null;
  6312. let idx;
  6313. let raNames = [];
  6314. for(idx in W.model.restrictedDrivingAreas.objects)
  6315. {
  6316. if(W.model.restrictedDrivingAreas.objects.hasOwnProperty(idx))
  6317. {
  6318. let name = W.model.restrictedDrivingAreas.objects[idx].attributes.name;
  6319. if(raNames.indexOf(name) == -1)
  6320. {
  6321. raNames.push(name);
  6322. }
  6323. }
  6324. }
  6325. // check for any previously selected name in the list, then clear it and repopulate
  6326. // using the newly gathered collection from above, and finally reselect the
  6327. // previously selected MTE if its still present in the new list...
  6328. let selector;
  6329. let selectedName;
  6330. let selectorEntry;
  6331.  
  6332. selector = document.getElementById('_selectRA');
  6333. selectedName = null;
  6334. if(selector.selectedOptions[0] != null)
  6335. {
  6336. selectedName = selector.selectedOptions[0].value;
  6337. }
  6338. while(selector.options.length > 0)
  6339. {
  6340. selector.options.remove(0);
  6341. }
  6342. selector.options.add(new Option('<select a RA>', null));
  6343. if(raNames.length > 0)
  6344. {
  6345. selectorEntry = '';
  6346. for(idx=0; idx<raNames.length; idx++)
  6347. {
  6348. selectorEntry = raNames[idx];
  6349. selector.options.add(new Option(selectorEntry, selectorEntry));
  6350. if(selectorEntry == selectedName)
  6351. {
  6352. selectedIdx = idx+1;
  6353. }
  6354. }
  6355. }
  6356.  
  6357. if(selectedIdx !== null)
  6358. {
  6359. selector.selectedIndex = selectedIdx;
  6360. }
  6361. }
  6362. function uroUpdateEditorList(modelObj, listElement, useCreated, useUpdated, useResolved, useCommenter)
  6363. {
  6364. if(Object.keys(modelObj).length === 0) return;
  6365.  
  6366. let selector = document.getElementById(listElement);
  6367.  
  6368. let selectedUser = null;
  6369. if(selector.selectedOptions[0] != null)
  6370. {
  6371. selectedUser = parseInt(selector.selectedOptions[0].value);
  6372. }
  6373.  
  6374. while(selector.options.length > 0)
  6375. {
  6376. selector.options.remove(0);
  6377. }
  6378.  
  6379. let selectedIdx = null;
  6380. let listedIDs = [];
  6381. let idx;
  6382. for(idx in modelObj)
  6383. {
  6384. if(modelObj.hasOwnProperty(idx))
  6385. {
  6386. let obj;
  6387. if(useCommenter == true)
  6388. {
  6389. obj = modelObj[idx];
  6390. if(obj.attributes.comments.length > 0)
  6391. {
  6392. for(let cidx=0; cidx < obj.attributes.comments.length; cidx++)
  6393. {
  6394. let userID = obj.attributes.comments[cidx].userID;
  6395. if((listedIDs.indexOf(userID) == -1) && (userID != -1))
  6396. {
  6397. listedIDs.push(userID);
  6398. }
  6399. }
  6400. }
  6401. }
  6402. else
  6403. {
  6404. obj = modelObj[idx].attributes;
  6405. let cbID = null;
  6406. let ubID = null;
  6407. let rbID = null;
  6408. if(useCreated == true) cbID = obj.createdBy;
  6409. if(useUpdated == true) ubID = obj.updatedBy;
  6410. if(useResolved == true) ubID = obj.resolvedBy;
  6411. if((cbID !== null) && (listedIDs.indexOf(cbID) == -1))
  6412. {
  6413. listedIDs.push(cbID);
  6414. }
  6415. if((ubID !== null) && (listedIDs.indexOf(ubID) == -1))
  6416. {
  6417. listedIDs.push(ubID);
  6418. }
  6419. if((rbID !== null) && (listedIDs.indexOf(rbID) == -1))
  6420. {
  6421. listedIDs.push(rbID);
  6422. }
  6423. }
  6424. }
  6425. }
  6426.  
  6427. selector.options.add(new Option('<select a user>', null));
  6428. if(listedIDs.length > 0)
  6429. {
  6430. let users = W.model.users.getByIds(listedIDs);
  6431. let selectorEntry = '';
  6432. for(idx=0; idx<users.length; idx++)
  6433. {
  6434. if(listedIDs.indexOf(users[idx].id) != -1)
  6435. {
  6436. listedIDs.splice(listedIDs.indexOf(users[idx]), 1);
  6437. }
  6438. if(users[idx].attributes.userName === undefined)
  6439. {
  6440. selectorEntry = users[idx].attributes.id;
  6441. }
  6442. else
  6443. {
  6444. selectorEntry = users[idx].attributes.userName;
  6445. }
  6446. selector.options.add(new Option(selectorEntry, users[idx].id));
  6447. if(users[idx].attributes.id == selectedUser)
  6448. {
  6449. selectedIdx = idx+1;
  6450. }
  6451. }
  6452. }
  6453.  
  6454. if(selectedIdx !== null)
  6455. {
  6456. selector.selectedIndex = selectedIdx;
  6457. }
  6458. }
  6459. function uroGetUserID(filterNameID, tbUserName)
  6460. {
  6461. if(filterNameID === null)
  6462. {
  6463. for(let idx in W.model.users.objects)
  6464. {
  6465. if(W.model.users.objects.hasOwnProperty(idx))
  6466. {
  6467. if(W.model.users.objects[idx].attributes.userName == tbUserName)
  6468. {
  6469. filterNameID = W.model.users.objects[idx].attributes.id;
  6470. break;
  6471. }
  6472. }
  6473. }
  6474. }
  6475. return filterNameID;
  6476. }
  6477. function uroFilterRAs()
  6478. {
  6479. let pmTStart = performance.now();
  6480. let pmFunction = "uroFilterRAs";
  6481.  
  6482. if(uroFilterPreamble() === false) return;
  6483. let uFURs_masterEnable = uroIsFilteringEnabled(false);
  6484. let filterByArea = uroUtils.GetCBChecked('_cbShowSpecificRA');
  6485. let filterByLastEditor = uroUtils.GetCBChecked('_cbRAEditorIDFilter');
  6486. let filterByMinAge = uroUtils.GetCBChecked('_cbEnableRAAgeFilterLessThan');
  6487. let filterByMaxAge = uroUtils.GetCBChecked('_cbEnableRAAgeFilterMoreThan');
  6488. let thresholdMinAge = uroUtils.GetElmValue('_inputFilterRAAgeLessThan');
  6489. let thresholdMaxAge = uroUtils.GetElmValue('_inputFilterRAAgeMoreThan');
  6490. let selectorRA = document.getElementById('_selectRA');
  6491. if(filterByArea === false)
  6492. {
  6493. while(selectorRA.options.length > 0)
  6494. {
  6495. selectorRA.options.remove(0);
  6496. }
  6497. }
  6498. let shownRA = null;
  6499. if(filterByArea === true)
  6500. {
  6501. if(selectorRA.options.length === 0)
  6502. {
  6503. uroUpdateRAList();
  6504. }
  6505. if(selectorRA.selectedOptions[0] != null)
  6506. {
  6507. shownRA = selectorRA.selectedOptions[0].value;
  6508. }
  6509. }
  6510.  
  6511. let filterNameID = null;
  6512. if(filterByLastEditor == true)
  6513. {
  6514. uroUpdateEditorList(W.model.restrictedDrivingAreas.objects, '_selectRAEditorID', true, true, false, false);
  6515. let selector = document.getElementById('_selectRAEditorID');
  6516. if(selector.selectedIndex > 0)
  6517. {
  6518. filterNameID = document.getElementById('_selectRAEditorID').selectedOptions[0].value;
  6519. }
  6520. }
  6521. let nRANames = document.querySelectorAll('.restricted-driving-area-name-marker').length;
  6522. for (let raIdx = 0; raIdx < W.map.restrictedDrivingAreaLayer.features.length; raIdx++)
  6523. {
  6524. let raObj = W.map.restrictedDrivingAreaLayer.features[raIdx].attributes.wazeFeature;
  6525. if(raObj !== undefined)
  6526. {
  6527. let raStyle = 'visible';
  6528. if(uFURs_masterEnable === true)
  6529. {
  6530. if(shownRA !== null)
  6531. {
  6532. if(raObj._wmeObject.attributes.name != shownRA) raStyle = 'hidden';
  6533. }
  6534. if(filterNameID !== null)
  6535. {
  6536. if((raObj._wmeObject.attributes.createdBy != filterNameID) && (raObj._wmeObject.attributes.updatedBy != filterNameID))
  6537. {
  6538. raStyle = 'hidden';
  6539. }
  6540. }
  6541. let raAge = uroUtils.DateToDays(raObj._wmeObject.attributes.updatedOn);
  6542. if(filterByMinAge == true)
  6543. {
  6544. if(raAge < thresholdMinAge) raStyle = 'hidden';
  6545. }
  6546. if(filterByMaxAge == true)
  6547. {
  6548. if(raAge > thresholdMaxAge) raStyle = 'hidden';
  6549. }
  6550. }
  6551. let geoID = W.map.restrictedDrivingAreaLayer.features[raIdx].geometry.id;
  6552. if(document.getElementById(geoID) !== null)
  6553. {
  6554. document.getElementById(geoID).style.visibility = raStyle;
  6555. }
  6556.  
  6557. // This doesn't always work, as the order in which the markers are listed on their layer isn't guaranteed
  6558. // to match the order in which the corresponding RA polys are listed on theirs...
  6559. if(raIdx < nRANames)
  6560. {
  6561. document.querySelectorAll('.restricted-driving-area-name-marker')[raIdx].style.visibility = raStyle;
  6562. }
  6563. }
  6564. }
  6565. uroDBG.PerfMon(pmFunction, pmTStart);
  6566. }
  6567. function uroFilterPlaceMarker(mObj, vObj, uFP_masterEnable)
  6568. {
  6569. if((mObj === undefined) || (vObj === undefined))
  6570. {
  6571. return;
  6572. }
  6573.  
  6574. let purAge = null;
  6575. let placeStyle = 'visible';
  6576. let hasBalloon = false;
  6577.  
  6578. if(uFP_masterEnable === true)
  6579. {
  6580. if(uro_uFP[uroEnums.FP_OPTS.filterInsideManagedAreas] === true)
  6581. {
  6582. let tPt = [];
  6583. tPt.push(vObj.attributes.geoJSONGeometry.coordinates[0]);
  6584. tPt.push(vObj.attributes.geoJSONGeometry.coordinates[1]);
  6585. if(uroCheckGeometryWithinManagedAreas(tPt) === true) placeStyle = 'hidden';
  6586. }
  6587.  
  6588. if((placeStyle == 'visible') && (uro_uFP[uroEnums.FP_OPTS.filterUneditable] === true))
  6589. {
  6590. if(vObj.attributes.permissions === 0)
  6591. {
  6592. placeStyle = 'hidden';
  6593. }
  6594. if((placeStyle == 'visible') && (uro_uFP[uroEnums.FP_OPTS.isLoggedIn]))
  6595. {
  6596. if(uro_uFP[uroEnums.FP_OPTS.userRank] < vObj.attributes.lockRank)
  6597. {
  6598. placeStyle = 'hidden';
  6599. }
  6600. }
  6601. if((placeStyle == 'visible') && (vObj.attributes.adLocked))
  6602. {
  6603. placeStyle = 'hidden';
  6604. }
  6605. }
  6606.  
  6607. if((placeStyle == 'visible') && (uro_uFP[uroEnums.FP_OPTS.filterLockRanked] === true))
  6608. {
  6609. if(vObj.attributes.lockRank !== 0)
  6610. {
  6611. placeStyle = 'hidden';
  6612. }
  6613. }
  6614.  
  6615. let urEntries = vObj.attributes.venueUpdateRequests;
  6616. if((placeStyle == 'visible') && (urEntries !== undefined))
  6617. {
  6618. hasBalloon = (urEntries.length > 1);
  6619.  
  6620. for(let i = 0; i < urEntries.length; ++i)
  6621. {
  6622. let ut = urEntries[i].attributes.updateType;
  6623. if((uro_uFP[uroEnums.FP_OPTS.filterFlagged] === true) && (ut === "flag"))
  6624. {
  6625. placeStyle = 'hidden';
  6626. }
  6627. else if((uro_uFP[uroEnums.FP_OPTS.filterNewPlace] === true) && (ut === "ADD_VENUE"))
  6628. {
  6629. placeStyle = 'hidden';
  6630. }
  6631. else if((uro_uFP[uroEnums.FP_OPTS.filterUpdatedDetails] === true) && (ut === "UPDATE_VENUE"))
  6632. {
  6633. placeStyle = 'hidden';
  6634. }
  6635. else if((uro_uFP[uroEnums.FP_OPTS.filterNewPhoto] === true) && (ut === "ADD_IMAGE"))
  6636. {
  6637. placeStyle = 'hidden';
  6638. }
  6639. }
  6640.  
  6641. if((placeStyle == 'visible') && (uro_uFP[uroEnums.FP_OPTS.filterOnCFs] === true))
  6642. {
  6643. let nVUR = urEntries.length;
  6644. while(nVUR > 0)
  6645. {
  6646. nVUR--;
  6647. let tCF = urEntries[nVUR].attributes.changedFields;
  6648. if(tCF !== undefined)
  6649. {
  6650. if(tCF.length > 0)
  6651. {
  6652. let tFN = tCF[0].attributes.fieldName;
  6653. if((tFN == "phone") && (uro_uFP[uroEnums.FP_OPTS.filterCFPhone] === true))
  6654. {
  6655. placeStyle = 'hidden';
  6656. }
  6657. else if((tFN == "name") && (uro_uFP[uroEnums.FP_OPTS.filterCFName] === true))
  6658. {
  6659. placeStyle = 'hidden';
  6660. }
  6661. else if((tFN == "entryExitPoints") && (uro_uFP[uroEnums.FP_OPTS.filterCFEntryExitPoints] === true))
  6662. {
  6663. placeStyle = 'hidden';
  6664. }
  6665. else if((tFN == "openingHours") && (uro_uFP[uroEnums.FP_OPTS.filterCFOpeningHours] === true))
  6666. {
  6667. placeStyle = 'hidden';
  6668. }
  6669. else if((tFN == "aliases") && (uro_uFP[uroEnums.FP_OPTS.filterCFAliases] === true))
  6670. {
  6671. placeStyle = 'hidden';
  6672. }
  6673. else if((tFN == "services") && (uro_uFP[uroEnums.FP_OPTS.filterCFServices] === true))
  6674. {
  6675. placeStyle = 'hidden';
  6676. }
  6677. else if((tFN == "geometry") && (uro_uFP[uroEnums.FP_OPTS.filterCFGeometry] === true))
  6678. {
  6679. placeStyle = 'hidden';
  6680. }
  6681. else if((tFN == "houseNumber") && (uro_uFP[uroEnums.FP_OPTS.filterCFHouseNumber] === true))
  6682. {
  6683. placeStyle = 'hidden';
  6684. }
  6685. else if((tFN == "categories") && (uro_uFP[uroEnums.FP_OPTS.filterCFCategories] === true))
  6686. {
  6687. placeStyle = 'hidden';
  6688. }
  6689. else if((tFN == "description") && (uro_uFP[uroEnums.FP_OPTS.filterCFDescription] === true))
  6690. {
  6691. placeStyle = 'hidden';
  6692. }
  6693. }
  6694. }
  6695. }
  6696. }
  6697. }
  6698.  
  6699. if(uro_uFP[uroEnums.FP_OPTS.invertPURFilters] === true)
  6700. {
  6701. if(placeStyle == 'hidden') placeStyle = 'visible';
  6702. else placeStyle = 'hidden';
  6703. }
  6704.  
  6705. if(uro_uFP[uroEnums.FP_OPTS.filterMinPURAge] || uro_uFP[uroEnums.FP_OPTS.filterMaxPURAge])
  6706. {
  6707. purAge = uroUtils.GetPURAge(vObj);
  6708. if(uro_uFP[uroEnums.FP_OPTS.filterMinPURAge] === true)
  6709. {
  6710. if(purAge < uro_uFP[uroEnums.FP_OPTS.thresholdMinPURDays]) placeStyle = 'hidden';
  6711. }
  6712. if(uro_uFP[uroEnums.FP_OPTS.filterMaxPURAge] === true)
  6713. {
  6714. if(purAge > uro_uFP[uroEnums.FP_OPTS.thresholdMaxPURDays]) placeStyle = 'hidden';
  6715. }
  6716. }
  6717.  
  6718. if(uroPURsToHide.indexOf(vObj.attributes.id) !== -1)
  6719. {
  6720. placeStyle = 'hidden';
  6721. }
  6722. }
  6723.  
  6724. mObj.style.visibility = placeStyle;
  6725. if(hasBalloon === true)
  6726. {
  6727. // for PURs related to multiple change requests, we also need to apply the
  6728. // filtering to the text inside the balloon that indicates how many CRs
  6729. // the PUR represents - the balloon itself gets filtered as part of the
  6730. // main marker above, but the text is in a seperate element...
  6731. let pObj = mObj.parentNode.parentNode;
  6732. let tObjs = pObj.getElementsByTagName("text");
  6733. for(let i = 0; i < tObjs.length; ++i)
  6734. {
  6735. tObjs[i].style.visibility = placeStyle;
  6736. }
  6737. }
  6738.  
  6739. if((uro_uFP[uroEnums.FP_OPTS.leavePURGeos] === false) && (placeStyle === 'hidden'))
  6740. {
  6741. if(vObj.model != null)
  6742. {
  6743. if(vObj.attributes.geometry != null)
  6744. {
  6745. let puGeo = document.getElementById(vObj.attributes.geometry.id);
  6746. if(puGeo !== null)
  6747. {
  6748. puGeo.style.visibility = 'hidden';
  6749. }
  6750. }
  6751. }
  6752. }
  6753. }
  6754. function uroFilterPlaces()
  6755. {
  6756. let pmTStart = performance.now();
  6757. let pmFunction = "uroFilterPlaces";
  6758.  
  6759. if(uroFilterPreamble() === false) return;
  6760.  
  6761. let moObj = uroGetHighlightedMapFeature();
  6762. let renderIntent = uroGetFeatureRenderIntent(moObj);
  6763. if(moObj != null)
  6764. {
  6765. if(moObj.featureType === 'venue')
  6766. {
  6767. if((renderIntent == 'select') || (renderIntent == 'highlightselected'))
  6768. {
  6769. return;
  6770. }
  6771. }
  6772. }
  6773.  
  6774. if(uroUtils.GetCBChecked('_cbDisablePlacesFiltering') === true) return;
  6775.  
  6776. uroUpdateVenueEditorLists();
  6777.  
  6778. let filterNameID = null;
  6779. let tbUserName = uroUtils.GetElmValue('_textPlacesEditor');
  6780. let selector = document.getElementById('_selectPlacesUserID');
  6781. if(selector.selectedIndex > 0)
  6782. {
  6783. let selUserName = document.getElementById('_selectPlacesUserID').selectedOptions[0].innerHTML;
  6784. if(selUserName == tbUserName)
  6785. {
  6786. filterNameID = document.getElementById('_selectPlacesUserID').selectedOptions[0].value;
  6787. }
  6788. }
  6789. filterNameID = uroGetUserID(filterNameID, tbUserName);
  6790.  
  6791. let filterHideNameID = null;
  6792. let tbHideUserName = uroUtils.GetElmValue('_textHidePlacesEditor');
  6793. let selectorHide = document.getElementById('_selectHidePlacesUserID');
  6794. if(selectorHide.selectedIndex > 0)
  6795. {
  6796. let selHideUserName = document.getElementById('_selectHidePlacesUserID').selectedOptions[0].innerHTML;
  6797. if(selHideUserName == tbHideUserName)
  6798. {
  6799. filterHideNameID = document.getElementById('_selectHidePlacesUserID').selectedOptions[0].value;
  6800. }
  6801. }
  6802. filterHideNameID = uroGetUserID(filterHideNameID, tbHideUserName);
  6803.  
  6804. let filterCats = [];
  6805. for(let i=0; i<W.Config.venues.categories.length; i++)
  6806. {
  6807. let parentCategory = W.Config.venues.categories[i];
  6808. let subCategory;
  6809.  
  6810. if(uroUtils.GetCBChecked('_cbPlacesFilter-'+parentCategory) === true)
  6811. {
  6812. filterCats.push(parentCategory);
  6813. for(let i1=0; i1<W.Config.venues.subcategories[parentCategory].length; i1++)
  6814. {
  6815. subCategory = W.Config.venues.subcategories[parentCategory][i1];
  6816. filterCats.push(subCategory);
  6817. }
  6818. }
  6819. else
  6820. {
  6821. for(let i2=0; i2<W.Config.venues.subcategories[parentCategory].length; i2++)
  6822. {
  6823. subCategory = W.Config.venues.subcategories[parentCategory][i2];
  6824. if(uroUtils.GetCBChecked('_cbPlacesFilter-'+subCategory) === true)
  6825. {
  6826. filterCats.push(subCategory);
  6827. }
  6828. }
  6829. }
  6830. }
  6831.  
  6832. let placeStyle;
  6833.  
  6834. let uFP_filterEditedLessThan = uroUtils.GetCBChecked('_cbPlaceFilterEditedLessThan');
  6835. let uFP_filterEditedMoreThan = uroUtils.GetCBChecked('_cbPlaceFilterEditedMoreThan');
  6836. let uFP_filterL0 = uroUtils.GetCBChecked('_cbHidePlacesL0');
  6837. let uFP_filterL1 = uroUtils.GetCBChecked('_cbHidePlacesL1');
  6838. let uFP_filterL2 = uroUtils.GetCBChecked('_cbHidePlacesL2');
  6839. let uFP_filterL3 = uroUtils.GetCBChecked('_cbHidePlacesL3');
  6840. let uFP_filterL4 = uroUtils.GetCBChecked('_cbHidePlacesL4');
  6841. let uFP_filterL5 = uroUtils.GetCBChecked('_cbHidePlacesL5');
  6842. let uFP_filterStaff = uroUtils.GetCBChecked('_cbHidePlacesStaff');
  6843. let uFP_filterAL = uroUtils.GetCBChecked('_cbHidePlacesAdLocked');
  6844. let uFP_filterOnLockLevel = (uFP_filterL0 || uFP_filterL1 || uFP_filterL2 || uFP_filterL3 || uFP_filterL4 || uFP_filterL5 || uFP_filterStaff);
  6845. let uFP_filterNoPhotos = uroUtils.GetCBChecked('_cbHideNoPhotoPlaces');
  6846. let uFP_filterWithPhotos = uroUtils.GetCBChecked('_cbHidePhotoPlaces');
  6847. let uFP_filterNoLinks = uroUtils.GetCBChecked('_cbHideNoLinkedPlaces');
  6848. let uFP_filterWithLinks = uroUtils.GetCBChecked('_cbHideLinkedPlaces');
  6849. let uFP_filterNoDescription = uroUtils.GetCBChecked('_cbHideNonDescribedPlaces');
  6850. let uFP_filterWithDescription = uroUtils.GetCBChecked('_cbHideDescribedPlaces');
  6851. let uFP_filterNoKeyword = uroUtils.GetCBChecked('_cbHideKeywordPlaces');
  6852. let uFP_filterKeyword = uroUtils.GetCBChecked('_cbHideNoKeywordPlaces');
  6853. let uFP_filterPrivate = uroUtils.GetCBChecked('_cbFilterPrivatePlaces');
  6854. let uFP_invertFilters = uroUtils.GetCBChecked('_cbInvertPlacesFilter');
  6855. let uFP_masterEnable = uroIsFilteringEnabled(false);
  6856. let uFP_filterAreaPlaces = uroUtils.GetCBChecked('_cbHideAreaPlaces');
  6857. let uFP_filterPointPlaces = uroUtils.GetCBChecked('_cbHidePointPlaces');
  6858. let uFP_filterCreatedBy = uroUtils.GetCBChecked('_cbShowOnlyPlacesCreatedBy');
  6859. let uFP_filterEditedBy = uroUtils.GetCBChecked('_cbShowOnlyPlacesEditedBy');
  6860. let uFP_filterHideCreatedBy = uroUtils.GetCBChecked('_cbHideOnlyPlacesCreatedBy');
  6861. let uFP_filterHideEditedBy = uroUtils.GetCBChecked('_cbHideOnlyPlacesEditedBy');
  6862.  
  6863. let uFP_hidePURsForFilteredPlaces = uroUtils.GetCBChecked('_cbHidePURsForFilteredPlaces');
  6864.  
  6865. let uFP_NameKeyword = document.getElementById('_textKeywordPlace').value.toLowerCase();
  6866. let uFP_thresholdMinDays = document.getElementById('_inputFilterPlaceEditMinDays').value;
  6867. let uFP_thresholdMaxDays = document.getElementById('_inputFilterPlaceEditMaxDays').value;
  6868.  
  6869. uroPURsToHide = [];
  6870.  
  6871. for(let v=0; v<uroVenueLayer.features.length; v++)
  6872. {
  6873. placeStyle = 'visible';
  6874. if(uFP_masterEnable === true)
  6875. {
  6876. let lmObj = uroVenueLayer.features[v];
  6877.  
  6878. // when an area place is selected, the drag points for editing the place outline now get added as objects into uroVenueLayer.features,
  6879. // however none of these objects had the .attributes.repositoryObject property - whilst the devs have now replaced this with the almost
  6880. // identical .wazeFeature._wmeObject property, it's unclear if drag points still need to be excluded from this scan, so the check
  6881. // remains in place as a "let's just make sure it has it before trying to use it"...
  6882. if(lmObj?.attributes?.wazeFeature?._wmeObject != null)
  6883. {
  6884. lmObj = lmObj.attributes.wazeFeature._wmeObject.attributes;
  6885. if(lmObj.id < 0)
  6886. {
  6887. // don't apply filtering to newly-created places - this allows the user to leave their filtering settings unchanged whilst
  6888. // adding a new place which, once saved, would then be hidden...
  6889. break;
  6890. }
  6891.  
  6892. if(uFP_filterAreaPlaces)
  6893. {
  6894. if(lmObj.geometry.id.indexOf('Polygon') !== -1)
  6895. {
  6896. placeStyle = 'hidden';
  6897. }
  6898. }
  6899. if(uFP_filterPointPlaces)
  6900. {
  6901. if(lmObj.geometry.id.indexOf('Point') !== -1)
  6902. {
  6903. placeStyle = 'hidden';
  6904. }
  6905. }
  6906.  
  6907.  
  6908. if(placeStyle == 'visible')
  6909. {
  6910. if((uFP_filterEditedLessThan) || (uFP_filterEditedMoreThan))
  6911. {
  6912. let editDate = lmObj.updatedOn;
  6913. if(editDate === undefined)
  6914. {
  6915. // where a place has never been edited since its creation, use the creation date instead...
  6916. editDate = lmObj.createdOn;
  6917. }
  6918. if(editDate != null)
  6919. {
  6920. let editDaysAgo = uroUtils.DateToDays(editDate);
  6921. if(uFP_filterEditedLessThan)
  6922. {
  6923. if(editDaysAgo < uFP_thresholdMinDays)
  6924. {
  6925. placeStyle = 'hidden';
  6926. }
  6927. }
  6928. if(uFP_filterEditedMoreThan)
  6929. {
  6930. if(editDaysAgo > uFP_thresholdMaxDays)
  6931. {
  6932. placeStyle = 'hidden';
  6933. }
  6934. }
  6935. }
  6936. }
  6937. }
  6938.  
  6939. if(placeStyle == 'visible')
  6940. {
  6941. if(uFP_filterOnLockLevel)
  6942. {
  6943. let lockLevel = lmObj.lockRank;
  6944. if ((uFP_filterL0) && (lockLevel === 0)) placeStyle = 'hidden';
  6945. if ((uFP_filterL1) && (lockLevel === 1)) placeStyle = 'hidden';
  6946. if ((uFP_filterL2) && (lockLevel === 2)) placeStyle = 'hidden';
  6947. if ((uFP_filterL3) && (lockLevel === 3)) placeStyle = 'hidden';
  6948. if ((uFP_filterL4) && (lockLevel === 4)) placeStyle = 'hidden';
  6949. if ((uFP_filterL5) && (lockLevel === 5)) placeStyle = 'hidden';
  6950. if ((uFP_filterStaff) && (lockLevel === 6)) placeStyle = 'hidden';
  6951. }
  6952. }
  6953.  
  6954. if(placeStyle == 'visible')
  6955. {
  6956. if(uFP_filterAL)
  6957. {
  6958. if(lmObj.adLocked) placeStyle = 'hidden';
  6959. }
  6960. }
  6961.  
  6962. if(placeStyle == 'visible')
  6963. {
  6964. if(uFP_filterNoPhotos || uFP_filterWithPhotos)
  6965. {
  6966. let nPhotos = 0;
  6967. for(let loop=0; loop<lmObj.images.length; loop++)
  6968. {
  6969. if(lmObj.images[loop].attributes.approved) nPhotos++;
  6970. }
  6971. if((uFP_filterNoPhotos) && (nPhotos === 0)) placeStyle = 'hidden';
  6972. if((uFP_filterWithPhotos) && (nPhotos !== 0)) placeStyle = 'hidden';
  6973. }
  6974. }
  6975.  
  6976. if(placeStyle == 'visible')
  6977. {
  6978. if(uFP_filterNoLinks || uFP_filterWithLinks)
  6979. {
  6980. let nLinks = lmObj.externalProviderIDs.length;
  6981. if((uFP_filterNoLinks) && (nLinks === 0)) placeStyle = 'hidden';
  6982. if((uFP_filterWithLinks) && (nLinks !== 0)) placeStyle = 'hidden';
  6983. }
  6984. }
  6985.  
  6986. if(placeStyle == 'visible')
  6987. {
  6988. if(uFP_filterNoDescription || uFP_filterWithDescription)
  6989. {
  6990. let lDesc = lmObj.description.length;
  6991. if((uFP_filterNoDescription) && (lDesc === 0)) placeStyle = 'hidden';
  6992. if((uFP_filterWithDescription) && (lDesc !== 0)) placeStyle = 'hidden';
  6993. }
  6994. }
  6995.  
  6996. if(placeStyle == 'visible')
  6997. {
  6998. if((uFP_filterPrivate === true) && (lmObj.residential === true))
  6999. {
  7000. placeStyle = 'hidden';
  7001. }
  7002. else
  7003. {
  7004. for(let cat=0; cat<filterCats.length; cat++)
  7005. {
  7006. if(_.includes(lmObj.categories, filterCats[cat]))
  7007. {
  7008. placeStyle = 'hidden';
  7009. break;
  7010. }
  7011. }
  7012. }
  7013. }
  7014.  
  7015. if(placeStyle == 'visible')
  7016. {
  7017. if(uFP_filterNoKeyword || uFP_filterKeyword)
  7018. {
  7019. let venueName = lmObj.name.toLowerCase();
  7020. let noKeywordMatch = true;
  7021. if(uFP_NameKeyword === '')
  7022. {
  7023. noKeywordMatch = (venueName !== '');
  7024. }
  7025. else
  7026. {
  7027. noKeywordMatch = (venueName.indexOf(uFP_NameKeyword) === -1);
  7028. }
  7029.  
  7030. if(!noKeywordMatch && uFP_filterNoKeyword) placeStyle = 'hidden';
  7031. if(noKeywordMatch && uFP_filterKeyword) placeStyle = 'hidden';
  7032. }
  7033. }
  7034.  
  7035. if(placeStyle == 'visible')
  7036. {
  7037. if(filterNameID != null)
  7038. {
  7039. if(uFP_filterCreatedBy === true)
  7040. {
  7041. if(filterNameID != lmObj.createdBy) placeStyle = 'hidden';
  7042. }
  7043. if(uFP_filterEditedBy === true)
  7044. {
  7045. if(filterNameID != lmObj.updatedBy) placeStyle = 'hidden';
  7046. }
  7047. }
  7048. }
  7049. if(placeStyle == 'visible')
  7050. {
  7051. if(filterHideNameID != null)
  7052. {
  7053. if(uFP_filterHideCreatedBy === true)
  7054. {
  7055. if(filterHideNameID == lmObj.createdBy) placeStyle = 'hidden';
  7056. }
  7057. if(uFP_filterHideEditedBy === true)
  7058. {
  7059. if(filterHideNameID == lmObj.updatedBy) placeStyle = 'hidden';
  7060. }
  7061. }
  7062. }
  7063.  
  7064. if(uFP_invertFilters === true)
  7065. {
  7066. if(placeStyle == 'hidden') placeStyle = 'visible';
  7067. else placeStyle = 'hidden';
  7068. }
  7069. }
  7070.  
  7071. if((placeStyle == 'hidden') && (uFP_hidePURsForFilteredPlaces === true))
  7072. {
  7073. uroPURsToHide.push(lmObj.id);
  7074. }
  7075. }
  7076.  
  7077. let geoID = uroVenueLayer.features[v].geometry.id;
  7078. if(document.getElementById(geoID) !== null)
  7079. {
  7080. document.getElementById(geoID).style.visibility = placeStyle;
  7081. }
  7082. }
  7083.  
  7084. uro_uFP[uroEnums.FP_OPTS.filterUneditable] = uroUtils.GetCBChecked('_cbFilterUneditablePlaceUpdates');
  7085. uro_uFP[uroEnums.FP_OPTS.filterInsideManagedAreas] = uroUtils.GetCBChecked('_cbPURFilterInsideManagedAreas');
  7086. uro_uFP[uroEnums.FP_OPTS.excludeMyAreas] = uroUtils.GetCBChecked('_cbPURExcludeUserArea');
  7087. uro_uFP[uroEnums.FP_OPTS.filterLockRanked] = uroUtils.GetCBChecked('_cbFilterLockRankedPlaceUpdates');
  7088. uro_uFP[uroEnums.FP_OPTS.filterFlagged] = uroUtils.GetCBChecked("_cbFilterFlaggedPUR");
  7089. uro_uFP[uroEnums.FP_OPTS.filterNewPlace] = uroUtils.GetCBChecked("_cbFilterNewPlacePUR");
  7090. uro_uFP[uroEnums.FP_OPTS.filterUpdatedDetails] = uroUtils.GetCBChecked("_cbFilterUpdatedDetailsPUR");
  7091. uro_uFP[uroEnums.FP_OPTS.filterNewPhoto] = uroUtils.GetCBChecked("_cbFilterNewPhotoPUR");
  7092. uro_uFP[uroEnums.FP_OPTS.filterMinPURAge] = uroUtils.GetCBChecked('_cbEnablePURMinAgeFilter');
  7093. uro_uFP[uroEnums.FP_OPTS.filterMaxPURAge] = uroUtils.GetCBChecked('_cbEnablePURMaxAgeFilter');
  7094. uro_uFP[uroEnums.FP_OPTS.invertPURFilters] = uroUtils.GetCBChecked('_cbInvertPURFilters');
  7095. uro_uFP[uroEnums.FP_OPTS.leavePURGeos] = uroUtils.GetCBChecked('_cbLeavePURGeos');
  7096. uro_uFP[uroEnums.FP_OPTS.filterCFPhone] = uroUtils.GetCBChecked('_cbPURFilterCFPhone');
  7097. uro_uFP[uroEnums.FP_OPTS.filterCFName] = uroUtils.GetCBChecked('_cbPURFilterCFName');
  7098. uro_uFP[uroEnums.FP_OPTS.filterCFEntryExitPoints] = uroUtils.GetCBChecked('_cbPURFilterCFEntryExitPoints');
  7099. uro_uFP[uroEnums.FP_OPTS.filterCFOpeningHours] = uroUtils.GetCBChecked('_cbPURFilterCFOpeningHours');
  7100. uro_uFP[uroEnums.FP_OPTS.filterCFAliases] = uroUtils.GetCBChecked('_cbPURFilterCFAliases');
  7101. uro_uFP[uroEnums.FP_OPTS.filterCFServices] = uroUtils.GetCBChecked('_cbPURFilterCFServices');
  7102. uro_uFP[uroEnums.FP_OPTS.filterCFGeometry] = uroUtils.GetCBChecked('_cbPURFilterCFGeometry');
  7103. uro_uFP[uroEnums.FP_OPTS.filterCFHouseNumber] = uroUtils.GetCBChecked('_cbPURFilterCFHouseNumber');
  7104. uro_uFP[uroEnums.FP_OPTS.filterCFCategories] = uroUtils.GetCBChecked('_cbPURFilterCFCategories');
  7105. uro_uFP[uroEnums.FP_OPTS.filterCFDescription] = uroUtils.GetCBChecked('_cbPURFilterCFDescription');
  7106.  
  7107. uro_uFP[uroEnums.FP_OPTS.filterOnCFs] =
  7108. (
  7109. uro_uFP[uroEnums.FP_OPTS.filterCFPhone] ||
  7110. uro_uFP[uroEnums.FP_OPTS.filterCFName] ||
  7111. uro_uFP[uroEnums.FP_OPTS.filterCFEntryExitPoints] ||
  7112. uro_uFP[uroEnums.FP_OPTS.filterCFOpeningHours]
  7113. );
  7114. uro_uFP[uroEnums.FP_OPTS.filterOnCFs] =
  7115. (
  7116. uro_uFP[uroEnums.FP_OPTS.filterOnCFs] ||
  7117. uro_uFP[uroEnums.FP_OPTS.filterCFAliases] ||
  7118. uro_uFP[uroEnums.FP_OPTS.filterCFServices] ||
  7119. uro_uFP[uroEnums.FP_OPTS.filterCFGeometry]
  7120. );
  7121. uro_uFP[uroEnums.FP_OPTS.filterOnCFs] =
  7122. (
  7123. uro_uFP[uroEnums.FP_OPTS.filterOnCFs] ||
  7124. uro_uFP[uroEnums.FP_OPTS.filterCFHouseNumber] ||
  7125. uro_uFP[uroEnums.FP_OPTS.filterCFCategories] ||
  7126. uro_uFP[uroEnums.FP_OPTS.filterCFDescription]
  7127. );
  7128.  
  7129. uro_uFP[uroEnums.FP_OPTS.thresholdMinPURDays] = uroUtils.GetElmValue('_inputPURFilterMinDays');
  7130. uro_uFP[uroEnums.FP_OPTS.thresholdMaxPURDays] = uroUtils.GetElmValue('_inputPURFilterMaxDays');
  7131. uro_uFP[uroEnums.FP_OPTS.isLoggedIn] = W.loginManager.isLoggedIn();
  7132. uro_uFP[uroEnums.FP_OPTS.userRank] = W.loginManager.user.attributes.rank;
  7133.  
  7134. uro_uFP[uroEnums.FP_OPTS.filterInsideManagedAreas] = uro_uFP[uroEnums.FP_OPTS.filterInsideManagedAreas] && (uroGetManagedAreas() !== 0);
  7135. if(uroUtils.GetCBChecked('_cbPURExcludeUserArea') == true)
  7136. {
  7137. uroIgnoreAreasUserID = W.loginManager.user.attributes.id;
  7138. }
  7139.  
  7140. uroPrepForFilterPlaceMarker(uroLayers.ID.PUR, uFP_masterEnable);
  7141. uroPrepForFilterPlaceMarker(uroLayers.ID.PPUR, uFP_masterEnable);
  7142. uroPrepForFilterPlaceMarker(uroLayers.ID.RPUR, uFP_masterEnable);
  7143.  
  7144. uroDBG.PerfMon(pmFunction, pmTStart);
  7145. }
  7146. function uroPrepForFilterPlaceMarker(markerType, masterEnable)
  7147. {
  7148. if(uroLayers.layers[markerType].l?.getVisibility() === true)
  7149. {
  7150. let pu;
  7151. let mObj;
  7152. let vObj;
  7153. let idList = uroGetMarkerIDs(markerType);
  7154. for(pu of idList)
  7155. {
  7156. mObj = uroGetMarker(markerType, pu);
  7157. if(mObj !== null)
  7158. {
  7159. vObj = W.model.venues.objects[pu];
  7160. uroFilterPlaceMarker(mObj, vObj, masterEnable);
  7161. }
  7162. }
  7163. }
  7164. }
  7165. function uroGetClosestSegmentToPoint(p)
  7166. {
  7167. let retval = null;
  7168. if(W.map.getZoom() >= 16)
  7169. {
  7170. let minDist = 99999999;
  7171.  
  7172. for(let s in W.model.segments.objects)
  7173. {
  7174. if(W.model.segments.objects.hasOwnProperty(s))
  7175. {
  7176. let seg = W.model.segments.getObjectById(s);
  7177. let dist = seg.attributes.geometry.distanceTo(p);
  7178. if(dist < minDist)
  7179. {
  7180. minDist = dist;
  7181. retval = s;
  7182. }
  7183. }
  7184. }
  7185. }
  7186. return retval;
  7187. }
  7188. function uroIsCamSpeedValid(camObj)
  7189. {
  7190. let retval = true;
  7191.  
  7192. let cPoint = camObj.attributes.geometry.getCentroid();
  7193. let nSeg = uroGetClosestSegmentToPoint(cPoint);
  7194. if(nSeg !== null)
  7195. {
  7196. let fwdSpeed = W.model.segments.getObjectById(nSeg).attributes.fwdMaxSpeed;
  7197. let revSpeed = W.model.segments.getObjectById(nSeg).attributes.revMaxSpeed;
  7198. let camSpeed = camObj.attributes.speed;
  7199. if(W.model.isImperial == true)
  7200. {
  7201. fwdSpeed = Math.round(fwdSpeed / 1.609);
  7202. revSpeed = Math.round(revSpeed / 1.609);
  7203. camSpeed = Math.round(camSpeed / 1.609);
  7204. }
  7205. if((camSpeed !== fwdSpeed) && (camSpeed !== revSpeed))
  7206. {
  7207. retval = false;
  7208. }
  7209. }
  7210.  
  7211. return retval;
  7212. }
  7213. function uroFilterCameras()
  7214. {
  7215. let pmTStart = performance.now();
  7216. let pmFunction = "uroFilterCameras";
  7217.  
  7218. if(uroFilterPreamble() === false)
  7219. {
  7220. return;
  7221. }
  7222.  
  7223. if(uroMouseIsDown === false) W.map.camerasLayer.redraw();
  7224.  
  7225. if(uroIsFilteringEnabled(false) === true)
  7226. {
  7227. uroUpdateEditorList(W.model.cameras.objects, '_selectCameraUserID', true, true, false, false);
  7228. let tbUserName = uroUtils.GetElmValue('_textCameraEditor');
  7229. let selector = document.getElementById('_selectCameraUserID');
  7230. let filterNameID = null;
  7231. if(selector.selectedIndex > 0)
  7232. {
  7233. let selUserName = document.getElementById('_selectCameraUserID').selectedOptions[0].innerHTML;
  7234. if(selUserName == tbUserName)
  7235. {
  7236. filterNameID = document.getElementById('_selectCameraUserID').selectedOptions[0].value;
  7237. }
  7238. }
  7239. filterNameID = uroGetUserID(filterNameID, tbUserName);
  7240.  
  7241. let isChecked_cbShowOnlyCamsCreatedBy = uroUtils.GetCBChecked('_cbShowOnlyCamsCreatedBy');
  7242. let isChecked_cbShowOnlyCamsEditedBy = uroUtils.GetCBChecked('_cbShowOnlyCamsEditedBy');
  7243. let isChecked_cbShowOnlyMyCams = uroUtils.GetCBChecked('_cbShowOnlyMyCams');
  7244. let isChecked_cbShowWorldCams = uroUtils.GetCBChecked('_cbShowWorldCams');
  7245. let isChecked_cbShowUSACams = uroUtils.GetCBChecked('_cbShowUSACams');
  7246. let isChecked_cbShowNonWorldCams = uroUtils.GetCBChecked('_cbShowNonWorldCams');
  7247. let isChecked_cbShowSpeedCams = uroUtils.GetCBChecked('_cbShowSpeedCams');
  7248. let isChecked_cbShowRedLightCams = uroUtils.GetCBChecked('_cbShowRedLightCams');
  7249. let isChecked_cbShowDummyCams = uroUtils.GetCBChecked('_cbShowDummyCams');
  7250. let isChecked_cbShowIfNoSpeedSet = uroUtils.GetCBChecked('_cbShowIfNoSpeedSet');
  7251. let isChecked_cbShowIfSpeedSet = uroUtils.GetCBChecked('_cbShowIfSpeedSet');
  7252. let isChecked_cbShowIfInvalidSpeedSet = uroUtils.GetCBChecked('_cbShowIfInvalidSpeedSet');
  7253. let isChecked_cbShowRLCIfNoSpeedSet = uroUtils.GetCBChecked('_cbShowRLCIfNoSpeedSet');
  7254. let isChecked_cbShowRLCIfNonZeroSpeedSet = uroUtils.GetCBChecked('_cbShowRLCIfNonZeroSpeedSet');
  7255. let isChecked_cbShowRLCIfZeroSpeedSet = uroUtils.GetCBChecked('_cbShowRLCIfZeroSpeedSet');
  7256. let isChecked_cbHideCreatedByMe = uroUtils.GetCBChecked('_cbHideCreatedByMe');
  7257. let isChecked_cbHideCreatedByRank0 = uroUtils.GetCBChecked('_cbHideCreatedByRank0');
  7258. let isChecked_cbHideCreatedByRank1 = uroUtils.GetCBChecked('_cbHideCreatedByRank1');
  7259. let isChecked_cbHideCreatedByRank2 = uroUtils.GetCBChecked('_cbHideCreatedByRank2');
  7260. let isChecked_cbHideCreatedByRank3 = uroUtils.GetCBChecked('_cbHideCreatedByRank3');
  7261. let isChecked_cbHideCreatedByRank4 = uroUtils.GetCBChecked('_cbHideCreatedByRank4');
  7262. let isChecked_cbHideCreatedByRank5 = uroUtils.GetCBChecked('_cbHideCreatedByRank5');
  7263. let isChecked_cbHideUpdatedByMe = uroUtils.GetCBChecked('_cbHideUpdatedByMe');
  7264. let isChecked_cbHideUpdatedByRank0 = uroUtils.GetCBChecked('_cbHideUpdatedByRank0');
  7265. let isChecked_cbHideUpdatedByRank1 = uroUtils.GetCBChecked('_cbHideUpdatedByRank1');
  7266. let isChecked_cbHideUpdatedByRank2 = uroUtils.GetCBChecked('_cbHideUpdatedByRank2');
  7267. let isChecked_cbHideUpdatedByRank3 = uroUtils.GetCBChecked('_cbHideUpdatedByRank3');
  7268. let isChecked_cbHideUpdatedByRank4 = uroUtils.GetCBChecked('_cbHideUpdatedByRank4');
  7269. let isChecked_cbHideUpdatedByRank5 = uroUtils.GetCBChecked('_cbHideUpdatedByRank5');
  7270. let isChecked_HideManualLockedCams = uroUtils.GetCBChecked('_cbHideManualLockedCams');
  7271. let isChecked_cbHideCWLCams = uroUtils.GetCBChecked('_cbHideCWLCams');
  7272. let isChecked_cbHighlightInsteadOfHideCams = uroUtils.GetCBChecked('_cbHighlightInsteadOfHideCams');
  7273. let isChecked_InvertFiltere = uroUtils.GetCBChecked('_cbInvertCamFilters');
  7274.  
  7275. let nCameras = uroLayers.layers[uroLayers.ID.cam].l.features.length;
  7276. for (let i = 0; i < nCameras; ++i)
  7277. {
  7278. let uroCamUpdater = '';
  7279. let uroCamUpdaterRank = -1;
  7280. let uroCamCreator = '';
  7281. let uroCamCreatorRank = -1;
  7282. let wf = uroLayers.layers[uroLayers.ID.cam].l.features[i].attributes.wazeFeature;
  7283. // When a camera is selected, the alignment/positioning UI elements get added to features[].
  7284. // As these elements aren't camera markers and therefore have no attributes, we need to
  7285. // ignore them to prevent errors in the filtering code below...
  7286. if(wf !== undefined)
  7287. {
  7288. let uroCam = wf._wmeObject;
  7289. let uroCamStyle = 'visible';
  7290.  
  7291. if(uroCam.attributes.createdBy !== null)
  7292. {
  7293. if(W.model.users.objects[uroCam.attributes.createdBy] != null)
  7294. {
  7295. uroCamCreator = W.model.users.objects[uroCam.attributes.createdBy].attributes.userName;
  7296. uroCamCreatorRank = W.model.users.objects[uroCam.attributes.createdBy].attributes.rank;
  7297. }
  7298. }
  7299.  
  7300. if(uroCam.attributes.updatedBy !== null)
  7301. {
  7302. if(W.model.users.objects[uroCam.attributes.updatedBy] != null)
  7303. {
  7304. uroCamUpdater = W.model.users.objects[uroCam.attributes.updatedBy].attributes.userName;
  7305. uroCamUpdaterRank = W.model.users.objects[uroCam.attributes.updatedBy].attributes.rank;
  7306. }
  7307. }
  7308.  
  7309. let uroCamType = uroCam.attributes.type;
  7310. let camIsAutoLocked = (uroCam.attributes.lockRank === null);
  7311.  
  7312. if(isChecked_HideManualLockedCams === true)
  7313. {
  7314. if(camIsAutoLocked === false) uroCamStyle = 'hidden';
  7315. }
  7316.  
  7317. if(filterNameID != null)
  7318. {
  7319. if(isChecked_cbShowOnlyCamsCreatedBy === true)
  7320. {
  7321. if(filterNameID != uroCam.attributes.createdBy) uroCamStyle = 'hidden';
  7322. }
  7323. if(isChecked_cbShowOnlyCamsEditedBy === true)
  7324. {
  7325. if(filterNameID != uroCam.attributes.updatedBy) uroCamStyle = 'hidden';
  7326. }
  7327. }
  7328.  
  7329. if(isChecked_cbShowOnlyMyCams === true)
  7330. {
  7331. if((uroUserID != uroCam.attributes.createdBy)&&(uroUserID != uroCam.attributes.updatedBy)) uroCamStyle = 'hidden';
  7332. }
  7333.  
  7334. if((isChecked_cbShowWorldCams === false) || (isChecked_cbShowUSACams === false) || (isChecked_cbShowNonWorldCams === false))
  7335. {
  7336. let posWorld = uroCamCreator.indexOf('world_');
  7337. let posUSA = uroCamCreator.indexOf('usa_');
  7338.  
  7339. if((isChecked_cbShowWorldCams === false) && (posWorld === 0)) uroCamStyle = 'hidden';
  7340. if((isChecked_cbShowUSACams === false) && (posUSA === 0)) uroCamStyle = 'hidden';
  7341. if((isChecked_cbShowNonWorldCams === false) && (posWorld !== 0) && (posUSA !== 0)) uroCamStyle = 'hidden';
  7342. }
  7343.  
  7344. if((isChecked_cbShowSpeedCams === false) || (isChecked_cbShowRedLightCams === false) || (isChecked_cbShowDummyCams === false))
  7345. {
  7346. if((isChecked_cbShowSpeedCams === false) && (uroCamType == 2)) uroCamStyle = 'hidden';
  7347. if((isChecked_cbShowRedLightCams === false) && (uroCamType == 4)) uroCamStyle = 'hidden';
  7348. if((isChecked_cbShowDummyCams === false) && (uroCamType == 3)) uroCamStyle = 'hidden';
  7349. }
  7350.  
  7351. if((isChecked_cbShowSpeedCams === true) && (uroCamType == 2))
  7352. {
  7353. if((isChecked_cbShowIfNoSpeedSet === false) && (uroCam.attributes.speed === null)) uroCamStyle = 'hidden';
  7354. if((isChecked_cbShowIfSpeedSet === false) && (uroCam.attributes.speed !== null)) uroCamStyle = 'hidden';
  7355. if(isChecked_cbShowIfInvalidSpeedSet === false)
  7356. {
  7357. if(uroIsCamSpeedValid(uroCam) === false)
  7358. {
  7359. uroCamStyle = 'hidden';
  7360. }
  7361. }
  7362. }
  7363.  
  7364. if((isChecked_cbShowRedLightCams === true) && (uroCamType == 4))
  7365. {
  7366. if((isChecked_cbShowRLCIfNoSpeedSet === false) && (uroCam.attributes.speed === null)) uroCamStyle = 'hidden';
  7367. if((isChecked_cbShowRLCIfNonZeroSpeedSet === false) && (uroCam.attributes.speed > 0)) uroCamStyle = 'hidden';
  7368. if((isChecked_cbShowRLCIfZeroSpeedSet === false) && (uroCam.attributes.speed === 0)) uroCamStyle = 'hidden';
  7369. }
  7370.  
  7371. if(isChecked_cbHideCreatedByMe === true)
  7372. {
  7373. if(uroUserID == uroCam.attributes.createdBy) uroCamStyle = 'hidden';
  7374. }
  7375. if((isChecked_cbHideCreatedByRank0 === true) && (uroCamCreatorRank === 0)) uroCamStyle = 'hidden';
  7376. if((isChecked_cbHideCreatedByRank1 === true) && (uroCamCreatorRank == 1)) uroCamStyle = 'hidden';
  7377. if((isChecked_cbHideCreatedByRank2 === true) && (uroCamCreatorRank == 2)) uroCamStyle = 'hidden';
  7378. if((isChecked_cbHideCreatedByRank3 === true) && (uroCamCreatorRank == 3)) uroCamStyle = 'hidden';
  7379. if((isChecked_cbHideCreatedByRank4 === true) && (uroCamCreatorRank == 4)) uroCamStyle = 'hidden';
  7380. if((isChecked_cbHideCreatedByRank5 === true) && (uroCamCreatorRank == 5)) uroCamStyle = 'hidden';
  7381.  
  7382. if(isChecked_cbHideUpdatedByMe === true)
  7383. {
  7384. if(uroUserID == uroCam.attributes.updatedBy) uroCamStyle = 'hidden';
  7385. }
  7386. if((isChecked_cbHideUpdatedByRank0 === true) && (uroCamUpdaterRank === 0)) uroCamStyle = 'hidden';
  7387. if((isChecked_cbHideUpdatedByRank1 === true) && (uroCamUpdaterRank == 1)) uroCamStyle = 'hidden';
  7388. if((isChecked_cbHideUpdatedByRank2 === true) && (uroCamUpdaterRank == 2)) uroCamStyle = 'hidden';
  7389. if((isChecked_cbHideUpdatedByRank3 === true) && (uroCamUpdaterRank == 3)) uroCamStyle = 'hidden';
  7390. if((isChecked_cbHideUpdatedByRank4 === true) && (uroCamUpdaterRank == 4)) uroCamStyle = 'hidden';
  7391. if((isChecked_cbHideUpdatedByRank5 === true) && (uroCamUpdaterRank == 5)) uroCamStyle = 'hidden';
  7392.  
  7393. if((isChecked_cbHideCWLCams === true) && (uroOWL.IsCamOnWatchList(uroCam.attributes.id) != -1)) uroCamStyle = 'hidden';
  7394.  
  7395. if(isChecked_InvertFiltere === true)
  7396. {
  7397. if(uroCamStyle == "hidden")
  7398. {
  7399. uroCamStyle = "";
  7400. }
  7401. else
  7402. {
  7403. uroCamStyle = "hidden";
  7404. }
  7405. }
  7406.  
  7407. let uroCamGeometryID = uroLayers.layers[uroLayers.ID.cam].l.features[i].geometry.id;
  7408. let svgElm = document.getElementById(uroCamGeometryID);
  7409.  
  7410. if(svgElm !== null)
  7411. {
  7412. let origImage;
  7413. if(uroCamStyle == "hidden")
  7414. {
  7415. if(isChecked_cbHighlightInsteadOfHideCams === true)
  7416. {
  7417. // set the "highlight" camera image here...
  7418. let hrefImage = svgElm.getAttribute("xlink:href");
  7419. origImage = svgElm.getAttribute("origImage");
  7420. if((hrefImage === origImage) || (origImage === null))
  7421. {
  7422. svgElm.setAttribute("origImage", hrefImage);
  7423. svgElm.setAttribute("xlink:href", uroImages.HighlightedCameraImages[(uroCamType-2)]);
  7424.  
  7425. svgElm.addEventListener("mouseover", uroMarkers.MouseOver, false);
  7426. svgElm.addEventListener("mouseout", uroMarkers.MouseOut, false);
  7427. }
  7428. }
  7429. else
  7430. {
  7431. svgElm.remove();
  7432. }
  7433. }
  7434. else
  7435. {
  7436. // restore the original camera image here...
  7437. if(svgElm.getAttribute("origImage") !== null)
  7438. {
  7439. origImage = svgElm.getAttribute("origImage");
  7440. svgElm.setAttribute("xlink:href", origImage);
  7441. svgElm.removeAttribute("origImage");
  7442. }
  7443. }
  7444. }
  7445. }
  7446. }
  7447. }
  7448. uroDBG.PerfMon(pmFunction, pmTStart);
  7449. }
  7450. function uroFilterMapComments()
  7451. {
  7452. let pmTStart = performance.now();
  7453. let pmFunction = "uroFilterMapComments";
  7454.  
  7455. if(uroFilterPreamble() === false) return;
  7456.  
  7457. let uFURs_masterEnable = uroIsFilteringEnabled(false);
  7458. let filterDescMustBePresent = uroUtils.GetCBChecked('_cbMCDescriptionMustBePresent');
  7459. let filterDescMustBeAbsent = uroUtils.GetCBChecked('_cbMCDescriptionMustBeAbsent');
  7460. let filterKeywordMustBePresent = uroUtils.GetCBChecked('_cbMCEnableKeywordMustBePresent');
  7461. let filterKeywordMustBeAbsent = uroUtils.GetCBChecked('_cbMCEnableKeywordMustBeAbsent');
  7462. let filterMyFollowed = uroUtils.GetCBChecked('_cbMCHideMyFollowed');
  7463. let filterMyUnfollowed = uroUtils.GetCBChecked('_cbMCHideMyUnfollowed');
  7464. let filterRoadworks = uroUtils.GetCBChecked('_cbMCFilterRoadworks');
  7465. let filterConstruction = uroUtils.GetCBChecked('_cbMCFilterConstruction');
  7466. let filterClosure = uroUtils.GetCBChecked('_cbMCFilterClosure');
  7467. let filterEvent = uroUtils.GetCBChecked('_cbMCFilterEvent');
  7468. let filterNote = uroUtils.GetCBChecked('_cbMCFilterNote');
  7469. let filterWSLM = uroUtils.GetCBChecked('_cbMCFilterWSLM');
  7470. let filterBOG = uroUtils.GetCBChecked('_cbMCFilterBOG');
  7471. let filterDifficult = uroUtils.GetCBChecked('_cbMCFilterDifficult');
  7472. let invertFilters = uroUtils.GetCBChecked('_cbInvertMCFilter');
  7473. let keywordPresent = uroUtils.GetElmValue('_textMCKeywordPresent');
  7474. let keywordAbsent = uroUtils.GetElmValue('_textMCKeywordAbsent');
  7475. let caseInsensitive = uroUtils.GetCBChecked('_cbMCCaseInsensitive');
  7476. let filterCommentsMustBePresent = uroUtils.GetCBChecked('_cbMCCommentsMustBePresent');
  7477. let filterCommentsMustBeAbsent = uroUtils.GetCBChecked('_cbMCCommentsMustBeAbsent');
  7478.  
  7479. let filterExpiryMustBePresent = uroUtils.GetCBChecked('_cbMCExpiryMustBePresent');
  7480. let filterExpiryMustBeAbsent = uroUtils.GetCBChecked('_cbMCExpiryMustBeAbsent');
  7481. let filterByCreatorEnable = uroUtils.GetCBChecked('_cbMCCreatorIDFilter');
  7482. let filterL1 = uroUtils.GetCBChecked('_cbHideMCRank0');
  7483. let filterL2 = uroUtils.GetCBChecked('_cbHideMCRank1');
  7484. let filterL3 = uroUtils.GetCBChecked('_cbHideMCRank2');
  7485. let filterL4 = uroUtils.GetCBChecked('_cbHideMCRank3');
  7486. let filterL5 = uroUtils.GetCBChecked('_cbHideMCRank4');
  7487. let filterL6 = uroUtils.GetCBChecked('_cbHideMCRank5');
  7488. let filterWRCMC = uroUtils.GetCBChecked('_cbHideWRCMCs');
  7489. let selectorCreator = document.getElementById('_selectMCCreatorID');
  7490.  
  7491. if(filterByCreatorEnable === false)
  7492. {
  7493. while(selectorCreator.options.length > 0)
  7494. {
  7495. selectorCreator.options.remove(0);
  7496. }
  7497. }
  7498. let creatorUser = null;
  7499. if(filterByCreatorEnable === true)
  7500. {
  7501. if(selectorCreator.options.length === 0)
  7502. {
  7503. uroUpdateEditorList(W.model.mapComments.objects, '_selectMCCreatorID', true, false, false, false);
  7504. }
  7505. if(selectorCreator.selectedOptions[0] != null)
  7506. {
  7507. creatorUser = parseInt(selectorCreator.selectedOptions[0].value);
  7508. }
  7509. }
  7510.  
  7511. for (let mcIdx = 0; mcIdx < uroMCLayer.features.length; mcIdx++)
  7512. {
  7513. {
  7514. let mcObj = uroMCLayer?.features[mcIdx]?.attributes?.wazeFeature?._wmeObject;
  7515. if(mcObj !== undefined)
  7516. {
  7517. let desc = '';
  7518. if(mcObj.attributes.subject !== null) desc += mcObj.attributes.subject.replace(/<\/?[^>]+(>|$)/g, "");
  7519. if(mcObj.attributes.body !== null) desc += mcObj.attributes.body.replace(/<\/?[^>]+(>|$)/g, "");
  7520. let nComments = mcObj.attributes.conversation.length;
  7521. if(nComments > 0)
  7522. {
  7523. for(let cIdx=0; cIdx < nComments; cIdx++)
  7524. {
  7525. desc += mcObj.attributes.conversation[cIdx].text.replace(/<\/?[^>]+(>|$)/g, "");
  7526. }
  7527. }
  7528.  
  7529. let mcStyle = 'visible';
  7530. if(uroIgnore.IsOnList(mcObj.attributes.id)) mcStyle = 'hidden';
  7531. if(uFURs_masterEnable === true)
  7532. {
  7533. let ukroadworks_ur = false;
  7534. let construction_ur = false;
  7535. let closure_ur = false;
  7536. let event_ur = false;
  7537. let note_ur = false;
  7538. let wslm_ur = false;
  7539. let bog_ur = false;
  7540. let difficult_ur = false;
  7541.  
  7542. let filterByNotIncludedKeyword = false;
  7543. let filterByIncludedKeyword = true;
  7544.  
  7545. let customType = uroGetCustomType(null, "mc", desc);
  7546. if(customType === 0) ukroadworks_ur = true;
  7547. else if(customType === 1) construction_ur = true;
  7548. else if(customType === 2) closure_ur = true;
  7549. else if(customType === 3) event_ur = true;
  7550. else if(customType === 4) note_ur = true;
  7551. else if(customType === 5) wslm_ur = true;
  7552. else if(customType === 6) bog_ur = true;
  7553. else if(customType === 7) difficult_ur = true;
  7554.  
  7555. let rank = mcObj.attributes.lockRank;
  7556. let expiry = mcObj.attributes.endDate;
  7557.  
  7558. // keywords
  7559. if(mcStyle == 'visible')
  7560. {
  7561. if(filterDescMustBePresent === true)
  7562. {
  7563. if(desc === '') mcStyle = 'hidden';
  7564. }
  7565. if(filterDescMustBeAbsent === true)
  7566. {
  7567. if(desc !== '') mcStyle = 'hidden';
  7568. }
  7569.  
  7570. if(filterCommentsMustBePresent === true)
  7571. {
  7572. if(nComments === 0) mcStyle = 'hidden';
  7573. }
  7574. if(filterCommentsMustBeAbsent === true)
  7575. {
  7576. if(nComments > 0) mcStyle = 'hidden';
  7577. }
  7578.  
  7579. if(filterKeywordMustBePresent === true)
  7580. {
  7581. let keywordIsPresentInDesc = uroUtils.KeywordPresent(desc,keywordPresent,caseInsensitive);
  7582. filterByIncludedKeyword = (filterByIncludedKeyword && (!keywordIsPresentInDesc));
  7583. }
  7584. if(filterKeywordMustBeAbsent === true)
  7585. {
  7586. let keywordIsAbsentInDesc = uroUtils.KeywordPresent(desc,keywordAbsent,caseInsensitive);
  7587. filterByNotIncludedKeyword = (filterByNotIncludedKeyword || keywordIsAbsentInDesc);
  7588. }
  7589.  
  7590. filterByNotIncludedKeyword = (filterByNotIncludedKeyword && filterKeywordMustBeAbsent);
  7591. filterByIncludedKeyword = (filterByIncludedKeyword && filterKeywordMustBePresent);
  7592. if(filterByNotIncludedKeyword || filterByIncludedKeyword)
  7593. {
  7594. mcStyle = 'hidden';
  7595. }
  7596.  
  7597. }
  7598.  
  7599. //lock rank
  7600. if(mcStyle == 'visible')
  7601. {
  7602. if((filterL1 === true) && (rank == 0)) mcStyle = 'hidden';
  7603. if((filterL2 === true) && (rank == 1)) mcStyle = 'hidden';
  7604. if((filterL3 === true) && (rank == 2)) mcStyle = 'hidden';
  7605. if((filterL4 === true) && (rank == 3)) mcStyle = 'hidden';
  7606. if((filterL5 === true) && (rank == 4)) mcStyle = 'hidden';
  7607. if((filterL6 === true) && (rank == 5)) mcStyle = 'hidden';
  7608. }
  7609.  
  7610. // expiry
  7611. if(mcStyle == 'visible')
  7612. {
  7613. if((filterExpiryMustBePresent === true) && (expiry === null)) mcStyle = 'hidden';
  7614. if((filterExpiryMustBeAbsent === true) && (expiry != null)) mcStyle = 'hidden';
  7615. }
  7616.  
  7617. // is following?
  7618. if(mcStyle == 'visible')
  7619. {
  7620. if(mcObj.attributes.isFollowing === true)
  7621. {
  7622. if(filterMyFollowed === true) mcStyle = 'hidden';
  7623. }
  7624. else
  7625. {
  7626. if(filterMyUnfollowed === true) mcStyle = 'hidden';
  7627. }
  7628. }
  7629.  
  7630. if(mcStyle == 'visible')
  7631. {
  7632. if(creatorUser !== null)
  7633. {
  7634. if(mcObj.attributes.createdBy != creatorUser) mcStyle = 'hidden';
  7635. }
  7636. if(filterWRCMC === true)
  7637. {
  7638. if(mcObj.attributes.createdBy == 304740435) mcStyle = 'hidden';
  7639. }
  7640. }
  7641.  
  7642. // custom tags
  7643. if(mcStyle == 'visible')
  7644. {
  7645. if(ukroadworks_ur === true)
  7646. {
  7647. if(filterRoadworks === true) mcStyle = 'hidden';
  7648. }
  7649. else if(construction_ur === true)
  7650. {
  7651. if(filterConstruction === true) mcStyle = 'hidden';
  7652. }
  7653. else if(closure_ur === true)
  7654. {
  7655. if(filterClosure === true) mcStyle = 'hidden';
  7656. }
  7657. else if(event_ur === true)
  7658. {
  7659. if(filterEvent === true) mcStyle = 'hidden';
  7660. }
  7661. else if(note_ur === true)
  7662. {
  7663. if(filterNote === true) mcStyle = 'hidden';
  7664. }
  7665. else if(wslm_ur === true)
  7666. {
  7667. if(filterWSLM === true) mcStyle = 'hidden';
  7668. }
  7669. else if(bog_ur === true)
  7670. {
  7671. if(filterBOG === true) mcStyle = 'hidden';
  7672. }
  7673. else if(difficult_ur === true)
  7674. {
  7675. if(filterDifficult === true) mcStyle = 'hidden';
  7676. }
  7677.  
  7678. if(invertFilters === true)
  7679. {
  7680. if(mcStyle == 'hidden') mcStyle = 'visible';
  7681. else mcStyle = 'hidden';
  7682. }
  7683. }
  7684. }
  7685.  
  7686. let geoID = uroMCLayer.features[mcIdx].geometry.id;
  7687. if(document.getElementById(geoID) !== null)
  7688. {
  7689. document.getElementById(geoID).style.visibility = mcStyle;
  7690. }
  7691. }
  7692. }
  7693. }
  7694. uroDBG.PerfMon(pmFunction, pmTStart);
  7695. }
  7696. function uroFilterURs_onObjectsChanged()
  7697. {
  7698. if(uroFilterPreamble())
  7699. {
  7700. if(uroURDialogIsOpen === true)
  7701. {
  7702. uroFilterURs();
  7703. }
  7704. }
  7705. }
  7706. function uroFilterURs_onObjectsAdded()
  7707. {
  7708. if(uroFilterPreamble())
  7709. {
  7710. }
  7711. }
  7712. function uroFilterURs_onObjectsRemoved()
  7713. {
  7714. if(uroFilterPreamble())
  7715. {
  7716. }
  7717. }
  7718. function uroGetManagedAreas()
  7719. {
  7720. uroManagedAreas = [];
  7721. uroIgnoreAreasUserID = null;
  7722.  
  7723. for(let maObj in W.model.managedAreas.objects)
  7724. {
  7725. if(W.model.managedAreas.objects.hasOwnProperty(maObj))
  7726. {
  7727. uroManagedAreas.push(W.model.managedAreas.objects[maObj]);
  7728. }
  7729. }
  7730. return uroManagedAreas.length;
  7731. }
  7732. function uroCheckGeometryWithinManagedAreas(geo)
  7733. {
  7734. let retval = false;
  7735. let ignoreUserMA = false;
  7736.  
  7737. // If we're ignoring the user's managed area, then we first check to see if
  7738. // the geopoint lies within that - if so then we can skip checking all the
  7739. // other areas in the list...
  7740. if(uroIgnoreAreasUserID !== null)
  7741. {
  7742. for(let uma = 0; uma < uroManagedAreas.length; ++uma)
  7743. {
  7744. if(uroIgnoreAreasUserID == uroManagedAreas[uma].attributes.userID)
  7745. {
  7746. ignoreUserMA = uroContainsPoint(uroManagedAreas[uma].attributes.geoJSONGeometry.coordinates[0], geo);
  7747. break;
  7748. }
  7749. }
  7750. }
  7751.  
  7752. // Point either isn't within the user's area, or we're not ignoring it, so
  7753. // check the rest of the areas in the list
  7754. if(ignoreUserMA == false)
  7755. {
  7756. for(let ma = 0; ma < uroManagedAreas.length; ++ma)
  7757. {
  7758. if(uroIgnoreAreasUserID != uroManagedAreas[ma].attributes.userID)
  7759. {
  7760. retval = uroContainsPoint(uroManagedAreas[ma].attributes.geoJSONGeometry.coordinates[0], geo);
  7761. break;
  7762. }
  7763. }
  7764. }
  7765.  
  7766. return retval;
  7767. }
  7768. function uroGetURDriveGeoms()
  7769. {
  7770. let retval = [];
  7771.  
  7772. for (let urobj in W.model.mapUpdateRequests.objects)
  7773. {
  7774. if(W.model.mapUpdateRequests.objects.hasOwnProperty(urobj))
  7775. {
  7776. let ureq = W.model.mapUpdateRequests.objects[urobj];
  7777. let ureqID = ureq.attributes.id;
  7778.  
  7779. let hasGeo = false;
  7780. let thisRet = [];
  7781. thisRet.push(ureqID);
  7782. thisRet.push(null);
  7783. thisRet.push([]);
  7784.  
  7785. let latMin = 9999;
  7786. let latMax = -9999;
  7787. let lonMin = 9999;
  7788. let lonMax = -9999;
  7789.  
  7790. let urs = W.model.updateRequestSessions.objects[ureqID];
  7791. if((urs !== undefined) && (urs.attributes.driveGeometry !== undefined))
  7792. {
  7793. let cPairs = [];
  7794. for(let i = 0; i < urs.attributes.driveGeometry.coordinates.length; ++i)
  7795. {
  7796. for(let j = 0; j < urs.attributes.driveGeometry.coordinates[i].length; ++j)
  7797. {
  7798. if((i === 0) || (j > 0))
  7799. {
  7800. let coords = urs.attributes.driveGeometry.coordinates[i][j];
  7801. cPairs.push(coords);
  7802.  
  7803. if(coords[0] > lonMax)
  7804. {
  7805. lonMax = coords[0];
  7806. }
  7807. if(coords[0] < lonMin)
  7808. {
  7809. lonMin = coords[0];
  7810. }
  7811. if(coords[1] > latMax)
  7812. {
  7813. latMax = coords[1];
  7814. }
  7815. if(coords[1] < latMin)
  7816. {
  7817. latMin = coords[1];
  7818. }
  7819.  
  7820. hasGeo = true;
  7821. }
  7822. }
  7823. }
  7824. let bbox = [];
  7825. bbox.push(lonMin);
  7826. bbox.push(lonMax);
  7827. bbox.push(latMin);
  7828. bbox.push(latMax);
  7829. thisRet.push(bbox);
  7830. thisRet.push(cPairs);
  7831. }
  7832.  
  7833. if(hasGeo === true)
  7834. {
  7835. retval.push(thisRet);
  7836. }
  7837. }
  7838. }
  7839. return retval;
  7840. }
  7841. function uroCompareDriveGeos(geoA, geoB)
  7842. {
  7843. const matchLength = 5;
  7844. let retval = false;
  7845.  
  7846. if((geoA.length >= matchLength) && (geoB.length >= matchLength))
  7847. {
  7848. for(let i = 0; i < (geoA.length - matchLength); ++i)
  7849. {
  7850. for(let j = 0; j < (geoB.length - matchLength); ++j)
  7851. {
  7852. if((geoA[i][0] == geoB[j][0]) && (geoA[i][1] == geoB[j][1]))
  7853. {
  7854. retval = true;
  7855. for(let k = 1; k < matchLength; ++k)
  7856. {
  7857. if((geoA[i+k][0] != geoB[j+k][0]) || (geoA[i+k][1] != geoB[j+k][1]))
  7858. {
  7859. retval = false;
  7860. break;
  7861. }
  7862. }
  7863. }
  7864. if(retval === true)
  7865. {
  7866. break;
  7867. }
  7868. }
  7869.  
  7870. if(retval === true)
  7871. {
  7872. break;
  7873. }
  7874. }
  7875. }
  7876. return retval;
  7877. }
  7878. function uroCompareDriveBBoxes(bbA, bbB)
  7879. {
  7880. let retval = true;
  7881.  
  7882. if
  7883. (
  7884. (bbA[0] > bbB[1]) ||
  7885. (bbA[1] < bbB[0]) ||
  7886. (bbA[2] > bbB[3]) ||
  7887. (bbA[3] < bbB[2])
  7888. )
  7889. {
  7890. retval = false;
  7891. }
  7892.  
  7893. return retval;
  7894. }
  7895. function uroGetURDupes()
  7896. {
  7897. uroURDupes = [];
  7898.  
  7899. // To determine which URs are duplicates of one another (i.e. have been raised by the same user
  7900. // during the same section of a journey), we first compare the geometries of the drive tracks
  7901. // attached to any URs which have them - as this is based on the users GPS position rather than
  7902. // the WME map data, it makes it vanishingly unlikely that any two users would have identical
  7903. // GPS positions (especially given the level of accuracy to which the track points are stored)
  7904. // even if they were driving exactly the same route at the same speed, in the same lane etc.
  7905. //
  7906. // To accelerate this geometry comparison, we start by performing a simple bounding box overlap
  7907. // check for the two geometries under consideration - if there's no overlap then there can't be
  7908. // any geometry match, so no need to continue onto the more detailed comparision of the GPS
  7909. // tracks themselves...
  7910. let driveGeos = uroGetURDriveGeoms();
  7911. if(driveGeos.length > 1)
  7912. {
  7913. for(let i = 0; i < (driveGeos.length - 1); ++i)
  7914. {
  7915. if(driveGeos[i].length !== 5)
  7916. {
  7917. driveGeos[i][1] = false;
  7918. }
  7919. else
  7920. {
  7921. for(let j = (i + 1); j < driveGeos.length; ++j)
  7922. {
  7923. if(driveGeos[j].length === 5)
  7924. {
  7925. let geoMatch = uroCompareDriveBBoxes(driveGeos[i][3], driveGeos[j][3]);
  7926. if(geoMatch === true)
  7927. {
  7928. geoMatch = uroCompareDriveGeos(driveGeos[i][4], driveGeos[j][4]);
  7929. if(geoMatch === true)
  7930. {
  7931. driveGeos[i][2].push(driveGeos[j][0]);
  7932. driveGeos[j][2].push(driveGeos[i][0]);
  7933. }
  7934. }
  7935. }
  7936. }
  7937. }
  7938. }
  7939.  
  7940. for(let i = 0; i < driveGeos.length; ++i)
  7941. {
  7942. if(driveGeos[i][2].length > 0)
  7943. {
  7944. let res = [];
  7945. res.push(driveGeos[i][0]);
  7946. res.push(driveGeos[i][2]);
  7947. uroURDupes.push(res);
  7948. }
  7949. }
  7950. }
  7951.  
  7952. // Once we've done the initial drive track comparision, uroURDupes will contain a list of
  7953. // all the URs which were matched up based on that. However, as the track comparision is
  7954. // inherently limited by the amount of track data included with each UR, this initial
  7955. // comparison may mean some more widely spaced URs aren't flagged as duplicates simply
  7956. // because there's insufficient overlap between their tracks, even though there may have
  7957. // been further URs dropped inbetween to which they were matched.
  7958. //
  7959. // e.g. if a user drops 4 URs along a section of their journey, spaced such that each of
  7960. // the GPS tracks generates a comparison match with the UR either side of it, but no
  7961. // further than that, we would get:
  7962. //
  7963. // UR A......UR B.......UR C......UR D
  7964. //
  7965. // Matches: A to B, B to A & C, C to B & D, D to C
  7966. //
  7967. // Note how, although we know all of these URs are in fact duplicates, and can infer this
  7968. // from seeing that e.g. A is flagged only as a duplicate of B, however as B is flagged as
  7969. // a duplicate of A & C, and C is flagged as a duplicate of B & D, A MUST therefore be a
  7970. // duplicate of B, C & D...
  7971. //
  7972. // To fix this, we now run a merging pass over each of the entries in uroURDupes - for
  7973. // each entry we see if its ID appears in any of the other entries as a duplicate, and
  7974. // if so we merge the duplicates for both entries.
  7975.  
  7976. for(let i = 0; i < uroURDupes.length; ++i)
  7977. {
  7978. let urID = uroURDupes[i][0];
  7979. for(let j = 0; j < uroURDupes.length; ++j)
  7980. {
  7981. if(i != j)
  7982. {
  7983. if(uroURDupes[j][1].includes(urID) === true)
  7984. {
  7985. // https://stackoverflow.com/questions/1584370/how-to-merge-two-arrays-in-javascript-and-de-duplicate-items
  7986. let mergedDupes = [...new Set([...uroURDupes[i][1], ...uroURDupes[j][1]])];
  7987. uroURDupes[i][1] = mergedDupes;
  7988. uroURDupes[j][1] = mergedDupes;
  7989. }
  7990. }
  7991. }
  7992. }
  7993. }
  7994. function uroFilterURs()
  7995. {
  7996. let pmTStart = performance.now();
  7997. let pmFunction = "uroFilterURs";
  7998.  
  7999. if(uroUserID === -1)
  8000. {
  8001. return;
  8002. }
  8003.  
  8004. if(uroInhibitURFiltering === true)
  8005. {
  8006. return;
  8007. }
  8008.  
  8009.  
  8010. // compatibility fix for URComments - based on code supplied by RickZabel
  8011. let hasActiveURFilters = false;
  8012. if(uroIsFilteringEnabled(false) === true)
  8013. {
  8014. let urTabInputs = uroTabs.CtrlTabs[uroTabs.IDS.URS][uroTabs.FIELDS.TABBODY].getElementsByTagName('input');
  8015. for(let loop = 0; loop < urTabInputs.length; loop++)
  8016. {
  8017. if(urTabInputs[loop].type == 'checkbox')
  8018. {
  8019. let ignoreCB = false;
  8020. ignoreCB = ignoreCB || (urTabInputs[loop].id == '_cbCaseInsensitive');
  8021. ignoreCB = ignoreCB || (urTabInputs[loop].id == '_cbNoFilterForTaggedURs');
  8022. if((urTabInputs[loop].checked) && (ignoreCB === false))
  8023. {
  8024. hasActiveURFilters = true;
  8025. break;
  8026. }
  8027. }
  8028. }
  8029. }
  8030. sessionStorage.UROverview_hasActiveURFilters = hasActiveURFilters;
  8031. if(uroFilterPreamble() === false) return;
  8032. uroRefreshUpdateRequestSessions();
  8033. let selectorResolver = document.getElementById('_selectURResolverID');
  8034. let selectorCommentUser = document.getElementById('_selectURUserID');
  8035. if(uroUtils.GetCBChecked('_cbURResolverIDFilter') === false)
  8036. {
  8037. while(selectorResolver.options.length > 0)
  8038. {
  8039. selectorResolver.options.remove(0);
  8040. }
  8041. }
  8042. if(uroUtils.GetCBChecked('_cbURUserIDFilter') === false)
  8043. {
  8044. while(selectorCommentUser.options.length > 0)
  8045. {
  8046. selectorCommentUser.options.remove(0);
  8047. }
  8048. }
  8049. if(Object.keys(W.model.updateRequestSessions.objects).length === 0)
  8050. {
  8051. // This may be the case if the user has disabled the UR layer, so call
  8052. // AddCommentCounts to clear any existing ones from the map view...
  8053. uroURExtras.AddCommentCounts();
  8054. return;
  8055. }
  8056. let commenterUser = null;
  8057. if(uroUtils.GetCBChecked('_cbURUserIDFilter') === true)
  8058. {
  8059. if(selectorCommentUser.options.length === 0)
  8060. {
  8061. uroUpdateEditorList(W.model.updateRequestSessions.objects, '_selectURUserID', false, false, false, true);
  8062. }
  8063. if(selectorCommentUser.selectedOptions[0] != null)
  8064. {
  8065. commenterUser = parseInt(selectorCommentUser.selectedOptions[0].value);
  8066. }
  8067. }
  8068. let resolverUser = null;
  8069. if(uroUtils.GetCBChecked('_cbURResolverIDFilter') === true)
  8070. {
  8071. if(selectorResolver.options.length === 0)
  8072. {
  8073. uroUpdateEditorList(W.model.mapUpdateRequests.objects, '_selectURResolverID', false, false, true, false);
  8074. }
  8075. if(selectorResolver.selectedOptions[0] != null)
  8076. {
  8077. resolverUser = parseInt(selectorResolver.selectedOptions[0].value);
  8078. }
  8079. }
  8080. uroURExtras.urList = [];
  8081. uroGetURDupes();
  8082.  
  8083. let uFURs_masterEnable = uroIsFilteringEnabled(false);
  8084. let filterOutsideEditableArea = uroUtils.GetCBChecked('_cbURFilterOutsideArea');
  8085. let filterInsideManagedAreas = uroUtils.GetCBChecked('_cbURFilterInsideManagedAreas');
  8086. let filterSolved = uroUtils.GetCBChecked('_cbFilterSolved');
  8087. let filterUnidentified = uroUtils.GetCBChecked('_cbFilterUnidentified');
  8088. let filterClosed = uroUtils.GetCBChecked('_cbFilterClosedUR');
  8089. let filterOpen = uroUtils.GetCBChecked('_cbFilterOpenUR');
  8090. let filterDescMustBePresent = uroUtils.GetCBChecked('_cbURDescriptionMustBePresent');
  8091. let filterDescMustBeAbsent = uroUtils.GetCBChecked('_cbURDescriptionMustBeAbsent');
  8092. let filterKeywordMustBePresent = uroUtils.GetCBChecked('_cbEnableKeywordMustBePresent');
  8093. let filterKeywordMustBeAbsent = uroUtils.GetCBChecked('_cbEnableKeywordMustBeAbsent');
  8094. let filterMinURAge = uroUtils.GetCBChecked('_cbEnableMinAgeFilter');
  8095. let filterMaxURAge = uroUtils.GetCBChecked('_cbEnableMaxAgeFilter');
  8096. let filterMinComments = uroUtils.GetCBChecked('_cbEnableMinCommentsFilter');
  8097. let filterMaxComments = uroUtils.GetCBChecked('_cbEnableMaxCommentsFilter');
  8098. let filterReporterLastCommenter = uroUtils.GetCBChecked('_cbHideIfReporterLastCommenter');
  8099. let filterReporterNotLastCommenter = uroUtils.GetCBChecked('_cbHideIfReporterNotLastCommenter');
  8100. let filterHideAnyComments = uroUtils.GetCBChecked('_cbHideAnyComments');
  8101. let filterHideNotLastCommenter = uroUtils.GetCBChecked('_cbHideIfNotLastCommenter');
  8102. let filterHideMyComments = uroUtils.GetCBChecked('_cbHideMyComments');
  8103. let filterIfLastCommenter = uroUtils.GetCBChecked('_cbHideIfLastCommenter');
  8104. let filterIfNotLastCommenter = uroUtils.GetCBChecked('_cbHideIfNotLastCommenter');
  8105. let filterCommentMinAge = uroUtils.GetCBChecked('_cbEnableCommentAgeFilter2');
  8106. let filterCommentMaxAge = uroUtils.GetCBChecked('_cbEnableCommentAgeFilter');
  8107. let filterUserID = uroUtils.GetCBChecked('_cbURUserIDFilter');
  8108. let filterMyFollowed = uroUtils.GetCBChecked('_cbHideMyFollowed');
  8109. let filterMyUnfollowed = uroUtils.GetCBChecked('_cbHideMyUnfollowed');
  8110.  
  8111. let filterWazeAuto = uroUtils.GetCBChecked('_cbFilterWazeAuto');
  8112. let filterRoadworks = uroUtils.GetCBChecked('_cbFilterRoadworks');
  8113. let filterConstruction = uroUtils.GetCBChecked('_cbFilterConstruction');
  8114. let filterClosure = uroUtils.GetCBChecked('_cbFilterClosure');
  8115. let filterEvent = uroUtils.GetCBChecked('_cbFilterEvent');
  8116. let filterNote = uroUtils.GetCBChecked('_cbFilterNote');
  8117. let filterWSLM = uroUtils.GetCBChecked('_cbFilterWSLM');
  8118. let filterBOG = uroUtils.GetCBChecked('_cbFilterBOG');
  8119. let filterDifficult = uroUtils.GetCBChecked('_cbFilterDifficult');
  8120.  
  8121. let filterIncorrectTurn = uroUtils.GetCBChecked('_cbFilterIncorrectTurn');
  8122. let filterIncorrectAddress = uroUtils.GetCBChecked('_cbFilterIncorrectAddress');
  8123. let filterIncorrectRoute = uroUtils.GetCBChecked('_cbFilterIncorrectRoute');
  8124. let filterMissingRoundabout = uroUtils.GetCBChecked('_cbFilterMissingRoundabout');
  8125. let filterGeneralError = uroUtils.GetCBChecked('_cbFilterGeneralError');
  8126. let filterTurnNotAllowed = uroUtils.GetCBChecked('_cbFilterTurnNotAllowed');
  8127. let filterIncorrectJunction = uroUtils.GetCBChecked('_cbFilterIncorrectJunction');
  8128. let filterMissingBridgeOverpass = uroUtils.GetCBChecked('_cbFilterMissingBridgeOverpass');
  8129. let filterWrongDrivingDirection = uroUtils.GetCBChecked('_cbFilterWrongDrivingDirection');
  8130. let filterMissingExit = uroUtils.GetCBChecked('_cbFilterMissingExit');
  8131. let filterMissingRoad = uroUtils.GetCBChecked('_cbFilterMissingRoad');
  8132. let filterMissingLandmark = uroUtils.GetCBChecked('_cbFilterMissingLandmark');
  8133. let filterNativeSpeedLimit = uroUtils.GetCBChecked('_cbFilterSpeedLimits');
  8134. let filterBlockedRoad = uroUtils.GetCBChecked('_cbFilterBlockedRoad');
  8135. let filterUndefined = uroUtils.GetCBChecked('_cbFilterUndefined');
  8136.  
  8137. let invertURFilters = uroUtils.GetCBChecked('_cbInvertURFilter');
  8138. let invertURStateFilters = uroUtils.GetCBChecked('_cbInvertURStateFilter');
  8139. let noFilterTaggedURs = uroUtils.GetCBChecked('_cbNoFilterForTaggedURs');
  8140. let noFilterURInURL = uroUtils.GetCBChecked('_cbNoFilterForURInURL');
  8141. let showOnlyDupes = uroUtils.GetCBChecked('_cbURFilterDupes');
  8142.  
  8143. let keywordPresent = uroUtils.GetElmValue('_textKeywordPresent');
  8144. let keywordAbsent = uroUtils.GetElmValue('_textKeywordAbsent');
  8145. let caseInsensitive = uroUtils.GetCBChecked('_cbCaseInsensitive');
  8146. let thresholdMinAge = uroUtils.GetElmValue('_inputFilterMinDays');
  8147. let thresholdMaxAge = uroUtils.GetElmValue('_inputFilterMaxDays');
  8148. let thresholdMinComments = uroUtils.GetElmValue('_inputFilterMinComments');
  8149. let thresholdMaxComments = uroUtils.GetElmValue('_inputFilterMaxComments');
  8150. let thresholdMaxCommentAge = uroUtils.GetElmValue('_inputFilterCommentDays');
  8151. let thresholdMinCommentAge = uroUtils.GetElmValue('_inputFilterCommentDays2');
  8152. let ignoreOtherEditorComments = uroUtils.GetCBChecked('_cbIgnoreOtherEditorComments');
  8153. let urcFilteringIsActive = false;
  8154. let urcCB = document.getElementById('URCommentsFilterEnabled');
  8155. if(urcCB !== null)
  8156. {
  8157. if(urcCB.checked)
  8158. {
  8159. urcFilteringIsActive = true;
  8160. }
  8161. }
  8162. urcCB = document.getElementById('URCommentUROOnlyMyUR');
  8163. if(urcCB !== null)
  8164. {
  8165. if(urcCB.checked)
  8166. {
  8167. urcFilteringIsActive = true;
  8168. }
  8169. }
  8170. urcCB = document.getElementById('URCommentUROHideTagged');
  8171. if(urcCB !== null)
  8172. {
  8173. if(urcCB.checked)
  8174. {
  8175. urcFilteringIsActive = true;
  8176. }
  8177. }
  8178.  
  8179. filterInsideManagedAreas = filterInsideManagedAreas && (uroGetManagedAreas() !== 0);
  8180. if(uroUtils.GetCBChecked('_cbURExcludeUserArea') == true)
  8181. {
  8182. uroIgnoreAreasUserID = W.loginManager.user.attributes.id;
  8183. }
  8184.  
  8185. for (let urobj in W.model.mapUpdateRequests.objects)
  8186. {
  8187. if(W.model.mapUpdateRequests.objects.hasOwnProperty(urobj))
  8188. {
  8189. let ureq = W.model.mapUpdateRequests.objects[urobj];
  8190. let ureqID = ureq.attributes.id;
  8191.  
  8192. let urStyle = 'visible';
  8193. let inhibitFiltering = ((ureqID == uroSelectedURID) && (noFilterURInURL));
  8194.  
  8195. let hasMyComments = false;
  8196. let nComments = 0;
  8197. let desc = ureq.attributes.description;
  8198. let customType = uroGetCustomType(ureqID, uroLayers.ID.UR, desc);
  8199. let ageLastComment = null;
  8200. if(W.model.updateRequestSessions.objects[ureqID] != null)
  8201. {
  8202. nComments = W.model.updateRequestSessions.objects[ureqID].attributes.comments.length;
  8203. if(nComments != 0)
  8204. {
  8205. ageLastComment = uroUtils.GetCommentAge(W.model.updateRequestSessions.objects[ureqID].attributes.comments[nComments-1]);
  8206. }
  8207. if((uFURs_masterEnable === false) && (nComments === 0))
  8208. {
  8209. // when master enable is turned off, we want to make sure that all URs, including ones that were previously hidden, are correctly
  8210. // displayed in their native form - i.e. no comment count or custom conversation bubbles. The easiest way to achieve this is to
  8211. // force the AddCommentCounts code to test for the presence of these bubbles on each UR, which we do by setting a non-zero
  8212. // comment count for each UR... For URs which genuinely do have no comments we use -1 to indicate that we're not really setting
  8213. // a comment count, but that we still need to do something that wouldn't be achieved by using 0.
  8214. nComments = -1;
  8215. }
  8216. }
  8217.  
  8218. // check UR against current session ignore list...
  8219. if(uroIgnore.IsOnList(ureqID)) urStyle = 'hidden';
  8220.  
  8221. if((uFURs_masterEnable === true) && (inhibitFiltering === false))
  8222. {
  8223. let wazeauto_ur = false;
  8224. let ukroadworks_ur = false;
  8225. let construction_ur = false;
  8226. let closure_ur = false;
  8227. let event_ur = false;
  8228. let note_ur = false;
  8229. let wslm_ur = false;
  8230. let bog_ur = false;
  8231. let difficult_ur = false;
  8232.  
  8233. let filterByNotIncludedKeyword = false;
  8234. let filterByIncludedKeyword = true;
  8235.  
  8236. if(desc !== null) desc = desc.replace(/<\/?[^>]+(>|$)/g, "");
  8237. else desc = '';
  8238.  
  8239. if(customType === 0) ukroadworks_ur = true;
  8240. else if(customType === 1) construction_ur = true;
  8241. else if(customType === 2) closure_ur = true;
  8242. else if(customType === 3) event_ur = true;
  8243. else if(customType === 4) note_ur = true;
  8244. else if(customType === 5) wslm_ur = true;
  8245. else if(customType === 6) bog_ur = true;
  8246. else if(customType === 7) difficult_ur = true;
  8247.  
  8248. // check UR against editable area...
  8249.  
  8250. if(filterOutsideEditableArea === true)
  8251. {
  8252. if(ureq.canEdit() === false) urStyle = 'hidden';
  8253. }
  8254.  
  8255. if(filterInsideManagedAreas === true)
  8256. {
  8257. if(uroCheckGeometryWithinManagedAreas(ureq.attributes.geoJSONGeometry.coordinates) === true) urStyle = 'hidden';
  8258. }
  8259.  
  8260. if(showOnlyDupes === true)
  8261. {
  8262. let isDupe = false;
  8263. for(let i = 0; i < uroURDupes.length; ++i)
  8264. {
  8265. if(uroURDupes[i][0] === ureqID)
  8266. {
  8267. isDupe = true;
  8268. break;
  8269. }
  8270. }
  8271. if(isDupe === false) urStyle = 'hidden';
  8272. }
  8273.  
  8274. // state-age filtering
  8275. if(urStyle == 'visible')
  8276. {
  8277. // check against closed/not identified filtering if enabled...
  8278. if(filterSolved === true)
  8279. {
  8280. if(ureq.attributes.resolution === 0) urStyle = 'hidden';
  8281. }
  8282. if(filterUnidentified === true)
  8283. {
  8284. if(ureq.attributes.resolution == 1) urStyle = 'hidden';
  8285. }
  8286.  
  8287. if((ureq.attributes.resolvedOn !== null) && (filterClosed === true))
  8288. {
  8289. urStyle = 'hidden';
  8290. }
  8291.  
  8292. if((ureq.attributes.resolvedOn === null) && (filterOpen === true))
  8293. {
  8294. urStyle = 'hidden';
  8295. }
  8296.  
  8297. if(urStyle == 'visible')
  8298. {
  8299. // check UR against keyword filtering if enabled...
  8300. if(filterDescMustBePresent === true)
  8301. {
  8302. if(desc === '') urStyle = 'hidden';
  8303. }
  8304. if(filterDescMustBeAbsent === true)
  8305. {
  8306. if(desc !== '') urStyle = 'hidden';
  8307. }
  8308.  
  8309. if(filterKeywordMustBePresent === true)
  8310. {
  8311. let keywordIsPresentInDesc = uroUtils.KeywordPresent(desc,keywordPresent,caseInsensitive);
  8312. filterByIncludedKeyword = (filterByIncludedKeyword && (!keywordIsPresentInDesc));
  8313. }
  8314. if(filterKeywordMustBeAbsent === true)
  8315. {
  8316. let keywordIsAbsentInDesc = uroUtils.KeywordPresent(desc,keywordAbsent,caseInsensitive);
  8317. filterByNotIncludedKeyword = (filterByNotIncludedKeyword || keywordIsAbsentInDesc);
  8318. }
  8319. }
  8320.  
  8321. if(urStyle == 'visible')
  8322. {
  8323. // do age-based filtering if enabled
  8324. if(filterMinURAge === true)
  8325. {
  8326. if(uroUtils.GetURAge(ureq,0,false) < thresholdMinAge) urStyle = 'hidden';
  8327. }
  8328. if(filterMaxURAge === true)
  8329. {
  8330. if(uroUtils.GetURAge(ureq,0,false) > thresholdMaxAge) urStyle = 'hidden';
  8331. }
  8332. }
  8333.  
  8334. if(urStyle == 'visible')
  8335. {
  8336. if(resolverUser !== null)
  8337. {
  8338. if(ureq.attributes.resolvedBy != resolverUser) urStyle = 'hidden';
  8339. }
  8340. }
  8341.  
  8342. if(urStyle == 'visible')
  8343. {
  8344. // do comments/following filtering
  8345. if(W.model.updateRequestSessions.objects[ureqID] != null)
  8346. {
  8347. nComments = W.model.updateRequestSessions.objects[ureqID].attributes.comments.length;
  8348. let commentDaysOld = -1;
  8349.  
  8350.  
  8351. if(filterMinComments === true)
  8352. {
  8353. if(nComments < thresholdMinComments) urStyle = 'hidden';
  8354. }
  8355. if(filterMaxComments === true)
  8356. {
  8357. if(nComments > thresholdMaxComments) urStyle = 'hidden';
  8358. }
  8359.  
  8360.  
  8361. if(nComments > 0)
  8362. {
  8363. let reporterIsLastCommenter = false;
  8364. if(W.model.updateRequestSessions.objects[ureqID].attributes.comments[nComments-1].userID == -1) reporterIsLastCommenter = true;
  8365.  
  8366. if(filterReporterLastCommenter === true)
  8367. {
  8368. if(reporterIsLastCommenter === true) urStyle = 'hidden';
  8369. }
  8370. else if(filterReporterNotLastCommenter === true)
  8371. {
  8372. if(reporterIsLastCommenter === false) urStyle = 'hidden';
  8373. }
  8374.  
  8375. hasMyComments = uroURHasMyComments(ureqID);
  8376. if(hasMyComments === false)
  8377. {
  8378. if(filterHideAnyComments === true) urStyle = 'hidden';
  8379. if(filterHideNotLastCommenter === true) urStyle = 'hidden';
  8380. }
  8381. else
  8382. {
  8383. if(filterHideMyComments === true) urStyle = 'hidden';
  8384.  
  8385. let userIsLastCommenter = false;
  8386. if(W.model.updateRequestSessions.objects[ureqID].attributes.comments[nComments-1].userID == uroUserID) userIsLastCommenter = true;
  8387.  
  8388. if(filterIfLastCommenter === true)
  8389. {
  8390. if(userIsLastCommenter === true) urStyle = 'hidden';
  8391. }
  8392. else if(filterIfNotLastCommenter === true)
  8393. {
  8394. if(userIsLastCommenter === false) urStyle = 'hidden';
  8395. }
  8396. }
  8397.  
  8398. let cidx;
  8399. if(ignoreOtherEditorComments === false)
  8400. {
  8401. commentDaysOld = ageLastComment;
  8402. }
  8403. else
  8404. {
  8405. for(cidx=0; cidx<nComments; cidx++)
  8406. {
  8407. let cObj = W.model.updateRequestSessions.objects[ureqID].attributes.comments[cidx];
  8408. if((cObj.userID == uroUserID) || (cObj.userID == -1))
  8409. {
  8410. commentDaysOld = uroUtils.GetCommentAge(cObj);
  8411. }
  8412. }
  8413. }
  8414. if((filterCommentMinAge === true) && (commentDaysOld != -1))
  8415. {
  8416. if(thresholdMinCommentAge > commentDaysOld) urStyle = 'hidden';
  8417. }
  8418. if((filterCommentMaxAge === true) && (commentDaysOld != -1))
  8419. {
  8420. if(thresholdMaxCommentAge < commentDaysOld) urStyle = 'hidden';
  8421. }
  8422.  
  8423. if((commenterUser !== null) && (urStyle != 'hidden'))
  8424. {
  8425. urStyle = 'hidden';
  8426. for(cidx=0; cidx<nComments; cidx++)
  8427. {
  8428. if(W.model.updateRequestSessions.objects[ureqID].attributes.comments[cidx].userID == commenterUser)
  8429. {
  8430. urStyle = 'visible';
  8431. break;
  8432. }
  8433. }
  8434. }
  8435.  
  8436. let commentText = '';
  8437. for(cidx=0; cidx<nComments; cidx++)
  8438. {
  8439. commentText += W.model.updateRequestSessions.objects[ureqID].attributes.comments[cidx].text;
  8440. }
  8441.  
  8442. if(filterKeywordMustBePresent === true)
  8443. {
  8444. let keywordIsPresentInComments = uroUtils.KeywordPresent(commentText,keywordPresent,caseInsensitive);
  8445. filterByIncludedKeyword = (filterByIncludedKeyword && (!keywordIsPresentInComments));
  8446. }
  8447. if(filterKeywordMustBeAbsent === true)
  8448. {
  8449. let keywordIsAbsentInComments = uroUtils.KeywordPresent(commentText,keywordAbsent,caseInsensitive);
  8450. filterByNotIncludedKeyword = (filterByNotIncludedKeyword || keywordIsAbsentInComments);
  8451. }
  8452. }
  8453. else
  8454. {
  8455. if(filterUserID === true)
  8456. {
  8457. urStyle = 'hidden';
  8458. }
  8459. }
  8460.  
  8461. filterByNotIncludedKeyword = (filterByNotIncludedKeyword && filterKeywordMustBeAbsent);
  8462. filterByIncludedKeyword = (filterByIncludedKeyword && filterKeywordMustBePresent);
  8463. if(filterByNotIncludedKeyword || filterByIncludedKeyword)
  8464. {
  8465. urStyle = 'hidden';
  8466. }
  8467.  
  8468. if(W.model.updateRequestSessions.objects[ureqID].attributes.isFollowing === true)
  8469. {
  8470. if(filterMyFollowed === true) urStyle = 'hidden';
  8471. }
  8472. else
  8473. {
  8474. if(filterMyUnfollowed === true) urStyle = 'hidden';
  8475. }
  8476. }
  8477. }
  8478.  
  8479. if(invertURStateFilters === true)
  8480. {
  8481. if(urStyle == 'hidden') urStyle = 'visible';
  8482. else urStyle = 'hidden';
  8483. }
  8484. }
  8485.  
  8486. // type filtering
  8487. if(urStyle == 'visible')
  8488. {
  8489. // Test for Waze automatic URs before any others - these always (?) get inserted as General Error URs,
  8490. // so we can't filter them by type...
  8491. if(desc.indexOf('Waze Automatic:') != -1)
  8492. {
  8493. wazeauto_ur = true;
  8494. }
  8495.  
  8496. if(wazeauto_ur === true)
  8497. {
  8498. if(filterWazeAuto === true) urStyle = 'hidden';
  8499. }
  8500.  
  8501. else if(ukroadworks_ur === true)
  8502. {
  8503. if(filterRoadworks === true) urStyle = 'hidden';
  8504. }
  8505. else if(construction_ur === true)
  8506. {
  8507. if(filterConstruction === true) urStyle = 'hidden';
  8508. }
  8509. else if(closure_ur === true)
  8510. {
  8511. if(filterClosure === true) urStyle = 'hidden';
  8512. }
  8513. else if(event_ur === true)
  8514. {
  8515. if(filterEvent === true) urStyle = 'hidden';
  8516. }
  8517. else if(note_ur === true)
  8518. {
  8519. if(filterNote === true) urStyle = 'hidden';
  8520. }
  8521. else if(wslm_ur === true)
  8522. {
  8523. if(filterWSLM === true) urStyle = 'hidden';
  8524. }
  8525. else if(bog_ur === true)
  8526. {
  8527. if(filterBOG === true) urStyle = 'hidden';
  8528. }
  8529. else if(difficult_ur === true)
  8530. {
  8531. if(filterDifficult === true) urStyle = 'hidden';
  8532. }
  8533.  
  8534. else if(ureq.attributes.type == 6)
  8535. {
  8536. if(filterIncorrectTurn === true) urStyle = 'hidden';
  8537. }
  8538. else if(ureq.attributes.type == 7)
  8539. {
  8540. if (filterIncorrectAddress === true) urStyle = 'hidden';
  8541. }
  8542. else if(ureq.attributes.type == 8)
  8543. {
  8544. if(filterIncorrectRoute === true) urStyle = 'hidden';
  8545. }
  8546. else if(ureq.attributes.type == 9)
  8547. {
  8548. if(filterMissingRoundabout === true) urStyle = 'hidden';
  8549. }
  8550. else if(ureq.attributes.type == 10)
  8551. {
  8552. if(filterGeneralError === true) urStyle = 'hidden';
  8553. }
  8554. else if(ureq.attributes.type == 11)
  8555. {
  8556. if(filterTurnNotAllowed === true) urStyle = 'hidden';
  8557. }
  8558. else if(ureq.attributes.type == 12)
  8559. {
  8560. if(filterIncorrectJunction === true) urStyle = 'hidden';
  8561. }
  8562. else if(ureq.attributes.type == 13)
  8563. {
  8564. if(filterMissingBridgeOverpass === true) urStyle = 'hidden';
  8565. }
  8566. else if(ureq.attributes.type == 14)
  8567. {
  8568. if(filterWrongDrivingDirection === true) urStyle = 'hidden';
  8569. }
  8570. else if(ureq.attributes.type == 15)
  8571. {
  8572. if(filterMissingExit === true) urStyle = 'hidden';
  8573. }
  8574. else if(ureq.attributes.type == 16)
  8575. {
  8576. if(filterMissingRoad === true) urStyle = 'hidden';
  8577. }
  8578. else if(ureq.attributes.type == 18)
  8579. {
  8580. if(filterMissingLandmark === true) urStyle = 'hidden';
  8581. }
  8582. else if(ureq.attributes.type == 19)
  8583. {
  8584. if(filterBlockedRoad === true) urStyle = 'hidden';
  8585. }
  8586. else if(ureq.attributes.type == 23)
  8587. {
  8588. if(filterNativeSpeedLimit === true) urStyle = 'hidden';
  8589. }
  8590. else if(filterUndefined === true) urStyle = 'hidden';
  8591.  
  8592. if(invertURFilters === true)
  8593. {
  8594. if(urStyle == 'hidden') urStyle = 'visible';
  8595. else urStyle = 'hidden';
  8596. }
  8597. }
  8598.  
  8599. // stage-age filtering override for tagged URs
  8600. if(noFilterTaggedURs === true)
  8601. {
  8602. if(ukroadworks_ur === true)
  8603. {
  8604. if(filterRoadworks === false) urStyle = 'visible';
  8605. }
  8606. else if(construction_ur === true)
  8607. {
  8608. if(filterConstruction === false) urStyle = 'visible';
  8609. }
  8610. else if(closure_ur === true)
  8611. {
  8612. if(filterClosure === false) urStyle = 'visible';
  8613. }
  8614. else if(event_ur === true)
  8615. {
  8616. if(filterEvent === false) urStyle = 'visible';
  8617. }
  8618. else if(note_ur === true)
  8619. {
  8620. if(filterNote === false) urStyle = 'visible';
  8621. }
  8622. else if(wslm_ur === true)
  8623. {
  8624. if(filterWSLM === false) urStyle = 'visible';
  8625. }
  8626. }
  8627. }
  8628. // only touch marker visibility if we've got active filter settings, or if URComments is not
  8629. // doing any filtering of its own
  8630. if((hasActiveURFilters === true) || (urcFilteringIsActive === false) || (uFURs_masterEnable === false))
  8631. {
  8632. let urMarker = uroGetMarker(uroLayers.ID.UR,urobj);
  8633. if(urMarker !== null)
  8634. {
  8635. urMarker.style.visibility = urStyle;
  8636. }
  8637. }
  8638. if(urStyle != 'hidden')
  8639. {
  8640. uroURExtras.AddToList(ureqID, customType, hasMyComments, nComments, ageLastComment);
  8641. }
  8642. }
  8643. }
  8644. uroURExtras.AddCommentCounts();
  8645. uroDBG.PerfMon(pmFunction, pmTStart);
  8646. }
  8647. function uroGetProblemTypes()
  8648. {
  8649. uroKnownProblemTypeIDs = [];
  8650. uroKnownProblemTypeNames = [];
  8651. let tProblemList = I18n.lookup("problems.types");
  8652. for(let tObj in tProblemList)
  8653. {
  8654. if(tObj !== undefined)
  8655. {
  8656. uroKnownProblemTypeIDs.push(parseInt(tObj));
  8657. uroKnownProblemTypeNames.push(tProblemList[tObj].title);
  8658. }
  8659. }
  8660. }
  8661. function uroFilterProblems()
  8662. {
  8663. let pmTStart = performance.now();
  8664. let pmFunction = "uroFilterProblems";
  8665.  
  8666. if(uroFilterPreamble() === false) return;
  8667. let selector;
  8668.  
  8669. if((uroUtils.GetCBChecked('_cbMPNotClosedUserIDFilter') === false) && (uroUtils.GetCBChecked('_cbMPClosedUserIDFilter') === false))
  8670. {
  8671. selector = document.getElementById('_selectMPUserID');
  8672. while(selector.options.length > 0)
  8673. {
  8674. selector.options.remove(0);
  8675. }
  8676. }
  8677.  
  8678. let solverUser = null;
  8679. if((uroUtils.GetCBChecked('_cbMPNotClosedUserIDFilter') === true) || (uroUtils.GetCBChecked('_cbMPClosedUserIDFilter') === true))
  8680. {
  8681. selector = document.getElementById('_selectMPUserID');
  8682. if(selector.options.length === 0)
  8683. {
  8684. uroUpdateEditorList(W.model.mapProblems.objects, '_selectMPUserID', false, false, true, false);
  8685. }
  8686. if(selector.selectedOptions[0] != null)
  8687. {
  8688. solverUser = parseInt(selector.selectedOptions[0].value);
  8689. }
  8690. }
  8691.  
  8692. let uFP_masterEnable = uroIsFilteringEnabled(false);
  8693. let filter_OutsideEditableArea = uroUtils.GetCBChecked('_cbMPFilterOutsideArea');
  8694. let filter_Solved = uroUtils.GetCBChecked('_cbMPFilterSolved');
  8695. let filter_Unidentified = uroUtils.GetCBChecked('_cbMPFilterUnidentified');
  8696. let filter_Closed = uroUtils.GetCBChecked('_cbMPFilterClosed');
  8697. let filter_NotClosedUserID = uroUtils.GetCBChecked('_cbMPNotClosedUserIDFilter');
  8698. let filter_ClosedUserID = uroUtils.GetCBChecked('_cbMPClosedUserIDFilter');
  8699. let filter_Reopened = uroUtils.GetCBChecked('_cbMPFilterReopenedProblem');
  8700.  
  8701. let filter_LowSeverity = uroUtils.GetCBChecked('_cbMPFilterLowSeverity');
  8702. let filter_MediumSeverity = uroUtils.GetCBChecked('_cbMPFilterMediumSeverity');
  8703. let filter_HighSeverity = uroUtils.GetCBChecked('_cbMPFilterHighSeverity');
  8704.  
  8705. let filterTypes = [];
  8706. let i;
  8707. for(i=0; i<uroKnownProblemTypeIDs.length; i++)
  8708. {
  8709. if(uroUtils.GetCBChecked('_cbMPFilter_T'+uroKnownProblemTypeIDs[i])) filterTypes.push(uroKnownProblemTypeIDs[i]);
  8710. }
  8711. let filter_TypeUnknown = uroUtils.GetCBChecked('_cbMPFilterUnknownProblem');
  8712.  
  8713. let filter_TaggedElgin = uroUtils.GetCBChecked('_cbFilterElgin');
  8714. let filter_TaggedTrafficCast = uroUtils.GetCBChecked('_cbFilterTrafficCast');
  8715. let filter_TaggedTrafficMaster = uroUtils.GetCBChecked('_cbFilterTrafficMaster');
  8716. let filter_TaggedCaltrans = uroUtils.GetCBChecked('_cbFilterCaltrans');
  8717. let filter_TaggedTFL = uroUtils.GetCBChecked('_cbFilterTFL');
  8718.  
  8719. let filter_Invert = uroUtils.GetCBChecked('_cbInvertMPFilter');
  8720.  
  8721. let filter_StartDateEnabled = uroUtils.GetCBChecked('_cbMPFilterStartDate');
  8722. let filter_EndDateEnabled = uroUtils.GetCBChecked('_cbMPFilterEndDate');
  8723. let filter_EndDatePassed = uroUtils.GetCBChecked('_cbMPFilterEndDatePassed');
  8724.  
  8725. let tsD = uroUtils.GetElmValue('_inputMPFilterStartDay');
  8726. let tsM = uroUtils.GetElmValue('_inputMPFilterStartMonth');
  8727. let tsY = uroUtils.GetElmValue('_inputMPFilterStartYear');
  8728. let startDate = uroUtils.GetTS(tsD, tsM, tsY, 0, 0);
  8729.  
  8730. tsD = uroUtils.GetElmValue('_inputMPFilterEndDay');
  8731. tsM = uroUtils.GetElmValue('_inputMPFilterEndMonth');
  8732. tsY = uroUtils.GetElmValue('_inputMPFilterEndYear');
  8733. let endDate = uroUtils.GetTS(tsD, tsM, tsY, 0, 0);
  8734. let nowTime = (new Date()).getTime();
  8735.  
  8736. for (let urobj in W.model.mapProblems.objects)
  8737. {
  8738. if(W.model.mapProblems.objects.hasOwnProperty(urobj))
  8739. {
  8740. let problem = W.model.mapProblems.objects[urobj];
  8741.  
  8742. if(problem.attributes.origJSONGeo === undefined)
  8743. {
  8744. // Store a copy of the original marker position if we haven't already done so
  8745. problem.attributes.origJSONGeo = uroUtils.CloneObject(problem.attributes.geoJSONGeometry);
  8746. }
  8747. else
  8748. {
  8749. // Restore the original position if we do have a copy of it, to undo any adjustments
  8750. // that may have been made in the last filtering pass
  8751. problem.attributes.geoJSONGeometry = uroUtils.CloneObject(problem.attributes.origJSONGeo);
  8752. }
  8753.  
  8754.  
  8755. let ureqID = problem.attributes.id;
  8756.  
  8757. let problemStyle = 'visible';
  8758. // check problem against current session ignore list...
  8759. if(uroIgnore.IsOnList(ureqID)) problemStyle = 'hidden';
  8760.  
  8761. if(uFP_masterEnable === true)
  8762. {
  8763. if(filter_OutsideEditableArea === true)
  8764. {
  8765. if(problem.canEdit() === false)
  8766. {
  8767. problemStyle = 'hidden';
  8768. }
  8769. }
  8770.  
  8771. if(filter_EndDatePassed == true)
  8772. {
  8773. if(problem.attributes.endTime > nowTime)
  8774. {
  8775. problemStyle = 'hidden';
  8776. }
  8777. }
  8778. if(filter_StartDateEnabled == true)
  8779. {
  8780. let tStart = new Date(problem.attributes.startTime);
  8781. tStart.setHours(0);
  8782. tStart.setMinutes(0);
  8783. tStart.setSeconds(0);
  8784. tStart = tStart.getTime();
  8785. if(tStart != startDate)
  8786. {
  8787. problemStyle = 'hidden';
  8788. }
  8789. }
  8790. if(filter_EndDateEnabled == true)
  8791. {
  8792. let tEnd = new Date(problem.attributes.endTime);
  8793. tEnd.setHours(0);
  8794. tEnd.setMinutes(0);
  8795. tEnd.setSeconds(0);
  8796. tEnd = tEnd.getTime();
  8797. if(tEnd != endDate)
  8798. {
  8799. problemStyle = 'hidden';
  8800. }
  8801. }
  8802.  
  8803. // check against closed/not identified filtering if enabled...
  8804. let geoID = problem.getOLGeometry().id;
  8805. if(geoID !== null)
  8806. {
  8807. if(document.getElementById(geoID) !== null)
  8808. {
  8809. let problem_marker_img = document.getElementById(geoID).href.baseVal;
  8810. if(filter_Solved === true)
  8811. {
  8812. if(problem_marker_img.indexOf('_solved') != -1) problemStyle = 'hidden';
  8813. }
  8814. if(filter_Unidentified === true)
  8815. {
  8816. if(problem_marker_img.indexOf('_rejected') != -1) problemStyle = 'hidden';
  8817. }
  8818. }
  8819. }
  8820.  
  8821. if(filter_Closed === true)
  8822. {
  8823. if(problem.attributes.open === false)
  8824. {
  8825. problemStyle = 'hidden';
  8826. }
  8827. }
  8828.  
  8829. if(problemStyle == 'visible')
  8830. {
  8831. if(solverUser !== null)
  8832. {
  8833. if((filter_NotClosedUserID === true) && (problem.attributes.resolvedBy == solverUser)) problemStyle = 'hidden';
  8834. if((filter_ClosedUserID === true) && (problem.attributes.resolvedBy != solverUser)) problemStyle = 'hidden';
  8835. }
  8836. }
  8837.  
  8838. if(problemStyle == 'visible')
  8839. {
  8840. let problemType = problem.attributes.subType;
  8841. let desc = '';
  8842. if(problem.attributes.description != null)
  8843. {
  8844. desc = problem.attributes.description;
  8845. }
  8846. let customType = uroGetCustomType(ureqID, uroLayers.ID.MP, desc);
  8847.  
  8848. if(customType === 100)
  8849. {
  8850. if(filter_TaggedElgin === true) problemStyle = 'hidden';
  8851. }
  8852. else if(customType === 101)
  8853. {
  8854. if(filter_TaggedTrafficCast === true) problemStyle = 'hidden';
  8855. }
  8856. else if(customType === 102)
  8857. {
  8858. if(filter_TaggedTrafficMaster === true) problemStyle = 'hidden';
  8859. }
  8860. else if(customType === 103)
  8861. {
  8862. if(filter_TaggedCaltrans === true) problemStyle = 'hidden';
  8863. }
  8864. else if(customType === 104)
  8865. {
  8866. if(filter_TaggedTFL === true) problemStyle = 'hidden';
  8867. }
  8868. else if(uroKnownProblemTypeIDs.indexOf(problemType) !== -1)
  8869. {
  8870. if(filterTypes.indexOf(problemType) !== -1)
  8871. {
  8872. problemStyle = 'hidden';
  8873. }
  8874. }
  8875. else if(filter_TypeUnknown === true) problemStyle = 'hidden';
  8876.  
  8877. if(filter_Reopened === true)
  8878. {
  8879. if((problem.attributes.open === true) && (problem.attributes.resolvedOn !== null))
  8880. {
  8881. problemStyle = 'hidden';
  8882. }
  8883. }
  8884.  
  8885.  
  8886. if(filter_Invert === true)
  8887. {
  8888. if(problemStyle == 'hidden') problemStyle = 'visible';
  8889. else problemStyle = 'hidden';
  8890. }
  8891.  
  8892.  
  8893. if(problem.attributes.weight <= 3)
  8894. {
  8895. if(filter_LowSeverity === true) problemStyle = 'hidden';
  8896. }
  8897. else if(problem.attributes.weight <= 7)
  8898. {
  8899. if(filter_MediumSeverity === true) problemStyle = 'hidden';
  8900. }
  8901. else if(filter_HighSeverity === true) problemStyle = 'hidden';
  8902. }
  8903. }
  8904.  
  8905. let marker = uroGetMarker(uroLayers.ID.MP, urobj);
  8906. if(marker !== null)
  8907. {
  8908. marker.style.visibility = problemStyle;
  8909. if(problemStyle === 'hidden')
  8910. {
  8911. // To ensure WME displays the details for the topmost marker that's
  8912. // left visible in a stack, alter the coords for any hidden markers
  8913. // to place them in a location that isn't likely to be clicked on...
  8914. problem.attributes.geoJSONGeometry.coordinates[0] = 0;
  8915. problem.attributes.geoJSONGeometry.coordinates[1] = 90;
  8916. }
  8917. }
  8918. }
  8919. }
  8920.  
  8921. uroDBG.PerfMon(pmFunction, pmTStart);
  8922. }
  8923. function uroFilterPreamble()
  8924. {
  8925. let mapviewport = document.getElementsByClassName("olMapViewport")[0];
  8926. if(mapviewport === null)
  8927. {
  8928. if(uroNullMapViewport === false)
  8929. {
  8930. uroDBG.AddLog('caught null mapviewport');
  8931. uroNullMapViewport = true;
  8932. }
  8933. return false;
  8934. }
  8935.  
  8936. let uiElms = uroTabs.CtrlTabs[uroTabs.IDS.MISC][uroTabs.FIELDS.TABBODY];
  8937. if(uiElms == null)
  8938. {
  8939. uroDBG.AddLog('caught missing UI');
  8940. return false;
  8941. }
  8942. if(uiElms.innerHTML.length === 0)
  8943. {
  8944. uroDBG.AddLog('caught empty UI');
  8945. return false;
  8946. }
  8947.  
  8948. if(uroSettingsApplied === false)
  8949. {
  8950. return false;
  8951. }
  8952.  
  8953. uroNullMapViewport = false;
  8954.  
  8955. return true;
  8956. }
  8957. function uroFilterItems_MasterEnableClick()
  8958. {
  8959. if(uroUtils.GetCBChecked('_cbMasterEnable') === false)
  8960. {
  8961. uroPopup.Hide();
  8962. }
  8963. uroFilterItems();
  8964. }
  8965. function uroFilterItems()
  8966. {
  8967. uroFilterProblems();
  8968. uroFilterPlaces();
  8969. uroFilterCameras();
  8970. uroFilterURs();
  8971. uroFilterRTCs();
  8972. uroFilterRAs();
  8973. uroFilterMapComments();
  8974. }
  8975. function uroFilterItemsOnMove()
  8976. {
  8977. W.map.events.unregister('mousemove',null,uroFilterItemsOnMove);
  8978. uroFilterItems();
  8979. }
  8980. function uroDeleteObject()
  8981. {
  8982. uroDBG.AddLog('delete camera ID '+uroShownFID);
  8983. if(W.model.cameras.objects[uroShownFID] === null)
  8984. {
  8985. uroDBG.AddLog('camera object not found...');
  8986. return false;
  8987. }
  8988. uroOWL.RemoveCamFromWatchList();
  8989. let actionObj = require('Waze/Action/DeleteObject');
  8990. let deleteAction = new actionObj(W.model.cameras.objects[uroShownFID], null);
  8991. W.model.actionManager.add(deleteAction);
  8992. uroPopup.MouseOut();
  8993. uroPopup.Hide();
  8994. return false;
  8995. }
  8996. function uroCheckCommentsForTag(idSrc)
  8997. {
  8998. let ursObj = W.model.updateRequestSessions.objects[idSrc];
  8999. if(typeof(ursObj) == 'undefined') return -1;
  9000. if(ursObj.attributes.comments.length === 0) return -1;
  9001.  
  9002. for(let idx=ursObj.attributes.comments.length-1; idx>=0; idx--)
  9003. {
  9004. for(let tag=0; tag<uroCustomURTags.length; tag++)
  9005. {
  9006. let keyword = uroCustomURTags[tag];
  9007. if(ursObj.attributes.comments[idx].text.indexOf(keyword) != -1)
  9008. {
  9009. return tag;
  9010. }
  9011. }
  9012. }
  9013. return -1;
  9014. }
  9015. function uroGetCustomType(idSrc, markerType, desc)
  9016. {
  9017. let provider = '';
  9018. if(desc === null) desc = '';
  9019. if(markerType == uroLayers.ID.UR)
  9020. {
  9021. let ureq = W.model.mapUpdateRequests.objects[idSrc];
  9022. // early test for native speed limit URs
  9023. if(ureq.attributes.type == 23) return 98;
  9024. }
  9025. else if(markerType == uroLayers.ID.MP)
  9026. {
  9027. let mp = W.model.mapProblems.objects[idSrc];
  9028. if(mp.attributes.provider != null)
  9029. {
  9030. provider = mp.attributes.provider;
  9031. }
  9032. }
  9033.  
  9034. if(desc !== '')
  9035. {
  9036. if((markerType == uroLayers.ID.UR) || (markerType == 'mc'))
  9037. {
  9038. for(let tag=0; tag<uroCustomURTags.length; tag++)
  9039. {
  9040. let keyword = uroCustomURTags[tag];
  9041. if(desc.indexOf(keyword) != -1)
  9042. {
  9043. return tag;
  9044. }
  9045. }
  9046. }
  9047.  
  9048. if(markerType == uroLayers.ID.MP)
  9049. {
  9050. if(desc.indexOf('[Elgin]') != -1) return 100;
  9051. if(desc.indexOf('[ELGIN]') != -1) return 100;
  9052. if(desc.indexOf('[elginroadworks]') != -1) return 100;
  9053. if(desc.indexOf('[one.network]') != -1) return 100;
  9054. if(desc.indexOf('[TrafficCast]') != -1) return 101;
  9055. if(desc.indexOf('[TM]') != -1) return 102;
  9056. if(desc.indexOf('[Caltrans]') != -1) return 103;
  9057. if(desc.indexOf('[TfL Open Data]') != -1) return 104;
  9058. if(provider.indexOf('London TFL Closures') != -1) return 104;
  9059. }
  9060. }
  9061.  
  9062. if(markerType == uroLayers.ID.UR)
  9063. {
  9064. return uroCheckCommentsForTag(idSrc);
  9065. }
  9066.  
  9067. return -1;
  9068. }
  9069. function uroGetRestrictionLanes(disposition)
  9070. {
  9071. let retval = '';
  9072. if(disposition == 1) retval += 'All lanes';
  9073. else if(disposition == 2) retval += 'Left lane';
  9074. else if(disposition == 3) retval += 'Middle lane';
  9075. else if(disposition == 4) retval += 'Right lane';
  9076. else retval += ' - ';
  9077. return retval;
  9078. }
  9079. function uroGetRestrictionLaneType(laneType)
  9080. {
  9081. let retval = '';
  9082. if(laneType === null) retval += ' - ';
  9083. else
  9084. {
  9085. if(laneType == 1) retval += 'HOV';
  9086. else if(laneType == 2) retval += 'HOT';
  9087. else if(laneType == 3) retval += 'Express';
  9088. else if(laneType == 4) retval += 'Bus lane';
  9089. else if(laneType == 5) retval += 'Fast lane';
  9090. else retval += ' - ';
  9091. }
  9092. return retval;
  9093. }
  9094. let uroVehicleTypes =
  9095. [
  9096. [1280, 'fa-car'],
  9097. [1024, 'fa-motorcycle'],
  9098. [272, 'fa-taxi'],
  9099. [1808, 'fa-bolt']
  9100. ];
  9101. function uroGetRestrictionVehicleTypes(restObj, allowInit, profileKey)
  9102. {
  9103. let i;
  9104. let j;
  9105. let k;
  9106. let tVT;
  9107. let retval = [];
  9108. for(i = 0; i < uroVehicleTypes.length; ++i)
  9109. {
  9110. retval.push(allowInit);
  9111. }
  9112. let tRest = restObj._driveProfiles.get(profileKey);
  9113. if(tRest !== undefined)
  9114. {
  9115. for(i = 0; i < tRest._driveProfiles.length; ++i)
  9116. {
  9117. tVT = tRest._driveProfiles[i].getVehicleTypes();
  9118. {
  9119. if(tVT.length > 0)
  9120. {
  9121. for(j = 0; j < tVT.length; ++j)
  9122. {
  9123. for(k = 0; k < uroVehicleTypes.length; ++k)
  9124. {
  9125. if(tVT[j] == uroVehicleTypes[k][0])
  9126. {
  9127. retval[k] = !allowInit;
  9128. }
  9129. }
  9130. }
  9131. }
  9132. }
  9133. }
  9134. }
  9135. return retval;
  9136. }
  9137. function uroFormatRestriction(restObj)
  9138. {
  9139. let retval = '';
  9140.  
  9141. if(restObj._defaultType == "DIFFICULT")
  9142. {
  9143. retval = '<tr><td colspan=13>Difficult Turn';
  9144. }
  9145. else
  9146. {
  9147. let roDays = null;
  9148. let roFromDate = null;
  9149. let roToDate = null;
  9150. let roFromTime = null;
  9151. let roToTime = null;
  9152. let roRepeats = false;
  9153. let roAllDay = false;
  9154. if(restObj._days !== undefined)
  9155. {
  9156. roDays = restObj._days;
  9157. roFromDate = restObj._fromDate;
  9158. roToDate = restObj._toDate;
  9159. roFromTime = restObj._fromTime;
  9160. roToTime = restObj._toTime;
  9161. }
  9162. else if(restObj._timeFrames.length > 0)
  9163. {
  9164. if(restObj._timeFrames[0]._weekdays !== undefined)
  9165. {
  9166. roDays = restObj._timeFrames[0]._weekdays;
  9167. roFromDate = restObj._timeFrames[0]._startDate;
  9168. roToDate = restObj._timeFrames[0]._endDate;
  9169. roFromTime = restObj._timeFrames[0]._fromTime;
  9170. roToTime = restObj._timeFrames[0]._toTime;
  9171. roRepeats = restObj._timeFrames[0]._repeatYearly;
  9172. }
  9173. }
  9174.  
  9175. if((roFromTime === null) && (roToTime === null))
  9176. {
  9177. roFromTime = "0:00";
  9178. roToTime = "23:59";
  9179. roAllDay = true;
  9180. }
  9181.  
  9182. let hasExpired = false;
  9183. let isFuture = false;
  9184. let tNow = Date.now();
  9185. let tFrom = null;
  9186. let tTo = null;
  9187. if(roFromDate !== null)
  9188. {
  9189. tFrom = new Date(roFromDate + " " + roFromTime);
  9190. isFuture = (tFrom.getTime() > tNow);
  9191. }
  9192. if(roToDate !== null)
  9193. {
  9194. tTo = new Date(roToDate + " " + roToTime);
  9195. hasExpired = (tTo.getTime() < tNow);
  9196. }
  9197. if((hasExpired === true) && (roRepeats === true))
  9198. {
  9199. while(tTo.getTime() < tNow)
  9200. {
  9201. tFrom.setFullYear(tFrom.getFullYear() + 1);
  9202. tTo.setFullYear(tTo.getFullYear() + 1);
  9203. }
  9204. isFuture = (tFrom.getTime() > tNow);
  9205. hasExpired = false;
  9206. }
  9207.  
  9208.  
  9209. if(isFuture === true)
  9210. {
  9211. retval = '<tr bgcolor="#8080FF">';
  9212. }
  9213. else if(hasExpired === true)
  9214. {
  9215. retval = '<tr bgcolor="#FFFFC0">';
  9216. }
  9217. else
  9218. {
  9219. retval = '<tr>';
  9220. }
  9221.  
  9222. if(roDays === null)
  9223. {
  9224. roDays = 127;
  9225. }
  9226.  
  9227. retval += '<td style="text-align:center;">';
  9228. if((roDays & 1) == 1) retval += 'M';
  9229. else retval += '-';
  9230. retval += '</td><td style="text-align:center;">';
  9231. if((roDays & 2) == 2) retval += 'Tu';
  9232. else retval += '-';
  9233. retval += '</td><td style="text-align:center;">';
  9234. if((roDays & 4) == 4) retval += 'W';
  9235. else retval += '-';
  9236. retval += '</td><td style="text-align:center;">';
  9237. if((roDays & 8) == 8) retval += 'Th';
  9238. else retval += '-';
  9239. retval += '</td><td style="text-align:center;">';
  9240. if((roDays & 16) == 16) retval += 'F';
  9241. else retval += '-';
  9242. retval += '</td><td style="text-align:center;">';
  9243. if((roDays & 32) == 32) retval += 'Sa';
  9244. else retval += '-';
  9245. retval += '</td><td style="text-align:center;">';
  9246. if((roDays & 64) == 64) retval += 'Su';
  9247. else retval += '-';
  9248.  
  9249. retval += '</td><td nowrap style="text-align:center;">';
  9250.  
  9251. if(roFromDate === null) retval += 'All dates';
  9252. else retval += tFrom.toISOString().slice(0,10) + ' to ' + tTo.toISOString().slice(0,10);
  9253. if(roRepeats === true)
  9254. {
  9255. retval += '&nbsp;<i class="fa fa-repeat"> </i>';
  9256. }
  9257.  
  9258. retval += '</td><td nowrap style="text-align:center;">';
  9259.  
  9260. if((restObj._allDay === true) || (roAllDay === true)) retval += 'All day';
  9261. else retval += roFromTime + ' to ' + roToTime;
  9262.  
  9263. retval += '</td><td nowrap style="text-align:center;">';
  9264.  
  9265. retval += uroGetRestrictionLanes(restObj._disposition);
  9266.  
  9267. retval += '</td><td nowrap style="text-align:center;">';
  9268.  
  9269. retval += uroGetRestrictionLaneType(restObj._laneType);
  9270.  
  9271. retval += '</td><td nowrap style="text-align:center;">';
  9272.  
  9273. // for brevity, the popup only displays the allowed/prohibited restriction for the driveable vehicle types in the app...
  9274. let typesAllowed = [];
  9275. if((restObj._defaultType == "BLOCKED") || (restObj._defaultType == "TOLL"))
  9276. {
  9277. if(restObj._defaultType == "TOLL")
  9278. {
  9279. retval += I18n.lookup('restrictions.editing.segment.toll_road');
  9280. }
  9281. typesAllowed = uroGetRestrictionVehicleTypes(restObj, false, "FREE");
  9282. }
  9283. else
  9284. {
  9285. typesAllowed = uroGetRestrictionVehicleTypes(restObj, true, "BLOCKED");
  9286. }
  9287.  
  9288. let i;
  9289. for(i = 0; i < uroVehicleTypes.length; ++i)
  9290. {
  9291. if(typesAllowed[i] === true)
  9292. {
  9293. retval += '<i class="fa '+uroVehicleTypes[i][1]+'" style="color:#000000;"> </i>&nbsp;';
  9294. }
  9295. else
  9296. {
  9297. retval += '<i class="fa '+uroVehicleTypes[i][1]+'" style="color:#d0d0d0;"> </i>&nbsp;';
  9298. }
  9299. }
  9300.  
  9301. retval += '</td><td>';
  9302. retval += uroUtils.Clickify(restObj._description, '');
  9303. }
  9304.  
  9305. retval += '</td></tr>';
  9306.  
  9307. return retval;
  9308. }
  9309. function uroOpenURDialog(urID)
  9310. {
  9311. let t = {showNext: false, nextButtonString: I18n.lookup('problems.panel.done')};
  9312. let urObj = W.model.mapUpdateRequests.objects[urID];
  9313. W.reqres.request("problems:browse", _.extend(t, {problem: urObj}));
  9314. }
  9315. function uroRecentreSessionOnUR()
  9316. {
  9317. //uroGetMarker(uroLayers.ID.UR, uroShownFID).element.click();
  9318. uroOpenURDialog(uroShownFID);
  9319. W.map.moveTo(uroGetMarker(uroLayers.ID.UR, uroShownFID).lonlat, 17);
  9320. uroPopup.Hide();
  9321. return false;
  9322. }
  9323. function uroRecentreSessionOnMP()
  9324. {
  9325. uroGetMarker(uroLayers.ID.MP, uroShownFID).element.click();
  9326. W.map.moveTo(uroGetMarker(uroLayers.ID.MP, uroShownFID).lonlat, 17);
  9327. uroPopup.Hide();
  9328. return false;
  9329. }
  9330. function uroRecentreSessionOnPUR()
  9331. {
  9332. uroGetMarker(uroLayers.ID.PUR, uroShownFID).element.click();
  9333. W.map.moveTo(uroGetMarker(uroLayers.ID.PUR, uroShownFID).lonlat, 17);
  9334. uroPopup.Hide();
  9335. return false;
  9336. }
  9337. function uroRecentreSessionOnPPUR()
  9338. {
  9339. uroGetMarker(uroLayers.ID.PPUR, uroShownFID).element.click();
  9340. W.map.moveTo(uroGetMarker(uroLayers.ID.PPUR, uroShownFID).lonlat, 17);
  9341. uroPopup.Hide();
  9342. return false;
  9343. }
  9344. function uroRecentreSessionOnVenueNavPoint()
  9345. {
  9346. W.map.moveTo(uroGetVenueNavPoint(uroShownFID), 17);
  9347. uroPopup.Hide();
  9348. return false;
  9349. }
  9350. function uroStackListObj(fid,x,y)
  9351. {
  9352. this.fid = fid;
  9353. this.x = uroUtils.TypeCast(x);
  9354. this.y = uroUtils.TypeCast(y);
  9355. }
  9356. function uroRestackMarkers()
  9357. {
  9358. if(uroStackList.length === 0) return;
  9359.  
  9360. if(uroLayers.layers[uroStackType].mf !== null)
  9361. {
  9362. uroDBG.AddLog('restacking markers...');
  9363. // strip off the .realX/realY attributes from any UR object we've previously added it to, to allow
  9364. // the native recentering to work again...
  9365. let idList = uroGetMarkerIDs(uroStackType);
  9366. for(let marker of idList)
  9367. {
  9368. let testMarkerAttributes = uroGetAttributes(uroStackType, marker);
  9369. if(testMarkerAttributes.geometry.realX != null)
  9370. {
  9371. testMarkerAttributes.geometry.x = testMarkerAttributes.geometry.realX;
  9372. testMarkerAttributes.geometry.y = testMarkerAttributes.geometry.realY;
  9373. delete(testMarkerAttributes.geometry.realX);
  9374. delete(testMarkerAttributes.geometry.realY);
  9375. }
  9376. }
  9377. // now restack any markers that were repositioned...
  9378. for(let idx=0; idx<uroStackList.length; idx++)
  9379. {
  9380. let orig_x = uroStackList[idx].x + 'px';
  9381. let orig_y = uroStackList[idx].y + 'px';
  9382. let fid = uroStackList[idx].fid;
  9383.  
  9384. if(uroGetMarker(uroStackType, fid) != null)
  9385. {
  9386. uroGetMarker(uroStackType, fid).element.style.left = orig_x;
  9387. uroGetMarker(uroStackType, fid).element.style.top = orig_y;
  9388. }
  9389. }
  9390. uroStackList = [];
  9391. uroUnstackedMasterID = null;
  9392. uroStackType = null;
  9393. uroDBG.AddLog('...stacked!');
  9394. }
  9395. }
  9396. function uroIsIDAlreadyUnstacked(idSrc)
  9397. {
  9398. if(uroStackList.length === 0) return false;
  9399. for(let idx=0; idx<uroStackList.length; idx++)
  9400. {
  9401. if(uroStackList[idx].fid == idSrc) return true;
  9402. }
  9403. return false;
  9404. }
  9405. function uroCheckStacking(stackType, masterID, unstackedX, unstackedY)
  9406. {
  9407. //// WIP
  9408. return;
  9409. if(typeof(masterID) === 'number')
  9410. {
  9411. masterID = masterID.toString();
  9412. }
  9413.  
  9414. if(uroIsIDAlreadyUnstacked(masterID) === true) return;
  9415. if(uroStackType !== null) return;
  9416.  
  9417. uroDBG.AddLog('checking for marker stack, masterID: '+masterID+', stackType: '+stackType);
  9418. let stackList = [];
  9419. stackList.push(masterID);
  9420. let threshSquared = uroUtils.GetElmValue('_inputUnstackSensitivity');
  9421. threshSquared *= threshSquared;
  9422.  
  9423. let marker;
  9424.  
  9425. let offset = 0.000000001;
  9426. if(uroLayers.layers[stackType].mf !== null)
  9427. {
  9428. let idList = uroGetMarkerIDs(stackType);
  9429. let showOpen = true;
  9430. let showClosed = false;
  9431. let showTypes = null;
  9432. if(stackType === uroLayers.ID.UR)
  9433. {
  9434. showTypes = W?.issueTrackerController?.app?.attributes?.issueTrackerFilter?.attributes?.mapUpdateRequestsFilter?.attributes?.status;
  9435. }
  9436. else if(stackType === uroLayers.ID.MP)
  9437. {
  9438. showTypes = W?.issueTrackerController?.app?.attributes?.issueTrackerFilter?.attributes?.mapProblemsFilter?.attributes?.status;
  9439. }
  9440. if(showTypes !== null)
  9441. {
  9442. showOpen = ((showTypes == 'OPEN') || (showTypes == 'BOTH'));
  9443. showClosed = ((showTypes == 'CLOSED') || (showTypes == 'BOTH'));
  9444. }
  9445.  
  9446. for(marker of idList)
  9447. {
  9448. let testMarkerObj = uroGetMarker(stackType, marker);
  9449. let testMarkerAttributes = uroGetAttributes(stackType, marker);
  9450. if((testMarkerAttributes !== null) && (testMarkerObj !== null))
  9451. {
  9452. // 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
  9453. // top of the stack in the absence of any URO+ filtering, regardless of which UR pin actually receives the click event. To prevent
  9454. // this, we give each pin in the stack a unique set of false coordinates, storing the original coordinates in newly created
  9455. // properties so they can be restored later on.
  9456. //
  9457. // 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
  9458. // 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
  9459. // is being viewed. By using a small fractional offset added to each stacked marker, the risk of accidentally setting the offset coords to
  9460. // those of another marker is low
  9461. if(testMarkerAttributes.geometry.realX === undefined)
  9462. {
  9463. testMarkerAttributes.geometry.realX = testMarkerAttributes.geometry.x;
  9464. testMarkerAttributes.geometry.x += offset;
  9465. testMarkerAttributes.geometry.realY = testMarkerAttributes.geometry.y;
  9466. testMarkerAttributes.geometry.y += offset;
  9467. offset += 0.000000001;
  9468. }
  9469.  
  9470. let includeInStack = (testMarkerObj.element.style.visibility != 'hidden');
  9471. let isClosed = testMarkerObj.element.classList.contains("recently-closed");
  9472. includeInStack = includeInStack && ((isClosed && showClosed) || (!isClosed && showOpen));
  9473. if(includeInStack)
  9474. {
  9475. if(testMarkerAttributes.id != masterID)
  9476. {
  9477. let bcr = testMarkerObj.element.getBoundingClientRect();
  9478. let xdiff = unstackedX - bcr.x;
  9479. let ydiff = unstackedY - bcr.y;
  9480. let distSquared = ((xdiff * xdiff) + (ydiff * ydiff));
  9481. if(distSquared < threshSquared)
  9482. {
  9483. stackList.push(testMarkerAttributes.id);
  9484. }
  9485. }
  9486. }
  9487. }
  9488. }
  9489. }
  9490.  
  9491. let inhibitUnstacking = (W.map.getZoom() < uroUtils.GetElmValue('_inputUnstackZoomLevel'));
  9492. inhibitUnstacking = inhibitUnstacking || (stackList.length < 2);
  9493.  
  9494. if(inhibitUnstacking == false)
  9495. {
  9496. uroStackType = stackType;
  9497. if(uroUnstackedMasterID != masterID)
  9498. {
  9499. uroDBG.AddLog('unstacked ID mismatch, relocating markers...');
  9500. uroRestackMarkers();
  9501. uroUnstackedMasterID = masterID;
  9502. uroStackList = [];
  9503.  
  9504. // push the highlighted marker onto the stacklist so uroIsIDAlreadyUnstacked() will return true
  9505. uroStackList.push(new uroStackListObj(masterID,unstackedX,unstackedY));
  9506.  
  9507. for(let shoveIdx=0; shoveIdx < stackList.length; shoveIdx++)
  9508. {
  9509. let fid = stackList[shoveIdx];
  9510. let stackMarker = uroGetMarker(stackType, fid);
  9511. if(stackMarker !== null)
  9512. {
  9513. let x = uroUtils.ParsePxString(stackMarker.element.style.left);
  9514. let y = uroUtils.ParsePxString(stackMarker.element.style.top);
  9515. // store the unstacked marker positions so they can be reinstated later
  9516. uroStackList.push(new uroStackListObj(fid,x,y));
  9517. stackMarker.element.style.left = unstackedX + 'px';
  9518. stackMarker.element.style.top = unstackedY + 'px';
  9519. unstackedX += 5;
  9520. unstackedY -= 20;
  9521. }
  9522. }
  9523.  
  9524.  
  9525. // hide other markers to prevent confusion with the unstacked markers
  9526. let listIDs = uroGetMarkerIDs(stackType);
  9527. for(marker in listIDs)
  9528. {
  9529. if(listIDs.hasOwnProperty(marker))
  9530. {
  9531. let toHideMarker = uroGetMarker(stackType, marker);
  9532. if(toHideMarker !== null)
  9533. {
  9534. let toHideID = toHideMarker.id;
  9535. if(uroIsIDAlreadyUnstacked(toHideID) === false)
  9536. {
  9537. toHideMarker = uroGetMarker(stackType, toHideID);
  9538. if(toHideMarker !== null)
  9539. {
  9540. toHideMarker.element.style.visibility = 'hidden';
  9541. }
  9542. }
  9543. }
  9544. }
  9545. }
  9546. }
  9547. }
  9548. else
  9549. {
  9550. uroRestackMarkers();
  9551. }
  9552. }
  9553. function uroGetVenueNavPoint(uroFID)
  9554. {
  9555. let retval = W.map.getUnprojectedCenter(); // allow the function to return a safe value in case we can't find the requested venue object...
  9556.  
  9557. let vObj = W.model.venues.objects[uroFID];
  9558. if(vObj !== undefined)
  9559. {
  9560. if(vObj.attributes.entryExitPoints.length > 0)
  9561. {
  9562. // if the venue has any navpoints defined, use the position of the first one
  9563. let tPoint = vObj.attributes.entryExitPoints[0].getPoint();
  9564. retval.lon = tPoint.coordinates[0];
  9565. retval.lat = tPoint.coordinates[1];
  9566. }
  9567. else
  9568. {
  9569. // otherwise use the centrepoint of the venue point or polygon
  9570. let tPoint = vObj.attributes.geometry.getCentroid();
  9571. let tLL = new OpenLayers.LonLat();
  9572. tLL.lon = tPoint.x;
  9573. tLL.lat = tPoint.y;
  9574. tLL = uroUtils.ConvertMercatorToWGS84(tLL);
  9575. retval.lon = tLL.lon;
  9576. retval.lat = tLL.lat;
  9577. }
  9578. }
  9579. return retval;
  9580. }
  9581. function uroOpenNewTab()
  9582. {
  9583. // flush the current settings into localStorage before the new tab opens, so that when its instance of
  9584. // URO+ fires up it'll have the same settings as this one
  9585. uroConfig.SaveSettings();
  9586. return true;
  9587. }
  9588. function uroGetRTCDuration(rcObj)
  9589. {
  9590. let duration = new Date(rcObj.attributes.endDate) - new Date(rcObj.attributes.startDate);
  9591. return Math.floor(duration / 86400000);
  9592. }
  9593. function uroGetRTCOffset(rcDate)
  9594. {
  9595. let dateObj = new Date(rcDate);
  9596. return (0 - uroUtils.DateToDays(dateObj));
  9597. }
  9598. function uroGetRTCOrigin(rcObj)
  9599. {
  9600. let retval = uroEnums.TRTC.UNKNOWN;
  9601.  
  9602. if(rcObj !== undefined)
  9603. {
  9604. if(rcObj.attributes.createdBy == -5)
  9605. {
  9606. retval = uroEnums.TRTC.WAZEFEED;
  9607. }
  9608. else if((W.model.users.objects[rcObj.attributes.createdBy] !== undefined) && (W.model.users.objects[rcObj.attributes.createdBy].attributes.rank == 6))
  9609. {
  9610. retval = uroEnums.TRTC.WAZEOTHER;
  9611. }
  9612. else
  9613. {
  9614. retval = uroEnums.TRTC.WME;
  9615. }
  9616. }
  9617.  
  9618. return retval;
  9619. }
  9620. function uroGetRTCState(rcObj)
  9621. {
  9622. let retval = uroEnums.SRTC.UNKNOWN;
  9623. let rcStatus = rcObj.attributes.closureStatus;
  9624.  
  9625. if(rcStatus === "ACTIVE")
  9626. {
  9627. retval = uroEnums.SRTC.ACTIVE;
  9628. }
  9629. else if(rcStatus === "NOT_STARTED")
  9630. {
  9631. retval = uroEnums.SRTC.FUTURE;
  9632. }
  9633. else if(rcStatus.indexOf("FINISHED") != -1)
  9634. {
  9635. retval = uroEnums.SRTC.EXPIRED;
  9636. }
  9637. // Haven't seen one of these yet, so assuming it should be treated
  9638. // the same as an expired closure...
  9639. else if(rcStatus === "SUSPENDED")
  9640. {
  9641. retval = uroEnums.SRTC.EXPIRED;
  9642. }
  9643.  
  9644. return retval;
  9645. }
  9646. function uroGetRTCStateText(rcObj)
  9647. {
  9648. let retval = "---";
  9649. let i18 = I18n.lookup("closures.statuses")[rcObj.attributes.closureStatus];
  9650. if(i18 !== undefined)
  9651. {
  9652. retval = i18;
  9653. }
  9654. return retval;
  9655. }
  9656. function uroGetAddress(streetID, houseNumber, formatForSegmentPopup, formatForNodePopup, showAsToll)
  9657. {
  9658. let result = '';
  9659. if((houseNumber !== undefined) && (houseNumber !== null))
  9660. {
  9661. result += houseNumber + ' ';
  9662. }
  9663.  
  9664. if(streetID != null)
  9665. {
  9666. let streetName = I18n.lookup('edit.address.no_street');
  9667. let doesStreetIDExist = true;
  9668. if(W.model.streets.objects[streetID] === undefined)
  9669. {
  9670. streetName = 'non-existent streetID';
  9671. doesStreetIDExist = false;
  9672. }
  9673. else
  9674. {
  9675. if((streetName !== null) && (W.model.streets.objects[streetID].attributes.isEmpty === false))
  9676. {
  9677. streetName = W.model.streets.objects[streetID].attributes.name;
  9678. }
  9679. }
  9680. if(formatForSegmentPopup === true)
  9681. {
  9682. if(showAsToll == true)
  9683. {
  9684. result += '<i class="fa fa-credit-card"></i> ';
  9685. }
  9686. result += '<b>'+streetName+'</b><br>';
  9687. }
  9688. else
  9689. {
  9690. result += streetName + ', ';
  9691. }
  9692.  
  9693. if(doesStreetIDExist === true)
  9694. {
  9695. let cityName = I18n.lookup('edit.address.no_city');
  9696. let doesCityIDExist = true;
  9697. let cityID = W.model.streets.objects[streetID].attributes.cityID;
  9698. if(W.model.cities.objects[cityID] === undefined)
  9699. {
  9700. cityName = 'non-existent cityID';
  9701. doesCityIDExist = false;
  9702. }
  9703. else
  9704. {
  9705. if(W.model.cities.objects[cityID].attributes.name !== "")
  9706. {
  9707. cityName = W.model.cities.objects[cityID].attributes.name;
  9708. }
  9709. }
  9710. result += cityName + ', ';
  9711.  
  9712. if(doesCityIDExist === true)
  9713. {
  9714. let stateID = W.model.cities.objects[cityID].attributes.stateID;
  9715. if(W.model.states.objects[stateID] === undefined)
  9716. {
  9717. result += 'non-existent stateID';
  9718. }
  9719. else
  9720. {
  9721. result += W.model.states.objects[stateID].attributes.name;
  9722. }
  9723. }
  9724. }
  9725. }
  9726. result += '<br>';
  9727.  
  9728. return result;
  9729. }
  9730. function uroGetSelectedSegmentRTCs(segID)
  9731. {
  9732. let closureTypes = uroEnums.DRTC.NONE;
  9733. let RTCObjs = [];
  9734. let selectedSegs = [];
  9735.  
  9736. if(segID === null)
  9737. {
  9738. // segID should always be set to a valid segment ID if we're being called from the segment mouseover
  9739. // handler, so if it's null it implies we've instead been called from the closure panel handler where
  9740. // we might therefore be dealing with a multi-segment selection...
  9741. selectedSegs = W.selectionManager.getSegmentSelection().segments;
  9742. }
  9743.  
  9744. if((selectedSegs.length > 0) || (segID !== null))
  9745. {
  9746. for(let roadClosure in W.model.roadClosures.objects)
  9747. {
  9748. if(W.model.roadClosures.objects.hasOwnProperty(roadClosure))
  9749. {
  9750. let rcObj = W.model.roadClosures.objects[roadClosure];
  9751. rcObj.segIDs = [rcObj.attributes.segID]; // copy the segID property into an array so we can push extra segIDs into it later...
  9752.  
  9753. // 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
  9754. // into a two-way closure, we can then change the direction value to indicate this as well
  9755. if(rcObj.attributes.forward === true)
  9756. {
  9757. rcObj.direction = uroEnums.DRTC.SEG_AB;
  9758. }
  9759. else
  9760. {
  9761. rcObj.direction = uroEnums.DRTC.SEG_BA;
  9762. }
  9763.  
  9764. // for each of the selected or moused-over segments, find all the closures which have matching segIDs
  9765. if(segID !== null)
  9766. {
  9767. if(rcObj.attributes.segID == segID)
  9768. {
  9769. RTCObjs.push(rcObj);
  9770. }
  9771. }
  9772. else
  9773. {
  9774. for(let i = 0; i < selectedSegs.length; ++i)
  9775. {
  9776. if(rcObj.attributes.segID == selectedSegs[i].attributes.id)
  9777. {
  9778. RTCObjs.push(rcObj);
  9779. break;
  9780. }
  9781. }
  9782. }
  9783. }
  9784. }
  9785.  
  9786. // RTCObjs now contains all of the segment closures relating to all of the segments of interest, so
  9787. // we can begin to organise them such that by the time we exit this function, the array will then contain
  9788. // an optimised list of closures that matches up to the list shown in the closure sidepanel, taking into
  9789. // account closures applying to all segments vs some, closures that can be merged into two-ways etc.
  9790.  
  9791. // first sort the closure by their start date, with a secondary sort by direction for those closures
  9792. // that have the same start date
  9793. RTCObjs = RTCObjs.sort(function(a,b)
  9794. {
  9795. if(a.attributes.startDate === b.attributes.startDate)
  9796. {
  9797. if(a.direction == uroEnums.DRTC.SEG_AB) return -1;
  9798. return 1;
  9799. }
  9800. if(a.attributes.startDate > b.attributes.startDate) return 1;
  9801. return -1;
  9802. });
  9803.  
  9804. // if we've got at least two closures in the sorted list, we then test adjacent list entries
  9805. // to see if they contain closure details which are identical except for their segment IDs, and
  9806. // combine them if so
  9807. if(RTCObjs.length > 1)
  9808. {
  9809. let i = 0;
  9810. while(i < (RTCObjs.length - 1))
  9811. {
  9812. if(
  9813. (RTCObjs[i].attributes.createdBy == RTCObjs[i+1].attributes.createdBy) &&
  9814. (RTCObjs[i].attributes.endDate == RTCObjs[i+1].attributes.endDate) &&
  9815. (RTCObjs[i].attributes.eventId == RTCObjs[i+1].attributes.eventId) &&
  9816. (RTCObjs[i].attributes.location == RTCObjs[i+1].attributes.location) &&
  9817. (RTCObjs[i].attributes.reason == RTCObjs[i+1].attributes.reason) &&
  9818. (RTCObjs[i].attributes.startDate == RTCObjs[i+1].attributes.startDate) &&
  9819. (RTCObjs[i].direction == RTCObjs[i+1].direction)
  9820. )
  9821. {
  9822. RTCObjs[i].segIDs.push(RTCObjs[i+1].attributes.segID);
  9823. RTCObjs.splice(i+1, 1);
  9824. }
  9825. else
  9826. {
  9827. ++i;
  9828. }
  9829. }
  9830. }
  9831.  
  9832. // after that first trimming of the list, if there are still two or more entries then
  9833. // we perform a second pass, this time merging any adjacent entries which have the same
  9834. // segment IDs in their segIDs arrays - these are two-way closures applying to all those
  9835. // segments, and so we also change the direction value to indicate two-way vs A-B or B-A
  9836. if(RTCObjs.length > 1)
  9837. {
  9838. let i = 0;
  9839. while(i < (RTCObjs.length - 1))
  9840. {
  9841. if
  9842. (
  9843. (RTCObjs[i].segIDs.sort().join(',') == RTCObjs[i+1].segIDs.sort().join(',')) &&
  9844. (RTCObjs[i].attributes.createdBy == RTCObjs[i+1].attributes.createdBy) &&
  9845. (RTCObjs[i].attributes.endDate == RTCObjs[i+1].attributes.endDate) &&
  9846. (RTCObjs[i].attributes.eventId == RTCObjs[i+1].attributes.eventId) &&
  9847. (RTCObjs[i].attributes.location == RTCObjs[i+1].attributes.location) &&
  9848. (RTCObjs[i].attributes.reason == RTCObjs[i+1].attributes.reason) &&
  9849. (RTCObjs[i].attributes.startDate == RTCObjs[i+1].attributes.startDate)
  9850. )
  9851. {
  9852. RTCObjs[i].direction = uroEnums.DRTC.SEG_BI;
  9853. RTCObjs.splice(i+1, 1);
  9854. }
  9855. ++i;
  9856. }
  9857. }
  9858. }
  9859.  
  9860. let RTTCObjs = [];
  9861. if(segID !== null)
  9862. {
  9863. // If we've been called from the segment popup handler, we now also check for any turn closures
  9864. // associated with this segment, so that their details can also be shown in the popup...
  9865. for(let turnClosure in W.model.turnClosures.objects)
  9866. {
  9867. if(W.model.turnClosures.objects.hasOwnProperty(turnClosure))
  9868. {
  9869. let tcObj = W.model.turnClosures.objects[turnClosure];
  9870. if(tcObj.attributes.fromSegID === segID)
  9871. {
  9872. tcObj.direction = uroEnums.DRTC.TURN_OUT;
  9873. RTTCObjs.push(tcObj);
  9874. }
  9875. else if(tcObj.attributes.toSegID === segID)
  9876. {
  9877. tcObj.direction = uroEnums.DRTC.TURN_IN;
  9878. RTTCObjs.push(tcObj);
  9879. }
  9880. }
  9881. }
  9882.  
  9883. if(RTTCObjs.length > 1)
  9884. {
  9885. RTTCObjs = RTTCObjs.sort(function(a,b)
  9886. {
  9887. if(a.attributes.startDate === b.attributes.startDate)
  9888. {
  9889. if(a.direction == uroEnums.DRTC.TURN_OUT) return -1;
  9890. return 1;
  9891. }
  9892. if(a.attributes.startDate > b.attributes.startDate) return 1;
  9893. return -1;
  9894. });
  9895. }
  9896. }
  9897.  
  9898. uroRTCObjs = RTCObjs.concat(RTTCObjs);
  9899. for(let i = 0; i < uroRTCObjs.length; ++i)
  9900. {
  9901. closureTypes |= uroRTCObjs[i].direction;
  9902. }
  9903.  
  9904. // the closure list ordering at this point doesn't always match up to the order used by the closures panel when
  9905. // a mixture of "all segment" and "some segment" closures are present - need to work out what ordering rules
  9906. // WME is using here...
  9907. return closureTypes;
  9908. }
  9909. function uroGetLengthString(length)
  9910. {
  9911. let retval = '';
  9912. if(length == null)
  9913. {
  9914. retval = "Default";
  9915. }
  9916. else if(W.model.isImperial == true)
  9917. {
  9918. retval = (length / (12 * 2.54)).toFixed(1) + "ft";
  9919. }
  9920. else
  9921. {
  9922. retval = (length / 100).toFixed(1) + "m";
  9923. }
  9924.  
  9925. return retval;
  9926. }
  9927. function uroGetHighlightedMapFeature()
  9928. {
  9929. let featureID = W.selectionManager.mouseInFeature;
  9930. let retval = null;
  9931.  
  9932. if(featureID !== undefined)
  9933. {
  9934. let isSelected = W.selectionManager.isSelected(featureID);
  9935. if(isSelected === false)
  9936. {
  9937. retval = W.selectionManager.getObjectByFeatureId(featureID);
  9938. }
  9939. }
  9940. return retval;
  9941. }
  9942. function uroGetFeatureRenderIntent(moObj)
  9943. {
  9944. let retval = "unknown";
  9945.  
  9946. if(moObj !== null)
  9947. {
  9948. let isSelected = moObj.selected;
  9949.  
  9950. if(isSelected === true)
  9951. {
  9952. retval = "highlightselected";
  9953. }
  9954. else
  9955. {
  9956. retval = "highlight";
  9957. }
  9958. }
  9959.  
  9960. return retval;
  9961. }
  9962. function uroExclusiveCB()
  9963. {
  9964. let cbChecked = uroUtils.GetCBChecked(this.id);
  9965.  
  9966. if(cbChecked === true)
  9967. {
  9968. let pairedList = this.attributes.pairedWith.value.split(',');
  9969. for(let i=0; i<pairedList.length; i++)
  9970. {
  9971. uroUtils.SetCBChecked(pairedList[i], false);
  9972. }
  9973. }
  9974. }
  9975. function uroContainsPoint(geo, point)
  9976. {
  9977. let retval = false;
  9978. try
  9979. {
  9980. let j = 1;
  9981. for(let i = 0; i < geo.length; ++i)
  9982. {
  9983. if
  9984. (
  9985. ((point[1] >= geo[i][1]) && (point[1] <= geo[j][1])) ||
  9986. ((point[1] >= geo[j][1]) && (point[1] <= geo[i][1]))
  9987. )
  9988. {
  9989. let lx = geo[i][0];
  9990. if(geo[i][1] != geo[j][1])
  9991. {
  9992. let g = ((point[1] - geo[i][1]) / (geo[j][1] - geo[i][1]));
  9993. lx += (g * (geo[j][0] - geo[i][0]));
  9994. }
  9995.  
  9996. if(point[0] <= lx)
  9997. {
  9998. retval = !retval;
  9999. }
  10000. }
  10001. if(++j == geo.length)
  10002. {
  10003. j = 0;
  10004. }
  10005. }
  10006. }
  10007. catch
  10008. {
  10009. }
  10010. return retval;
  10011. }
  10012. function uroGetAMs(e)
  10013. {
  10014. if(uroMTEMode) return;
  10015. if(!uroFilterPreamble) return;
  10016. if(!uroInit.initialised) return;
  10017. if(document.getElementById("uroAMList") == null) return;
  10018. if(document.getElementsByClassName('topbar') == null) return;
  10019.  
  10020. if(uroUtils.GetCBChecked("_cbMoveAMList") === false)
  10021. {
  10022. document.getElementsByClassName('area-managers-region')[0].style.display = "block";
  10023. uroAMList.innerHTML = uroUtils.ModifyHTML("");
  10024. document.getElementsByClassName('topbar')[0].style.backgroundColor=null;
  10025. return;
  10026. }
  10027.  
  10028. document.getElementsByClassName('topbar')[0].style.backgroundColor="#000000";
  10029. document.getElementsByClassName('area-managers-region')[0].style.display = "none";
  10030.  
  10031. let amList = '';
  10032. let tName = '';
  10033. if(W.map.managedAreasLayer.getVisibility() === true)
  10034. {
  10035. let mouseX = e.pageX - document.getElementById('map').getBoundingClientRect().left;
  10036. let mouseY = e.pageY - document.getElementById('map').getBoundingClientRect().top;
  10037. let mousePixel = W.map.getLonLatFromPixel(new OpenLayers.Pixel(mouseX, mouseY));
  10038. let mousePoint = [];
  10039. mousePoint.push(mousePixel.lon);
  10040. mousePoint.push(mousePixel.lat);
  10041.  
  10042. for(let amObj in W.model.managedAreas.objects)
  10043. {
  10044. let nc = W.model.managedAreas.objects[amObj].attributes.geoJSONGeometry.coordinates.length;
  10045. for(let i = 0; i < nc; ++i)
  10046. {
  10047. let geo = W.model.managedAreas.objects[amObj].attributes.geoJSONGeometry.coordinates[i];
  10048. if(nc > 1)
  10049. {
  10050. geo = geo[0];
  10051. }
  10052.  
  10053. if(uroContainsPoint(geo, mousePoint) === true)
  10054. {
  10055. let amName = uroUtils.GetUserNameFromID(W.model.managedAreas.objects[amObj].attributes.userID);
  10056. if(amList.indexOf(amName) === -1)
  10057. {
  10058. if(amList !== '') amList += ', ';
  10059. tName = uroUtils.GetUserNameAndRank(W.model.managedAreas.objects[amObj].attributes.userID);
  10060. if(tName.indexOf('a href') !== -1)
  10061. {
  10062. tName = tName.replace('a href', 'a style="color:#c0c0ff;" href');
  10063. }
  10064. amList += tName;
  10065. }
  10066. }
  10067. }
  10068. }
  10069. if(amList === '')
  10070. {
  10071. amList = 'none';
  10072. }
  10073. amList = "&nbsp;-&nbsp;<b>Area Managers:</b> "+amList;
  10074. }
  10075. document.getElementById("uroAMList").innerHTML = uroUtils.ModifyHTML(amList);
  10076. }
  10077. function uroNewTabAtMouseLoc(x, y)
  10078. {
  10079. let tPix = new OpenLayers.Pixel(x,y);
  10080. let mPos = uroUtils.ConvertMercatorToWGS84(W.map.getLonLatFromPixel(tPix));
  10081. let nZoom = W.map.getZoom();
  10082. if(nZoom < 17) nZoom = 17;
  10083. let nHref = window.location.origin + window.location.pathname;
  10084. nHref += '?lon=' + mPos.lon;
  10085. nHref += '&lat=' + mPos.lat;
  10086. nHref += '&zoomLevel=' + nZoom;
  10087. window.open(nHref);
  10088. }
  10089. function uroMouseDown(e)
  10090. {
  10091. uroMouseIsDown = true;
  10092. if((e.altKey === true) && (e.ctrlKey === true))
  10093. {
  10094. uroNewTabAtMouseLoc(e.offsetX, e.offsetY);
  10095. }
  10096. }
  10097. function uroMouseUp()
  10098. {
  10099. uroMouseIsDown = false;
  10100. }
  10101. function uroTestPointerOutsideMap(mX, mY)
  10102. {
  10103. let mapElm = document.getElementById("map");
  10104. if(mapElm === undefined) return;
  10105. let mapBCR = mapElm.getBoundingClientRect();
  10106.  
  10107. if
  10108. (
  10109. (mX < mapBCR.left) ||
  10110. (mX > mapBCR.right) ||
  10111. (mY < mapBCR.top) ||
  10112. (mY > mapBCR.bottom)
  10113. )
  10114. {
  10115. if(uroUtils.GetCBChecked('_cbKillInertialPanning') === true)
  10116. {
  10117. let controller = null;
  10118. if (W.map.navigationControl)
  10119. {
  10120. controller = W.map.navigationControl;
  10121. }
  10122. else if(W.map.controls.find(control => control.CLASS_NAME == 'OpenLayers.Control.Navigation'))
  10123. {
  10124. controller = W.map.controls.find(control => control.CLASS_NAME == 'OpenLayers.Control.Navigation');
  10125. }
  10126. if (controller !== null)
  10127. {
  10128. controller.dragPan.panMapStart();
  10129. }
  10130. }
  10131. return true;
  10132. }
  10133. else
  10134. {
  10135. return false;
  10136. }
  10137. }
  10138. function uroMouseOut(e)
  10139. {
  10140. if(uroTestPointerOutsideMap(e.clientX, e.clientY))
  10141. {
  10142. uroPopup.Hide();
  10143. }
  10144. }
  10145. function uroUREvent_onObjectsAdded()
  10146. {
  10147. if(uroUtils.GetCBChecked('_cbURResolverIDFilter') === true)
  10148. {
  10149. uroUpdateEditorList(W.model.mapUpdateRequests.objects, '_selectURResolverID', false, false, true, false);
  10150. }
  10151. if(uroPopulatingRequestSessions === false)
  10152. {
  10153. uroFilterURs();
  10154. }
  10155. }
  10156. function uroGetSelectedURCommentCount()
  10157. {
  10158. if(W.model.updateRequestSessions.objects[uroSelectedURID] != null)
  10159. {
  10160. let cachedCommentCount = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments.length;
  10161. uroDBG.AddLog(uroSelectedURID+':'+cachedCommentCount+' '+uroExpectedCommentCount);
  10162.  
  10163. // if there aren't the same number of cached comments as there are comments in the UR dialog list, initiate
  10164. // a refresh of the comment data...
  10165. if(cachedCommentCount != uroExpectedCommentCount)
  10166. {
  10167. if(uroPendingCommentDataRefresh === true)
  10168. {
  10169. if(cachedCommentCount > 0)
  10170. {
  10171. uroCachedLastCommentID = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments[cachedCommentCount-1].id;
  10172. }
  10173. else
  10174. {
  10175. uroCachedLastCommentID = null;
  10176. }
  10177. uroDBG.AddLog('updateRequestSessions refresh required for UR '+uroSelectedURID);
  10178. if(uroCachedLastCommentID !== null)
  10179. {
  10180. uroDBG.AddLog('last comment ID for this UR is '+uroCachedLastCommentID);
  10181. }
  10182. else
  10183. {
  10184. uroDBG.AddLog('first comment for this UR, no previous comment to ID');
  10185. }
  10186. let idList = [];
  10187. idList.push(uroSelectedURID);
  10188. // need to delete the existing cache object first, as .get() is only capable of creating new objects,
  10189. // it doesn't seem able to update an existing object with new data
  10190. W.model.updateRequestSessions.remove(W.model.updateRequestSessions.objects[uroSelectedURID]);
  10191. W.model.updateRequestSessions.getAsync(idList);
  10192.  
  10193. // the call to .get() initiates a XMLHttpRequest for the data, so we now need to switch modes - the
  10194. // refresh process has started so we're no longer pending, but we are now waiting for the XMLHttpRequest
  10195. // to return something...
  10196. uroPendingCommentDataRefresh = false;
  10197. uroWaitingCommentDataRefresh = true;
  10198. }
  10199. else
  10200. {
  10201. if(cachedCommentCount > 0)
  10202. {
  10203. let currentLastCommentID = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments[cachedCommentCount-1].id;
  10204. if(currentLastCommentID == uroCachedLastCommentID)
  10205. {
  10206. // most recent comment loaded for this UR is the same one that was present at the start of this
  10207. // refresh process, so kick back into pending mode so we can retry the .get()...
  10208. uroDBG.AddLog('latest comment ID still the same, reverting to pending mode...');
  10209. uroPendingCommentDataRefresh = true;
  10210. }
  10211. else
  10212. {
  10213. // something may have gone awry here - the most recent comment loaded for this UR doesn't have the
  10214. // same ID as the one present at the start of the refresh process, yet the comment counts still don't
  10215. // match up, which suggests either a comment got lost along the way or someone else has commented on
  10216. // the same UR at almost the same time. To get out of the loop this would create, assume that a
  10217. // mismatch in the IDs means the .get() has completed successfully no matter what the new comment
  10218. // count is, and take this new count to be the count we were expecting all along...
  10219. uroDBG.AddLog('latest comment ID different, but expected count not correct...');
  10220. uroExpectedCommentCount = cachedCommentCount;
  10221. }
  10222. }
  10223. else
  10224. {
  10225. uroDBG.AddLog('first comment on this UR not received yet, reverting to pending mode...');
  10226. uroPendingCommentDataRefresh = true;
  10227. }
  10228. }
  10229.  
  10230. }
  10231. else
  10232. {
  10233. // if the WME session is loaded with a UR already selected, such that WME has opened the UR dialog as part
  10234. // of the session startup process, adding new comments to the UR cause the cached data to be updated immediately.
  10235. // This prevents URO+ from switching into waiting mode in the above block of code, so we have to instead do
  10236. // it here by comparing the cached count against the expected count following the Send click event.
  10237. if(cachedCommentCount >= uroExpectedCommentCount)
  10238. {
  10239. uroPendingCommentDataRefresh = false;
  10240. uroWaitingCommentDataRefresh = true;
  10241. uroExpectedCommentCount = null;
  10242. }
  10243.  
  10244. // once the cached data has been updated, refilter the URs so that the new comment count is taken into account
  10245. // immediately for filtering and display purposes
  10246. if(uroWaitingCommentDataRefresh === true)
  10247. {
  10248. uroWaitingCommentDataRefresh = false;
  10249. uroFilterURs();
  10250. uroDBG.AddLog('refresh complete');
  10251. }
  10252. }
  10253. }
  10254. }
  10255. function uroAddedComment()
  10256. {
  10257. // when the user clicks the Send button to submit a new UR comment, this event handler fires before the new comment is
  10258. // posted to the server and thus also before the comment list gets updated in the UR dialog. So we take the current
  10259. // comment count and, if the new comment edit box isn't empty, increment it by 1 to get the expected count. Then we
  10260. // set the pending flag true to initiate a session refresh on the next 100ms tick
  10261. uroExpectedCommentCount = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments.length;
  10262. if(document.getElementsByClassName('new-comment-text')[0].value !== '')
  10263. {
  10264. uroExpectedCommentCount++;
  10265. uroDBG.AddLog('new comment added to UR '+uroSelectedURID+', cache refresh required...');
  10266. uroPendingCommentDataRefresh = true;
  10267. }
  10268. else
  10269. {
  10270. uroPendingCommentDataRefresh = false;
  10271. }
  10272. }
  10273. function uroInhibitNextUpdateRequestButton(e)
  10274. {
  10275. e.stopPropagation();
  10276.  
  10277. let doClick = true;
  10278. if(document.getElementsByClassName('form-control new-comment-text').length > 0)
  10279. {
  10280. if(document.getElementsByClassName('form-control new-comment-text')[0].textLength > 0)
  10281. {
  10282. uroAlertBox.Show("fa-warning", "URO+ Warning", "Comment not sent, close report panel anyway?", true, "Yes", "No", uroCloseReportPanel, null);
  10283. // set doClick to false here, as uroCloseReportPanel will be called by the alert box handler if required...
  10284. doClick = false;
  10285. }
  10286. }
  10287. // no alert box has been generated, so close the panel
  10288. if(doClick)
  10289. {
  10290. uroCloseReportPanel();
  10291. }
  10292. }
  10293. function uroCloseReportPanel()
  10294. {
  10295. document.getElementsByClassName('close-panel')[0].click();
  10296. }
  10297. function uroIncrementClosureDate(oldDate, incByDays)
  10298. {
  10299. // Thanks to WME no longer using consistent ISO8601 date formatting when displaying
  10300. // closure details, parsing the date string is now somewhat more involved. Thanks devs...
  10301.  
  10302. // Default to returning the existing date, just in case we can't increment it
  10303. let retval = oldDate;
  10304. let sepChar = null;
  10305.  
  10306. // Search through oldDate for a non-digit character, so we know what's
  10307. // being used to seperate the year, month and date values by this locale...
  10308. for(let i = 0; i < oldDate.length; ++i)
  10309. {
  10310. if((oldDate[i] < '0') || (oldDate[i] > '9'))
  10311. {
  10312. sepChar = oldDate[i];
  10313. break;
  10314. }
  10315. }
  10316.  
  10317. if(sepChar != null)
  10318. {
  10319. // First build a "probe" date object we can use to determine what the user's WME locale
  10320. // does with dates.
  10321. let incDate = new Date();
  10322. incDate.setFullYear(3000);
  10323. incDate.setMonth(10);
  10324. incDate.setDate(22);
  10325.  
  10326. // With these three carefully chosen date elements set, we now generate a localised datestring
  10327. // using the WME locale setting - the first character of which then tells us the date
  10328. // format - 1 = MDY (ack ptui), 2 = DMY (good), 3 = YMD (sweet!)
  10329. let localeDate = incDate.toLocaleDateString(I18n.locale);
  10330. let dateFormat = localeDate[0];
  10331.  
  10332. // Now we know the seperator character and the date format, so we can finally start to parse
  10333. // the existing date string...
  10334. let oldDateBits = oldDate.split(sepChar);
  10335. let datePos;
  10336. let monthPos;
  10337. let yearPos;
  10338. if(dateFormat == '1')
  10339. {
  10340. datePos = 1;
  10341. monthPos = 0;
  10342. yearPos = 2;
  10343. }
  10344. else if(dateFormat == '2')
  10345. {
  10346. datePos = 0;
  10347. monthPos = 1;
  10348. yearPos = 2;
  10349. }
  10350. else
  10351. {
  10352. datePos = 2;
  10353. monthPos = 1;
  10354. yearPos = 0;
  10355. }
  10356. incDate.setFullYear(parseInt(oldDateBits[yearPos]));
  10357. incDate.setMonth(parseInt(oldDateBits[monthPos]) - 1);
  10358. incDate.setDate(parseInt(oldDateBits[datePos]));
  10359. let tDate = new Date(incDate.getTime());
  10360. incDate.setDate(tDate.getDate() + incByDays);
  10361.  
  10362. retval = incDate.toLocaleDateString(I18n.locale);
  10363.  
  10364. // Except for those pesky locales where toLocaleDateString() doesn't *quite*
  10365. // return what WME is expecting. Because, you know, why make it easy for
  10366. // scripters when you can chuck in a few subtle curveballs like this, eh...
  10367.  
  10368. if(I18n.locale == 'bg')
  10369. {
  10370. // Remove the "r." suffix
  10371. retval = retval.split(" ")[0] + " ";
  10372. }
  10373. }
  10374. return retval;
  10375. }
  10376. function uroGetElementProperty(elmName, elmOffset, elmProperty)
  10377. {
  10378. let retval = null;
  10379. if(document.getElementsByName(elmName).length > elmOffset)
  10380. {
  10381. retval = document.getElementsByName(elmName)[elmOffset][elmProperty];
  10382. }
  10383. else if(document.getElementById(elmName) !== null)
  10384. {
  10385. retval = document.getElementById(elmName)[elmProperty];
  10386. }
  10387. return retval;
  10388. }
  10389. function uroGetShadowElementProperty(elmName, shadowElmType, property)
  10390. {
  10391. let retval = null;
  10392. let tObj = document.getElementById(elmName);
  10393. if(tObj !== null)
  10394. {
  10395. let sObj = tObj.shadowRoot.querySelector(shadowElmType);
  10396. if(sObj !== null)
  10397. {
  10398. retval = sObj[property];
  10399. }
  10400. }
  10401. return retval;
  10402. }
  10403. let rtcTotal = null;
  10404. let rtcSegIDs = null;
  10405. function uroScrollToEndOfClosures()
  10406. {
  10407. let cItems = document.querySelectorAll('.closure-item');
  10408. let nClosures = cItems.length;
  10409. let segIDs = W.selectionManager.getSelectedFeatureIds();
  10410. let sameSegs = false;
  10411. if((segIDs !== null) && (rtcSegIDs !== null))
  10412. {
  10413. if(segIDs.length == rtcSegIDs.length)
  10414. {
  10415. sameSegs = true;
  10416. for(let i = 0; i < segIDs.length; ++i)
  10417. {
  10418. if(segIDs[i] != rtcSegIDs[i])
  10419. {
  10420. sameSegs = false;
  10421. break;
  10422. }
  10423. }
  10424. }
  10425. }
  10426. if(sameSegs === false)
  10427. {
  10428. rtcTotal = null;
  10429. rtcSegIDs = segIDs;
  10430. }
  10431. if(nClosures > rtcTotal)
  10432. {
  10433. if(cItems[0].getBoundingClientRect().height != 0)
  10434. {
  10435. rtcTotal = nClosures;
  10436. if(uroUtils.GetCBChecked('_cbAutoScrollClosureList') == true)
  10437. {
  10438. // Scroll to the end of the closure tab, as that's where the closure you're most likely to be cloning
  10439. // is located...
  10440. cItems[cItems.length - 1].scrollIntoView();
  10441. }
  10442. }
  10443. }
  10444. }
  10445. function uroClosureEditUIChanged()
  10446. {
  10447. if(document.getElementsByClassName('edit-closure').length === 1)
  10448. {
  10449. // note: this also fires when the UI is closed, due to the change events triggered as its elements are removed
  10450. // prior to the tab itself closing...
  10451.  
  10452. let notReady = 0;
  10453. let mteDropDown = document.getElementById('closure_eventId');
  10454. if(document.getElementById('closure_reason').shadowRoot.querySelector('input') === null) notReady += 1;
  10455. if(document.getElementById('closure_direction').shadowRoot.querySelector('.selected-value') === null) notReady += 2;
  10456. else if(document.getElementById('closure_direction').shadowRoot.querySelector('.selected-value').innerText === "") notReady += 4;
  10457. if(document.getElementById('closure_startDate') === null) notReady += 8;
  10458. if(document.getElementById('closure_endDate') === null) notReady += 16;
  10459. if(mteDropDown.shadowRoot.querySelector('.selected-value') === null) notReady += 32;
  10460. else if(mteDropDown.shadowRoot.querySelector('.selected-value').innerText === "") notReady += 64;
  10461. if(document.getElementById('closure_permanent').shadowRoot.querySelector('.wz-checkbox') === null) notReady += 128;
  10462. if(notReady === 0)
  10463. {
  10464. if(uroRTCClone.PendingClone === -3)
  10465. {
  10466. uroRTCClone.Complete();
  10467. }
  10468. else if(uroRTCClone.PendingClone !== -1)
  10469. {
  10470. uroRTCClone.Copy();
  10471. }
  10472. else
  10473. {
  10474. uroFixMTEDropDown(mteDropDown);
  10475. }
  10476. }
  10477. }
  10478. else
  10479. {
  10480. if(uroRTCClone.PendingClone === -2)
  10481. {
  10482. // generate a click event on the Add a closure button to open up the closure editing UI, then
  10483. // wait for the UI to finish opening...
  10484. document.getElementsByClassName('add-closure-button')[0].click();
  10485. uroRTCClone.PendingClone = -3;
  10486. }
  10487. uroClosureListHandler();
  10488. }
  10489. }
  10490. function uroTSTPopupHandler()
  10491. {
  10492. if(document.getElementsByClassName('panel')[0] === undefined)
  10493. {
  10494. uroHidePopupOnPanelOpen = true;
  10495. }
  10496.  
  10497. if(uroPopup.shown === true)
  10498. {
  10499. let hidePopup = false;
  10500.  
  10501. if(document.getElementsByClassName('panel')[0] != null)
  10502. {
  10503. if(uroHidePopupOnPanelOpen === true)
  10504. {
  10505. hidePopup = true;
  10506. uroHidePopupOnPanelOpen = false;
  10507. }
  10508. }
  10509.  
  10510. if(hidePopup === true)
  10511. {
  10512. uroPopup.Hide();
  10513. }
  10514. }
  10515.  
  10516. if((uroAFN.hoverObj !== null) && (uroAFN.hoverTime != -1) && (uroAFN.overlayShown === false))
  10517. {
  10518. if(++uroAFN.hoverTime > 5)
  10519. {
  10520. uroAFN.OverlaySetup();
  10521. }
  10522. }
  10523. uroAFN.ReplaceAreaNames(false);
  10524.  
  10525. if(uroPopup.autoHideTimer > 0)
  10526. {
  10527. if(--uroPopup.autoHideTimer === 0)
  10528. {
  10529. uroPopup.Hide();
  10530. }
  10531. }
  10532.  
  10533. if(uroPopup.timer > 0)
  10534. {
  10535. if(uroPopup.mouseIn === false)
  10536. {
  10537. uroPopup.timer--;
  10538. }
  10539. }
  10540. if(uroPopup.timer === 0)
  10541. {
  10542. uroPopup.Hide();
  10543. }
  10544. }
  10545. function uroTSTNextBtnHandler()
  10546. {
  10547. // replaces the "next xxx" button on UR, MP and PUR editing UIs
  10548.  
  10549. // Correctly determining what WME is displaying for the "next" button in the UR/MP/(P)PUR panel is not trivial due to
  10550. // inconsistencies in the panel behaviour depending on whether it was opened by clicking directly on the relevant
  10551. // marker, or by clicking on the associated feed entry... For PURs, there's also the added complication of multi-part
  10552. // update requests, where the same marker/panel are used to access more than one request and where, therefore, we need
  10553. // to enable access to all requests contained within the PUR, but still inhibit the "next" button once the last
  10554. // request in the multi-part sequence has been viewed.
  10555. //
  10556. // For directly-accesed markers, the "next" button caption is:
  10557. //
  10558. // URs = "Next update request" (update_requests.panel.next)
  10559. // MPs = "Next map problem" (problems.panel.next)
  10560. // PURs = "Next place" for single-part PURs or for the last part of a multi-part PUR (venues.update_requests.panel.next_venue)
  10561. // = "Next" for all but the last part of a multi-part PUR (venues.update_requests.panel.next)
  10562. // PPURs = "Next place" (venues.update_requests.panel.next_venue)
  10563. //
  10564. // For markers accessed via the feed, the "next" button caption always appears to be "Next issue" (feed.issues.next)
  10565.  
  10566.  
  10567.  
  10568. if(W.map.panelRegion.hasView() === true)
  10569. {
  10570. let nurButton = W.map.panelRegion.$el[0].getElementsByClassName('next')[0];
  10571. if(nurButton === undefined)
  10572. {
  10573. nurButton = W.map.panelRegion.$el[0].getElementsByClassName('next-venue')[0];
  10574. }
  10575. if(nurButton !== undefined)
  10576. {
  10577. let doneString = I18n.lookup('problems.panel.done');
  10578. let btnCaptionIsNextPlace = (nurButton.innerHTML.indexOf(I18n.lookup('venues.update_requests.panel.next_venue')) !== -1);
  10579. let btnCaptionIsDefaultUR = (nurButton.innerHTML.indexOf(I18n.lookup('update_requests.panel.next')) !== -1);
  10580. let btnCaptionIsDefaultMP = (nurButton.innerHTML.indexOf(I18n.lookup('problems.panel.next')) !== -1);
  10581. let btnCaptionIsNextIssue = (nurButton.innerHTML.indexOf(I18n.lookup('feed.issues.next')) !== -1);
  10582.  
  10583. let updateButton = false;
  10584.  
  10585. let panelClass = W.map.panelRegion.$el[0].childNodes[0].childNodes[0].className;
  10586. let isURorMPPanel = (panelClass.indexOf('problem-edit') !== -1);
  10587. let isPURPanel = (panelClass.indexOf('place-update') !== -1);
  10588.  
  10589. if(isURorMPPanel === true)
  10590. {
  10591. // user has enabled UR button mod?
  10592. if(uroUtils.GetCBChecked('_cbInhibitNURButton') === true)
  10593. {
  10594. // the native UR panel button will always either be "Next update request" or "Next issue"
  10595. updateButton = ((btnCaptionIsDefaultUR) || (btnCaptionIsNextIssue));
  10596. }
  10597.  
  10598. // user has enabled MP button mod?
  10599. if(uroUtils.GetCBChecked('_cbInhibitNMPButton') === true)
  10600. {
  10601. // there's no way to determine if the edit panel has been opened for a UR or a MP, however as MPs
  10602. // don't currently appear in the feed, the native button only uses "Next map problem" as its caption
  10603. updateButton = (updateButton || btnCaptionIsDefaultMP);
  10604. }
  10605. }
  10606. else if(isPURPanel === true)
  10607. {
  10608. if(uroUtils.GetCBChecked('_cbInhibitNPURButton') === true)
  10609. {
  10610. // for a (P)PUR, only modify the button if it's showing the "Next place" or "Next issue" caption, to
  10611. // avoid messing up the "Next" button used to move to the next part of a multi-part PUR...
  10612. updateButton = ((btnCaptionIsNextPlace === true) || (btnCaptionIsNextIssue));
  10613. }
  10614. }
  10615.  
  10616. if(updateButton === true)
  10617. {
  10618. uroDBG.AddLog('inhibit Next UR/MP/PUR button');
  10619.  
  10620. // alter the button caption
  10621. nurButton.innerHTML = uroUtils.ModifyHTML(doneString);
  10622. // 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
  10623. // moving to the next UR/MP/PUR, and also allows us to warn about closing the UR panel if there's an unsent comment...
  10624. nurButton.addEventListener("click", uroInhibitNextUpdateRequestButton, false);
  10625. }
  10626. }
  10627. uroInhibitURFiltering = false;
  10628. }
  10629. }
  10630. function uroTSTCommentAddedHandler()
  10631. {
  10632. // test for the opening or closing of the UR editing dialog so we can detect when a new comment is added
  10633. let URDialogIsOpen = false;
  10634. let panelOpen = (document.getElementById('panel-container').firstChild !== null);
  10635.  
  10636. if(panelOpen)
  10637. {
  10638. URDialogIsOpen = (document.getElementById('panel-container').getElementsByClassName('conversation').length > 0);
  10639. }
  10640.  
  10641. if(URDialogIsOpen)
  10642. {
  10643. let thisSelectedURID = document.getElementsByClassName('permalink')[0].href.split('&mapUpdateRequest=');
  10644. if(thisSelectedURID.length > 1)
  10645. {
  10646. thisSelectedURID = thisSelectedURID[1].split('&')[0];
  10647. }
  10648. else
  10649. {
  10650. thisSelectedURID = null;
  10651. }
  10652.  
  10653. if((thisSelectedURID != uroSelectedURID) || ((thisSelectedURID != uroMarkers.clickedOnID) && (uroMarkers.clickedOnID != null)))
  10654. {
  10655. // if the user selects a new UR whilst the editing dialog is still open, treat it in the
  10656. // same way as if the user had selected that UR with the dialog closed
  10657. uroURDialogIsOpen = false;
  10658. uroSelectedURID = null;
  10659. }
  10660.  
  10661. if(((uroURDialogIsOpen === false) && (uroSelectedURID === null)) || (uroURReclickAttempts > 0))
  10662. {
  10663. // user is editing a new UR
  10664.  
  10665. // add our own click event handler to the Send button, so we can do stuff whenever a new comment is added
  10666. if(document.getElementsByClassName('new-comment-form').length > 0)
  10667. {
  10668. if(document.getElementsByClassName('new-comment-form')[0].getElementsByClassName('send-button').length > 0)
  10669. {
  10670. document.getElementsByClassName('new-comment-form')[0].getElementsByClassName('send-button')[0].addEventListener("click", uroAddedComment, false);
  10671.  
  10672. uroSelectedURID = thisSelectedURID;
  10673. uroDBG.AddLog('user is editing UR '+uroSelectedURID);
  10674. uroExpectedCommentCount = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments.length;
  10675.  
  10676. if((uroHoveredURID !== null) && (uroSelectedURID !== null) && (parseInt(uroHoveredURID) !== parseInt(uroSelectedURID)))
  10677. {
  10678. if(uroURReclickAttempts === 0)
  10679. {
  10680. 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...');
  10681. }
  10682. if(++uroURReclickAttempts < 3)
  10683. {
  10684. //uroRestackMarkers();
  10685. let urMarker = uroGetMarker(uroLayers.ID.UR,uroHoveredURID);
  10686. if(urMarker !== null)
  10687. {
  10688. let urMarkerAttributes = uroGetAttributes(uroLayers.ID.UR, uroHoveredURID);
  10689. if(urMarkerAttributes !== null)
  10690. {
  10691. urMarkerAttributes.geometry.x = urMarkerAttributes.geometry.realX;
  10692. urMarkerAttributes.geometry.y = urMarkerAttributes.geometry.realY;
  10693. uroOpenURDialog(uroHoveredURID);
  10694. }
  10695. }
  10696. return;
  10697. }
  10698. else
  10699. {
  10700. uroDBG.AddLog('Woe is me, attempting to open UR ID '+uroHoveredURID+' has failed...');
  10701. 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);
  10702. }
  10703. }
  10704. uroURReclickAttempts = 0;
  10705. uroFilterURs();
  10706. }
  10707. }
  10708. }
  10709. }
  10710. else if(uroURDialogIsOpen === true)
  10711. {
  10712. // dialog was open and has now been closed
  10713. uroSelectedURID = null;
  10714. uroMarkers.clickedOnID = null;
  10715. uroFilterURs();
  10716. }
  10717. uroURDialogIsOpen = URDialogIsOpen;
  10718.  
  10719. if(((uroPendingCommentDataRefresh === true) || (uroWaitingCommentDataRefresh === true)) && (uroSelectedURID !== null))
  10720. {
  10721. uroDBG.AddLog('check completion of comment data refresh for UR '+uroSelectedURID+' ('+uroPendingCommentDataRefresh+','+uroWaitingCommentDataRefresh+')');
  10722. uroGetSelectedURCommentCount();
  10723. }
  10724.  
  10725. }
  10726. function uroClosureListHandler()
  10727. {
  10728. // Handles adjustments to the closure list in the sidepanel...
  10729. //
  10730. if(uroUtils.GetCBChecked('_cbMasterEnable') === false)
  10731. {
  10732. return;
  10733. }
  10734.  
  10735. // List entry filtering
  10736. let nEntries = document.querySelectorAll('.closure-item').length;
  10737. if(nEntries > 0)
  10738. {
  10739. let filterExpired = uroUtils.GetCBChecked('_cbHideExpiredSidepanelRTCs');
  10740. let filterCurrent = uroUtils.GetCBChecked('_cbHideSidepanelRTCs');
  10741. let filterFuture = uroUtils.GetCBChecked('_cbHideFutureSidepanelRTCs');
  10742. let filterUnknown = uroUtils.GetCBChecked('_cbHideUnknownSidepanelRTCs');
  10743. for(let i = 0; i < nEntries; ++i)
  10744. {
  10745. let hide = false;
  10746. let cElm = document.querySelectorAll('.closure-item')[i];
  10747. let ciSrc = cElm.querySelector('img')?.src;
  10748. if(ciSrc != undefined)
  10749. {
  10750. hide |= ((ciSrc.indexOf('finished') != -1) && (filterExpired == true));
  10751. hide |= ((ciSrc.indexOf('active') != -1) && (filterCurrent == true));
  10752. hide |= ((ciSrc.indexOf('not-started') != -1) && (filterFuture == true));
  10753. hide |= ((ciSrc === "") && (filterUnknown == true));
  10754. }
  10755.  
  10756. if(hide == true)
  10757. {
  10758. cElm.style.display = "none";
  10759. }
  10760. else
  10761. {
  10762. cElm.style.display = "block";
  10763. }
  10764. }
  10765. }
  10766.  
  10767. // Closure cloning controls
  10768. if((document.querySelectorAll('.closures-list').length > 0) && (document.querySelector('.closures-list').getAttribute('touchedbyuro') === null))
  10769. {
  10770. let nClosures;
  10771. let cLoop;
  10772. let btnElm;
  10773.  
  10774. // Cloning doesn't work with certain locales due to the way the date strings are formatted...
  10775. if
  10776. (
  10777. (I18n.locale == "fa-IR") ||
  10778. (I18n.locale == 'ar') ||
  10779. (I18n.locale == 'zh') ||
  10780. (I18n.locale == 'ko')
  10781. )
  10782. {
  10783. // Sorry :-(
  10784. }
  10785. else
  10786. {
  10787. // for the others, are there any closures defined for all of the selected segment(s)...
  10788. if(document.getElementsByClassName('full-closures').length > 0)
  10789. {
  10790. nClosures = document.getElementsByClassName('full-closures')[0].querySelectorAll('.closure-item.is-editable').length;
  10791. if(nClosures > 0)
  10792. {
  10793. // Force a refresh of uroRTCObjs for the selected segment, as this is no longer guaranteed to have already occurred...
  10794. let segID = W.selectionManager.getSelectedFeatureIds()[0];
  10795. uroGetSelectedSegmentRTCs(segID);
  10796.  
  10797. // and if so, have we already added the clone icon?
  10798. for(cLoop = 0; cLoop < nClosures; cLoop++)
  10799. {
  10800. btnElm = document.getElementsByClassName('full-closures')[0].querySelectorAll('.closure-item.is-editable')[cLoop].getElementsByClassName('closure-title')[0];
  10801. if((btnElm.innerHTML.indexOf('_uroCloneClosure-') == -1) && (uroGetRTCOrigin(uroRTCObjs[cLoop]) !== uroEnums.TRTC.UNKNOWN))
  10802. {
  10803. let newNode = document.createElement("div");
  10804. let anchorID1 = '_uroCloneClosure-1-'+cLoop;
  10805. let anchorID2 = '_uroCloneClosure-7-'+cLoop;
  10806. let newAnchor = '<a id="'+anchorID1+'" href="#">';
  10807. newAnchor += "<i style='font-size: 150%; cursor: copy' class='fa fa-copy'></i>";
  10808. newAnchor += "</a><sup>+1</sup>&nbsp;";
  10809. newAnchor += '<a id="'+anchorID2+'" href="#">';
  10810. newAnchor += "<i style='font-size: 150%; cursor: copy' class='fa fa-copy'></i>";
  10811. newAnchor += "</a><sup>+7</sup>";
  10812. newNode.innerHTML = uroUtils.ModifyHTML(newAnchor);
  10813. btnElm.prepend(newNode);
  10814. uroUtils.AddEventListener(anchorID1,"click",uroRTCClone.Clone,false);
  10815. uroUtils.AddEventListener(anchorID2,"click",uroRTCClone.Clone,false);
  10816.  
  10817. let chipElm = btnElm.querySelector("wz-image-chip");
  10818. chipElm.innerHTML = chipElm.innerHTML.split('>')[0] + '>';
  10819. }
  10820. }
  10821. }
  10822. }
  10823. }
  10824.  
  10825. // if there's more than one closure (full or partial) listed, also add the delete all button if not already present
  10826. nClosures = document.querySelectorAll('.closure-item.is-editable').length;
  10827. if(nClosures > 0)
  10828. {
  10829. if(document.getElementById('_btnDeleteAllClosures') === null)
  10830. {
  10831. let daDiv = document.createElement('wz-button');
  10832. daDiv.className = 'delete-all-button btn is-expanded'; //btn-primary';
  10833. daDiv.id = '_btnDeleteAllClosures';
  10834.  
  10835. let tHTML = '<i class="fa fa-trash"></i> '+I18n.lookup("closures.delete_confirm_no_reason");
  10836. if(nClosures > 1)
  10837. {
  10838. tHTML += ' ('+I18n.lookup("closures.apply_to_all")+')';
  10839. }
  10840. daDiv.innerHTML = uroUtils.ModifyHTML(tHTML);
  10841. daDiv.style.width = '100%';
  10842. daDiv.style.marginBottom = '10px';
  10843.  
  10844. let acBtn = document.getElementsByClassName('add-closure-button')[0];
  10845. if(acBtn !== undefined)
  10846. {
  10847. acBtn.parentNode.insertBefore(daDiv, acBtn.nextSibling);
  10848. uroUtils.AddEventListener('_btnDeleteAllClosures',"click", uroRTCClone.DeleteAll, false);
  10849. }
  10850. }
  10851. }
  10852.  
  10853. document.querySelector('.closures-list').setAttribute('touchedbyuro','true');
  10854. }
  10855. }
  10856. function uroMiscUITweaksHandler()
  10857. {
  10858. if(uroFilterPreamble())
  10859. {
  10860. // clickifies the ExtraInfo URL present in some MPs
  10861. {
  10862. if(document.getElementById('panel-container').getElementsByClassName('extraInfo').length > 0)
  10863. {
  10864. if(document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].touchedByURO === undefined)
  10865. {
  10866. let tDesc = document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].innerHTML;
  10867. tDesc = uroUtils.Clickify(tDesc, '');
  10868. document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].innerHTML = uroUtils.ModifyHTML(tDesc);
  10869. document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].touchedByURO = true;
  10870. }
  10871. }
  10872. }
  10873. }
  10874. }
  10875. function uroMainTick()
  10876. {
  10877. if(uroMTEMode) return;
  10878. if(uroInit.setupListeners)
  10879. {
  10880. if(uroInit.finalisingListenerSetup === false)
  10881. {
  10882. if(W.loginManager.isLoggedIn())
  10883. {
  10884. if(document.getElementsByClassName('topbar').length === 0) return;
  10885. uroInit.FinalizeListenerSetup();
  10886. document.getElementsByClassName('topbar')[0].appendChild(uroAMList);
  10887. }
  10888. }
  10889. }
  10890. else
  10891. {
  10892. if(uroUtils.GetCBChecked('_cbMasterEnable') === true)
  10893. {
  10894. // do one maintick handler call in each 10ms cycle to minimise the time stuck within the maintick handler without
  10895. // unduly affecting the overall response time for each individual handler
  10896.  
  10897. if(uroMainTickStage === 0) uroTSTPopupHandler();
  10898. if(uroMainTickStage == 1) uroTSTNextBtnHandler();
  10899. if(uroMainTickStage == 2) uroTSTCommentAddedHandler();
  10900. if(uroMainTickStage == 4) uroMiscUITweaksHandler();
  10901.  
  10902. if(++uroMainTickStage == 6) uroMainTickStage = 0;
  10903. }
  10904. }
  10905. }
  10906. function uroNewLookCheckDetailsRequest()
  10907. {
  10908. let thisurl = document.location.href;
  10909. let doRetry = true;
  10910. let urID;
  10911. let endmarkerpos = thisurl.indexOf('&endshow');
  10912. let showmarkerpos = thisurl.indexOf('&showturn=');
  10913.  
  10914. if((endmarkerpos != -1) && (showmarkerpos != -1))
  10915. {
  10916. showmarkerpos += 10;
  10917. uroDBG.AddLog('showturn tab opened');
  10918. urID = thisurl.substr(showmarkerpos,endmarkerpos-showmarkerpos);
  10919. uroDBG.AddLog(' turn problem ID = '+urID);
  10920.  
  10921. try
  10922. {
  10923. uroGetMarker(uroLayers.ID.MP,urID).element.click();
  10924. doRetry = false;
  10925. }
  10926. catch(err)
  10927. {
  10928. uroDBG.AddLog('problems not fully loaded, retrying...');
  10929. }
  10930.  
  10931. if(doRetry) window.setTimeout(uroNewLookCheckDetailsRequest,500);
  10932. }
  10933. else
  10934. {
  10935. showmarkerpos = thisurl.indexOf('&showpur=');
  10936. if((endmarkerpos != -1) && (showmarkerpos != -1))
  10937. {
  10938. showmarkerpos += 9;
  10939. uroDBG.AddLog('showPUR tab opened');
  10940. urID = thisurl.substr(showmarkerpos,endmarkerpos-showmarkerpos);
  10941. uroDBG.AddLog(' PUR ID = '+urID);
  10942.  
  10943. try
  10944. {
  10945. uroGetMarker(uroLayers.ID.PUR, urID).element.click();
  10946. doRetry = false;
  10947. }
  10948. catch(err)
  10949. {
  10950. uroDBG.AddLog('PURs not fully loaded, retrying...');
  10951. }
  10952.  
  10953. if(doRetry) window.setTimeout(uroNewLookCheckDetailsRequest,500);
  10954. }
  10955.  
  10956. else
  10957. {
  10958. showmarkerpos = thisurl.indexOf('&showppur=');
  10959. if((endmarkerpos != -1) && (showmarkerpos != -1))
  10960. {
  10961. showmarkerpos += 10;
  10962. uroDBG.AddLog('showPPUR tab opened');
  10963. urID = thisurl.substr(showmarkerpos,endmarkerpos-showmarkerpos);
  10964. uroDBG.AddLog(' PPUR ID = '+urID);
  10965.  
  10966. try
  10967. {
  10968. uroGetMarker(uroLayers.ID.PPUR, urID).element.click();
  10969. doRetry = false;
  10970. }
  10971. catch(err)
  10972. {
  10973. uroDBG.AddLog('PPURs not fully loaded, retrying...');
  10974. }
  10975.  
  10976. if(doRetry) window.setTimeout(uroNewLookCheckDetailsRequest,500);
  10977. }
  10978. }
  10979. }
  10980.  
  10981. }
  10982. function uroUpdateVenueEditorLists()
  10983. {
  10984. if(Object.keys(W.model.venues.objects).length === 0) return;
  10985.  
  10986. // build the list of all userIDs contained in the currently loaded venue objects
  10987. let selectedIdx = null;
  10988. let listedIDs = [];
  10989. let idx;
  10990. for(idx in W.model.venues.objects)
  10991. {
  10992. if(W.model.venues.objects.hasOwnProperty(idx))
  10993. {
  10994. let obj = W.model.venues.objects[idx].attributes;
  10995. let cbID = obj.createdBy;
  10996. let ubID = obj.updatedBy;
  10997.  
  10998. if((cbID !== null) && (listedIDs.indexOf(cbID) == -1))
  10999. {
  11000. listedIDs.push(cbID);
  11001. }
  11002. if((ubID !== null) && (ubID !== cbID) && (listedIDs.indexOf(ubID) == -1))
  11003. {
  11004. listedIDs.push(ubID);
  11005. }
  11006. }
  11007. }
  11008.  
  11009. // check for any previously selected userIDs in the two selector lists, then clear both lists
  11010. // and repopulate using the newly gathered ID collection from above, and finally reselect the
  11011. // previously selected user if they're still present in the new list...
  11012. let selector;
  11013. let selectedUser;
  11014. let users = W.model.users.getByIds(listedIDs);
  11015. let selectorEntry;
  11016.  
  11017. for(let i=0; i<2; i++)
  11018. {
  11019. if(i === 0) selector = document.getElementById('_selectPlacesUserID');
  11020. else selector = document.getElementById('_selectHidePlacesUserID');
  11021.  
  11022. selectedUser = null;
  11023. if(selector.selectedOptions[0] != null)
  11024. {
  11025. selectedUser = parseInt(selector.selectedOptions[0].value);
  11026. }
  11027. while(selector.options.length > 0)
  11028. {
  11029. selector.options.remove(0);
  11030. }
  11031. selector.options.add(new Option('<select a user>', null));
  11032. if(listedIDs.length > 0)
  11033. {
  11034. selectorEntry = '';
  11035. for(idx=0; idx<users.length; idx++)
  11036. {
  11037. if(users[idx].attributes.userName === undefined)
  11038. {
  11039. selectorEntry = users[idx].attributes.id;
  11040. }
  11041. else
  11042. {
  11043. selectorEntry = users[idx].attributes.userName;
  11044. }
  11045. selector.options.add(new Option(selectorEntry, users[idx].id));
  11046. if(users[idx].attributes.id == selectedUser)
  11047. {
  11048. selectedIdx = idx+1;
  11049. }
  11050. }
  11051. }
  11052.  
  11053. if(selectedIdx !== null)
  11054. {
  11055. selector.selectedIndex = selectedIdx;
  11056. }
  11057. }
  11058. }
  11059. function uroPlacesEditorSelected()
  11060. {
  11061. let selector = document.getElementById('_selectPlacesUserID');
  11062. if(selector.selectedIndex > 0)
  11063. {
  11064. document.getElementById('_textPlacesEditor').value = document.getElementById('_selectPlacesUserID').selectedOptions[0].innerHTML;
  11065. }
  11066. }
  11067. function uroHidePlacesEditorSelected()
  11068. {
  11069. let selector = document.getElementById('_selectHidePlacesUserID');
  11070. if(selector.selectedIndex > 0)
  11071. {
  11072. document.getElementById('_textHidePlacesEditor').value = document.getElementById('_selectHidePlacesUserID').selectedOptions[0].innerHTML;
  11073. }
  11074. }
  11075. function uroCamEditorSelected()
  11076. {
  11077. let selector = document.getElementById('_selectCameraUserID');
  11078. if(selector.selectedIndex > 0)
  11079. {
  11080. document.getElementById('_textCameraEditor').value = document.getElementById('_selectCameraUserID').selectedOptions[0].innerHTML;
  11081. }
  11082. }
  11083. function uroSetStyles(obj)
  11084. {
  11085. obj.style.fontSize = '12px';
  11086. obj.style.lineHeight = '100%';
  11087. obj.style.flex = '1';
  11088. obj.style.overflowY = 'auto';
  11089. }
  11090. function uroSetSectionTabStyles()
  11091. {
  11092. for(let i =0; i < uroTabs.CtrlTabs.length; ++i)
  11093. {
  11094. uroSetStyles(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY]);
  11095. }
  11096. }
  11097. function uroPlacesGroupCEHandler(groupidx)
  11098. {
  11099. if(uroPlacesGroupsCollapsed[groupidx] === false)
  11100. {
  11101. document.getElementById('_uroPlacesGroup-'+groupidx).style.display = "block";
  11102. document.getElementById('_uroPlacesGroupState-'+groupidx).className = "fa fa-minus-square-o";
  11103. }
  11104. else
  11105. {
  11106. document.getElementById('_uroPlacesGroup-'+groupidx).style.display = "none";
  11107. document.getElementById('_uroPlacesGroupState-'+groupidx).className = "fa fa-plus-square-o";
  11108. }
  11109. }
  11110. function uroPlacesGroupCollapseExpand()
  11111. {
  11112. let groupidx = this.id.substr(21);
  11113. if(uroPlacesGroupsCollapsed[groupidx] === true) uroPlacesGroupsCollapsed[groupidx] = false;
  11114. else uroPlacesGroupsCollapsed[groupidx] = true;
  11115. uroPlacesGroupCEHandler(groupidx);
  11116. return false;
  11117. }
  11118. function uroGetMarkerIDs(markerType)
  11119. {
  11120. let idList = [];
  11121.  
  11122. if(uroLayers.layers[markerType].mf !== null)
  11123. {
  11124. // Refresh .mf, as this is no longer guaranteed to have been set up as a reference to
  11125. // whatever's in the current W.map.layers object...
  11126. uroLayers.layers[markerType].mf = uroLayers.GetMarkersOrFeatures(markerType);
  11127. for(let i = 0; i < uroLayers.layers[markerType].mf.length; ++i)
  11128. {
  11129. let dID = uroLayers.layers[markerType].mf[i]?.element?.attributes['data-id']?.value;
  11130. if(dID === undefined)
  11131. {
  11132. dID = uroLayers.layers[markerType].mf[i]?.attributes?.wazeFeature?.id;
  11133. }
  11134. if(dID !== undefined)
  11135. {
  11136. idList.push(dID);
  11137. }
  11138. }
  11139. }
  11140. return idList;
  11141. }
  11142. function uroGetAttributes(markerType, markerID)
  11143. {
  11144. if(markerType == uroLayers.ID.UR) return W.model.mapUpdateRequests.objects[markerID].attributes;
  11145. if(markerType == uroLayers.ID.MP) return W.model.mapProblems.objects[markerID].attributes;
  11146. return null;
  11147. }
  11148. function uroGetMarker(markerType, markerID)
  11149. {
  11150. if(typeof(markerID) === 'number')
  11151. {
  11152. markerID = markerID.toString();
  11153. }
  11154.  
  11155. let retval = null;
  11156.  
  11157. if(markerID !== null)
  11158. {
  11159. let mObj = null;
  11160. if(markerType === uroLayers.ID.UR)
  11161. {
  11162. mObj = W.model.mapUpdateRequests.getObjectById(markerID);
  11163. }
  11164. else if(markerType === uroLayers.ID.MP)
  11165. {
  11166. mObj = W.model.mapProblems.getObjectById(markerID);
  11167. }
  11168. else if(markerType === uroLayers.ID.RTC)
  11169. {
  11170. mObj = W.model.roadClosures.getObjectById(markerID);
  11171. }
  11172.  
  11173. if(mObj !== null)
  11174. {
  11175. retval = W.userscripts.getMapElementByDataModel(mObj);
  11176. }
  11177. else
  11178. {
  11179. for(let i = 0; i < uroLayers.layers[markerType].mf.length; ++i)
  11180. {
  11181. if(uroLayers.layers[markerType].mf[i]?.attributes?.wazeFeature?.id === markerID)
  11182. {
  11183. let geoID = uroLayers.layers[markerType].mf[i].geometry.id;
  11184. retval = document.getElementById(geoID);
  11185. break;
  11186. }
  11187. }
  11188. }
  11189. }
  11190. return retval;
  11191. }
  11192.  
  11193. uroInit.Initialise();