UROverview Plus (URO+)

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

目前為 2024-04-20 提交的版本,檢視 最新版本

  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.3
  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 _: */
  32. /* globals trustedTypes: */
  33. /* jshint bitwise: false */
  34. /* jshint eqnull: true */
  35. /* jshint esversion: 11 */
  36.  
  37. const uroRelease =
  38. {
  39. version : "4.3",
  40. date : "20240421",
  41. changes :
  42. [
  43. 'Stopped popups appearing if map element is no longer being highlighted',
  44. 'Fixed AM area test with complex areas',
  45. 'Segment popups now show turn closure details'
  46. ]
  47. };
  48.  
  49. const URO_UFP_OPTS =
  50. {
  51. filterUneditable: 0,
  52. filterInsideManagedAreas: 1,
  53. excludeMyAreas: 2,
  54. filterLockRanked: 3,
  55. filterFlagged: 4,
  56. filterNewPlace: 5,
  57. filterUpdatedDetails: 6,
  58. filterNewPhoto: 7,
  59. filterMinPURAge: 8,
  60. filterMaxPURAge: 9,
  61. invertPURFilters: 10,
  62. filterHighSeverity: 11,
  63. filterMedSeverity: 12,
  64. filterLowSeverity: 13,
  65. leavePURGeos: 14,
  66. filterCFPhone: 15,
  67. filterCFName: 16,
  68. filterCFEntryExitPoints: 17,
  69. filterCFOpeningHours: 18,
  70. filterCFAliases: 19,
  71. filterCFServices: 20,
  72. filterCFGeometry: 21,
  73. filterCFHouseNumber: 22,
  74. filterCFCategories: 23,
  75. filterCFDescription: 24,
  76. filterOnCFs: 25,
  77. thresholdMinPURDays: 26,
  78. thresholdMaxPURDays: 27,
  79. isLoggedIn: 28,
  80. userRank: 29,
  81. N_OPTS: 30
  82. };
  83. const URO_TRTC =
  84. {
  85. UNKNOWN: 0,
  86. WME: 1,
  87. WAZEFEED: 2,
  88. WAZEOTHER: 3
  89. };
  90. const URO_SRTC =
  91. {
  92. UNKNOWN: 0,
  93. EXPIRED: 1,
  94. ACTIVE: 2,
  95. FUTURE: 3
  96. };
  97. const URO_DRTC =
  98. {
  99. NONE: 0,
  100. SEG_AB: 1,
  101. SEG_BA: 2,
  102. SEG_BI: 4,
  103. TURN_OUT: 8,
  104. TURN_IN: 16
  105. };
  106. const uroCustomURTags = ['[ROADWORKS]','[CONSTRUCTION]','[CLOSURE]','[EVENT]','[NOTE]','[WSLM]','[BOG]','[DIFFICULT]'];
  107. const uroImages =
  108. {
  109. HighlightedCameraImages :
  110. [
  111. // speed
  112. ["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/Y7ux4zK5Wfz6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dXBwbGllcj4KICAgPHBsdXM6SW1hZ2VDcmVhdG9yPgogICAgPHJkZjpTZXEvPgogICA8L3BsdXM6SW1hZ2VDcmVhdG9yPgogICA8cGx1czpDb3B5cmlnaHRPd25lcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkNvcHlyaWdodE93bmVyPgogICA8cGx1czpMaWNlbnNvcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkxpY2Vuc29yPgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgIAo8P3hwYWNrZXQgZW5kPSJ3Ij8+txeqYAAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAuIwAALiMBeKU/dgAAAAd0SU1FB+IDAw8pAmNZfO0AAA7kSURBVHja1Zx5kB1FHcc/8459b+9N2GSPhBiBBAQBBeVSI4GEoFQFSIASj+CRshDFQstAgXiiJcT7SLQKUVkQhOIIRVFA1gSSYCFHAgIakFSwSNjdhGU3yR7v7b43M/7Rr/N6erpn3stuTJyqrp7p6Zk3/X2/4/v7dc84HLrNiTme6ObHHFe1pQ4hOM4kA+cfpL4H5V+sFiS9LepY7W+SFj/mGEvbYQuUqTYVUx8bOL7Wphci6sNa9UzAJLRaBSdhuZ9nAMjTah0s50BUL3WI1M4ETkI5Thr6mFRPB8Qt9fdKfVXQdJWrCrDUIbJRaEAkI2onRvUkQJ4Ckqv09wygOP8PqudoUpRUSkqrdUlzNJA8pbhAUQHJjfB0h43qOTF2SZWYVEQxSRYGSZIgJUt1Aihoz+FrNs2pBrTUQQZHB0qXIhWUtFJSSp3UpApNmiRIhVJJWOgHBlV0KpWy1CQC5MRQgYRmf1SQarZv5w3fB1k8L1hHtet9fB/OOovZMUTTq4aMpg6SemFx/zpIUoJqAk+qPKrjBAEwtct97foaC+cqWoioE6WSziRJkWPwZI7B9auGO60BlQEyr7/OUyCkxCQpNgnzfXBdOPNMPgSMKWW8VAqawXc1ahFJS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K32rUr0m7tNFcQAdMpAqASoOLCzA2L5kYXPJPvHfdzpkIFUKVKXeUQcpCiio7KthhwVI1QBVCWDV3rMSiTnkAO0P3/6HIFcKwmEDzmQO9mCDdths/wXji1Blzxb9QAAAAABJRU5ErkJggg=="],
  113. // dummy
  114. ["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/JxCSc4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gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgCjw/eHBhY2tldCBlbmQ9InciPz73ndT8AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH4gMDDykcmVZBjgAADbFJREFUeNrtXGuMVcUd/805595z774X9gWlIFIVl0dJU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W1hZ2VTdXBwbGllcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkltYWdlU3VwcGxpZXI+CiAgIDxwbHVzOkltYWdlQ3JlYXRvcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkltYWdlQ3JlYXRvcj4KICAgPHBsdXM6Q29weXJpZ2h0T3duZXI+CiAgICA8cmRmOlNlcS8+CiAgIDwvcGx1czpDb3B5cmlnaHRPd25lcj4KICAgPHBsdXM6TGljZW5zb3I+CiAgICA8cmRmOlNlcS8+CiAgIDwvcGx1czpMaWNlbnNvcj4KICA8L3JkZjpEZXNjcmlwdGlvbj4KIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAKPD94cGFja2V0IGVuZD0idyI/PvOQ5mMAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQfiAwMPKBseKeVsAAAJfElEQVR42u1bXWgcxx3/ze7e7VnWl2vJ0jnCrkiKbRUbxw92nFIwwQ0plIIcDCmUvMQUTB+DyAfkrU8u5K0USvISQp5KbUoJIa2NnbYPwSGxQxI3NdhWPmxJOTknyWeddLe7eZjb3Oz//vNxurtEDxkYdnfuP7czv/l/z6xAd4vQ3Ls820rSxnPSycB7AQJtMz2r9NwkE8tzR2D0AgjuylWORjf5hLTRCsPVqQQ9Eg1u4h65qpP3NP8XMwDE5ErBEBsRjaBHYsFN3lOefYaGEw064ahBHzdoVVCoSLQFSNAjHQEyUd9wFRbRSAGIFRAihT5mJi02g2gIwgW+UgNypZwiCAixUiMAdQWEqJtWI+iSKFAQ1BUPDJXjDDCckILgN64egBoZR0J0imgHlKDDyVMgKBeok84pNVCuPuEKEG5IQag1qqcxz2BERbhySdCmJTCZSo/IvwpC/sYN3EwSIK1xnL2a2ilNkgCPPoofW5yu2NExswJhYn9ozCMFIeWAfGYkylCEyE6Qa0/vSf+8xueoaxwtYRIZsUHnyGOUIlWMOQJECCC8fh3/AeQqcyut45AkAaIIOH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rXFWoubAEXogXvkMuFCyg3ChJGlbgPg7UH5fsweh0JU/MQNh4wIOqHv3dr333HOf/xHN07oRmDMRTjoiSaSzZALjQknS6JKn1/4ALF3hlZ4AsPQJ8P+/uAVIpnxGM+IU8dzcvr+ePr34+8ZBkXWFI+omjrAe5++qi/2A9C4rs8C8g4utxhu6Y0RxHK5Wq4PzpdLou2+/XTuriIN6ENXp6NDtzRB+a8oigJNMsEQ/X0hrjdQ64Qj1tH9GRAIAFxu5iM1Y3gNQ0cQJCVGAdTLhOqMfjKKRJmY2W05iCcAJAPNMBEnPRUUMd9QtIGQUpg9gGcAbDfEYATDwPQOwAOA8gNMAvtCwuq7WNbrAGnSZTue3cyidPtP/ADr/tFL33af6gVvMPJu+CExcgNBdueO/uuPA3QLBBIbp+KDzZwrCHC2wwJi+7dTRdru4fhwLW/jdzkq5fsqko+0VR8BhpW2fTW9ogL38AL7bwDhnrzsdsOjif/UKFOvkfyhM+QYKVFliJfC7TQAAAABJRU5ErkJggg=="]
  117. ]
  118. };
  119.  
  120. let uroURDupes = [];
  121. let uroFID = -1;
  122. let uroShownFID = -1;
  123. let uroInhibitSave = true;
  124. let uroConfirmIntercepted = false;
  125. let uroMCLayer = null;
  126. let uroVenueLayer = null;
  127. let uro_uFP = [];
  128. let uroPendingURSessionIDs = [];
  129. let uroRequestedURSessionIDs = [];
  130. let uroPlacesGroupsCollapsed = [];
  131. let uroKnownProblemTypeIDs = [];
  132. let uroKnownProblemTypeNames = [];
  133. let uroPURsToHide = [];
  134. let uroNullOpenLayers = false;
  135. let uroNullURLayer = false;
  136. let uroNullProblemLayer = false;
  137. let uroNullMapViewport = false;
  138. let uroURDialogIsOpen = false;
  139. let uroHoveredURID = null;
  140. let uroSelectedURID = null;
  141. let uroURReclickAttempts = 0;
  142. let uroPendingCommentDataRefresh = false;
  143. let uroWaitingCommentDataRefresh = false;
  144. let uroExpectedCommentCount = null;
  145. let uroCachedLastCommentID = null;
  146. let uroMouseIsDown = false;
  147. let uroPopulatingRequestSessions = false;
  148. let uroHidePopupOnPanelOpen = false;
  149. let uroUserID = -1;
  150. let uroMTEMode = false;
  151. let uroDiv = null;
  152. let uroAlerts = null;
  153. let uroControls = null;
  154. let uroCtrlHides = null;
  155. let uroAMList = [];
  156. let uroManagedAreas = [];
  157. let uroIgnoreAreasUserID = null;
  158. let uroMousedOverMapComment = null;
  159. let uroMousedOverOtherObjectWithinMapComment = false;
  160. let uroRTCObjs = null;
  161. let uroUnstackedMasterID = null;
  162. let uroStackList = [];
  163. let uroStackType = null;
  164. let uroMainTickHandlerID = null;
  165. let uroMainTickStage = 0;
  166. let uroSettingsApplied = false;
  167. let uroInhibitURFiltering = false;
  168.  
  169.  
  170. const uroUtils = // utility functions
  171. {
  172. ModifyHTML: function(htmlIn)
  173. {
  174. if(typeof trustedTypes === "undefined")
  175. {
  176. return htmlIn;
  177. }
  178. else
  179. {
  180. const escapeHTMLPolicy = trustedTypes.createPolicy("forceInner", {createHTML: (to_escape) => to_escape});
  181. return escapeHTMLPolicy.createHTML(htmlIn);
  182. }
  183. },
  184. CloneObject: function(objIn)
  185. {
  186. return JSON.parse(JSON.stringify(objIn));
  187. },
  188. GetCBChecked: function(cbID)
  189. {
  190. try
  191. {
  192. return(document.getElementById(cbID).checked);
  193. }
  194. catch(err)
  195. {
  196. uroDBG.AddLog('GetCBChecked() - '+cbID+' not found!');
  197. return null;
  198. }
  199. },
  200. SetCBChecked: function(cbID, state)
  201. {
  202. try
  203. {
  204. document.getElementById(cbID).checked = state;
  205. }
  206. catch(err)
  207. {
  208. uroDBG.AddLog('SetCBChecked() - '+cbID+' not found!');
  209. }
  210. },
  211. GetElmValue: function(elmID)
  212. {
  213. try
  214. {
  215. return(document.getElementById(elmID).value);
  216. }
  217. catch(err)
  218. {
  219. uroDBG.AddLog('GetElmValue() - '+elmID+' not found!');
  220. return null;
  221. }
  222. },
  223. SetOnClick: function(elm,fn)
  224. {
  225. try
  226. {
  227. if(typeof elm == 'object')
  228. {
  229. elm.onclick = fn;
  230. }
  231. else
  232. {
  233. document.getElementById(elm).onclick = fn;
  234. }
  235. }
  236. catch(err)
  237. {
  238. uroDBG.AddLog('SetOnClick() - '+elm+' not found!');
  239. }
  240. },
  241. AddEventListener: function(elm, eventType, eventFn, eventBool)
  242. {
  243. try
  244. {
  245. document.getElementById(elm).addEventListener(eventType, eventFn, eventBool);
  246. }
  247. catch(err)
  248. {
  249. uroDBG.AddLog('AddEventListener() - '+elm+' not found!');
  250. }
  251. },
  252. DateToDays: function(dateToConvert)
  253. {
  254. let dateNow = new Date();
  255. let elapsedSinceEpoch = dateNow.getTime();
  256. let elapsedSinceEvent = elapsedSinceEpoch - dateToConvert;
  257. dateNow.setHours(0);
  258. dateNow.setMinutes(0);
  259. dateNow.setSeconds(0);
  260. dateNow.setMilliseconds(0);
  261. let elapsedSinceMidnight = elapsedSinceEpoch - dateNow.getTime();
  262. dateNow.setHours(24);
  263. let pendingUntilMidnight = elapsedSinceEpoch - dateNow.getTime();
  264. if((elapsedSinceEvent < elapsedSinceMidnight) && (elapsedSinceEvent > pendingUntilMidnight))
  265. {
  266. // event occurred today...
  267. return 0;
  268. }
  269. else if(elapsedSinceEvent < 0)
  270. {
  271. // event occurrs at some point in the future after midnight today, so return a minimum value of -1...
  272. return -1 - Math.floor((pendingUntilMidnight - elapsedSinceEvent) / 86400000);
  273. }
  274. else
  275. {
  276. // event occurred at some point prior to midnight this morning, so return a minimum value of 1...
  277. return 1 + Math.floor((elapsedSinceEvent - elapsedSinceMidnight) / 86400000);
  278. }
  279. },
  280. GetURAge: function(urObj,ageType,getRaw)
  281. {
  282. if(ageType === 0)
  283. {
  284. if((urObj.attributes.driveDate === null)||(urObj.attributes.driveDate === 0)) return -1;
  285. if(getRaw) return urObj.attributes.driveDate;
  286. else return uroUtils.DateToDays(urObj.attributes.driveDate);
  287. }
  288. else if(ageType === 1)
  289. {
  290. if((urObj.attributes.resolvedOn === null)||(urObj.attributes.resolvedOn === 0)) return -1;
  291. if(getRaw) return urObj.attributes.resolvedOn;
  292. else return uroUtils.DateToDays(urObj.attributes.resolvedOn);
  293. }
  294. else
  295. {
  296. return -1;
  297. }
  298. },
  299. GetMCAge: function(mcAttrs, ageType, getRaw)
  300. {
  301. if(ageType === 0)
  302. {
  303. if((mcAttrs.createdOn === null)||(mcAttrs.createdOn === 0)) return -1;
  304. if(getRaw) return mcAttrs.createdOn;
  305. else return uroUtils.DateToDays(mcAttrs.createdOn);
  306. }
  307. else if(ageType === 1)
  308. {
  309. if((mcAttrs.updatedOn === null)||(mcAttrs.updatedOn === 0)) return -1;
  310. if(getRaw) return mcAttrs.updatedOn;
  311. else return uroUtils.DateToDays(mcAttrs.updatedOn);
  312. }
  313. else if(ageType === 2)
  314. {
  315. if((mcAttrs.endDate === null)||(mcAttrs.endDate === 0)) return -1;
  316. let tDate = new Date(mcAttrs.endDate);
  317. if(getRaw) return tDate;
  318. else return uroUtils.DateToDays(tDate);
  319. }
  320. else
  321. {
  322. return -1;
  323. }
  324. },
  325. GetPURAge: function(purObj)
  326. {
  327. if(purObj.attributes.venueUpdateRequests[0].attributes.dateAdded !== null)
  328. {
  329. return uroUtils.DateToDays(purObj.attributes.venueUpdateRequests[0].attributes.dateAdded);
  330. }
  331. else
  332. {
  333. return -1;
  334. }
  335. },
  336. GetCameraAge: function(camObj, mode)
  337. {
  338. if(mode === 0)
  339. {
  340. if(camObj.attributes.updatedOn === null) return -1;
  341. return uroUtils.DateToDays(camObj.attributes.updatedOn);
  342. }
  343. if(mode === 1)
  344. {
  345. if(camObj.attributes.createdOn === null) return -1;
  346. return uroUtils.DateToDays(camObj.attributes.createdOn);
  347. }
  348. },
  349. GetCommentAge: function(commentObj)
  350. {
  351. if(commentObj.createdOn === null) return -1;
  352. return uroUtils.DateToDays(commentObj.createdOn);
  353. },
  354. ParseDaysAgo: function(days)
  355. {
  356. if(days === 0) return 'today';
  357. else if(days === 1) return '1 day ago';
  358. else return days+' days ago';
  359. },
  360. ParseDaysToGo: function(days)
  361. {
  362. days = 0 - days;
  363. if(days === 0) return 'today';
  364. else if(days === 1) return 'in 1 day';
  365. else return 'in '+days+' days';
  366. },
  367. GetLocalisedSpeedString: function(thisSpeed)
  368. {
  369. if(thisSpeed !== null)
  370. {
  371. let conversionFactor = 1; // default to metric
  372. let multipleFactor = 10; // default to limits being set in multiples of 10
  373. let country = null;
  374. if((W.model.getTopCountry()) && (W.model.getTopCountry().attributes.name !== undefined))
  375. {
  376. country = W.model.getTopCountry().attributes.name;
  377. }
  378. if(country !== null)
  379. {
  380. // country-specific deviations from the above...
  381. if
  382. (
  383. (country == "United Kingdom") ||
  384. (country == "Jersey") ||
  385. (country == "Guernsey") ||
  386. (country == "United States")
  387. )
  388. {
  389. // countries using MPH
  390. conversionFactor = 1.609;
  391. }
  392. if
  393. (
  394. (country == "United States") ||
  395. (country == "Guernsey")
  396. )
  397. {
  398. // countries with speed limits set in multiples of 5
  399. multipleFactor = 5;
  400. }
  401. }
  402. let speed = Math.round(thisSpeed / conversionFactor);
  403. let retval = speed;
  404. if(conversionFactor == 1) retval += "KM/H";
  405. else retval += "MPH";
  406. return retval;
  407. }
  408. else return "not set";
  409. },
  410. Clickify: function(desc, suffix)
  411. {
  412. // The terminators array consists of pairs of characters which may be found at either
  413. // end of a URL. The first entry in each pair indicates which character needs to be
  414. // found immediately prior to the URL ('' indicates any character) in order for the
  415. // second entry to be considered as a potential end of URL marker
  416. let terminators = [
  417. ['', ' '],
  418. ['', ','],
  419. ['(', ')'],
  420. ['[', ']'],
  421. ['', '\r'],
  422. ['', '\n']
  423. ];
  424. if(desc === null) return '';
  425. if(desc === undefined) return '';
  426. if(desc === '') return '';
  427. if(desc.indexOf("https: one.network") == 0)
  428. {
  429. desc = desc.replaceAll(' ','/');
  430. }
  431. desc = desc.replace(/<\/?[^>]+(>|$)/g, "");
  432. if(desc !== "null")
  433. {
  434. // At the moment we can only clickify links that start with http or https...
  435. if(desc.indexOf('http') != -1)
  436. {
  437. let links = desc.split("http");
  438. desc = '';
  439. let i, j, linkEndPos, descPostLink;
  440. for(i=0; i<links.length; i++)
  441. {
  442. if(links[i].indexOf('://') != -1)
  443. {
  444. let prefix = links[i - 1][links[i - 1].length - 1];
  445. links[i] = "http" + links[i];
  446. linkEndPos = links[i].length + 1;
  447. // work out where the end of the URL is, based on what the character immediately
  448. // preceding the "http" is
  449. for(j=0; j<terminators.length; j++)
  450. {
  451. if(links[i].indexOf(terminators[j][1]) !== -1)
  452. {
  453. if((prefix === terminators[j][0]) || (terminators[j][0] === ''))
  454. {
  455. linkEndPos = Math.min(linkEndPos, links[i].indexOf(terminators[j][1]));
  456. }
  457. }
  458. }
  459. descPostLink = '';
  460. if(linkEndPos < links[i].length)
  461. {
  462. descPostLink = links[i].slice(linkEndPos);
  463. links[i] = links[i].slice(0,linkEndPos);
  464. }
  465. desc += '<a target="_wazeUR" href="'+links[i]+'">'+links[i]+'</a>' + descPostLink;
  466. }
  467. else
  468. {
  469. desc += links[i];
  470. }
  471. }
  472. }
  473. desc = desc.replace(/\n/g,"<br>");
  474. return desc + suffix;
  475. }
  476. else
  477. {
  478. return '';
  479. }
  480. },
  481. GetUserNameFromID: function(userID)
  482. {
  483. let userName;
  484. if(W.model.users.objects[userID] != null)
  485. {
  486. userName = W.model.users.objects[userID].attributes.userName;
  487. if(userName === undefined)
  488. {
  489. userName = userID;
  490. }
  491. }
  492. else
  493. {
  494. userName = userID;
  495. }
  496. return userName;
  497. },
  498. GetUserNameAndRank: function(userID)
  499. {
  500. let userName;
  501. let userLevel;
  502. if(W.model.users.objects[userID] != null)
  503. {
  504. userName = W.model.users.objects[userID].attributes.userName;
  505. if(userName === undefined)
  506. {
  507. userName = userID;
  508. }
  509. else
  510. {
  511. userName = '<a href="' + (W.Config.user_profile.url + userName) + '" target="_blank">' + userName + '</a>';
  512. }
  513. userLevel = W.model.users.objects[userID].attributes.rank + 1;
  514. }
  515. else
  516. {
  517. userName = userID;
  518. userLevel = '?';
  519. }
  520. return userName + ' (' + userLevel + ')';
  521. },
  522. GetDateTimeString: function(ts)
  523. {
  524. let tDateObj = new Date(ts);
  525. let dateLocale;
  526. let timeLocale;
  527. if(uroUtils.GetCBChecked('_cbDateFmtDDMMYY')) dateLocale = 'en-gb';
  528. if(uroUtils.GetCBChecked('_cbDateFmtMMDDYY')) dateLocale = 'en-us';
  529. if(uroUtils.GetCBChecked('_cbDateFmtYYMMDD')) dateLocale = 'ja';
  530. if(uroUtils.GetCBChecked('_cbTimeFmt24H')) timeLocale = 'en-gb';
  531. if(uroUtils.GetCBChecked('_cbTimeFmt12H')) timeLocale = 'en-us';
  532. return tDateObj.toLocaleDateString(dateLocale) + ' ' + tDateObj.toLocaleTimeString(timeLocale);
  533. },
  534. ParsePxString: function(pxString)
  535. {
  536. return parseInt(pxString.split("px")[0]);
  537. },
  538. TypeCast: function(varin)
  539. {
  540. if(varin == "null") return null;
  541. if(typeof varin == "string") return parseInt(varin);
  542. return varin;
  543. },
  544. Truncate: function(val)
  545. {
  546. if(val === null) return val;
  547. if(val < 0) return Math.ceil(val);
  548. return Math.floor(val);
  549. },
  550. KeywordPresent: function(desc, keyword, caseInsensitive)
  551. {
  552. let re;
  553. if(caseInsensitive) re = RegExp(keyword,'i');
  554. else re = RegExp(keyword);
  555. if(desc.search(re) != -1) return true;
  556. else return false;
  557. },
  558. AddStyle: function(ID, css)
  559. {
  560. let head, style;
  561. head = document.getElementsByTagName('head')[0];
  562. if (!head)
  563. {
  564. return;
  565. }
  566. uroUtils.RemoveStyle(ID); // in case it is already there
  567. style = document.createElement('style');
  568. style.type = 'text/css';
  569. style.innerHTML = uroUtils.ModifyHTML(css);
  570. style.id = ID;
  571. head.appendChild(style);
  572. },
  573. RemoveStyle: function(ID)
  574. {
  575. let style = document.getElementById(ID);
  576. if (style)
  577. {
  578. style.parentNode.removeChild(style);
  579. }
  580. },
  581. GetTS: function(day, month, year, hours, mins)
  582. {
  583. let retval = new Date(0);
  584. retval.setDate(day);
  585. retval.setMonth(month - 1);
  586. retval.setYear(year);
  587. retval.setHours(hours);
  588. retval.setMinutes(mins);
  589. return retval.getTime();
  590. },
  591. ToHex: function(decValue, digits)
  592. {
  593. let modifier = 1;
  594. for(let i=0; i < digits; i++)
  595. {
  596. modifier *= 16;
  597. }
  598. // make sure decValue actually is an integer
  599. decValue = parseInt(decValue);
  600. // adding the modifier ensures we have enough digits, including
  601. // any leading zeros which may be required, for the required output
  602. decValue += modifier;
  603. let retval = decValue.toString(16);
  604. // after converting to hex with the modifier included, we'll have
  605. // as many digits as we need to represent decValue, but also an
  606. // extra leading 1, which now needs to be removed before returning
  607. // the result...
  608. retval = retval.substr(-digits);
  609. retval = retval.toUpperCase();
  610. return retval;
  611. },
  612. GetActiveSidebarTab: function()
  613. {
  614. let retval = null;
  615.  
  616. let tabIcons = document.querySelectorAll('wz-navigation-item');
  617. for(let i = 0; i < tabIcons.length; ++i)
  618. {
  619. if(tabIcons[i].selected === true)
  620. {
  621. retval = tabIcons[i].attributes['data-for'].value;
  622. break;
  623. }
  624. }
  625. return retval;
  626. },
  627. IsClosureUIActive: function()
  628. {
  629. let retval = false;
  630.  
  631. if(W.selectionManager.getSelectedFeatures()[0]?.featureType === 'segment')
  632. {
  633. let ast = uroUtils.GetActiveSidebarTab();
  634. if(ast === 'feature_editor')
  635. {
  636. retval = document.querySelector('wz-tab.closures-tab').attributes['is-active'].value !== 'false';
  637. }
  638. }
  639.  
  640. return retval;
  641. },
  642. ConvertWGS84ToMercator: function(point)
  643. {
  644. return point.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
  645. },
  646. ConvertMercatorToWGS84: function(point)
  647. {
  648. return point.transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326"));
  649. }
  650. };
  651. const uroTabs = // script tab handling
  652. {
  653. MAX_PER_ROW: 6,
  654. IDS:
  655. {
  656. URS: 0,
  657. MPS: 1,
  658. MCS: 2,
  659. RTCS: 3,
  660. RAS: 4,
  661. PLACES: 5,
  662. CAMS: 6,
  663. OWL: 7,
  664. MISC: 8
  665. },
  666. FIELDS:
  667. {
  668. TABHEADER: 0,
  669. TABBODY: 1,
  670. LINKID: 2,
  671. TABTITLE: 3,
  672. SHOWFN: 4,
  673. CLICKFN: 5,
  674. STORAGE: 6,
  675. POPULATEFN: 7
  676. },
  677. CtrlTabs: [],
  678. selectedOWLGroup: null,
  679.  
  680. SetStyleDisplay: function(elm,style)
  681. {
  682. try
  683. {
  684. if(typeof elm == 'object')
  685. {
  686. elm.style.display = style;
  687. }
  688. else
  689. {
  690. document.getElementById(elm).style.display = style;
  691. }
  692. }
  693. catch(err)
  694. {
  695. uroDBG.AddLog('SetStyleDisplay() - '+elm+' not found!');
  696. }
  697. },
  698. PopulateMP: function()
  699. {
  700. let tHTML = '';
  701. tHTML += '<input type="checkbox" id="_cbMPFilterOutsideArea">Hide MPs outside my editable area</input><br><br>';
  702. tHTML += '<b>Filter MPs by type:</b><br>';
  703. let i;
  704. for(i=0; i<uroKnownProblemTypeNames.length; i++)
  705. {
  706. tHTML += '<input type="checkbox" id="_cbMPFilter_T'+uroKnownProblemTypeIDs[i]+'">'+uroKnownProblemTypeNames[i]+'</input><br>';
  707. }
  708. tHTML += '<br><input type="checkbox" id="_cbMPFilterUnknownProblem">Unknown problem type</input><br><br>';
  709.  
  710. tHTML += '&nbsp;&nbsp;<i>Specially tagged types</i><br>';
  711. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterElgin">[Elgin]</input><br>';
  712. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterTrafficCast">[TrafficCast]</input><br>';
  713. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterTrafficMaster">[TM]</input><br>';
  714. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterCaltrans">[Caltrans]</input><br>';
  715. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterTFL">TfL</input><br>';
  716.  
  717. tHTML += '<input type="checkbox" id="_cbMPFilterReopenedProblem">Reopened Problems</input><br><br>';
  718.  
  719. tHTML += '<input type="checkbox" id="_cbInvertMPFilter">Invert operation of type filters?</input><br>';
  720.  
  721. tHTML += '<br><b>Hide closed/solved/unidentified Problems:</b><br>';
  722. tHTML += '<input type="checkbox" id="_cbMPFilterClosed">Closed</input><br>';
  723. tHTML += '<input type="checkbox" id="_cbMPFilterSolved">Solved</input><br>';
  724. tHTML += '<input type="checkbox" id="_cbMPFilterUnidentified">Not identified</input><br><br>';
  725.  
  726. tHTML += '<input type="checkbox" id="_cbMPClosedUserIDFilter" pairedWith="_cbMPNotClosedUserIDFilter">Closed</input> or ';
  727. tHTML += '<input type="checkbox" id="_cbMPNotClosedUserIDFilter" pairedWith="_cbMPClosedUserIDFilter">Not Closed</input> by user';
  728. tHTML += '<select id="_selectMPUserID" style="width:80%; height:22px;"></select><br>';
  729.  
  730. tHTML += '<br><b>Hide problems (not turn) by severity:</b><br>';
  731. tHTML += '<input type="checkbox" id="_cbMPFilterLowSeverity">Low</input>&nbsp;&nbsp;';
  732. tHTML += '<input type="checkbox" id="_cbMPFilterMediumSeverity">Medium</input>&nbsp;&nbsp;';
  733. tHTML += '<input type="checkbox" id="_cbMPFilterHighSeverity">High</input><br>';
  734.  
  735. tHTML += '<br><b>Show MPs based on start/end dates:</b><br>';
  736. tHTML += '<input type="checkbox" id="_cbMPFilterStartDate">Start</input>&nbsp;&nbsp;';
  737. tHTML += '<input type="number" min="1" max="31" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterStartDay"> / ';
  738. tHTML += '<input type="number" min="1" max="12" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterStartMonth"> / ';
  739. tHTML += '<input type="number" min="2010" max="2100" size="4" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterStartYear"><br>';
  740. tHTML += '<input type="checkbox" id="_cbMPFilterEndDate">End</input>&nbsp;&nbsp;';
  741. tHTML += '<input type="number" min="1" max="31" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterEndDay"> / ';
  742. tHTML += '<input type="number" min="1" max="12" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterEndMonth"> / ';
  743. tHTML += '<input type="number" min="2010" max="2100" size="4" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterEndYear"><br>';
  744. tHTML += '<input type="checkbox" id="_cbMPFilterEndDatePassed">End date in the past</input>';
  745.  
  746. return tHTML;
  747. },
  748. PopulatePlaces: function()
  749. {
  750. let tHTML = '';
  751. tHTML += '<b>Filter PURs by category/status:</b><br>';
  752. tHTML += '<input type="checkbox" id="_cbFilterUneditablePlaceUpdates">Ones I can\'t edit</input><br>';
  753. tHTML += '<input type="checkbox" id="_cbPURFilterInsideManagedAreas">Ones within AM areas</input>';
  754. tHTML += '&nbsp;(<input type="checkbox" id="_cbPURExcludeUserArea">except my area)</input><br>';
  755. tHTML += '<i>Requires Area Manager layer to be enabled</i><br>';
  756. tHTML += '<input type="checkbox" id="_cbFilterLockRankedPlaceUpdates">Ones with non-zero lockRanks</input><br>';
  757. tHTML += '<input type="checkbox" id="_cbFilterNewPlacePUR">Ones for new places</input><br>';
  758. tHTML += '<input type="checkbox" id="_cbFilterUpdatedDetailsPUR">Ones for updated place details</input><br>';
  759.  
  760. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFPhone">Phone number</input><br>';
  761. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFName">Name</input><br>';
  762. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFEntryExitPoints">Entry//exit points</input><br>';
  763. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFOpeningHours">Opening hours</input><br>';
  764. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFAliases">Aliases</input><br>';
  765. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFServices">Services</input><br>';
  766. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFGeometry">Geometry</input><br>';
  767. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFHouseNumber">House number</input><br>';
  768. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFCategories">Categories</input><br>';
  769. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFDescription">Description</input><br>';
  770.  
  771. tHTML += '<input type="checkbox" id="_cbFilterNewPhotoPUR">Ones for new photos</input><br>';
  772. tHTML += '<input type="checkbox" id="_cbFilterFlaggedPUR">Ones flagged for attention</input><br>';
  773. tHTML += '<br><input type="checkbox" id="_cbInvertPURFilters">Invert PUR filters</input><br>';
  774.  
  775. tHTML += '<br><b>Filter PURs by age of submission:</b><br>';
  776. tHTML += '<input type="checkbox" id="_cbEnablePURMinAgeFilter">Hide PURs less than </input>';
  777. tHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputPURFilterMinDays"> days old<br>';
  778. tHTML += '<input type="checkbox" id="_cbEnablePURMaxAgeFilter">Hide PURs more than </input>';
  779. tHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputPURFilterMaxDays"> days old<br>';
  780.  
  781. tHTML += '<hr>';
  782.  
  783. tHTML += '<br><b>Filter Places by state:</b><br>';
  784. tHTML += 'Hide if last edited<br>';
  785. tHTML += '<input type="checkbox" id="_cbPlaceFilterEditedLessThan"> less than </input>';
  786. tHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterPlaceEditMinDays"> days ago<br>';
  787. tHTML += '<input type="checkbox" id="_cbPlaceFilterEditedMoreThan"> more than </input>';
  788. tHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterPlaceEditMaxDays"> days ago<br>';
  789.  
  790. tHTML += '<br>Hide if locked at level:<br>';
  791. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL0">1</input>';
  792. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL1">2</input>';
  793. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL2">3</input>';
  794. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL3">4</input>';
  795. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL4">5</input>';
  796. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL5">6</input>';
  797. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesStaff">Staff</input>';
  798. tHTML += '<br>&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesAdLocked">AdLocked</input><br>';
  799.  
  800. tHTML += '<br>Hide by geometry:<br>';
  801. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideAreaPlaces">Areas</input>';
  802. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePointPlaces">Points</input>';
  803.  
  804. tHTML += '<br><br><input type="checkbox" id="_cbHidePhotoPlaces" pairedWith="_cbHideNoPhotoPlaces">Hide or </input>';
  805. tHTML += '<input type="checkbox" id="_cbHideNoPhotoPlaces" pairedWith="_cbHidePhotoPlaces">show ones with photos</input><br>';
  806.  
  807. tHTML += '<input type="checkbox" id="_cbHideLinkedPlaces" pairedWith="_cbHideNoLinkedPlaces">Hide or </input>';
  808. tHTML += '<input type="checkbox" id="_cbHideNoLinkedPlaces" pairedWith="_cbHideLinkedPlaces">show ones with external links</input><br>';
  809.  
  810. tHTML += '<input type="checkbox" id="_cbHideDescribedPlaces" pairedWith="_cbHideNonDescribedPlaces">Hide or </input>';
  811. tHTML += '<input type="checkbox" id="_cbHideNonDescribedPlaces" pairedWith="_cbHideDescribedPlaces">show ones with descriptive text</input><br>';
  812.  
  813. tHTML += '<input type="checkbox" id="_cbHideKeywordPlaces" pairedWith="_cbHideNoKeywordPlaces">Hide or </input>';
  814. tHTML += '<input type="checkbox" id="_cbHideNoKeywordPlaces" pairedWith="_cbHideKeywordPlaces">show ones with a name including</input><br>';
  815. tHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textKeywordPlace"><br>';
  816.  
  817. tHTML += '<br><b>Show Places touched by a specific editor:</b><br>';
  818. tHTML += '<input type="checkbox" id="_cbShowOnlyPlacesCreatedBy">Created by</input>&nbsp;/&nbsp;';
  819. tHTML += '<input type="checkbox" id="_cbShowOnlyPlacesEditedBy">edited by</input><br>';
  820. tHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textPlacesEditor"><br>';
  821. tHTML += '<select id="_selectPlacesUserID" style="width:80%; height:22px;"></select><br>';
  822.  
  823. tHTML += '<br><b>Hide Places touched by a specific editor:</b><br>';
  824. tHTML += '<input type="checkbox" id="_cbHideOnlyPlacesCreatedBy">Created by</input>&nbsp;/&nbsp;';
  825. tHTML += '<input type="checkbox" id="_cbHideOnlyPlacesEditedBy">edited by</input><br>';
  826. tHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textHidePlacesEditor"><br>';
  827. tHTML += '<select id="_selectHidePlacesUserID" style="width:80%; height:22px;"></select><br>';
  828.  
  829. tHTML += '<br><br><b>Filter Places by category:</b><br>';
  830. tHTML += '<input type="checkbox" id="_cbLeavePURGeos" pairedWith="_cbHidePURsForFilteredPlaces">Keep place visible if linked PUR is hidden, or</input><br>';
  831. tHTML += '<input type="checkbox" id="_cbHidePURsForFilteredPlaces" pairedWith="_cbLeavePURGeos">Hide PURs linked to hidden places</input><br><br>';
  832.  
  833. let nCategories = W.Config.venues.categories.length;
  834. let i;
  835. if(uroPlacesGroupsCollapsed.length != nCategories)
  836. {
  837. for(i=0; i<nCategories; i++)
  838. {
  839. uroPlacesGroupsCollapsed.push(false);
  840. }
  841. }
  842.  
  843. for(i=0; i<nCategories; i++)
  844. {
  845. let parentCategory = W.Config.venues.categories[i];
  846. let localisedName = I18n.lookup("venues.categories." + parentCategory);
  847.  
  848. if(uroPlacesGroupsCollapsed[i] === true)
  849. {
  850. tHTML += '<i class="fa fa-plus-square-o" style="cursor:pointer;font-size:14px;" id="_uroPlacesGroupState-'+i+'"></i>';
  851. }
  852. else
  853. {
  854. tHTML += '<i class="fa fa-minus-square-o" style="cursor:pointer;font-size:14px;" id="_uroPlacesGroupState-'+i+'"></i>';
  855. }
  856.  
  857. tHTML += '&nbsp;<input type="checkbox" id="_cbPlacesFilter-'+parentCategory+'"><b>'+localisedName+'</b></input><br>';
  858. tHTML += '<div id="_uroPlacesGroup-'+i+'" style="padding:3px;border-width:2px;border-style:solid;border-color:#FFFFFF">';
  859.  
  860. for(let ii=0; ii<W.Config.venues.subcategories[parentCategory].length; ii++)
  861. {
  862. let subCategory = W.Config.venues.subcategories[parentCategory][ii];
  863. localisedName = I18n.lookup("venues.categories." + subCategory);
  864. tHTML += '&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbPlacesFilter-'+subCategory+'">'+localisedName+'</input><br>';
  865. }
  866. tHTML += '</div>';
  867. }
  868. tHTML += '<input type="checkbox" id="_cbFilterPrivatePlaces"><b>Residential Places</b></input><br>';
  869. tHTML += '<br><input type="checkbox" id="_cbInvertPlacesFilter">Invert Place filters?</input>';
  870.  
  871. return tHTML;
  872. },
  873. PopulateUR: function()
  874. {
  875. let iHTML = '';
  876. iHTML = '<br>';
  877.  
  878. iHTML += '<input type="checkbox" id="_cbURFilterOutsideArea">Hide URs outside my editable area</input><br>';
  879. iHTML += '<input type="checkbox" id="_cbURFilterInsideManagedAreas">Hide URs within AM areas</input>';
  880. iHTML += '&nbsp;(<input type="checkbox" id="_cbURExcludeUserArea">except my area)</input><br>';
  881. iHTML += '&nbsp;<i>Requires Area Manager layer to be enabled</i><br>';
  882. iHTML += '<input type="checkbox" id="_cbNoFilterForURInURL">Don\'t filter selected UR</input><br><br>';
  883. iHTML += '<input type="checkbox" id="_cbURFilterDupes">Show only duplicate URs</input><br><br>';
  884.  
  885. iHTML += '<b>Filter by type:</b><br>';
  886. iHTML += '<input type="checkbox" id="_cbFilterWazeAuto">Waze Automatic</input><br>';
  887. iHTML += '<input type="checkbox" id="_cbFilterIncorrectTurn">Incorrect turn</input><br>';
  888. iHTML += '<input type="checkbox" id="_cbFilterIncorrectAddress">Incorrect address</input><br>';
  889. iHTML += '<input type="checkbox" id="_cbFilterIncorrectRoute">Incorrect route</input><br>';
  890. iHTML += '<input type="checkbox" id="_cbFilterMissingRoundabout">Missing roundabout</input><br>';
  891. iHTML += '<input type="checkbox" id="_cbFilterGeneralError">General error</input><br>';
  892. iHTML += '<input type="checkbox" id="_cbFilterTurnNotAllowed">Turn not allowed</input><br>';
  893. iHTML += '<input type="checkbox" id="_cbFilterIncorrectJunction">Incorrect junction</input><br>';
  894. iHTML += '<input type="checkbox" id="_cbFilterMissingBridgeOverpass">Missing bridge overpass</input><br>';
  895. iHTML += '<input type="checkbox" id="_cbFilterWrongDrivingDirection">Wrong driving direction</input><br>';
  896. iHTML += '<input type="checkbox" id="_cbFilterMissingExit">Missing exit</input><br>';
  897. iHTML += '<input type="checkbox" id="_cbFilterMissingRoad">Missing road</input><br>';
  898. iHTML += '<input type="checkbox" id="_cbFilterBlockedRoad">Blocked road</input><br>';
  899. iHTML += '<input type="checkbox" id="_cbFilterMissingLandmark">Missing Landmark</input><br>';
  900. iHTML += '<input type="checkbox" id="_cbFilterSpeedLimits">Missing or Invalid Speed limit</input><br>';
  901. iHTML += '<input type="checkbox" id="_cbFilterUndefined">Undefined</input><br>';
  902.  
  903. iHTML += '&nbsp;&nbsp;<i>Specially tagged types</i><br>';
  904. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterRoadworks">[ROADWORKS]</input><br>';
  905. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterConstruction">[CONSTRUCTION]</input><br>';
  906. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterClosure">[CLOSURE]</input><br>';
  907. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterEvent">[EVENT]</input><br>';
  908. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterNote">[NOTE]</input><br>';
  909. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterBOG">[BOG]</input><br>';
  910. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterDifficult">[DIFFICULT]</input><br>';
  911. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterWSLM">[WSLM]</input><br><br>';
  912. iHTML += '<input type="checkbox" id="_cbInvertURFilter">Invert operation of type filters?</input><br>';
  913.  
  914. iHTML += '<hr>';
  915.  
  916. iHTML += '<br><b>Hide by state:</b><br>';
  917. iHTML += '<input type="checkbox" id="_cbFilterOpenUR">Open</input><br>';
  918. iHTML += '<input type="checkbox" id="_cbFilterClosedUR">Closed</input><br>';
  919. iHTML += '<input type="checkbox" id="_cbFilterSolved">Solved</input><br>';
  920. iHTML += '<input type="checkbox" id="_cbFilterUnidentified">Not identified</input><br><br>';
  921.  
  922.  
  923. iHTML += '<br><b>Filter by age of submission:</b><br>';
  924. iHTML += '<input type="checkbox" id="_cbEnableMinAgeFilter">Hide URs less than </input>';
  925. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMinDays"> days old<br>';
  926. iHTML += '<input type="checkbox" id="_cbEnableMaxAgeFilter">Hide URs more than </input>';
  927. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMaxDays"> days old<br>';
  928.  
  929. iHTML += '<br><b>Filter by other details:</b><br>';
  930. iHTML += '<input type="checkbox" id="_cbHideMyFollowed" pairedWith="_cbHideMyUnfollowed">Hide</input> or ';
  931. iHTML += '<input type="checkbox" id="_cbHideMyUnfollowed" pairedWith="_cbHideMyFollowed">show</input> URs I\'m following<br><br>';
  932.  
  933. iHTML += '<input type="checkbox" id="_cbURDescriptionMustBePresent" pairedWith="_cbURDescriptionMustBeAbsent">Hide</input> or ';
  934. iHTML += '<input type="checkbox" id="_cbURDescriptionMustBeAbsent" pairedWith="_cbURDescriptionMustBePresent">show</input> URs with no description<br>';
  935. iHTML += '<input type="checkbox" id="_cbEnableKeywordMustBePresent">Hide URs not including </input>';
  936. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textKeywordPresent"><br>';
  937. iHTML += '<input type="checkbox" id="_cbEnableKeywordMustBeAbsent">Hide URs including </input>';
  938. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textKeywordAbsent"><br>';
  939. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbCaseInsensitive"><i>Case-insensitive matches?</i></input><br><br>';
  940.  
  941. iHTML += 'With comments from me?<br>';
  942. iHTML += '<input type="checkbox" id="_cbHideMyComments" pairedWith="_cbHideAnyComments">Yes </input>';
  943. iHTML += '<input type="checkbox" id="_cbHideAnyComments" pairedWith="_cbHideMyComments">No</input><br>';
  944. iHTML += 'If last comment made by me?<br>';
  945. iHTML += '<input type="checkbox" id="_cbHideIfLastCommenter" pairedWith="_cbHideIfNotLastCommenter">Yes </input>';
  946. iHTML += '<input type="checkbox" id="_cbHideIfNotLastCommenter" pairedWith="_cbHideIfLastCommenter">No </input><br>';
  947. iHTML += 'If last comment made by UR reporter?<br>';
  948. iHTML += '<input type="checkbox" id="_cbHideIfReporterLastCommenter" pairedWith="_cbHideIfReporterNotLastCommenter">Yes </input>';
  949. iHTML += '<input type="checkbox" id="_cbHideIfReporterNotLastCommenter" pairedWith="_cbHideIfReporterLastCommenter">No</input><br>';
  950.  
  951. iHTML += '<input type="checkbox" id="_cbEnableMinCommentsFilter">With less than </input>';
  952. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMinComments"> comments<br>';
  953. iHTML += '<input type="checkbox" id="_cbEnableMaxCommentsFilter">With more than </input>';
  954. iHTML += '<input type="number" min="0" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMaxComments"> comments<br><br>';
  955.  
  956. iHTML += '<input type="checkbox" id="_cbEnableCommentAgeFilter2">Last comment less than </input>';
  957. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterCommentDays2"> days ago<br>';
  958. iHTML += '<input type="checkbox" id="_cbEnableCommentAgeFilter">Last comment more than </input>';
  959. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterCommentDays"> days ago<br>';
  960. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbIgnoreOtherEditorComments"><i>Ignore other editor comments?</i></input><br><br>';
  961.  
  962. iHTML += '<input type="checkbox" id="_cbURUserIDFilter">Without comments from user</input>';
  963. iHTML += '<select id="_selectURUserID" style="width:80%; height:22px;"></select><br>';
  964. iHTML += '<input type="checkbox" id="_cbURResolverIDFilter">Not resolved by user</input>';
  965. iHTML += '<select id="_selectURResolverID" style="width:80%; height:22px;"></select>';
  966.  
  967. iHTML += '<br><br><input type="checkbox" id="_cbInvertURStateFilter">Invert operation of state/age filters?</input><br>';
  968. iHTML += '<input type="checkbox" id="_cbNoFilterForTaggedURs">Don\'t apply state/age filters to tagged URs</input><br>';
  969.  
  970. return iHTML;
  971. },
  972. PopulateMC: function()
  973. {
  974. let iHTML = '';
  975. iHTML = '<br>';
  976.  
  977. iHTML += '&nbsp;&nbsp;<i>Specially tagged types</i><br>';
  978. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterRoadworks">[ROADWORKS]</input><br>';
  979. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterConstruction">[CONSTRUCTION]</input><br>';
  980. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterClosure">[CLOSURE]</input><br>';
  981. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterEvent">[EVENT]</input><br>';
  982. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterNote">[NOTE]</input><br>';
  983. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterBOG">[BOG]</input><br>';
  984. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterDifficult">[DIFFICULT]</input><br>';
  985. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterWSLM">[WSLM]</input><br><br>';
  986. iHTML += '<input type="checkbox" id="_cbInvertMCFilter">Invert operation of type filters?</input><br>';
  987.  
  988. iHTML += '<hr>';
  989.  
  990. iHTML += '<br><b>Filter by description/comments/following:</b><br>';
  991. iHTML += '<input type="checkbox" id="_cbMCHideMyFollowed" pairedWith="_cbMCHideMyUnfollowed">Ones I am or </input>';
  992. iHTML += '<input type="checkbox" id="_cbMCHideMyUnfollowed" pairedWith="_cbMCHideMyFollowed">am not following</input><br><br>';
  993.  
  994. iHTML += '<input type="checkbox" id="_cbMCDescriptionMustBePresent" pairedWith="_cbMCDescriptionMustBeAbsent">Hide</input> or ';
  995. iHTML += '<input type="checkbox" id="_cbMCDescriptionMustBeAbsent" pairedWith="_cbMCDescriptionMustBePresent">show</input> MCs with no description<br>';
  996. iHTML += '<input type="checkbox" id="_cbMCCommentsMustBePresent" pairedWith="_cbMCCommentsMustBeAbsent">Hide</input> or ';
  997. iHTML += '<input type="checkbox" id="_cbMCCommentsMustBeAbsent" pairedWith="_cbMCCommentsMustBePresent">show</input> MCs with no comments<br>';
  998. iHTML += '<input type="checkbox" id="_cbMCExpiryMustBePresent" pairedWith="_cbMCExpiryMustBeAbsent">Hide</input> or ';
  999. iHTML += '<input type="checkbox" id="_cbMCExpiryMustBeAbsent" pairedWith="_cbMCExpiryMustBePresent">show</input> MCs with no expiry date<br>';
  1000. iHTML += '<input type="checkbox" id="_cbMCEnableKeywordMustBePresent">Hide MCs not including </input>';
  1001. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textMCKeywordPresent"><br>';
  1002. iHTML += '<input type="checkbox" id="_cbMCEnableKeywordMustBeAbsent">Hide MCs including </input>';
  1003. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textMCKeywordAbsent"><br>';
  1004. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCCaseInsensitive"><i>Case-insensitive matches?</i></input><br>';
  1005. iHTML += '<input type="checkbox" id="_cbMCCreatorIDFilter">Show MCs created by user</input>';
  1006. iHTML += '<select id="_selectMCCreatorID" style="width:80%; height:22px;"></select><br>';
  1007.  
  1008. iHTML += '<br><input type="checkbox" id="_cbHideWRCMCs"><b>Hide Waze_roadclosures MCs</b></input><br>';
  1009.  
  1010. iHTML += '<br><b>Hide MCs with lock level:</b><br>';
  1011. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank0">L1</input>';
  1012. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank1">L2</input>';
  1013. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank2">L3</input>';
  1014. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank3">L4</input>';
  1015. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank4">L5</input>';
  1016. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank5">L6</input>';
  1017. iHTML += '<hr>';
  1018. iHTML += '<input type="checkbox" id="_cbMCEnhancePointMCVisibility">Enhance visibility of point MCs</input>';
  1019.  
  1020. return iHTML;
  1021. },
  1022. PopulateCams: function()
  1023. {
  1024. let iHTML = '';
  1025. iHTML = '<br><b>Show Cameras created by:</b><br>';
  1026. iHTML += '<input type="checkbox" id="_cbShowWorldCams" checked>world_* users</input><br>';
  1027. iHTML += '<input type="checkbox" id="_cbShowUSACams" checked>usa_* users</input><br>';
  1028. iHTML += '<input type="checkbox" id="_cbShowNonWorldCams" checked>other users</input><br>';
  1029.  
  1030. iHTML += '<br><b>Show Cameras touched by a specific editor:</b><br>';
  1031. iHTML += '<input type="checkbox" id="_cbShowOnlyCamsCreatedBy">Created by</input>&nbsp;/&nbsp;';
  1032. iHTML += '<input type="checkbox" id="_cbShowOnlyCamsEditedBy">edited by</input><br>';
  1033. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textCameraEditor"><br>';
  1034. iHTML += '<select id="_selectCameraUserID" style="width:80%; height:22px;"></select><br>';
  1035. iHTML += '<br><input type="checkbox" id="_cbShowOnlyMyCams">Show ONLY cameras created/edited by me</input><br>';
  1036.  
  1037. iHTML += '<br><b>Show Cameras by type:</b><br>';
  1038. iHTML += '<input type="checkbox" id="_cbShowSpeedCams" checked>Speed</input><br>';
  1039. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowIfSpeedSet" checked> with speed data</input><br>';
  1040. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowIfNoSpeedSet" checked> with no speed data</input><br>';
  1041. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowIfInvalidSpeedSet" checked> with invalid speed data (zoom 16+)</input><br>';
  1042. iHTML += '&nbsp;&nbsp;&nbsp;<i>NOTE: slows down WME when deselected</i><br>';
  1043. iHTML += '<input type="checkbox" id="_cbShowRedLightCams" checked>Red Light</input><br>';
  1044. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowRLCIfZeroSpeedSet" checked> with speed limit = 0</input><br>';
  1045. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowRLCIfNonZeroSpeedSet" checked> with speed limit > 0</input><br>';
  1046. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowRLCIfNoSpeedSet" checked> with no speed data</input><br>';
  1047. iHTML += '<input type="checkbox" id="_cbShowDummyCams" checked>Dummy</input><br>';
  1048.  
  1049. iHTML += '<br><b>Hide Cameras by creator:</b><br>';
  1050. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByMe">me</input>';
  1051. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank0">L1</input>';
  1052. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank1">L2</input>';
  1053. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank2">L3</input>';
  1054. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank3">L4</input>';
  1055. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank4">L5</input>';
  1056. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank5">L6</input>';
  1057.  
  1058. iHTML += '<br><b>Hide Cameras by updater:</b><br>';
  1059. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByMe">me</input>';
  1060. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank0">L1</input>';
  1061. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank1">L2</input>';
  1062. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank2">L3</input>';
  1063. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank3">L4</input>';
  1064. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank4">L5</input>';
  1065. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank5">L6</input>';
  1066.  
  1067. iHTML += '<br><br><b><input type="checkbox" id="_cbHideManualLockedCams">Show only auto-locked cameras</input></b><br>';
  1068.  
  1069. iHTML += '<br><b><input type="checkbox" id="_cbHideCWLCams">Hide cameras on watchlist</input></b><br>';
  1070.  
  1071. iHTML += '<br><b><input type="checkbox" id="_cbInvertCamFilters">Invert operation of camera filters?</input></b><br>';
  1072.  
  1073. iHTML += '<b><input type="checkbox" id="_cbHighlightInsteadOfHideCams">Highlight instead of hide</input></b><br>';
  1074. return iHTML;
  1075. },
  1076. PopulateRTC: function()
  1077. {
  1078. let iHTML = '';
  1079. iHTML = '<br><b>Hide Road Closures:</b><br>';
  1080. // Hidden checkbox to avoid errors when applying settings from previous versions of the script where this was an active control...
  1081. iHTML += '<input type="checkbox" id="_cbHideUserRTCs" style="display: none;" />';
  1082.  
  1083. iHTML += '<table style="text-align:center;">';
  1084. 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></tr>';
  1085. 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></tr>';
  1086. 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></tr>';
  1087. 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></tr>';
  1088. 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></tr>';
  1089. iHTML += '</table><br>';
  1090.  
  1091. iHTML += '<input type="checkbox" id="_cbShowMTERTCs" pairedWith="_cbHideMTERTCs">Show</input> or ';
  1092. iHTML += '<input type="checkbox" id="_cbHideMTERTCs" pairedWith="_cbShowMTERTCs">hide RTCs associated with MTE: </input>';
  1093. iHTML += '<select id="_selectRTCMTE" style="width:80%; height:22px;"></select><br>';
  1094. iHTML += '<br>';
  1095. iHTML += 'Hide if:<br>';
  1096. iHTML += '<input type="checkbox" id="_cbEnableRTCDurationFilterLessThan">Duration less than </input>';
  1097. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterRTCDurationLessThan"> days<br>';
  1098. iHTML += '<input type="checkbox" id="_cbEnableRTCDurationFilterMoreThan">Duration more than </input>';
  1099. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterRTCDurationMoreThan"> days<br>';
  1100. iHTML += '<br><b>Filter by date/time:</b><br>';
  1101. iHTML += '<input type="checkbox" id="_cbRTCFilterShowForTS" pairedWith="_cbRTCFilterHideForTS">Show</input> or ';
  1102. iHTML += '<input type="checkbox" id="_cbRTCFilterHideForTS" pairedWith="_cbRTCFilterShowForTS">hide</input> RTCs active at<br>';
  1103. iHTML += 'Date: <input type="number" min="1" max="31" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterDay"> / ';
  1104. iHTML += '<input type="number" min="1" max="12" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterMonth"> / ';
  1105. iHTML += '<input type="number" min="2010" max="2100" size="4" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterYear"><br>';
  1106. iHTML += 'Time: <input type="number" min="0" max="23" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterHour">:';
  1107. iHTML += '<input type="number" min="0" max="59" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterMin">';
  1108. return iHTML;
  1109. },
  1110. PopulateRA: function()
  1111. {
  1112. let iHTML = '';
  1113. iHTML = '<br><b>Filter Restricted Areas:</b><br>';
  1114. iHTML += '<input type="checkbox" id="_cbShowSpecificRA">Show a specific area: </input>';
  1115. iHTML += '<select id="_selectRA" style="width:80%; height:22px;"></select><br><br>';
  1116.  
  1117. iHTML += '<input type="checkbox" id="_cbRAEditorIDFilter">Show areas edited by user: </input>';
  1118. iHTML += '<select id="_selectRAEditorID" style="width:80%; height:22px;"></select><br><br>';
  1119.  
  1120. iHTML += 'Hide if:<br>';
  1121. iHTML += '<input type="checkbox" id="_cbEnableRAAgeFilterLessThan">Last modified less than </input>';
  1122. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterRAAgeLessThan"> days ago<br>';
  1123. iHTML += '<input type="checkbox" id="_cbEnableRAAgeFilterMoreThan">Last modified more than </input>';
  1124. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterRAAgeMoreThan"> days ago<br>';
  1125. return iHTML;
  1126. },
  1127. PopulateMisc: function()
  1128. {
  1129. let iHTML = '';
  1130. iHTML += '<br><b><input type="checkbox" id="_cbHideSegmentsWhenRoadsHidden" />Hide segment layer when road layer is hidden</b><br>';
  1131. iHTML += '<br><b><input type="checkbox" id="_cbKillInertialPanning" />Stop inertial panning when mouse moves out of map area</b><br>';
  1132.  
  1133. iHTML += '<br><br><b><input type="checkbox" id="_cbCommentCount" />Show comment count on UR markers</b><br>';
  1134.  
  1135. iHTML += '<br><br><b><input type="checkbox" id="_cbAutoApplyClonedClosure" />Auto-apply cloned closures</b><br>';
  1136. iHTML += '<b><input type="checkbox" id="_cbAutoScrollClosureList" />Auto-scroll to end of closures</b><br>';
  1137.  
  1138. iHTML += '<br><br><b>Disable filtering above zoom level </b>';
  1139. 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>';
  1140.  
  1141. iHTML += '<br><br><b>Marker Unstacking:</b><br>';
  1142. 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>';
  1143. 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>';
  1144.  
  1145. iHTML += '<br><br><b>Popup mouse behaviour:</b><br>';
  1146. iHTML += 'Mouse over <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>';
  1147. 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>';
  1148.  
  1149. iHTML += '<br><br><b>Disable popup for:</b><br>';
  1150. iHTML += '<input type="checkbox" id="_cbInhibitURPopup" />URs<br>';
  1151. iHTML += '<input type="checkbox" id="_cbInhibitMPPopup" />MPs<br>';
  1152. iHTML += '<input type="checkbox" id="_cbInhibitCamPopup" />Cameras<br>';
  1153. iHTML += '<input type="checkbox" id="_cbInhibitSegPopup" />Segments<br>';
  1154. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbInhibitSegGenericPopup" />Speed limit info<br>';
  1155. iHTML += '<input type="checkbox" id="_cbInhibitLandmarkPopup" />Places<br>';
  1156. iHTML += '<input type="checkbox" id="_cbInhibitPUPopup" />Place Updates<br>';
  1157. iHTML += '<input type="checkbox" id="_cbInhibitMapCommentPopup" />Map Comments<br>';
  1158. iHTML += '<input type="checkbox" id="_cbInhibitNodesPopup" />Junction Nodes<br>';
  1159.  
  1160. iHTML += '<br><br><b>Date/Time formatting for popups:</b><br>';
  1161. iHTML += '<input type="checkbox" id="_cbDateFmtDDMMYY" pairedWith="_cbDateFmtMMDDYY,_cbDateFmtYYMMDD" checked />day/month/year<br>';
  1162. iHTML += '<input type="checkbox" id="_cbDateFmtMMDDYY" pairedWith="_cbDateFmtDDMMYY,_cbDateFmtYYMMDD" />month/day/year<br>';
  1163. iHTML += '<input type="checkbox" id="_cbDateFmtYYMMDD" pairedWith="_cbDateFmtMMDDYY,_cbDateFmtDDMMYY" />year/month/day<br><br>';
  1164. iHTML += '<input type="checkbox" id="_cbTimeFmt24H" pairedWith="_cbTimeFmt12H" checked />24 hour<br>';
  1165. iHTML += '<input type="checkbox" id="_cbTimeFmt12H" pairedWith="_cbTimeFmt24H" />12 hour<br><br>';
  1166. iHTML += '<i>Unticked uses browser default setting</i>';
  1167.  
  1168. iHTML += '<br><br><b><input type="checkbox" id="_cbWhiteBackground" />Use custom background colour</b><br>';
  1169. 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" />';
  1170. 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" />';
  1171. 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>';
  1172.  
  1173. iHTML += '<br><br><b>Replace "Next ..." button with "Done" for:</b><br>';
  1174. iHTML += '<input type="checkbox" id="_cbInhibitNURButton" />URs<br>';
  1175. iHTML += '<input type="checkbox" id="_cbInhibitNMPButton" />MPs<br>';
  1176. iHTML += '<input type="checkbox" id="_cbInhibitNPURButton" />PURs<br>';
  1177.  
  1178. iHTML += '<br><br><b>Disable on-click recentering for:</b><br>';
  1179. iHTML += '<input type="checkbox" id="_cbInhibitURCentering" />URs<br>';
  1180. iHTML += '<input type="checkbox" id="_cbInhibitMPCentering" />MPs<br>';
  1181. iHTML += '<input type="checkbox" id="_cbInhibitPURCentering" />PURs<br>';
  1182. iHTML += '<input type="checkbox" id="_cbInhibitPPURCentering" />PPURs<br>';
  1183. iHTML += '<input type="checkbox" id="_cbInhibitRPURCentering" />RPURs<br>';
  1184.  
  1185. iHTML += '<br><br><b><input type="checkbox" id="_cbHideAMLayer" />Hide Area Manager polygons</b><br>';
  1186. iHTML += '<b><input type="checkbox" id="_cbMoveAMList" />Show AMs in topbar when AM layer is active</b><br>';
  1187. iHTML += '<br><b><input type="checkbox" id="_cbDisablePlacesFiltering" />Disable Places filtering</b><br>';
  1188.  
  1189. iHTML += '<br><br><b>Settings backup/restore/reset:</b><br>';
  1190. iHTML += '<input type="button" id="_btnSettingsToText" value="Backup" />&nbsp;&nbsp;&nbsp;';
  1191. iHTML += '<input type="button" id="_btnTextToSettings" value="Restore" />&nbsp;&nbsp;|&nbsp;&nbsp;';
  1192. iHTML += '<input type="button" id="_btnResetSettings" value="Reset" /><br><br>';
  1193. iHTML += '<textarea id="_txtSettings" value=""></textarea><br>';
  1194. iHTML += '<input type="button" id="_btnClearSettingsText" value="Clear" /><br>';
  1195.  
  1196. /*
  1197. iHTML += '<br><br><b>Debug:</b><br>';
  1198. iHTML += '<input type="button" id="_btnDebugToScreen" value="Show debug data" />';
  1199. */
  1200. return iHTML;
  1201. },
  1202. PopulateOWL()
  1203. {
  1204. let camTypes = new Array("","","Speed", "Dummy", "Red Light");
  1205. let iHTML = '';
  1206. if(document.getElementById('_uroCWLGroupSelect') !== null)
  1207. {
  1208. uroTabs.selectedOWLGroup = document.getElementById('_uroCWLGroupSelect').selectedIndex;
  1209. }
  1210. iHTML = '<br><b>Camera Watchlist:</b><br><br>';
  1211. iHTML += '<div id="_uroCWLCamList" style="height:65%;overflow:auto;">';
  1212. if(uroOWL.CWLGroups.length > 0)
  1213. {
  1214. let camidx;
  1215. for(let groupidx=0;groupidx<uroOWL.CWLGroups.length;groupidx++)
  1216. {
  1217. let groupObj = uroOWL.CWLGroups[groupidx];
  1218. iHTML += '<div id="_uroCWLGroup-'+groupidx+'">';
  1219. if(groupObj.groupCollapsed === true)
  1220. {
  1221. iHTML += '<i class="fa fa-plus-square-o" style="cursor:pointer;font-size:14px;" id="_uroCWLGroupState-'+groupidx+'"></i>';
  1222. }
  1223. else
  1224. {
  1225. iHTML += '<i class="fa fa-minus-square-o" style="cursor:pointer;font-size:14px;" id="_uroCWLGroupState-'+groupidx+'"></i>';
  1226. }
  1227. iHTML += '<b>'+groupObj.groupName+'</b><br>';
  1228. groupObj.groupCount = 0;
  1229. if(uroOWL.CamWatchObjects.length > 0)
  1230. {
  1231. for(camidx=0;camidx<uroOWL.CamWatchObjects.length;camidx++)
  1232. {
  1233. let camObj = uroOWL.CamWatchObjects[camidx];
  1234. if(camObj.groupID == groupObj.groupID)
  1235. {
  1236. groupObj.groupCount++;
  1237. let changed = uroOWL.CamDataChanged(camidx);
  1238. let deleted = (camObj.loaded === false);
  1239. iHTML += '<div id="_uroCWL-'+camidx+'" style="padding:3px;border-width:2px;border-style:solid;border-color:#FFFFFF;background-color:';
  1240. if(camObj.server != W.app.getAppRegionCode())
  1241. {
  1242. if(camObj.server == '??') iHTML += '#A0A0A0;';
  1243. else iHTML += '#AAFFAA;';
  1244. }
  1245. else if(changed) iHTML += '#AAAAFF;';
  1246. else if(deleted) iHTML += '#FFAAAA;';
  1247. else iHTML += '#FFFFFF;';
  1248. if(groupObj.groupCollapsed === true) iHTML += 'display:none;">';
  1249. else iHTML += 'display:block;">';
  1250. iHTML += 'ID: '+camObj.fid;
  1251. iHTML += ' ('+camObj.server+')';
  1252. iHTML += ' Type: '+camTypes[camObj.watch.type];
  1253. if(camObj.server != W.app.getAppRegionCode())
  1254. {
  1255. if(camObj.server == '??')
  1256. {
  1257. iHTML += '<br><i>Unknown server</i>';
  1258. }
  1259. else
  1260. {
  1261. iHTML += '<br><i>Not on this server</i>';
  1262. }
  1263. }
  1264. else if(deleted)
  1265. {
  1266. iHTML += '<br>DELETED';
  1267. }
  1268. else if(changed)
  1269. {
  1270. if(camObj.current.type != camObj.watch.type)
  1271. {
  1272. iHTML += '<br>&nbsp;&nbsp;Type changed';
  1273. iHTML += ' ('+camObj.watch.type+' to '+camObj.current.type+')';
  1274. }
  1275. if(camObj.current.azymuth != camObj.watch.azymuth)
  1276. {
  1277. iHTML += '<br>&nbsp;&nbsp;Azimuth changed';
  1278. iHTML += ' ('+camObj.watch.azymuth+' to '+camObj.current.azymuth+')';
  1279. }
  1280. if(camObj.current.speed != camObj.watch.speed)
  1281. {
  1282. iHTML += '<br>&nbsp;&nbsp;Speed changed';
  1283. iHTML += ' ('+camObj.watch.speed+' to '+camObj.current.speed+')';
  1284. }
  1285. if(camObj.current.lat != camObj.watch.lat)
  1286. {
  1287. iHTML += '<br>&nbsp;&nbsp;Latitude changed';
  1288. iHTML += ' ('+camObj.watch.lat+' to '+camObj.current.lat+')';
  1289. }
  1290. if(camObj.current.lon != camObj.watch.lon)
  1291. {
  1292. iHTML += '<br>&nbsp;&nbsp;Longitude changed';
  1293. iHTML += ' ('+camObj.watch.lon+' to '+camObj.current.lon+')';
  1294. }
  1295. }
  1296. if(camObj.server == W.app.getAppRegionCode())
  1297. {
  1298. if(deleted === false)
  1299. {
  1300. iHTML += '&nbsp;<i class="fa fa-group" style="cursor:pointer;font-size:14px;color:#ccccff;" id="_uroCWLIcon1-'+camidx+'"></i>';
  1301. }
  1302. iHTML += '&nbsp;<i class="fa fa-arrow-circle-right" style="cursor:pointer;font-size:14px;color:#ccccff;" id="_uroCWLIcon2-'+camidx+'"></i>';
  1303. }
  1304. iHTML += '</div>';
  1305. }
  1306. }
  1307. }
  1308. iHTML += '</div>';
  1309. }
  1310. }
  1311. iHTML += '</div><div id="_uroCWLControls">';
  1312. iHTML += '<hr>Group control:<br>';
  1313. iHTML += '<select id="_uroCWLGroupSelect" style="width:40%;height:22px;"></select>&nbsp;<input type="button" id="_btnCWLGroupDel" value="Delete group"><br>';
  1314. iHTML += '<input type="text" id="_uroCWLGroupEntry" style="width:40%;height:22px;">&nbsp;<input type="button" id="_btnCWLGroupAdd" value="Add group">';
  1315. iHTML += '<br><input type="button" id="_btnRescanCamWatchList" value="Refresh camera data"><br><br>';
  1316. iHTML += '<input type="button" id="_btnUpdateCamValues" value="Accept all changes"><br><br>';
  1317. iHTML += '<b>Remove cameras from OWL:</b><br>';
  1318. iHTML += '<input type="button" id="_btnRemoveDeletedCameras" value="Deleted">&nbsp;&nbsp;';
  1319. iHTML += '<input type="button" id="_btnRemoveUnknownServerCameras" value="Unknown Server">&nbsp;&nbsp;';
  1320. iHTML += '<input type="button" id="_btnClearCamWatchList" value="ALL Cameras">';
  1321. iHTML += '</div>';
  1322. uroTabs.CtrlTabs[uroTabs.IDS.OWL][uroTabs.FIELDS.TABBODY].innerHTML = uroUtils.ModifyHTML(iHTML);
  1323. uroTabs.FinaliseOWLTab();
  1324. },
  1325. FinaliseOWLTab: function()
  1326. {
  1327. if(uroOWL.CamWatchObjects.length > 0)
  1328. {
  1329. if(document.getElementById("_uroCWL-0") == null)
  1330. {
  1331. window.setTimeout(uroTabs.FinaliseOWLTab,100);
  1332. return;
  1333. }
  1334. for(let camidx=0;camidx<uroOWL.CamWatchObjects.length;camidx++)
  1335. {
  1336. document.getElementById("_uroCWL-"+camidx).onmouseover = uroOWL.HighlightCWLEntry;
  1337. document.getElementById("_uroCWL-"+camidx).onmouseleave = uroOWL.UnhighlightCWLEntry;
  1338. if(uroOWL.CamWatchObjects[camidx].server == W.app.getAppRegionCode())
  1339. {
  1340. let icon1 = document.getElementById("_uroCWLIcon1-"+camidx);
  1341. let icon2 = document.getElementById("_uroCWLIcon2-"+camidx);
  1342. if(icon1 !== null)
  1343. {
  1344. icon1.onmouseover = uroOWL.CWLIconHighlight;
  1345. icon1.onmouseleave = uroOWL.CWLIconLowlight;
  1346. icon1.onclick = uroOWL.AssignCameraToGroup;
  1347. }
  1348. if(icon2 !== null)
  1349. {
  1350. icon2.onmouseover = uroOWL.CWLIconHighlight;
  1351. icon2.onmouseleave = uroOWL.CWLIconLowlight;
  1352. icon2.onclick = uroOWL.GotoCam;
  1353. }
  1354. }
  1355. }
  1356. }
  1357. if(document.getElementById('_btnClearCamWatchList') == null)
  1358. {
  1359. window.setTimeout(uroTabs.FinaliseOWLTab, 100);
  1360. return;
  1361. }
  1362. uroUtils.AddEventListener('_btnClearCamWatchList', 'click', uroOWL.ClearCamWatchList, true);
  1363. uroUtils.AddEventListener('_btnRemoveDeletedCameras', 'click', uroOWL.ClearDeletedCameras, true);
  1364. uroUtils.AddEventListener('_btnRemoveUnknownServerCameras', 'click', uroOWL.ClearUnknownServerCameras, true);
  1365. uroUtils.AddEventListener('_btnRescanCamWatchList', 'click', uroOWL.RescanCamWatchList, true);
  1366. uroUtils.AddEventListener('_btnUpdateCamValues', 'click', uroOWL.AcceptCameraChanges, true);
  1367. uroUtils.AddEventListener('_btnCWLGroupDel', 'click', uroOWL.RemoveCWLGroup, true);
  1368. uroUtils.AddEventListener('_btnCWLGroupAdd', 'click', uroOWL.AddCWLGroup, true);
  1369. if(document.getElementById('_uroCWLGroupSelect') !== null)
  1370. {
  1371. uroDBG.AddLog('populating CWL group list');
  1372. uroOWL.PopulateCWLGroupSelect();
  1373. let selector = document.getElementById('_uroCWLGroupSelect');
  1374. if(uroTabs.selectedOWLGroup >= selector.length)
  1375. {
  1376. uroTabs.selectedOWLGroup = 0;
  1377. }
  1378. selector.selectedIndex = uroTabs.selectedOWLGroup;
  1379. }
  1380. if(uroOWL.CWLGroups.length > 0)
  1381. {
  1382. for(let groupidx=0;groupidx<uroOWL.CWLGroups.length;groupidx++)
  1383. {
  1384. if(uroOWL.CWLGroups[groupidx].groupCount === 0)
  1385. {
  1386. uroTabs.SetStyleDisplay('_uroCWLGroup-'+groupidx,'none');
  1387. }
  1388. else
  1389. {
  1390. uroUtils.SetOnClick('_uroCWLGroupState-'+groupidx,uroOWL.CWLGroupCollapseExpand);
  1391. }
  1392. }
  1393. }
  1394. },
  1395. ActiveTab: function(_id)
  1396. {
  1397. let e = document.getElementById(_id);
  1398. e.style.backgroundColor = "greenyellow";
  1399. e.style.borderTop = "1px solid";
  1400. e.style.borderLeft = "1px solid";
  1401. e.style.borderRight = "1px solid";
  1402. e.style.borderBottom = "0px solid";
  1403. },
  1404. InactiveTab: function(_id)
  1405. {
  1406. let e = document.getElementById(_id);
  1407. e.style.backgroundColor = "gainsboro";
  1408. e.style.borderTop = "0px solid";
  1409. e.style.borderLeft = "0px solid";
  1410. e.style.borderRight = "0px solid";
  1411. e.style.borderBottom = "1px solid";
  1412. },
  1413. InactiveAllTabs: function()
  1414. {
  1415. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  1416. {
  1417. uroTabs.InactiveTab(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABHEADER]);
  1418. uroTabs.SetStyleDisplay(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY], 'none');
  1419. }
  1420. },
  1421. ShowTab: function(tabID)
  1422. {
  1423. uroTabs.InactiveAllTabs();
  1424. uroTabs.ActiveTab(uroTabs.CtrlTabs[tabID][uroTabs.FIELDS.TABHEADER]);
  1425. uroTabs.SetStyleDisplay(uroTabs.CtrlTabs[tabID][uroTabs.FIELDS.TABBODY], 'block');
  1426. return false;
  1427. },
  1428. ShowURs: function()
  1429. {
  1430. uroTabs.ShowTab(uroTabs.IDS.URS);
  1431. return false;
  1432. },
  1433. ShowMPs: function()
  1434. {
  1435. uroTabs.ShowTab(uroTabs.IDS.MPS);
  1436. return false;
  1437. },
  1438. ShowMCs: function()
  1439. {
  1440. uroTabs.ShowTab(uroTabs.IDS.MCS);
  1441. return false;
  1442. },
  1443. ShowPlaces: function()
  1444. {
  1445. uroTabs.ShowTab(uroTabs.IDS.PLACES);
  1446. for(let idx=0;idx<uroPlacesGroupsCollapsed.length;idx++)
  1447. {
  1448. uroPlacesGroupCEHandler(idx);
  1449. }
  1450. return false;
  1451. },
  1452. ShowCams: function()
  1453. {
  1454. uroTabs.ShowTab(uroTabs.IDS.CAMS);
  1455. return false;
  1456. },
  1457. ShowOWL: function()
  1458. {
  1459. uroTabs.ShowTab(uroTabs.IDS.OWL);
  1460. uroTabs.PopulateOWL();
  1461. return false;
  1462. },
  1463. ShowMisc: function()
  1464. {
  1465. uroTabs.ShowTab(uroTabs.IDS.MISC);
  1466. return false;
  1467. },
  1468. ShowRTCs: function()
  1469. {
  1470. uroTabs.ShowTab(uroTabs.IDS.RTCS);
  1471. return false;
  1472. },
  1473. ShowRAs: function()
  1474. {
  1475. uroTabs.ShowTab(uroTabs.IDS.RAS);
  1476. return false;
  1477. },
  1478. ClickURs: function()
  1479. {
  1480. uroFilterURs();
  1481. },
  1482. ClickMPs: function()
  1483. {
  1484. uroFilterProblems();
  1485. },
  1486. ClickMCs: function()
  1487. {
  1488. uroFilterMapComments();
  1489. uroLayers.MCLayerChanged();
  1490. },
  1491. ClickPlaces: function()
  1492. {
  1493. uroFilterPlaces();
  1494. },
  1495. ClickCams: function()
  1496. {
  1497. uroFilterCameras();
  1498. },
  1499. ClickOWL: function()
  1500. {
  1501. // no action required
  1502. },
  1503. ClickMisc: function()
  1504. {
  1505. uroFilterItems();
  1506. uroUITweaks.ChangeMapBGColour();
  1507. uroUITweaks.HideAMLayer();
  1508. uroUITweaks.HideSegments();
  1509. },
  1510. ClickRTCs: function()
  1511. {
  1512. uroFilterRTCs();
  1513. uroClosureListHandler();
  1514. },
  1515. ClickRAs: function()
  1516. {
  1517. uroFilterRAs();
  1518. },
  1519. CreateTabHeaders: function()
  1520. {
  1521. uroTabs.CtrlTabs =
  1522. [
  1523. ['_tabURs', null, '_linkURs', 'URs', uroTabs.ShowURs, uroTabs.ClickURs, 'UROverviewUROptions', uroTabs.PopulateUR],
  1524. ['_tabMPs', null, '_linkMPs', 'MPs', uroTabs.ShowMPs, uroTabs.ClickMPs, 'UROverviewMPOptions', uroTabs.PopulateMP],
  1525. ['_tabMCs', null, '_linkMCs', 'MCs', uroTabs.ShowMCs, uroTabs.ClickMCs, 'UROverviewMCOptions', uroTabs.PopulateMC],
  1526. ['_tabRTCs', null, '_linkRTCs', 'RTCs', uroTabs.ShowRTCs, uroTabs.ClickRTCs, 'UROverviewRTCOptions', uroTabs.PopulateRTC],
  1527. ['_tabRAs', null, '_linkRAs', 'RAs', uroTabs.ShowRAs, uroTabs.ClickRAs, 'UROverviewRAOptions', uroTabs.PopulateRA],
  1528. ['_tabPlaces', null, '_linkPlaces', 'Places', uroTabs.ShowPlaces, uroTabs.ClickPlaces, 'UROverviewPlacesOptions', uroTabs.PopulatePlaces],
  1529. ['_tabCams', null, '_linkCams', 'Cams', uroTabs.ShowCams, uroTabs.ClickCams, 'UROverviewCameraOptions', uroTabs.PopulateCams],
  1530. ['_tabOWL', null, '_linkOWL', 'OWL', uroTabs.ShowOWL, uroTabs.ClickOWL, null, null],
  1531. ['_tabMisc', null, '_linkMisc', 'Misc', uroTabs.ShowMisc, uroTabs.ClickMisc, 'UROverviewMiscOptions', uroTabs.PopulateMisc]
  1532. ];
  1533.  
  1534. let i;
  1535. let tabsTotal = uroTabs.CtrlTabs.length;
  1536. let tabsPerRow = Math.ceil(tabsTotal / Math.ceil(tabsTotal / uroTabs.MAX_PER_ROW));
  1537. let tabCount = 0;
  1538. let tabbyHTML = '';
  1539. for(i = 0; i < tabsTotal; ++i)
  1540. {
  1541. if(tabCount == 0)
  1542. {
  1543. tabbyHTML += '<table border=0 width="100%"><tr>';
  1544. }
  1545. tabbyHTML += '<td valign="center" align="center" id="'+uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABHEADER]+'">';
  1546. 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>';
  1547. if(((++tabCount == tabsPerRow) && (i < (tabsTotal - 1))) || (i == (tabsTotal - 1)))
  1548. {
  1549. tabbyHTML += '</tr></table>';
  1550. tabCount = 0;
  1551. }
  1552. }
  1553. return tabbyHTML;
  1554. },
  1555. CreateTabBodies: function()
  1556. {
  1557. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  1558. {
  1559. uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY] = document.createElement('div');
  1560. }
  1561. },
  1562. AddToDOM: function()
  1563. {
  1564. let i;
  1565. for(i = 0; i < uroTabs.CtrlTabs.length; ++i)
  1566. {
  1567. if(uroTabs.CtrlTabs[i][uroTabs.FIELDS.POPULATEFN] != null)
  1568. {
  1569. uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY].innerHTML = uroTabs.CtrlTabs[i][uroTabs.FIELDS.POPULATEFN]();
  1570. }
  1571. document.getElementById('uroControlsContainer').appendChild(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY]);
  1572. uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY].onclick = uroTabs.CtrlTabs[i][uroTabs.FIELDS.CLICKFN];
  1573. }
  1574. }
  1575. };
  1576. const uroDBG = // debug output handling
  1577. {
  1578. // true enables debug output during script startup
  1579. showDebugOutput: true,
  1580. // true keeps debug output enabled after script startup
  1581. persistentDebugOutput: false,
  1582. // true enables performance monitoring debug output
  1583. performanceMonitoringOutput: false,
  1584.  
  1585. recentDebug: [],
  1586.  
  1587. Add: function(debugtext)
  1588. {
  1589. let ts = Math.round(performance.now());
  1590. if(uroDBG.recentDebug.length == 100)
  1591. {
  1592. uroDBG.recentDebug.shift();
  1593. }
  1594. uroDBG.recentDebug.push(ts+': '+debugtext);
  1595. console.debug('URO+DBG '+ts+':'+debugtext);
  1596. },
  1597. Dump: function()
  1598. {
  1599. if(uroDBG.recentDebug.length > 0)
  1600. {
  1601. document.getElementById('WazeMap').innerHTML = uroUtils.ModifyHTML('<textarea id="uroDbgOutput" style="width:100%;height:100%">');
  1602. let dbgOutput = '';
  1603. for(let i = 0; i < uroDBG.recentDebug.length; i++)
  1604. {
  1605. dbgOutput += uroDBG.recentDebug[i]+'\n';
  1606. }
  1607. document.getElementById('uroDbgOutput').textContent = dbgOutput;
  1608. }
  1609. },
  1610. Toggle: function()
  1611. {
  1612. uroDBG.showDebugOutput = !uroDBG.showDebugOutput;
  1613. let dbgMode = "none";
  1614. if(uroDBG.showDebugOutput)
  1615. {
  1616. dbgMode = "inline";
  1617. }
  1618. document.getElementById('_uroDebugMode').style.display = dbgMode;
  1619. },
  1620. PerfMon: function(source, ts)
  1621. {
  1622. if(uroDBG.performanceMonitoringOutput === true)
  1623. {
  1624. console.log(source+': '+(performance.now() - ts));
  1625. }
  1626. },
  1627. AddLog: function(logtext)
  1628. {
  1629. if(uroDBG.showDebugOutput) console.log('URO+: '+Date()+' '+logtext);
  1630. }
  1631. };
  1632. const uroAFN = // area friendly name functions
  1633. {
  1634. friendlyNames: [],
  1635. hoverTime: -1,
  1636. hoverObj: null,
  1637. overlayShown: false,
  1638. editHovered: false,
  1639. editBox: null,
  1640. friendlyAreaNames: null,
  1641. AFNObject: function(fName, area, server)
  1642. {
  1643. this.fName = fName;
  1644. this.area = area;
  1645. this.server = server;
  1646. },
  1647. UpdateName: function(name, server, area)
  1648. {
  1649. let foundExisting = false;
  1650. for(let i = 0; i < uroAFN.friendlyNames.length; i++)
  1651. {
  1652. if((uroAFN.friendlyNames[i].server == server) && (uroAFN.friendlyNames[i].area == area))
  1653. {
  1654. if(name === "")
  1655. {
  1656. this.friendlyNames.splice(i, 1);
  1657. foundExisting = true;
  1658. }
  1659. else
  1660. {
  1661. uroAFN.friendlyNames[i].fName = name;
  1662. foundExisting = true;
  1663. }
  1664. }
  1665. }
  1666. if((foundExisting === false) && (name !== ""))
  1667. {
  1668. uroAFN.friendlyNames.push(new uroAFN.AFNObject(name, area, server));
  1669. }
  1670. uroAFN.ReplaceAreaNames(true);
  1671. },
  1672. AreaNameHover: function()
  1673. {
  1674. if((uroAFN.hoverObj === null) || (uroAFN.hoverObj != this))
  1675. {
  1676. uroAFN.hoverTime = 0;
  1677. }
  1678. uroAFN.hoverObj = this;
  1679. },
  1680. AreaNameUnHover: function()
  1681. {
  1682. if(uroAFN.editHovered === true)
  1683. {
  1684. return false;
  1685. }
  1686. if(uroAFN.overlayShown)
  1687. {
  1688. uroAFN.hoverObj.removeChild(uroAFN.editBox);
  1689. }
  1690. uroAFN.hoverObj = null;
  1691. uroAFN.hoverTime = -1;
  1692. uroAFN.overlayShown = false;
  1693. },
  1694. EditHover: function()
  1695. {
  1696. uroAFN.editHovered = true;
  1697. uroUtils.AddEventListener('uroANEditBox', 'mouseout', uroAFN.EditUnHover, false);
  1698. uroUtils.AddEventListener('uroANEditBox', 'click', uroAFN.EditClick, false);
  1699. },
  1700. EditUnHover: function()
  1701. {
  1702. let newName = document.getElementById('_textAreaName').value;
  1703. // sanitise name to avoid conflicts with config storage delimiters...
  1704. newName = newName.replace(',','');
  1705. newName = newName.replace(':','');
  1706. let server = W.app.getAppRegionCode();
  1707. let area = uroAFN.GetAreaArea(uroAFN.hoverObj.parentNode.children[1].innerText);
  1708. uroAFN.hoverObj.removeChild(uroAFN.editBox);
  1709. uroAFN.overlayShown = false;
  1710. uroAFN.editHovered = false;
  1711. uroAFN.UpdateName(newName, server, area);
  1712. },
  1713. EditClick: function(e)
  1714. {
  1715. // this traps the click to prevent it falling through to the underlying area name element and
  1716. // potentially causing the map view to be relocated to that area...
  1717. e.stopPropagation();
  1718. },
  1719. GetAreaArea: function(area)
  1720. {
  1721. area = parseFloat(area.split(' ')[0]);
  1722. return area;
  1723. },
  1724. OverlaySetup: function()
  1725. {
  1726. uroAFN.overlayShown = true;
  1727. uroAFN.editBox = document.createElement('div');
  1728. uroAFN.editBox.id = "uroANEditBox";
  1729. uroAFN.editBox.style.position = "absolute";
  1730. uroAFN.editBox.style.top = '0px';
  1731. uroAFN.editBox.style.left = '0px';
  1732. uroAFN.editBox.style.width = "99%";
  1733. uroAFN.hoverObj.appendChild(uroAFN.editBox);
  1734. uroAFN.editBox.onmouseover = uroAFN.EditHover();
  1735. let existingName = uroAFN.hoverObj.innerHTML;
  1736. let italicTagPos = existingName.indexOf(' <i>');
  1737. if(italicTagPos == -1)
  1738. {
  1739. existingName = "";
  1740. }
  1741. else
  1742. {
  1743. existingName = existingName.substr(0,italicTagPos);
  1744. }
  1745. uroAFN.editBox.innerHTML = uroUtils.ModifyHTML('<input type="text" style="font-size:14px; line-height:16px; height:22px; width:100%" id="_textAreaName" value="'+existingName+'">');
  1746. },
  1747. ReplaceAreaNames: function(replaceAfterNameChange)
  1748. {
  1749. if(document.getElementById('sidepanel-areas') === undefined)
  1750. {
  1751. return;
  1752. }
  1753. if(document.getElementById('sidepanel-areas').getElementsByClassName('result-list').length === 0)
  1754. {
  1755. return;
  1756. }
  1757. if(replaceAfterNameChange === false)
  1758. {
  1759. if(document.getElementById('sidepanel-areas').getElementsByClassName('result-list')[0].id == "friendlyNamed")
  1760. {
  1761. return;
  1762. }
  1763. }
  1764. let panelRootObj = document.getElementById('sidepanel-areas').getElementsByClassName('result-list')[0];
  1765. if(panelRootObj === undefined)
  1766. {
  1767. // we get here if the user doesn't have any areas defined...
  1768. return;
  1769. }
  1770. let areaNameObjs = panelRootObj.getElementsByClassName('list-item-card-info');
  1771. if(areaNameObjs.length === 0)
  1772. {
  1773. return;
  1774. }
  1775. let localisedManagedArea = I18n.lookup("user.areas.managed_area");
  1776. for(let loop=0; loop < areaNameObjs.length; loop++)
  1777. {
  1778. if(areaNameObjs[loop].children.length === 2)
  1779. {
  1780. let title = areaNameObjs[loop].children[0].innerText;
  1781. if(title.indexOf(localisedManagedArea) > -1)
  1782. {
  1783. let area = uroAFN.GetAreaArea(areaNameObjs[loop].children[1].innerText);
  1784. areaNameObjs[loop].children[0].innerHTML = uroUtils.ModifyHTML(localisedManagedArea);
  1785. for(let fnIdx=0; fnIdx < uroAFN.friendlyNames.length; fnIdx++)
  1786. {
  1787. let fnObj = uroAFN.friendlyNames[fnIdx];
  1788. if((fnObj.area == area) && (fnObj.server == W.app.getAppRegionCode()))
  1789. {
  1790. areaNameObjs[loop].children[0].innerHTML = uroUtils.ModifyHTML(fnObj.fName +' <i>('+localisedManagedArea+')</i>');
  1791. break;
  1792. }
  1793. }
  1794. let titleObj = areaNameObjs[loop].getElementsByClassName('list-item-card-title')[0];
  1795. titleObj.addEventListener("mouseover", uroAFN.AreaNameHover, false);
  1796. titleObj.addEventListener("mouseout", uroAFN.AreaNameUnHover, false);
  1797. titleObj.style.cursor = "text";
  1798. }
  1799. }
  1800. }
  1801. document.getElementById('sidepanel-areas').getElementsByClassName('result-list')[0].id = "friendlyNamed";
  1802. },
  1803. ApplyNames: function()
  1804. {
  1805. let objects = localStorage.UROverviewFriendlyAreaNames.split(':');
  1806. uroAFN.friendlyNames = [];
  1807. for(let objIdx=0;objIdx<objects.length;objIdx++)
  1808. {
  1809. let fields = objects[objIdx].split(',');
  1810. uroAFN.friendlyNames.push(new uroAFN.AFNObject(fields[0],parseFloat(fields[1]),fields[2]));
  1811. }
  1812. uroAFN.ReplaceAreaNames(true);
  1813. }
  1814. };
  1815. const uroMarkers = // marker-related function
  1816. {
  1817. elm : null,
  1818. obj : null,
  1819. id : null,
  1820. type : null,
  1821. lastOver : null,
  1822.  
  1823. mouseX : null,
  1824. mouseY : null,
  1825. mouseButtons : null,
  1826. clientX : null,
  1827. clientY : null,
  1828. armHover : false,
  1829. entryTimeout : null,
  1830. inhibitSetCenter : false,
  1831. clickedOnCenter : null,
  1832. clickedOnID : null,
  1833.  
  1834. EntryTimeout: function()
  1835. {
  1836. uroMarkers.armHover = false;
  1837. if(uroMarkers.lastOver !== null)
  1838. {
  1839. if(uroMarkers.type === 'cam')
  1840. {
  1841. if(uroUtils.GetCBChecked('_cbHighlightInsteadOfHideCams') === true)
  1842. {
  1843. if(uroMarkers.lastOver !== uroMarkers.id)
  1844. {
  1845. window.setTimeout(uroFilterCameras, 50);
  1846. }
  1847. }
  1848. }
  1849. else if((uroMarkers.type == uroLayers.ID.UR) || (uroMarkers.type == uroLayers.ID.MP))
  1850. {
  1851. if(uroMarkers.type == uroLayers.ID.UR) uroHoveredURID = uroMarkers.id;
  1852. }
  1853.  
  1854. uroDBG.AddLog('hover over marker (Type ' + uroMarkers.type + ' / ID ' + uroMarkers.id + ')');
  1855. uroPopup.Generate();
  1856. }
  1857. },
  1858. MouseMove: function(e)
  1859. {
  1860. uroMarkers.buttons = e.buttons;
  1861. uroMarkers.mouseX = e.pageX - document.getElementById('map').getBoundingClientRect().left;
  1862. uroMarkers.mouseY = e.pageY - document.getElementById('map').getBoundingClientRect().top;
  1863. uroMarkers.clientX = e.clientX;
  1864. uroMarkers.clientY = e.clientY;
  1865.  
  1866. if(uroMarkers.armHover === true)
  1867. {
  1868. let eto = uroUtils.GetElmValue('_inputPopupEntryTimeout') * 100;
  1869. if(uroMarkers.entryTimeout !== null)
  1870. {
  1871. window.clearTimeout(uroMarkers.entryTimeout);
  1872. }
  1873. uroMarkers.entryTimeout = window.setTimeout(uroMarkers.EntryTimeout, eto);
  1874. }
  1875. },
  1876. TranslateType: function(ft)
  1877. {
  1878. const TLU =
  1879. [
  1880. ["mapProblem", uroLayers.ID.MP],
  1881. ["mapUpdateRequest", uroLayers.ID.UR],
  1882. ["placeUpdate", uroLayers.ID.PUR],
  1883. ["camera", "cam"],
  1884. ["node", "node"],
  1885. ["comment", "comment"],
  1886. ["venue", "venue"],
  1887. ["segment", "segment"]
  1888. ];
  1889.  
  1890. let retval = null;
  1891. for(let i = 0; i < TLU.length; ++i)
  1892. {
  1893. if(ft == TLU[i][0])
  1894. {
  1895. retval = TLU[i][1];
  1896. break;
  1897. }
  1898. }
  1899. return retval;
  1900. },
  1901. MouseOver: function(e)
  1902. {
  1903. let elm = null;
  1904. let obj = null;
  1905. let id = null;
  1906. let markerType = null;
  1907. let ft = e?.feature?.attributes?.wazeFeature?.featureType;
  1908. if(ft !== undefined)
  1909. {
  1910. obj = e.feature.attributes.wazeFeature._wmeObject;
  1911. elm = W.userscripts.getMapElementByDataModel(obj);
  1912. id = e.feature.attributes.wazeFeature.id;
  1913. markerType = uroMarkers.TranslateType(ft);
  1914.  
  1915. uroMarkers.elm = elm;
  1916. uroMarkers.obj = obj;
  1917. uroMarkers.id = id;
  1918. uroMarkers.type = markerType;
  1919. uroMarkers.lastOver = id;
  1920. uroMarkers.armHover = true;
  1921.  
  1922. uroMarkers.AddMarkerEventHandler();
  1923. }
  1924. },
  1925. MouseOut: function(e)
  1926. {
  1927. uroMarkers.lastOver = null;
  1928. if(uroMarkers.type !== null)
  1929. {
  1930. if(uroMarkers.type === 'cam')
  1931. {
  1932. if(uroUtils.GetCBChecked('_cbHighlightInsteadOfHideCams') === true)
  1933. {
  1934. window.setTimeout(uroFilterCameras, 50);
  1935. }
  1936. }
  1937. uroDBG.AddLog('hover off '+uroMarkers.type+' ID '+uroMarkers.id);
  1938. uroHoveredURID = null;
  1939.  
  1940. uroFID = -1;
  1941. if(uroStackType !== null)
  1942. {
  1943. let tStackType = uroStackType;
  1944. uroRestackMarkers();
  1945. if(tStackType == 1)
  1946. {
  1947. uroFilterURs();
  1948. }
  1949. else if(tStackType == 2)
  1950. {
  1951. uroFilterProblems();
  1952. }
  1953. else if(tStackType == 3)
  1954. {
  1955. uroFilterPlaces();
  1956. }
  1957. }
  1958.  
  1959. if(uroPopup.timer == -1)
  1960. {
  1961. uroPopup.timer = uroUtils.GetElmValue('_inputPopupEntryTimeout');
  1962. }
  1963. }
  1964. else
  1965. {
  1966. uroDBG.AddLog('hover off unknown object...');
  1967. }
  1968. },
  1969. MouseDown: function()
  1970. {
  1971. // Do this stuff in the mousedown event rather than the click event so we fire before any of the native
  1972. // click events - we need to ensure this happens for inhibiting marker centering, as we need to capture
  1973. // the markerType ahead of our interceptor function being called to deal with the centering...
  1974. if(uroMarkers.type !== null)
  1975. {
  1976. uroDBG.AddLog('clicked on '+uroMarkers.type+' marker '+uroMarkers.id);
  1977. uroMarkers.clickedOnID = uroMarkers.id;
  1978. uroMarkers.clickedOnCenter = W.map.getCenter();
  1979. uroInhibitURFiltering = true;
  1980. if(uroMarkers.inhibitSetCenter === false)
  1981. {
  1982. if(uroMarkers.Decentre() === true)
  1983. {
  1984. uroMarkers.inhibitSetCenter = true;
  1985. }
  1986. }
  1987. }
  1988. },
  1989. Decentre: function()
  1990. {
  1991. let inhibit = false;
  1992. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.UR) && (uroUtils.GetCBChecked("_cbInhibitURCentering")));
  1993. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.MP) && (uroUtils.GetCBChecked("_cbInhibitMPCentering")));
  1994. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.PUR) && (uroUtils.GetCBChecked("_cbInhibitPURCentering")));
  1995. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.PPUR) && (uroUtils.GetCBChecked("_cbInhibitPPURCentering")));
  1996. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.RPUR) && (uroUtils.GetCBChecked("_cbInhibitRPURCentering")));
  1997. return inhibit;
  1998. },
  1999. RegisterEvents: function()
  2000. {
  2001. for(let i = 0; i < uroLayers.layers.length; ++i)
  2002. {
  2003. if(uroLayers.layers[i].regEvt === true)
  2004. {
  2005. uroLayers.layers[i].l.events.register("fe-feature-in", null, uroMarkers.MouseOver);
  2006. uroLayers.layers[i].l.events.register("fe-feature-out", null, uroMarkers.MouseOut);
  2007. }
  2008. }
  2009. },
  2010. AddMarkerEventHandler: function()
  2011. {
  2012. if
  2013. (
  2014. (uroMarkers.type === uroLayers.ID.UR) ||
  2015. (uroMarkers.type === uroLayers.ID.MP) ||
  2016. (uroMarkers.type === uroLayers.ID.PUR) ||
  2017. (uroMarkers.type === uroLayers.ID.PPUR) ||
  2018. (uroMarkers.type === uroLayers.ID.RPUR)
  2019. )
  2020. {
  2021. let mMarker = uroGetMarker(uroMarkers.type, uroMarkers.id);
  2022. if(mMarker !== null)
  2023. {
  2024. let mIcon = null;
  2025. if(mMarker.element !== undefined)
  2026. {
  2027. mIcon = mMarker.element;
  2028. }
  2029. else if(mMarker.geometry !== undefined)
  2030. {
  2031. mIcon = document.querySelector('#'+mMarker.geometry.id);
  2032. }
  2033. else if(mMarker.tagName === "image")
  2034. {
  2035. mIcon = mMarker;
  2036. }
  2037. if((mIcon !== null) && (mIcon !== undefined))
  2038. {
  2039. mIcon.addEventListener("mousedown", uroMarkers.MouseDown, false);
  2040. }
  2041. }
  2042. }
  2043. }
  2044. };
  2045. const uroLayers = // layer functions
  2046. {
  2047. // -----------------------------------------------------------------
  2048. // NOTE CAREFULLY!
  2049. // The contents of layers and ID MUST, MUST, MUST, remain
  2050. // in sync at all times...
  2051. layers :
  2052. [
  2053. {name: "update_requests", l: null, mf: null, MO: null, regEvt: true, getMF: true},
  2054. {name: "mapProblems", l: null, mf: null, MO: null, regEvt: true, getMF: true},
  2055. {name: "place_updates", l: null, mf: null, MO: null, regEvt: true, getMF: true},
  2056. {name: "PARKING_PLACE_UPDATES", l: null, mf: null, MO: null, regEvt: true, getMF: true},
  2057. {name: "RESIDENTIAL_PLACE_UPDATES", l: null, mf: null, MO: null, regEvt: true, getMF: true},
  2058. {name: "closures", l: null, mf: null, MO: null, regEvt: false, getMF: true},
  2059. {name: "nodes", l: null, mf: null, MO: null, regEvt: true, getMF: false},
  2060. {name: "segments", l: null, mf: null, MO: null, regEvt: true, getMF: false},
  2061. {name: "venues", l: null, mf: null, MO: null, regEvt: true, getMF: false},
  2062. {name: "mapComments", l: null, mf: null, MO: null, regEvt: true, getMF: false},
  2063. {name: "speed_cameras", l: null, mf: null, MO: null, regEvt: true, getMF: false},
  2064. {name: "closure_nodes", l: null, mf: null, MO: null, regEvt: false, getMF: false}
  2065. ],
  2066. ID :
  2067. {
  2068. UR: 0,
  2069. MP: 1,
  2070. PUR: 2,
  2071. PPUR: 3,
  2072. RPUR: 4,
  2073. RTC: 5,
  2074. node: 6,
  2075. seg: 7,
  2076. venue: 8,
  2077. MC: 9,
  2078. cam: 10,
  2079. RTCnode: 11
  2080. },
  2081. // -----------------------------------------------------------------
  2082.  
  2083. BlobMouseOut: function(e)
  2084. {
  2085. let blobType = this.attributes.uroBlobType;
  2086. if(blobType !== undefined)
  2087. {
  2088. let blobID = this.attributes.uroBlobID;
  2089. uroDBG.AddLog('hover off '+blobType+' ID '+blobID);
  2090. if(blobType == 'map_comment')
  2091. {
  2092. if(W.model.mapComments.objects[blobID] != undefined)
  2093. {
  2094. let geoID = W.model.mapComments.objects[blobID].attributes.geometry.id;
  2095. if(geoID.indexOf('Point') != -1)
  2096. {
  2097. // reapply visibility mods
  2098. let svgElm = document.getElementById(uroMCLayer.div.id+'_vroot');
  2099. for(let svgIdx = 0; svgIdx < svgElm.children.length; svgIdx++)
  2100. {
  2101. if(svgElm.children[svgIdx].id === geoID)
  2102. {
  2103. window.setTimeout(uroLayers.ReapplyPointMCVisibilityMods,10);
  2104. }
  2105. }
  2106. }
  2107. }
  2108. }
  2109. }
  2110. else
  2111. {
  2112. uroDBG.AddLog('hover off unknown blob...');
  2113. }
  2114. },
  2115. MCLayerChanged_changed: function()
  2116. {
  2117. uroLayers.MCLayerChanged();
  2118. },
  2119. MCLayerChanged_added: function()
  2120. {
  2121. uroLayers.MCLayerChanged();
  2122. },
  2123. MCLayerChanged_removed: function()
  2124. {
  2125. uroLayers.MCLayerChanged();
  2126. },
  2127. ReapplyPointMCVisibilityMods: function()
  2128. {
  2129. if(uroLayers.ApplyPointMCVisibilityMods() === false)
  2130. {
  2131. window.setTimeout(uroLayers.ReapplyPointMCVisibilityMods,100);
  2132. }
  2133. },
  2134. ApplyPointMCVisibilityMods: function()
  2135. {
  2136. let retval = true;
  2137. if(uroLayers.HasSelectedMCs() === true)
  2138. {
  2139. retval = false;
  2140. }
  2141. else
  2142. {
  2143. let svgElm = document.getElementById(uroMCLayer.div.id+'_vroot');
  2144. for(let svgIdx = 0; svgIdx < svgElm.children.length; svgIdx++)
  2145. {
  2146. let svgChild = svgElm.children[svgIdx];
  2147. if(svgChild.id.indexOf('Point') != -1)
  2148. {
  2149. if(uroUtils.GetCBChecked('_cbMCEnhancePointMCVisibility') === true)
  2150. {
  2151. if(svgChild.getAttribute('r') == 6)
  2152. {
  2153. svgChild.setAttribute('fill','#ffff00');
  2154. svgChild.setAttribute('fill-opacity',0.75);
  2155. svgChild.setAttribute('r',12);
  2156. svgChild.setAttribute('touchedByURO',true);
  2157. }
  2158. else if((svgChild.getAttribute('touchedByURO') === "true")&&(svgChild.getAttribute('fill') === '#ffff00'))
  2159. {
  2160. // do nothing...
  2161. }
  2162. else
  2163. {
  2164. retval = false;
  2165. break;
  2166. }
  2167. }
  2168. else
  2169. {
  2170. if((svgChild.getAttribute('touchedByURO') === "true")&&(svgChild.getAttribute('fill') === '#ffff00'))
  2171. {
  2172. svgChild.setAttribute('fill','#ffffff');
  2173. svgChild.setAttribute('fill-opacity',1);
  2174. svgChild.setAttribute('r',6);
  2175. svgChild.setAttribute('touchedByURO',false);
  2176. }
  2177. }
  2178. }
  2179. }
  2180. }
  2181. return retval;
  2182. },
  2183. HasSelectedMCs: function()
  2184. {
  2185. let retval = false;
  2186. for(let mcObj in W.model.mapComments.objects)
  2187. {
  2188. if(W.model.mapComments.objects[mcObj].isSelected() === true)
  2189. {
  2190. retval = true;
  2191. break;
  2192. }
  2193. }
  2194. return retval;
  2195. },
  2196. MCLayerChanged: function()
  2197. {
  2198. uroInit.WazeBits();
  2199. if(uroMCLayer != null)
  2200. {
  2201. if(uroLayers.HasSelectedMCs() === false)
  2202. {
  2203. uroDBG.AddLog('adding MC blob event handlers');
  2204. let mcModel = null;
  2205. for(let mObj=0; mObj<uroMCLayer.features.length; mObj++)
  2206. {
  2207. if(uroMCLayer.features[mObj]?.attributes?.wazeFeature?._wmeObject !== undefined)
  2208. {
  2209. mcModel = uroMCLayer.features[mObj].attributes.wazeFeature._wmeObject;
  2210. {
  2211. if(mcModel.selected !== true)
  2212. {
  2213. let mcBlobID = mcModel.attributes.geometry.id;
  2214. let mcID = mcModel.attributes.id;
  2215. let mcBlob = document.getElementById(mcBlobID);
  2216. if(mcBlob !== null)
  2217. {
  2218. mcBlob.addEventListener("mouseout", uroLayers.blobMouseOut, false);
  2219. mcBlob.attributes.uroBlobID = mcID;
  2220. mcBlob.attributes.uroBlobType = "map_comment";
  2221. uroDBG.AddLog('added handlers to MC '+mcID);
  2222. }
  2223. }
  2224. }
  2225. }
  2226. }
  2227. uroLayers.ApplyPointMCVisibilityMods();
  2228. }
  2229. else
  2230. {
  2231. uroDBG.AddLog('MC selected, handlers not added yet...');
  2232. }
  2233. uroFilterMapComments();
  2234. }
  2235. },
  2236. VenueLayerChanged: function()
  2237. {
  2238. uroDBG.AddLog('adding place blob event handlers');
  2239. for(let mObj=0; mObj<uroVenueLayer.features.length; mObj++)
  2240. {
  2241. // clicking on an area place now adds the polygon drag handles into the features[] array, so we need to test that
  2242. // the current array entry isn't referring to one of these handles before trying to access the attributes...
  2243. if(uroVenueLayer.features[mObj]?.attributes?.wazeFeature?._wmeObject !== undefined)
  2244. {
  2245. let mcBlobID = uroVenueLayer.features[mObj].attributes.wazeFeature._wmeObject.attributes.geometry.id;
  2246. let mcID = uroVenueLayer.features[mObj].attributes.wazeFeature._wmeObject.attributes.id;
  2247. let mcBlob = document.getElementById(mcBlobID);
  2248. if(mcBlob !== null)
  2249. {
  2250. mcBlob.addEventListener("mouseout", uroLayers.blobMouseOut, false);
  2251. mcBlob.attributes.uroBlobID = mcID;
  2252. mcBlob.attributes.uroBlobType = "place";
  2253. }
  2254. }
  2255. }
  2256. },
  2257. Observe_VenueLayer: function()
  2258. {
  2259. uroLayers.layers[uroLayers.ID.venue].MO.observe(uroVenueLayer.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2260. },
  2261. Observe_URLayer: function()
  2262. {
  2263. // As URs are now displayed as SVG image elements rather than HTML elements, and as WME likes to re-render them seemingly
  2264. // at random after they've been initially displayed, we hang the mutation observer off of the vectorRoot element, as this
  2265. // is the parent SVG element for the markers, and the MO therefore seems to trigger reliably on each change to that level
  2266. // of the SVG, including these random re-renders. It's obvious if these re-renders aren't being captured correctly, as it
  2267. // causes the comment count markers to randomly show up behind UR markers instead of always being in front of them...
  2268. uroLayers.layers[uroLayers.ID.UR].MO.observe(uroLayers.layers[uroLayers.ID.UR].l.renderer.vectorRoot,{childList: true, attributes : true, characterData : true, subtree: true});
  2269. },
  2270. URLayerChanged: function()
  2271. {
  2272. uroDBG.AddLog('UR layer change detected');
  2273. uroLayers.layers[uroLayers.ID.UR].MO.disconnect();
  2274. uroFilterURs();
  2275. uroLayers.Observe_URLayer();
  2276. },
  2277. PURLayerChanged: function()
  2278. {
  2279. uroDBG.AddLog('PUR layer change detected');
  2280. uroLayers.layers[uroLayers.ID.PUR].MO.disconnect();
  2281. uroFilterProblems();
  2282. uroLayers.Observe_PURLayer();
  2283. },
  2284. Observe_PURLayer: function()
  2285. {
  2286. uroLayers.layers[uroLayers.ID.PUR].MO.observe(uroLayers.layers[uroLayers.ID.PUR].l.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2287. },
  2288. PPURLayerChanged: function()
  2289. {
  2290. uroDBG.AddLog('PPUR layer change detected');
  2291. uroLayers.layers[uroLayers.ID.PPUR].MO.disconnect();
  2292. uroFilterProblems();
  2293. uroLayers.Observe_PPURLayer();
  2294. },
  2295. Observe_PPURLayer: function()
  2296. {
  2297. uroLayers.layers[uroLayers.ID.PPUR].MO.observe(uroLayers.layers[uroLayers.ID.PPUR].l.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2298. },
  2299. RPURLayerChanged: function()
  2300. {
  2301. uroDBG.AddLog('RPUR layer change detected');
  2302. uroLayers.layers[uroLayers.ID.RPUR].MO.disconnect();
  2303. uroFilterProblems();
  2304. uroLayers.Observe_RPURLayer();
  2305. },
  2306. Observe_RPURLayer: function()
  2307. {
  2308. uroLayers.layers[uroLayers.ID.RPUR].MO.observe(uroLayers.layers[uroLayers.ID.RPUR].l.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2309. },
  2310.  
  2311. RTCLayerChanged: function()
  2312. {
  2313. uroDBG.AddLog('reapplying closures filter');
  2314. uroLayers.layers[uroLayers.ID.RTC].MO.disconnect();
  2315. uroFilterRTCs();
  2316. uroLayers.Observe_RTCLayer();
  2317. },
  2318. Observe_RTCLayer: function()
  2319. {
  2320. uroLayers.layers[uroLayers.ID.RTC].MO.observe(uroLayers.layers[uroLayers.ID.RTC].l.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2321. },
  2322. RunChangeHandlers: function()
  2323. {
  2324. uroLayers.URLayerChanged();
  2325. uroLayers.PURLayerChanged();
  2326. uroLayers.PPURLayerChanged();
  2327. uroLayers.RPURLayerChanged();
  2328. uroLayers.VenueLayerChanged();
  2329. uroLayers.RTCLayerChanged();
  2330.  
  2331. uroLayers.MCLayerChanged();
  2332. },
  2333. InitialiseMOs: function()
  2334. {
  2335. uroLayers.layers[uroLayers.ID.UR].MO = new MutationObserver(uroLayers.URLayerChanged);
  2336. uroLayers.layers[uroLayers.ID.PUR].MO = new MutationObserver(uroLayers.PURLayerChanged);
  2337. uroLayers.layers[uroLayers.ID.PPUR].MO = new MutationObserver(uroLayers.PPURLayerChanged);
  2338. uroLayers.layers[uroLayers.ID.RPUR].MO = new MutationObserver(uroLayers.RPURLayerChanged);
  2339. uroLayers.layers[uroLayers.ID.venue].MO = new MutationObserver(uroLayers.VenueLayerChanged);
  2340. uroLayers.layers[uroLayers.ID.RTC].MO = new MutationObserver(uroLayers.RTCLayerChanged);
  2341. uroLayers.Observe_URLayer();
  2342. uroLayers.Observe_PURLayer();
  2343. uroLayers.Observe_PPURLayer();
  2344. uroLayers.Observe_RPURLayer();
  2345. uroLayers.Observe_VenueLayer();
  2346. uroLayers.Observe_RTCLayer();
  2347. },
  2348. GetMarkersOrFeatures: function(layerID)
  2349. {
  2350. let retval = null;
  2351. let findit = uroLayers.layers[layerID].l.features;
  2352. if(findit !== undefined)
  2353. {
  2354. retval = findit;
  2355. uroDBG.AddLog(uroLayers.layers[layerID].name + ' = features');
  2356. }
  2357. else
  2358. {
  2359. findit = uroLayers.layers[layerID].l.markers;
  2360. if(findit !== undefined)
  2361. {
  2362. retval = findit;
  2363. uroDBG.AddLog(uroLayers.layers[layerID].name + ' = markers');
  2364. }
  2365. }
  2366. if(retval === null)
  2367. {
  2368. uroDBG.AddLog(uroLayers.layers[layerID].name + ' = unknown :-/');
  2369. }
  2370. return retval;
  2371. },
  2372. Init: function()
  2373. {
  2374. for(let i = 0; i < uroLayers.layers.length; ++i)
  2375. {
  2376. uroLayers.layers[i].l = W.map.getLayerByUniqueName(uroLayers.layers[i].name);
  2377. if(uroLayers.layers[i].getMF === true)
  2378. {
  2379. uroLayers.layers[i].mf = uroLayers.GetMarkersOrFeatures(i);
  2380. }
  2381. }
  2382. }
  2383. };
  2384. const uroAlertBox = // alert box handling
  2385. {
  2386. stack: [],
  2387. tickAction: null,
  2388. crossAction: null,
  2389. inUse: false,
  2390. ABObj: function(headericon, title, content, hasCross, tickText, crossText, tickAction, crossAction)
  2391. {
  2392. this.headericon = headericon;
  2393. this.title = title;
  2394. this.content = content;
  2395. this.hasCross = hasCross;
  2396. this.tickText = tickText;
  2397. this.crossText = crossText;
  2398. this.tickAction = tickAction;
  2399. this.crossAction = crossAction;
  2400. },
  2401. Close: function()
  2402. {
  2403. document.getElementById('uroAlerts').childNodes[0].innerHTML = uroUtils.ModifyHTML('');
  2404. document.getElementById('uroAlerts').childNodes[1].innerHTML = uroUtils.ModifyHTML('');
  2405. document.getElementById('uroAlertTickBtnCaption').innerHTML = uroUtils.ModifyHTML('');
  2406. document.getElementById('uroAlertCrossBtnCaption').innerHTML = uroUtils.ModifyHTML('');
  2407. uroAlertBox.tickAction = null;
  2408. uroAlertBox.crossAction = null;
  2409. document.getElementById('uroAlerts').style.visibility = "hidden";
  2410. document.getElementById('uroAlertCrossBtn').style.visibility = "hidden";
  2411. uroAlertBox.inUse = false;
  2412. if(uroAlertBox.stack.length > 0)
  2413. {
  2414. uroAlertBox.BuildFromStack();
  2415. }
  2416. },
  2417. CloseWithTick: function()
  2418. {
  2419. if(typeof uroAlertBox.tickAction === 'function')
  2420. {
  2421. uroAlertBox.tickAction();
  2422. }
  2423. uroAlertBox.Close();
  2424. },
  2425. CloseWithCross: function()
  2426. {
  2427. if(typeof uroAlertBox.crossAction === 'function')
  2428. {
  2429. uroAlertBox.crossAction();
  2430. }
  2431. uroAlertBox.Close();
  2432. },
  2433. Show: function(headericon, title, content, hasCross, tickText, crossText, tickAction, crossAction)
  2434. {
  2435. uroAlertBox.stack.push(new uroAlertBox.ABObj(headericon, title, content, hasCross, tickText, crossText, tickAction, crossAction));
  2436. if(uroAlertBox.inUse === false)
  2437. {
  2438. uroAlertBox.BuildFromStack();
  2439. }
  2440. },
  2441. BuildFromStack: function()
  2442. {
  2443. uroAlertBox.inUse = true;
  2444. uroAlertBox.tickAction = null;
  2445. uroAlertBox.crossAction = null;
  2446. let titleContent = '<span style="font-size:14px;padding:2px;">';
  2447. titleContent += '<i class="fa '+uroAlertBox.stack[0].headericon+'"> </i>&nbsp;';
  2448. titleContent += uroAlertBox.stack[0].title;
  2449. titleContent += '</span>';
  2450. document.getElementById('uroAlerts').childNodes[0].innerHTML = uroUtils.ModifyHTML(titleContent);
  2451. document.getElementById('uroAlerts').childNodes[1].innerHTML = uroUtils.ModifyHTML(uroAlertBox.stack[0].content);
  2452. document.getElementById('uroAlertTickBtnCaption').innerHTML = uroUtils.ModifyHTML(uroAlertBox.stack[0].tickText);
  2453. if(uroAlertBox.stack[0].hasCross)
  2454. {
  2455. document.getElementById('uroAlertCrossBtnCaption').innerHTML = uroUtils.ModifyHTML(uroAlertBox.stack[0].crossText);
  2456. document.getElementById('uroAlertCrossBtn').style.visibility = "visible";
  2457. if(typeof uroAlertBox.stack[0].crossAction === "function")
  2458. {
  2459. uroAlertBox.crossAction = uroAlertBox.stack[0].crossAction;
  2460. }
  2461. }
  2462. else
  2463. {
  2464. document.getElementById('uroAlertCrossBtn').style.visibility = "hidden";
  2465. }
  2466. if(typeof uroAlertBox.stack[0].tickAction === "function")
  2467. {
  2468. uroAlertBox.tickAction = uroAlertBox.stack[0].tickAction;
  2469. }
  2470. document.getElementById('uroAlerts').style.visibility = "";
  2471. uroAlertBox.stack.shift();
  2472. }
  2473. };
  2474. const uroStartup = // startup messaging to users
  2475. {
  2476. ShowUpgradeNotes: function()
  2477. {
  2478. uroDBG.AddLog('let users know what\'s new in this release');
  2479.  
  2480. let releaseNotes = '';
  2481. releaseNotes += '<p>Thanks for installing URO+ '+uroRelease.version+' ('+uroRelease.date+')</p>';
  2482.  
  2483. let loop;
  2484. if(uroRelease.changes.length > 0)
  2485. {
  2486. releaseNotes += '<br>Changes since the last release:<br>';
  2487. releaseNotes += '<ul>';
  2488. for(loop=0; loop < uroRelease.changes.length; loop++)
  2489. {
  2490. releaseNotes += '<li>'+uroRelease.changes[loop];
  2491. }
  2492. releaseNotes += '</ul>';
  2493. }
  2494.  
  2495. uroAlertBox.Show('fa-info-circle', 'URO+ Release Notes', releaseNotes, false, "OK", "", null, null);
  2496. }
  2497. };
  2498. const uroConfig = // configuration handling
  2499. {
  2500. GatherSettings: function(container)
  2501. {
  2502. let options = '';
  2503. if(typeof(container) == 'string')
  2504. {
  2505. container = document.getElementById(container);
  2506. }
  2507. let urOptions = container.getElementsByTagName('input');
  2508. for (let optIdx=0;optIdx<urOptions.length;optIdx++)
  2509. {
  2510. // Don't save settings for any of the legacy input elements we've now hidden...
  2511. if(urOptions[optIdx].style.display != "none")
  2512. {
  2513. let id = urOptions[optIdx].id;
  2514. if((id.indexOf('_cb') === 0)||(id.indexOf('_text') === 0)||(id.indexOf('_input') === 0))
  2515. {
  2516. options += ':' + id;
  2517. if(urOptions[optIdx].type == 'checkbox') options += ',' + urOptions[optIdx].checked.toString();
  2518. else if((urOptions[optIdx].type == 'text')||(urOptions[optIdx].type == 'number')) options += ',' + urOptions[optIdx].value.toString();
  2519. }
  2520. }
  2521. }
  2522. return options;
  2523. },
  2524. GatherCamWatchList: function()
  2525. {
  2526. let liststr = '';
  2527. for(let loop=0;loop<uroOWL.CamWatchObjects.length;loop++)
  2528. {
  2529. let camObj = uroOWL.CamWatchObjects[loop];
  2530. if((camObj.fid != null) && (camObj.persistent === true))
  2531. {
  2532. if(loop > 0) liststr += ':';
  2533.  
  2534. liststr += camObj.fid+',';
  2535. liststr += camObj.watch.lon+',';
  2536. liststr += camObj.watch.lat+',';
  2537. liststr += camObj.watch.type+',';
  2538. liststr += camObj.watch.azymuth+',';
  2539. liststr += camObj.watch.speed+',';
  2540. liststr += camObj.groupID+',';
  2541. liststr += camObj.server;
  2542. }
  2543. }
  2544. return liststr;
  2545. },
  2546. GatherCWLGroups: function()
  2547. {
  2548. let liststr = '';
  2549. for(let loop=0;loop<uroOWL.CWLGroups.length;loop++)
  2550. {
  2551. let groupObj = uroOWL.CWLGroups[loop];
  2552. if(groupObj.groupID != -1)
  2553. {
  2554. if(loop > 0) liststr += ':';
  2555.  
  2556. liststr += groupObj.groupID+',';
  2557. liststr += groupObj.groupName+',';
  2558. liststr += groupObj.groupCollapsed;
  2559. }
  2560. }
  2561. return liststr;
  2562. },
  2563. GatherPlacesGroups: function()
  2564. {
  2565. let liststr = '';
  2566. for(let loop=0;loop<uroPlacesGroupsCollapsed.length;loop++)
  2567. {
  2568. if(loop > 0) liststr += ':';
  2569. liststr += uroPlacesGroupsCollapsed[loop];
  2570. }
  2571. return liststr;
  2572. },
  2573. GatherAFNs: function()
  2574. {
  2575. let liststr = '';
  2576. for(let loop=0; loop < uroAFN.friendlyNames.length; loop++)
  2577. {
  2578. let fnObj = uroAFN.friendlyNames[loop];
  2579. if(loop > 0) liststr += ':';
  2580.  
  2581. liststr += fnObj.fName+',';
  2582. liststr += fnObj.area+',';
  2583. liststr += fnObj.server;
  2584. }
  2585. return liststr;
  2586. },
  2587. SaveSettings: function()
  2588. {
  2589. if((uroInhibitSave) || (uroMTEMode === true) || (uroSettingsApplied === false))
  2590. {
  2591. uroDBG.AddLog('save inhibited');
  2592. return;
  2593. }
  2594.  
  2595. if (localStorage)
  2596. {
  2597. try
  2598. {
  2599. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  2600. {
  2601. localStorage[uroTabs.CtrlTabs[i][uroTabs.FIELDS.STORAGE]] = uroConfig.GatherSettings(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY]);
  2602. }
  2603.  
  2604. localStorage.UROverviewCamWatchList = uroConfig.GatherCamWatchList();
  2605. localStorage.UROverviewCWLGroups = uroConfig.GatherCWLGroups();
  2606. localStorage.UROverviewFriendlyAreaNames = uroConfig.GatherAFNs();
  2607. localStorage.UROverviewPlacesGroups = uroConfig.GatherPlacesGroups();
  2608.  
  2609. localStorage.UROverviewMasterEnable = uroUtils.GetCBChecked('_cbMasterEnable');
  2610. localStorage.UROverviewCurrentVersion = uroRelease.version;
  2611.  
  2612. uroDBG.AddLog('save complete');
  2613. }
  2614. catch(err)
  2615. {
  2616. uroDBG.AddLog('exception thrown during save - probably script reload whilst in MTE mode...');
  2617. }
  2618. }
  2619. else
  2620. {
  2621. uroDBG.AddLog('no localStorage, save blocked');
  2622. }
  2623. },
  2624. ApplySettings: function(settings)
  2625. {
  2626. uroSettingsApplied = true;
  2627. if(settings != undefined)
  2628. {
  2629. if(document.querySelector('#_cbMasterEnable') === null)
  2630. {
  2631. uroSettingsApplied = false;
  2632. }
  2633. else
  2634. {
  2635. let options = settings.split(':');
  2636. for(let optIdx=0;optIdx<options.length;optIdx++)
  2637. {
  2638. let fields = options[optIdx].split(',');
  2639. if(fields[0].indexOf('_cb') === 0)
  2640. {
  2641. if(document.getElementById(fields[0]) !== null)
  2642. {
  2643. uroUtils.SetCBChecked(fields[0], (fields[1] == 'true'));
  2644. }
  2645. }
  2646. else if((fields[0].indexOf('_input') === 0)||(fields[0].indexOf('_text') === 0))
  2647. {
  2648. if(document.getElementById(fields[0]) !== null) document.getElementById(fields[0]).value = fields[1];
  2649. }
  2650. }
  2651. }
  2652. }
  2653. },
  2654. ApplyCamWatchList: function()
  2655. {
  2656. let objects = localStorage.UROverviewCamWatchList.split(':');
  2657. uroOWL.CamWatchObjects = [];
  2658. if(objects.length > 0)
  2659. {
  2660. for(let objIdx=0;objIdx<objects.length;objIdx++)
  2661. {
  2662. let fields = objects[objIdx].split(',');
  2663. if(fields.length == 9)
  2664. {
  2665. // CWL entries with 9 fields include the validated property which is now redundant, so we need to strip this property before adding
  2666. // the camera to the object collection. Whilst WME no longer displays unapproved cameras, it's preferable at this stage to leave
  2667. // any watched unapproved cameras in the object collection, just in case any of them were approved (and will therefore still be
  2668. // present in WME) inbetween the last time the user ran URO and now. For those unapproved cameras which were still unapproved when
  2669. // 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
  2670. // remove them there as well.
  2671. uroOWL.CamWatchObjects.push(new uroOWL.CamWatchObj(true,fields[0],fields[1],fields[2],fields[3],fields[4],fields[5],fields[7],fields[8]));
  2672. }
  2673. else if(fields.length == 8)
  2674. {
  2675. uroOWL.CamWatchObjects.push(new uroOWL.CamWatchObj(true,fields[0],fields[1],fields[2],fields[3],fields[4],fields[5],fields[6],fields[7]));
  2676. }
  2677. }
  2678. }
  2679. },
  2680. ApplyCWLGroups: function()
  2681. {
  2682. let objects = localStorage.UROverviewCWLGroups.split(':');
  2683. uroOWL.CWLGroups = [];
  2684.  
  2685. if(objects.length === 0)
  2686. {
  2687. uroOWL.CWLGroups.push(new uroOWL.GroupObj(0,'No group',false));
  2688. }
  2689. else
  2690. {
  2691. for(let objIdx=0;objIdx<objects.length;objIdx++)
  2692. {
  2693. let fields = objects[objIdx].split(',');
  2694. if(fields.length < 2)
  2695. {
  2696. fields.push(false);
  2697. }
  2698. uroOWL.CWLGroups.push(new uroOWL.GroupObj(fields[0],fields[1],(fields[2] == 'true')));
  2699. }
  2700. }
  2701. },
  2702. TranslateLegacyMPTab: function()
  2703. {
  2704. let options = localStorage.UROverviewMPOptions.split(':');
  2705. for(let optIdx=0;optIdx<options.length;optIdx++)
  2706. {
  2707. let fields = options[optIdx].split(',');
  2708. if(fields[0].indexOf('_cb') === 0)
  2709. {
  2710. if(fields[0] == '_cbMPFilterParkingLotInputAsPoint') uroUtils.SetCBChecked('_cbMPFilter_T50', (fields[1] == 'true'));
  2711. if(fields[0] == '_cbMPMissingPLP_T70') uroUtils.SetCBChecked('_cbMPFilter_T70', (fields[1] == 'true'));
  2712. if(fields[0] == '_cbMPMissingPLP_T71') uroUtils.SetCBChecked('_cbMPFilter_T71', (fields[1] == 'true'));
  2713. if(fields[0] == '_cbMPFilterDrivingDirectionMismatch') uroUtils.SetCBChecked('_cbMPFilter_T101', (fields[1] == 'true'));
  2714. if(fields[0] == '_cbMPFilterMissingJunction') uroUtils.SetCBChecked('_cbMPFilter_T102', (fields[1] == 'true'));
  2715. if(fields[0] == '_cbMPFilterMissingRoad') uroUtils.SetCBChecked('_cbMPFilter_T103', (fields[1] == 'true'));
  2716. if(fields[0] == '_cbMPFilterCrossroadsJunctionMissing') uroUtils.SetCBChecked('_cbMPFilter_T104', (fields[1] == 'true'));
  2717. if(fields[0] == '_cbMPFilterRoadTypeMismatch') uroUtils.SetCBChecked('_cbMPFilter_T105', (fields[1] == 'true'));
  2718. if(fields[0] == '_cbMPFilterRestrictedTurn') uroUtils.SetCBChecked('_cbMPFilter_T106', (fields[1] == 'true'));
  2719. if(fields[0] == '_cbMPFilterTurnProblem') uroUtils.SetCBChecked('_cbMPFilter_T200', (fields[1] == 'true'));
  2720. if(fields[0] == '_cbMPFilterRoadClosureProblem') uroUtils.SetCBChecked('_cbMPFilter_T300', (fields[1] == 'true'));
  2721. }
  2722. }
  2723. },
  2724. TranslateLegacyZoom: function()
  2725. {
  2726. let tZoom = parseInt(document.getElementById("_inputFilterMinZoomLevel").value);
  2727. if(tZoom < 12)
  2728. {
  2729. tZoom += 12;
  2730. document.getElementById("_inputFilterMinZoomLevel").value = tZoom;
  2731. }
  2732. tZoom = parseInt(document.getElementById("_inputUnstackZoomLevel").value);
  2733. if(tZoom < 12)
  2734. {
  2735. tZoom += 12;
  2736. document.getElementById("_inputUnstackZoomLevel").value = tZoom;
  2737. }
  2738. },
  2739. LoadSettings: function()
  2740. {
  2741. let isNewInstall = true;
  2742. let isUpgradeInstall = true;
  2743.  
  2744. uroDBG.AddLog('loadSettings()');
  2745. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  2746. {
  2747. if (uroTabs.CtrlTabs[i][uroTabs.FIELDS.STORAGE] != null)
  2748. {
  2749. uroDBG.AddLog('recover '+uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABTITLE]+' tab settings');
  2750. uroConfig.ApplySettings(localStorage[uroTabs.CtrlTabs[i][uroTabs.FIELDS.STORAGE]]);
  2751. isNewInstall = false;
  2752. }
  2753. }
  2754. if (localStorage.UROverviewMPOptions != null)
  2755. {
  2756. uroConfig.TranslateLegacyMPTab();
  2757. }
  2758. if (localStorage.UROverviewMiscOptions != null)
  2759. {
  2760. uroConfig.TranslateLegacyZoom();
  2761. }
  2762.  
  2763. if(localStorage.UROverviewCWLGroups != null)
  2764. {
  2765. uroDBG.AddLog('recover CWL groups');
  2766. uroConfig.ApplyCWLGroups();
  2767. isNewInstall = false;
  2768. }
  2769. else
  2770. {
  2771. uroDBG.AddLog('set default CWL group');
  2772. uroOWL.CWLGroups.push(new uroOWL.GroupObj(0,'No group',false));
  2773. }
  2774.  
  2775. if(localStorage.UROverviewCamWatchList != null)
  2776. {
  2777. uroDBG.AddLog('recover camera watchlist');
  2778. uroConfig.ApplyCamWatchList();
  2779. uroOWL.GetCurrentCamWatchListObjects();
  2780. isNewInstall = false;
  2781. }
  2782. /*
  2783. if(localStorage.UROverviewSegWatchList != null)
  2784. {
  2785. uroDBG.AddLog('recover segment watchlist');
  2786. uroApplySegWatchList();
  2787. uroGetCurrentSegWatchListObjects();
  2788. isNewInstall = false;
  2789. }
  2790.  
  2791. if(localStorage.UROverviewPlaceWatchList != null)
  2792. {
  2793. uroDBG.AddLog('recover places watchlist');
  2794. uroApplyPlaceWatchList();
  2795. //uroGetCurrentPlaceWatchListObjects();
  2796. isNewInstall = false;
  2797. }
  2798.  
  2799. if(localStorage.UROverviewPlacesGroups != null)
  2800. {
  2801. uroDBG.AddLog('recover places groups');
  2802. uroApplyPlacesGroups();
  2803. isNewInstall = false;
  2804. }
  2805. */
  2806. if(localStorage.UROverviewCurrentVersion != null)
  2807. {
  2808. uroDBG.AddLog('comparing install versions');
  2809. if(localStorage.UROverviewCurrentVersion == uroRelease.version)
  2810. {
  2811. isUpgradeInstall = false;
  2812. }
  2813. }
  2814.  
  2815. if(localStorage.UROverviewFriendlyAreaNames != null)
  2816. {
  2817. uroDBG.AddLog('recover friendly area names');
  2818. uroAFN.ApplyNames();
  2819. isNewInstall = false;
  2820. }
  2821.  
  2822. if(localStorage.UROverviewMasterEnable != null)
  2823. {
  2824. uroDBG.AddLog('recover master enable state');
  2825. document.getElementById('_cbMasterEnable').checked = (localStorage.UROverviewMasterEnable == "true");
  2826. uroDBG.AddLog('enable checkbox state set...');
  2827. }
  2828.  
  2829. if((isNewInstall)||(isUpgradeInstall))
  2830. {
  2831. uroStartup.ShowUpgradeNotes();
  2832. }
  2833.  
  2834. uroInhibitSave = false;
  2835. },
  2836. DefaultSettings: function()
  2837. {
  2838. 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);
  2839. },
  2840. DefaultSettingsAction: function()
  2841. {
  2842. let defaultSettings = '';
  2843.  
  2844. defaultSettings += '[UROverviewCWLGroups][len=16]0,No group,false[END]';
  2845. defaultSettings += '[UROverviewCamWatchList][len=0][END]';
  2846. defaultSettings += '[UROverviewCameraOptions][len=852]:_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:_cbHideCWLCams,false:_cbHighlightInsteadOfHideCams,false[END]';
  2847. defaultSettings += '[UROverviewCurrentVersion][len=5]3.146[END]';
  2848. defaultSettings += '[UROverviewFriendlyAreaNames][len=0][END]';
  2849. defaultSettings += '[UROverviewMCOptions][len=529]:_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:_cbMCEnableKeywordMustBePresent,false:_textMCKeywordPresent,:_cbMCEnableKeywordMustBeAbsent,false:_textMCKeywordAbsent,:_cbMCCaseInsensitive,false:_cbMCEnhancePointMCVisibility,false[END]';
  2850. defaultSettings += '[UROverviewMPOptions][len=1219]:_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[END]';
  2851. defaultSettings += '[UROverviewMasterEnable][len=4]true[END]';
  2852. defaultSettings += '[UROverviewMiscOptions][len=1698]:_cbHideUserRTCs,false:_cbHideEditorRTCs,false:_cbHideFutureEditorRTCs,false:_cbHideWazeRTCs,false:_cbHideFutureWazeRTCs,false:_cbHideSegmentsWhenRoadsHidden,false:_cbKillInertialPanning,false:_cbNativeConvoMarkers,true:_cbNativeBetaConvoMarkers,true:_cbCommentCount,false:_cbEnableDeleteFeedEntries,false:_cbURBackfill,false:_inputFilterMinZoomLevel,10:_inputUnstackSensitivity,15:_inputUnstackZoomLevel,3:_cbCustomRoadworksMarkers,false:_cbCustomConstructionMarkers,false:_cbCustomClosuresMarkers,false:_cbCustomEventsMarkers,false:_cbCustomNotesMarkers,false:_cbCustomBOGMarkers,false:_cbCustomDifficultMarkers,false:_cbCustomWSLMMarkers,false:_cbCustomNativeSLMarkers,false:_cbCustomKeywordMarkers,false:_textCustomKeyword,:_cbCustomElginMarkers,false:_cbCustomTrafficMasterMarkers,false:_cbCustomTrafficCastMarkers,false:_cbCustomCaltransMarkers,false:_cbCustomTFLMarkers,false:_inputPopupDwellTimeout,2:_inputPopupEntryTimeout,2:_inputMaxJitter,2:_inputPopupAutoHideTimeout,0:_cbInhibitURPopup,false:_cbInhibitMPPopup,false:_cbInhibitCamPopup,false:_cbInhibitSegPopup,false:_cbInhibitSegGenericPopup,false:_cbInhibitTurnsPopup,false:_cbInhibitLandmarkPopup,false:_cbInhibitPUPopup,false:_cbInhibitMapCommentPopup,false:_cbInhibitNodesPopup,false:_cbDateFmtDDMMYY,true:_cbDateFmtMMDDYY,false:_cbDateFmtYYMMDD,false:_cbTimeFmt24H,true:_cbTimeFmt12H,false:_cbWhiteBackground,false:_inputCustomBackgroundRed,255:_inputCustomBackgroundGreen,255:_inputCustomBackgroundBlue,255:_cbInhibitNURButton,false:_cbInhibitNMPButton,false:_cbInhibitNPURButton,false:_cbHideAMLayer,false:_cbMoveAMList,false:_cbDisablePlacesFiltering,false:_cbDisableTabStyling,false:_cbHideEditorInfo,false:_cbEnableDTE,false[END]';
  2853. defaultSettings += '[UROverviewPlaceWatchList][len=0][END]';
  2854. defaultSettings += '[UROverviewPlacesGroups][len=65]false:false:false:false:false:false:false:false:false:false:false[END]';
  2855. defaultSettings += '[UROverviewPlacesOptions][len=6062]:_cbFilterUneditablePlaceUpdates,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:_cbLeavePURGeos,false:_cbInvertPURFilters,false:_cbPURFilterLowSeverity,false:_cbPURFilterMediumSeverity,false:_cbPURFilterHighSeverity,false:_cbEnablePURMinAgeFilter,false:_inputPURFilterMinDays,:_cbEnablePURMaxAgeFilter,false:_inputPURFilterMaxDays,:_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,:_cbHideOnlyPlacesCreatedBy,false:_cbHideOnlyPlacesEditedBy,false:_textHidePlacesEditor,:_cbPlacesFilter-CAR_SERVICES,false:_cbPlacesFilter-GAS_STATION,false:_cbPlacesFilter-GARAGE_AUTOMOTIVE_SHOP,false:_cbPlacesFilter-CAR_WASH,false:_cbPlacesFilter-CHARGING_STATION,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-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-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-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-OTHER,false:_cbPlacesFilter-CONSTRUCTION_SITE,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-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-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-PARKING_LOT,false:_cbFilterPrivatePlaces,false:_cbInvertPlacesFilter,false[END]';
  2856. defaultSettings += '[UROverviewSegWatchList][len=0][END]';
  2857. defaultSettings += '[UROverviewUROptions][len=1779]:_cbURFilterDupes,false:_cbURFilterOutsideArea,false:_cbNoFilterForURInURL,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,:_cbEnableMaxAgeFilter,false:_inputFilterMaxDays,:_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,:_cbEnableMaxCommentsFilter,false:_inputFilterMaxComments,:_cbEnableCommentAgeFilter2,false:_inputFilterCommentDays2,:_cbEnableCommentAgeFilter,false:_inputFilterCommentDays,:_cbIgnoreOtherEditorComments,false:_cbURUserIDFilter,false:_cbURResolverIDFilter,false:_cbInvertURStateFilter,false:_cbNoFilterForTaggedURs,false[END]';
  2858.  
  2859. document.getElementById('_txtSettings').value = defaultSettings;
  2860. uroConfig.TextToSettings();
  2861. document.getElementById('_txtSettings').value = '';
  2862. },
  2863. SettingsToText: function()
  2864. {
  2865. let txtSettings = '';
  2866.  
  2867. uroConfig.SaveSettings();
  2868.  
  2869. for(let lsEntry in localStorage)
  2870. {
  2871. if(lsEntry.indexOf('UROverview') === 0)
  2872. {
  2873. txtSettings += '['+lsEntry+'][len=' + localStorage[lsEntry].length + ']' + localStorage[lsEntry] + '[END]\n';
  2874. }
  2875. }
  2876.  
  2877. document.getElementById('_txtSettings').value = txtSettings;
  2878. document.getElementById('_txtSettings').focus();
  2879. document.getElementById('_txtSettings').select();
  2880. },
  2881. TextToSettings: function()
  2882. {
  2883. let txtSettings = '';
  2884. txtSettings = uroUtils.GetElmValue('_txtSettings');
  2885. if(txtSettings.indexOf('[END]') == -1) return;
  2886.  
  2887. let subText = txtSettings.split('[END]');
  2888. for(let i=0;i<subText.length;i++)
  2889. {
  2890. let aPos = subText[i].indexOf('[');
  2891. let bPos = subText[i].indexOf(']');
  2892. if((aPos != -1) && (bPos != -1))
  2893. {
  2894. let settingID = subText[i].substr(aPos+1,bPos-1-aPos);
  2895. subText[i] = subText[i].substr(bPos+1);
  2896. bPos = subText[i].indexOf(']');
  2897. if(bPos != -1)
  2898. {
  2899. let settingLength = subText[i].substr(5,bPos-5);
  2900. subText[i] = subText[i].substr(bPos+1);
  2901. if(subText[i].length == settingLength)
  2902. {
  2903. localStorage[settingID] = subText[i];
  2904. }
  2905. }
  2906. }
  2907. }
  2908. uroConfig.LoadSettings();
  2909. },
  2910. ClearSettingsText: function()
  2911. {
  2912. document.getElementById('_txtSettings').value = '';
  2913. }
  2914. };
  2915. const uroRTCClone = // RTC cloning
  2916. {
  2917. ConfirmDelete : true,
  2918. ToDelete : 0,
  2919. Reason : null,
  2920. Event : null,
  2921. Direction : null,
  2922. StartDate : null,
  2923. StartTime : null,
  2924. EndDate : null,
  2925. EndTime : null,
  2926. IgnoreTraffic : null,
  2927. ClosedNodes : null,
  2928. PendingClone : -1,
  2929. PendingCloneIncrement : 0,
  2930.  
  2931. Complete: function()
  2932. {
  2933. let loop;
  2934. if(document.getElementsByClassName('edit-closure').length === 0)
  2935. {
  2936. window.setTimeout(uroRTCClone.Complete,100);
  2937. return;
  2938. }
  2939.  
  2940. if(uroTempFixMTEDropDown() == false)
  2941. {
  2942. window.setTimeout(uroRTCClone.Complete,100);
  2943. return;
  2944. }
  2945.  
  2946. // need to generate a change event on each of the form fields, because WME appears to be silently populating some hidden
  2947. // closure object with the details as they're entered manually, and if we just set the form values without then forcing
  2948. // the change event as well then WME will end up using its default values instead of the ones we've so lovingly copied...
  2949. let form = $('#edit-panel .closures .edit-closure form');
  2950.  
  2951. if(uroRTCClone.Reason !== null)
  2952. {
  2953. let fObj = form.find('wz-text-input#closure_reason');
  2954. fObj.val(uroRTCClone.Reason);
  2955. fObj.change();
  2956. }
  2957. if(uroRTCClone.Direction !== null)
  2958. {
  2959. let fObj = form.find('wz-select#closure_direction');
  2960. fObj[0].value = uroRTCClone.Direction;
  2961. fObj.change();
  2962. }
  2963. if(uroRTCClone.StartDate !== null)
  2964. {
  2965. let fObj = form.find('input#closure_startDate');
  2966. fObj.val(uroRTCClone.StartDate);
  2967. fObj.change();
  2968. }
  2969. if(uroRTCClone.StartTime !== null)
  2970. {
  2971. let fObj = form.find('div.form-group.start-date-form-group input.time-picker-input');
  2972. fObj.focus();
  2973. fObj.val(uroRTCClone.StartTime);
  2974. fObj.change();
  2975. }
  2976.  
  2977. if(uroRTCClone.IgnoreTraffic !== null)
  2978. {
  2979. let fObj = form.find('wz-checkbox#closure_permanent');
  2980. fObj.val(uroRTCClone.IgnoreTraffic);
  2981. fObj.change();
  2982. }
  2983. if(uroRTCClone.EndTime !== null)
  2984. {
  2985. let fObj = form.find('div.form-group.end-date-form-group input.time-picker-input');
  2986. fObj.focus();
  2987. fObj.val(uroRTCClone.EndTime);
  2988. fObj.change();
  2989. }
  2990.  
  2991. // the current version of WME wipes any existing end date as soon as the end time is altered, so we now need
  2992. // to set the date after the time instead of before as in earlier versions of this function...
  2993. if(uroRTCClone.EndDate !== null)
  2994. {
  2995. let fObj = form.find('input#closure_endDate');
  2996. fObj.val(uroRTCClone.EndDate);
  2997. fObj.change();
  2998. }
  2999.  
  3000. // the old method of setting the MTE just by changing the value attribute on closure_eventId no longer
  3001. // seems to work as expected (it runs OK from the dev console, but not within the scope of the userscript),
  3002. // so just as we do for setting the event to None, we set the event to the desired value here by finding
  3003. // the appropriate menu entry and clicking on it...
  3004. let cEvents = document.getElementById('closure_eventId').getElementsByTagName('wz-option');
  3005. for(let i of cEvents)
  3006. {
  3007. if(i.value == uroRTCClone.Event)
  3008. {
  3009. i.click();
  3010. break;
  3011. }
  3012. }
  3013.  
  3014. let nNodes = uroRTCClone.ClosedNodes.length;
  3015. if(nNodes > 0)
  3016. {
  3017. let fObj = form.find('wz-toggle-switch');
  3018. for(loop = 0; loop < nNodes; ++loop)
  3019. {
  3020. if(uroRTCClone.ClosedNodes[loop] === true)
  3021. {
  3022. fObj[loop].click();
  3023. }
  3024. }
  3025. }
  3026. if(uroUtils.GetCBChecked('_cbAutoApplyClonedClosure') == true)
  3027. {
  3028. window.setTimeout(uroRTCClone.ClickSave,100);
  3029. }
  3030.  
  3031. uroRTCClone.PendingClone = -1;
  3032. },
  3033. ClickSave: function()
  3034. {
  3035. document.getElementsByClassName('closures')[0].getElementsByClassName('save-button')[0].click();
  3036. },
  3037. Copy: function(closureOffset)
  3038. {
  3039. // grab the current closure details from the UI...
  3040. uroRTCClone.Reason = uroGetShadowElementProperty('closure_reason', 'input', 'value');
  3041. uroRTCClone.Direction = uroGetElementProperty('closure_direction', 0, 'value');
  3042. uroRTCClone.StartDate = uroGetElementProperty('closure_startDate', 0, 'value');
  3043. uroRTCClone.StartTime = document.querySelector('.start-date-form-group').querySelector('.time-picker-input').value;
  3044. uroRTCClone.EndDate = uroGetElementProperty('closure_endDate', 0, 'value');
  3045. uroRTCClone.EndTime = document.querySelector('.end-date-form-group').querySelector('.time-picker-input').value;
  3046. uroRTCClone.Event = uroGetElementProperty('closure_eventId', 0, 'value');
  3047. uroRTCClone.IgnoreTraffic = uroGetElementProperty('closure_permanent', 0, 'checked');
  3048. uroRTCClone.ClosedNodes = [];
  3049. let nNodes = document.getElementsByClassName('fromNodeClosed').length;
  3050. if(nNodes > 0)
  3051. {
  3052. for(let loop = 0; loop < nNodes; ++loop)
  3053. {
  3054. uroRTCClone.ClosedNodes.push(document.getElementsByClassName('fromNodeClosed')[loop].checked);
  3055. }
  3056. }
  3057.  
  3058. document.getElementsByClassName('closures')[0].getElementsByClassName('cancel-button')[0].click();
  3059.  
  3060. // auto-increment the start and end dates
  3061. uroRTCClone.StartDate = uroIncrementClosureDate(uroRTCClone.StartDate,uroRTCClone.PendingCloneIncrement);
  3062. uroRTCClone.EndDate = uroIncrementClosureDate(uroRTCClone.EndDate,uroRTCClone.PendingCloneIncrement);
  3063.  
  3064. uroRTCClone.PendingClone = -2;
  3065. },
  3066. Clone: function()
  3067. {
  3068. uroRTCClone.PendingCloneIncrement = parseInt(this.id.split('-')[1]);
  3069. uroRTCClone.PendingClone = parseInt(this.id.split('-')[2]);
  3070. },
  3071. DeleteNextOnList: function()
  3072. {
  3073. let nClosures = document.querySelectorAll('.closure-item.is-editable').length;
  3074. if(nClosures > 0)
  3075. {
  3076. if (nClosures != uroRTCClone.ToDelete)
  3077. {
  3078. uroRTCClone.ToDelete = nClosures;
  3079. let ctObj = document.querySelector('.closure-item.is-editable');
  3080. let deleteMenuEntry = ctObj.querySelector('wz-menu-item.delete');
  3081. if(deleteMenuEntry !== null)
  3082. {
  3083. deleteMenuEntry.click();
  3084. }
  3085. }
  3086. window.setTimeout(uroRTCClone.DeleteNextOnList,100);
  3087. }
  3088. else
  3089. {
  3090. uroRTCClone.ConfirmDelete = true;
  3091. }
  3092. },
  3093. DeleteAll: function()
  3094. {
  3095. uroRTCClone.ConfirmDelete = true;
  3096. 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);
  3097. },
  3098. DeleteAllAction: function()
  3099. {
  3100. uroRTCClone.ConfirmDelete = false;
  3101. let nClosures = document.getElementsByClassName('closure-item').length;
  3102. if(nClosures > 0)
  3103. {
  3104. uroRTCClone.ToDelete = -1;
  3105. uroRTCClone.DeleteNextOnList();
  3106. }
  3107. else
  3108. {
  3109. uroRTCClone.ConfirmDelete = true;
  3110. }
  3111. }
  3112. };
  3113. const uroOWL = /// camera watchlist
  3114. {
  3115. CWLGroups : [],
  3116. CamWatchObjects : [],
  3117.  
  3118. GroupObj: function(groupID, groupName, groupCollapsed)
  3119. {
  3120. groupID = uroUtils.TypeCast(groupID);
  3121. this.groupID = groupID;
  3122. this.groupName = groupName;
  3123. this.groupCount = 0;
  3124. this.groupCollapsed = groupCollapsed;
  3125. },
  3126. CamWatchObjCheckProps: function(type, azymuth, speed, lat, lon)
  3127. {
  3128. if(type !== null) type = uroUtils.TypeCast(type);
  3129. if(azymuth !== null) azymuth = uroUtils.Truncate(uroUtils.TypeCast(azymuth)%360);
  3130. if(speed !== null) speed = uroUtils.Truncate(uroUtils.TypeCast(speed));
  3131. if(lat !== null) lat = uroUtils.Truncate(uroUtils.TypeCast(lat));
  3132. if(lon !== null) lon = uroUtils.Truncate(uroUtils.TypeCast(lon));
  3133.  
  3134. this.type = type;
  3135. this.azymuth = azymuth;
  3136. this.speed = speed;
  3137. this.lat = lat;
  3138. this.lon = lon;
  3139. },
  3140. CamWatchObj: function(persistent, fid, lon, lat, type, azymuth, speed, groupID, server)
  3141. {
  3142. fid = uroUtils.TypeCast(fid);
  3143. groupID = uroUtils.TypeCast(groupID);
  3144. if(typeof persistent == "string") persistent = (persistent == "true");
  3145. if(server === "undefined") server = "??";
  3146.  
  3147. this.fid = fid;
  3148. this.persistent = persistent;
  3149. this.loaded = false;
  3150. this.server = server;
  3151. this.groupID = groupID;
  3152. this.watch = new uroOWL.CamWatchObjCheckProps(type, azymuth, speed, lat, lon);
  3153. this.current = new uroOWL.CamWatchObjCheckProps(null, null, null, null, null);
  3154. },
  3155. CamDataChanged: function(idx)
  3156. {
  3157. let camObj = uroOWL.CamWatchObjects[idx];
  3158. if(camObj.loaded === false) return false;
  3159. if(camObj.current.type != camObj.watch.type) return true;
  3160. if(camObj.current.azymuth != camObj.watch.azymuth) return true;
  3161. if(camObj.current.speed != camObj.watch.speed) return true;
  3162. if(camObj.current.lat != camObj.watch.lat) return true;
  3163. if(camObj.current.lon != camObj.watch.lon) return true;
  3164. return false;
  3165. },
  3166. FindCWLGroupByIdx: function(groupIdx)
  3167. {
  3168. let groupName = '';
  3169. for(let loop=0;loop<uroOWL.CWLGroups.length;loop++)
  3170. {
  3171. if(uroOWL.CWLGroups[loop].groupID == groupIdx)
  3172. {
  3173. groupName = uroOWL.CWLGroups[loop].groupName;
  3174. break;
  3175. }
  3176. }
  3177. return groupName;
  3178. },
  3179. IsCamOnWatchList: function(fid)
  3180. {
  3181. for(let loop=0;loop<uroOWL.CamWatchObjects.length;loop++)
  3182. {
  3183. if(uroOWL.CamWatchObjects[loop].fid == fid) return loop;
  3184. }
  3185. return -1;
  3186. },
  3187. AddCurrentCamWatchData: function(idx, lat, lon, type, azymuth, speed, server)
  3188. {
  3189. let camObj = uroOWL.CamWatchObjects[idx];
  3190. camObj.loaded = true;
  3191. camObj.server = server;
  3192. camObj.current = new uroOWL.CamWatchObjCheckProps(type, azymuth, speed, lat, lon);
  3193. return(uroOWL.CamDataChanged(idx));
  3194. },
  3195. AddCamToWatchList: function()
  3196. {
  3197. if(uroOWL.IsCamOnWatchList(uroShownFID) == -1)
  3198. {
  3199. let camObj = W.model.cameras.objects[uroShownFID];
  3200. 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()));
  3201. uroOWL.AddCurrentCamWatchData(uroOWL.CamWatchObjects.length-1, camObj.geometry.y, camObj.geometry.x, camObj.attributes.type, camObj.attributes.azymuth, camObj.attributes.speed, W.app.getAppRegionCode());
  3202. uroDBG.AddLog('added camera '+uroShownFID+' to watchlist');
  3203. uroTabs.PopulateOWL();
  3204. }
  3205. },
  3206. RemoveCamFromWatchList: function()
  3207. {
  3208. let camidx = uroOWL.IsCamOnWatchList(uroShownFID);
  3209. if(camidx != -1)
  3210. {
  3211. uroOWL.CamWatchObjects.splice(camidx,1);
  3212. uroDBG.AddLog('removed camera '+uroShownFID+' from watchlist');
  3213. uroTabs.PopulateOWL();
  3214. }
  3215. },
  3216. UpdateCamWatchList: function()
  3217. {
  3218. let camIdx = uroOWL.IsCamOnWatchList(uroShownFID);
  3219. if(camIdx != -1)
  3220. {
  3221. let camObj = W.model.cameras.objects[uroShownFID];
  3222. uroOWL.CamWatchObjects[camIdx].watch = new uroOWL.CamWatchObjCheckProps(camObj.attributes.type, camObj.attributes.azymuth, camObj.attributes.speed, camObj.geometry.y, camObj.geometry.x);
  3223. }
  3224. },
  3225. ClearCamWatchList: function()
  3226. {
  3227. 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);
  3228. },
  3229. ClearCamWatchListAction: function()
  3230. {
  3231. uroOWL.CamWatchObjects = [];
  3232. uroTabs.PopulateOWL();
  3233. },
  3234. RetrieveCameras: function(lat, lon)
  3235. {
  3236. let camPos = new OpenLayers.LonLat();
  3237. let camChanged = false;
  3238.  
  3239. camPos.lon = lon;
  3240. camPos.lat = lat;
  3241. camPos = uroUtils.ConvertMercatorToWGS84(camPos);
  3242.  
  3243. let camURL = 'https://' + document.location.host;
  3244. camURL += W.Config.api_base;
  3245. camURL += '/Features?language=en&cameras=true&bbox=';
  3246. let latl = camPos.lat - 0.25;
  3247. let latu = camPos.lat + 0.25;
  3248. let lonl = camPos.lon - 0.25;
  3249. let lonr = camPos.lon + 0.25;
  3250. camURL += lonl+','+latl+','+lonr+','+latu;
  3251. uroDBG.AddLog('retrieving camera data around '+camPos.lon+','+camPos.lat);
  3252.  
  3253. let camReq = new XMLHttpRequest();
  3254. camReq.open('GET',camURL,false);
  3255. try
  3256. {
  3257. camReq.send();
  3258. uroDBG.AddLog('response '+camReq.status+' received for camera data request');
  3259. if (camReq.status === 200)
  3260. {
  3261. let camData = JSON.parse(camReq.responseText);
  3262. for(let camIdx = 0; camIdx < camData.cameras.objects.length; camIdx++)
  3263. {
  3264. let camObj = camData.cameras.objects[camIdx];
  3265. let listIdx = uroOWL.IsCamOnWatchList(camObj.id);
  3266. if(listIdx != -1)
  3267. {
  3268. camPos.lon = camObj.geometry.coordinates[0];
  3269. camPos.lat = camObj.geometry.coordinates[1];
  3270. camPos = uroUtils.ConvertWGS84ToMercator(camPos);
  3271. camPos.lon = uroUtils.Truncate(camPos.lon);
  3272. camPos.lat = uroUtils.Truncate(camPos.lat);
  3273. camChanged = (uroOWL.AddCurrentCamWatchData(listIdx, camPos.lat, camPos.lon, camObj.type, camObj.azymuth, camObj.speed, W.app.getAppRegionCode()) || camChanged);
  3274. }
  3275. }
  3276. }
  3277. else
  3278. {
  3279. uroDBG.AddLog('camera data request failed (status != 200)');
  3280. }
  3281. }
  3282. catch(err)
  3283. {
  3284. uroDBG.AddLog('camera data request failed (exception '+err+' caught)');
  3285. }
  3286. return camChanged;
  3287. },
  3288. GetCurrentCamWatchListObjects: function()
  3289. {
  3290. let camChanged = false;
  3291. let camsChanged = [];
  3292. let camsDeleted = [];
  3293. let camidx;
  3294. let camObj;
  3295. for(camidx=0;camidx<uroOWL.CamWatchObjects.length;camidx++)
  3296. {
  3297. camObj = uroOWL.CamWatchObjects[camidx];
  3298. if((camObj.loaded === false) && ((camObj.server == W.app.getAppRegionCode()) || (camObj.server == '??')))
  3299. {
  3300. if(typeof W.model.cameras.objects[camObj.fid] == 'object')
  3301. {
  3302. if(W.model.cameras.objects[camObj.fid].state != "Delete")
  3303. {
  3304. let wazeObj = W.model.cameras.objects[camObj.fid];
  3305. camChanged = (uroOWL.AddCurrentCamWatchData(camidx, wazeObj.geometry.y, wazeObj.geometry.x, wazeObj.attributes.type, wazeObj.attributes.azymuth, wazeObj.attributes.speed, W.app.getAppRegionCode()) || camChanged);
  3306. }
  3307. else
  3308. {
  3309. camChanged = (uroOWL.RetrieveCameras(camObj.watch.lat, camObj.watch.lon) || camChanged);
  3310. }
  3311. }
  3312. else
  3313. {
  3314. camChanged = (uroOWL.RetrieveCameras(camObj.watch.lat, camObj.watch.lon) || camChanged);
  3315. }
  3316. }
  3317. }
  3318.  
  3319. if(camChanged)
  3320. {
  3321. for(camidx=0;camidx<uroOWL.CamWatchObjects.length;camidx++)
  3322. {
  3323. if(uroOWL.CamDataChanged(camidx))
  3324. {
  3325. camsChanged.push(uroOWL.CamWatchObjects[camidx]);
  3326. }
  3327. }
  3328. }
  3329.  
  3330. for(camidx=0;camidx<uroOWL.CamWatchObjects.length;camidx++)
  3331. {
  3332. camObj = uroOWL.CamWatchObjects[camidx];
  3333. if((camObj.loaded === false) && (camObj.server == W.app.getAppRegionCode()))
  3334. {
  3335. camsDeleted.push(camObj);
  3336. }
  3337. }
  3338. if((camsChanged.length > 0) || (camsDeleted.length > 0))
  3339. {
  3340. let alertStr = '';
  3341. for(camidx=0;camidx<camsChanged.length;camidx++)
  3342. {
  3343. alertStr += 'Camera ID '+camsChanged[camidx].fid+' in group "'+uroOWL.FindCWLGroupByIdx(camsChanged[camidx].groupID)+'" has been changed<br>';
  3344. }
  3345. alertStr += '<br>';
  3346. for(camidx=0;camidx<camsDeleted.length;camidx++)
  3347. {
  3348. alertStr += 'Camera ID '+camsDeleted[camidx].fid+' in group "'+uroOWL.FindCWLGroupByIdx(camsDeleted[camidx].groupID)+'" has been deleted<br>';
  3349. }
  3350. uroAlertBox.Show("fa-info-circle", "URO+ Camera Watchlist Alert", alertStr, false, "OK", null, null, null);
  3351. }
  3352. },
  3353. ClearDeletedCameras: function()
  3354. {
  3355. for(let camidx=uroOWL.CamWatchObjects.length-1;camidx>=0;camidx--)
  3356. {
  3357. if(uroOWL.CamWatchObjects[camidx].loaded === false)
  3358. {
  3359. uroShownFID = uroOWL.CamWatchObjects[camidx].fid;
  3360. uroOWL.RemoveCamFromWatchList();
  3361. }
  3362. }
  3363. },
  3364. AcceptCameraChanges: function()
  3365. {
  3366. for(let camidx=0; camidx < uroOWL.CamWatchObjects.length; camidx++)
  3367. {
  3368. if(uroOWL.CamDataChanged(camidx))
  3369. {
  3370. uroOWL.CamWatchObjects[camidx].watch.type = uroOWL.CamWatchObjects[camidx].current.type;
  3371. uroOWL.CamWatchObjects[camidx].watch.azymuth = uroOWL.CamWatchObjects[camidx].current.azymuth;
  3372. uroOWL.CamWatchObjects[camidx].watch.speed = uroOWL.CamWatchObjects[camidx].current.speed;
  3373. uroOWL.CamWatchObjects[camidx].watch.lat = uroOWL.CamWatchObjects[camidx].current.lat;
  3374. uroOWL.CamWatchObjects[camidx].watch.lon = uroOWL.CamWatchObjects[camidx].current.lon;
  3375. }
  3376. }
  3377. uroTabs.PopulateOWL();
  3378. },
  3379. ClearUnknownServerCameras: function()
  3380. {
  3381. let confirmMsg = '<p>Cameras with an unknown server <i>cannot</i> be automatically verified by URO+</p>';
  3382. 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>';
  3383. confirmMsg += 'If the cameras then continue to show up as an unknown server, it is safe to delete them...<br><br>';
  3384. confirmMsg += 'Do you still wish to proceed with deleting all unknown server cameras?';
  3385.  
  3386. uroAlertBox.Show("fa-warning", "URO+ Warning", confirmMsg, true, "Delete unknown cameras", "Keep unknown cameras", uroOWL.ClearUnknownServerCamerasAction, null);
  3387. },
  3388. ClearUnknownServerCamerasAction: function()
  3389. {
  3390. for(let camidx=uroOWL.CamWatchObjects.length-1;camidx>=0;camidx--)
  3391. {
  3392. if(uroOWL.CamWatchObjects[camidx].server == '??')
  3393. {
  3394. uroShownFID = uroOWL.CamWatchObjects[camidx].fid;
  3395. uroOWL.RemoveCamFromWatchList();
  3396. }
  3397. }
  3398. },
  3399. RescanCamWatchList: function()
  3400. {
  3401. for(let camidx=0;camidx<uroOWL.CamWatchObjects.length;camidx++)
  3402. {
  3403. uroOWL.CamWatchObjects[camidx].loaded = false;
  3404. }
  3405. uroOWL.GetCurrentCamWatchListObjects();
  3406. uroTabs.PopulateOWL();
  3407. },
  3408. GotoCam: function()
  3409. {
  3410. let camidx = this.id.substr(13);
  3411. let camPos = new OpenLayers.LonLat();
  3412. camPos.lon = uroOWL.CamWatchObjects[camidx].watch.lon;
  3413. camPos.lat = uroOWL.CamWatchObjects[camidx].watch.lat;
  3414. W.map.setCenter(camPos,16);
  3415. W.map.camerasLayer.setVisibility(true);
  3416. return false;
  3417. },
  3418. HighlightCWLEntry: function()
  3419. {
  3420. this.style.backgroundColor = '#FFFFAA';
  3421. return false;
  3422. },
  3423. UnhighlightCWLEntry: function()
  3424. {
  3425. let camidx = this.id.substr(8);
  3426. let changed = uroOWL.CamDataChanged(camidx);
  3427. let deleted = (uroOWL.CamWatchObjects[camidx].loaded === false);
  3428.  
  3429. if(uroOWL.CamWatchObjects[camidx].server != W.app.getAppRegionCode())
  3430. {
  3431. if(uroOWL.CamWatchObjects[camidx].server == '??') this.style.backgroundColor = '#A0A0A0';
  3432. else this.style.backgroundColor = '#AAFFAA';
  3433. }
  3434. else if(changed) this.style.backgroundColor = '#AAAAFF';
  3435. else if(deleted) this.style.backgroundColor = '#FFAAAA';
  3436. else this.style.backgroundColor = '#FFFFFF';
  3437. return false;
  3438. },
  3439. CWLIconHighlight: function()
  3440. {
  3441. this.style.color="#0000ff";
  3442. return false;
  3443. },
  3444. CWLIconLowlight: function()
  3445. {
  3446. this.style.color="#ccccff";
  3447. return false;
  3448. },
  3449. PopulateCWLGroupSelect: function()
  3450. {
  3451. let selector = document.getElementById('_uroCWLGroupSelect');
  3452. while(selector.options.length > 0)
  3453. {
  3454. selector.options.remove(0);
  3455. }
  3456. for(let loop=0;loop<uroOWL.CWLGroups.length;loop++)
  3457. {
  3458. let groupObj = uroOWL.CWLGroups[loop];
  3459. if(groupObj.groupID != -1)
  3460. {
  3461. selector.options.add(new Option(groupObj.groupName,groupObj.groupID));
  3462. }
  3463. }
  3464. },
  3465. GetNextCWLGroupID: function()
  3466. {
  3467. let nextID = 1;
  3468. for(let loop=0;loop<uroOWL.CWLGroups.length;loop++)
  3469. {
  3470. if(uroOWL.CWLGroups[loop].groupID >= nextID)
  3471. {
  3472. nextID = uroOWL.CWLGroups[loop].groupID + 1;
  3473. }
  3474. }
  3475. return nextID;
  3476. },
  3477. FindCWLGroupByName: function(groupName)
  3478. {
  3479. let groupID = -1;
  3480. for(let loop=0;loop<uroOWL.CWLGroups.length;loop++)
  3481. {
  3482. if((uroOWL.CWLGroups[loop].groupName == groupName) && (uroOWL.CWLGroups[loop].groupID != -1))
  3483. {
  3484. groupID = uroOWL.CWLGroups[loop].groupID;
  3485. break;
  3486. }
  3487. }
  3488. return groupID;
  3489. },
  3490. AddCWLGroup: function()
  3491. {
  3492. let groupID = uroOWL.GetNextCWLGroupID();
  3493. let groupName = uroUtils.GetElmValue('_uroCWLGroupEntry');
  3494. if(uroOWL.FindCWLGroupByName(groupName) == -1)
  3495. {
  3496. uroOWL.CWLGroups.push(new uroOWL.GroupObj(groupID,groupName,false));
  3497. uroOWL.PopulateCWLGroupSelect();
  3498. }
  3499. },
  3500. RemoveCWLGroup: function()
  3501. {
  3502. let loop;
  3503. let selector = document.getElementById('_uroCWLGroupSelect');
  3504. let groupID = parseInt(selector.selectedOptions[0].value);
  3505. if(groupID === 0) return false; // prevent deletion of the default group
  3506.  
  3507. for(loop=0;loop<uroOWL.CamWatchObjects.length;loop++)
  3508. {
  3509. let cwObj = uroOWL.CamWatchObjects[loop];
  3510. if(cwObj.groupID == groupID)
  3511. {
  3512. cwObj.groupID = 0;
  3513. }
  3514. }
  3515. for(loop=0;loop<uroOWL.CWLGroups.length;loop++)
  3516. {
  3517. let groupObj = uroOWL.CWLGroups[loop];
  3518. if(groupObj.groupID == groupID)
  3519. {
  3520. groupObj.groupID = -1;
  3521. }
  3522. }
  3523. uroTabs.PopulateOWL();
  3524. },
  3525. AssignCameraToGroup: function()
  3526. {
  3527. let camidx = this.id.substr(13);
  3528. let selector = document.getElementById('_uroCWLGroupSelect');
  3529. uroOWL.CamWatchObjects[camidx].groupID = parseInt(selector.selectedOptions[0].value);
  3530. uroTabs.PopulateOWL();
  3531. return false;
  3532. },
  3533. CWLGroupCollapseExpand: function()
  3534. {
  3535. let groupidx = this.id.substr(18);
  3536. if(uroOWL.CWLGroups[groupidx].groupCollapsed === true) uroOWL.CWLGroups[groupidx].groupCollapsed = false;
  3537. else uroOWL.CWLGroups[groupidx].groupCollapsed = true;
  3538. uroTabs.PopulateOWL();
  3539. return false;
  3540. }
  3541. };
  3542. const uroIgnore = // ignore list
  3543. {
  3544. IsOnList: function(fid)
  3545. {
  3546. if(sessionStorage.UROverview_FID_IgnoreList.indexOf('fid:'+fid) == -1) return false;
  3547. else return true;
  3548. },
  3549. EnableControls: function()
  3550. {
  3551. let btnState = "visible";
  3552. if(sessionStorage.UROverview_FID_IgnoreList === '')
  3553. {
  3554. btnState = "hidden";
  3555. }
  3556. try
  3557. {
  3558. document.getElementById('_btnUndoLastHide').style.visibility = btnState;
  3559. document.getElementById('_btnClearSessionHides').style.visibility = btnState;
  3560. uroFilterItems();
  3561. }
  3562. catch(err)
  3563. {
  3564. uroDBG.AddLog('exception thrown in uroIgnore.EnableControls()');
  3565. }
  3566. },
  3567. Add: function()
  3568. {
  3569. if(!uroIgnore.IsOnList(uroShownFID))
  3570. {
  3571. sessionStorage.UROverview_FID_IgnoreList += 'fid:'+uroShownFID;
  3572. uroDBG.AddLog('added fid '+uroShownFID+' to ignore list');
  3573. uroDBG.AddLog(sessionStorage.UROverview_FID_IgnoreList);
  3574. uroDiv.style.visibility = 'hidden';
  3575. uroIgnore.EnableControls();
  3576.  
  3577. W.map.events.register("mousemove", null, uroFilterItemsOnMove);
  3578. }
  3579. return false;
  3580. },
  3581. RemoveLastAdded: function()
  3582. {
  3583. let ignorelist = sessionStorage.UROverview_FID_IgnoreList;
  3584. let fidpos = ignorelist.lastIndexOf('fid:');
  3585. if(fidpos != -1)
  3586. {
  3587. ignorelist = ignorelist.slice(0,fidpos);
  3588. sessionStorage.UROverview_FID_IgnoreList = ignorelist;
  3589. uroDBG.AddLog('removed last fid from ignore list');
  3590. uroDBG.AddLog(sessionStorage.UROverview_FID_IgnoreList);
  3591. uroIgnore.EnableControls();
  3592. }
  3593. },
  3594. RemoveAll: function()
  3595. {
  3596. sessionStorage.UROverview_FID_IgnoreList = '';
  3597. uroIgnore.EnableControls();
  3598. }
  3599. };
  3600. const uroPopup = // map object popup handling
  3601. {
  3602. hasIgnoreLink : null,
  3603. hasDeleteLink : null,
  3604. hasAddWatchLink : null,
  3605. hasRemoveWatchLink : null,
  3606. hasUpdateWatchLink : null,
  3607. hasRecentreSessionLink : null,
  3608. hasOpenInNewTabLink : null,
  3609.  
  3610. isVenue : null,
  3611. isMapComment : null,
  3612. isUR : null,
  3613. isProblem : null,
  3614. isTurnProb : null,
  3615. isPlaceUpdate : null,
  3616. timer : -2,
  3617. autoHideTimer : 0,
  3618. mouseIn : false,
  3619. shown : false,
  3620. shownType : null,
  3621. newType : null,
  3622. hovered : null,
  3623. unstackedX : null,
  3624. unstackedY : null,
  3625. renderIntent : null,
  3626. pX : null,
  3627. pY : null,
  3628. suppressed : false,
  3629.  
  3630. GetFormattedLocks: function(attrs)
  3631. {
  3632. let autoLock = attrs.rank;
  3633. let userLock = attrs.lockRank;
  3634. let retval = '<b>' + I18n.lookup("edit.segment.fields.lock") + ': </b>';
  3635. if(userLock !== null)
  3636. {
  3637. retval += 'M' + (userLock+1) + ' / ';
  3638. }
  3639. retval += 'A' + (autoLock+1);
  3640. return retval;
  3641. },
  3642. UR: function()
  3643. {
  3644. let result = '';
  3645.  
  3646. uroPopup.unstackedX = uroUtils.ParsePxString(uroMarkers.elm.style.left);
  3647. uroPopup.unstackedY = uroUtils.ParsePxString(uroMarkers.elm.style.top);
  3648. // check for stacking...
  3649. if(uroShownFID != uroMarkers.id)
  3650. {
  3651. uroCheckStacking(uroLayers.ID.UR,uroMarkers.id, uroPopup.unstackedX, uroPopup.unstackedY);
  3652. }
  3653.  
  3654. if(uroUtils.GetCBChecked('_cbInhibitURPopup') === false)
  3655. {
  3656. if(uroMousedOverMapComment !== null)
  3657. {
  3658. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for UR highlight');
  3659. uroMousedOverOtherObjectWithinMapComment = true;
  3660. }
  3661.  
  3662. uroPopup.isUR = true;
  3663. uroPopup.newPopupType = uroMarkers.type;
  3664. let ureq = W.model.mapUpdateRequests.objects[uroMarkers.id];
  3665.  
  3666. uroFID = uroMarkers.id;
  3667.  
  3668. uroDBG.AddLog('building popup for UR '+uroMarkers.id);
  3669. result = '<b>Update Request ('+uroMarkers.id+'): ' + I18n.lookup("update_requests.types." + ureq.attributes.type) + '</b><br>';
  3670.  
  3671. result += uroUtils.Clickify(ureq.attributes.description, '<br>');
  3672. let uroDaysOld = uroUtils.GetURAge(ureq,0,false);
  3673. let uroSubmittedTS = uroUtils.GetURAge(ureq,0,true);
  3674. if(uroSubmittedTS != -1)
  3675. {
  3676. uroSubmittedTS = uroUtils.GetDateTimeString(uroSubmittedTS);
  3677. }
  3678. if(uroDaysOld != -1)
  3679. {
  3680. result += '<i>Submitted ' + uroUtils.ParseDaysAgo(uroDaysOld) + ' ';
  3681. if(uroSubmittedTS != -1) result += '(' + uroSubmittedTS + ') ';
  3682. if(ureq.attributes.guestUserName != null)
  3683. {
  3684. result += 'via Livemap';
  3685. if(ureq.attributes.guestUserName !== '')
  3686. {
  3687. result += ' by '+ureq.attributes.guestUserName.replace(/<\/?[^>]+(>|$)/g, "");
  3688. }
  3689. }
  3690. result += '</i>';
  3691. }
  3692. if(ureq.attributes.resolvedOn !== null)
  3693. {
  3694. let daysResolved = uroUtils.GetURAge(ureq,1,false);
  3695. let uroResolvedTS = uroUtils.GetURAge(ureq,1,true);
  3696. if(uroResolvedTS != -1)
  3697. {
  3698. uroResolvedTS = uroUtils.GetDateTimeString(uroResolvedTS);
  3699. }
  3700.  
  3701. if(daysResolved != -1)
  3702. {
  3703. result += '<br><i>Closed ' + uroUtils.ParseDaysAgo(daysResolved) + ' ';
  3704. if(uroResolvedTS != -1) result += '(' + uroResolvedTS + ')</i>';
  3705.  
  3706. result += '<br><i>Marked as ';
  3707. if(ureq.attributes.resolution === 0) result += 'solved';
  3708. else if(ureq.attributes.resolution == 1) result += 'not identified';
  3709. else result += 'unknown';
  3710. if(ureq.attributes.resolvedBy !== null)
  3711. {
  3712. result += ' by '+uroUtils.GetUserNameAndRank(ureq.attributes.resolvedBy);
  3713. }
  3714. result += '</i>';
  3715. }
  3716. }
  3717. if(W.model.updateRequestSessions.objects[uroMarkers.id] != null)
  3718. {
  3719. let hasMyComments = uroURHasMyComments(uroMarkers.id);
  3720. let nComments = W.model.updateRequestSessions.objects[uroMarkers.id].attributes.comments.length;
  3721. result += '<br>' + nComments + ' comment';
  3722. if(nComments != 1) result += 's';
  3723. if((hasMyComments === false) && (nComments > 0)) result += ' (none by me)';
  3724. if(nComments > 0)
  3725. {
  3726. let commentDaysOld = uroUtils.GetCommentAge(W.model.updateRequestSessions.objects[uroMarkers.id].attributes.comments[nComments-1]);
  3727. if(commentDaysOld != -1)
  3728. {
  3729. result += ', last update '+uroUtils.ParseDaysAgo(commentDaysOld);
  3730. }
  3731. }
  3732. }
  3733. if(uroURDupes.length > 0)
  3734. {
  3735. let thisID = parseInt(uroMarkers.id);
  3736. for(let i = 0; i < uroURDupes.length; ++i)
  3737. {
  3738. if(uroURDupes[i][0] === thisID)
  3739. {
  3740. result += '<br><br>Duplicate of: ';
  3741. let dupes = 0;
  3742. for(let j = 0; j < uroURDupes[i][1].length; ++j)
  3743. {
  3744. if(uroURDupes[i][1][j] !== thisID)
  3745. {
  3746. if(dupes > 0)
  3747. {
  3748. result += ', ';
  3749. }
  3750. result += uroURDupes[i][1][j];
  3751. ++dupes;
  3752. }
  3753. }
  3754. }
  3755. }
  3756. }
  3757. uroPopup.result += result;
  3758. uroPopup.UMPExtras(ureq);
  3759. uroPopup.Show();
  3760. }
  3761. },
  3762. MP: function()
  3763. {
  3764. let result = '';
  3765.  
  3766. uroPopup.unstackedX = uroUtils.ParsePxString(uroMarkers.elm.style.left);
  3767. uroPopup.unstackedY = uroUtils.ParsePxString(uroMarkers.elm.style.top);
  3768. // check for stacking...
  3769. if(uroShownFID != uroMarkers.id)
  3770. {
  3771. ////uroCheckStacking(uroLayers.ID.MP,uroMarkers.id, uroPopup.unstackedX, uroPopup.unstackedY);
  3772. }
  3773.  
  3774. if(uroUtils.GetCBChecked('_cbInhibitMPPopup') === false)
  3775. {
  3776. if(uroMousedOverMapComment !== null)
  3777. {
  3778. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for MP highlight');
  3779. uroMousedOverOtherObjectWithinMapComment = true;
  3780. }
  3781.  
  3782. uroPopup.isProblem = true;
  3783. uroPopup.newPopupType = uroMarkers.type;
  3784. let ureq = W.model.mapProblems.objects[uroMarkers.id];
  3785.  
  3786. uroFID = uroMarkers.id;
  3787. uroDBG.AddLog('building popup for problem '+uroMarkers.id);
  3788. if(uroPopup.isTurnProb) result = '<b>Turn Problem ('+uroMarkers.id+'): ' + I18n.lookup("problems.types.turn.title");
  3789. else
  3790. {
  3791. result = '<b>Map Problem ('+uroMarkers.id+'): ';
  3792.  
  3793. let problemType = ureq.attributes.subType;
  3794. if(problemType == 300)
  3795. {
  3796. result += I18n.lookup("problems.panel.closure.title");
  3797. }
  3798. else
  3799. {
  3800. if(I18n.lookup("problems.types." + problemType) === undefined) result += 'Unknown problem type ('+problemType+')';
  3801. else result += I18n.lookup("problems.types." + problemType + ".title");
  3802. }
  3803. }
  3804. result += '</b><br>';
  3805.  
  3806. if(ureq.attributes.description != null)
  3807. {
  3808. result += 'Description: ' + ureq.attributes.description + '<br>';
  3809. }
  3810. if(ureq.attributes.extraInfo != null)
  3811. {
  3812. result += 'ExtraInfo: ' + uroUtils.Clickify(ureq.attributes.extraInfo, '<br>');
  3813. }
  3814. if(ureq.attributes.provider != null)
  3815. {
  3816. result += 'Provider: ' + ureq.attributes.provider + '<br>';
  3817. }
  3818. if(ureq.attributes.startTime != null)
  3819. {
  3820. result += 'From: ' + uroUtils.GetDateTimeString(ureq.attributes.startTime) + '<br>';
  3821. }
  3822. if(ureq.attributes.endTime != null)
  3823. {
  3824. result += 'To: ' + uroUtils.GetDateTimeString(ureq.attributes.endTime) + '<br>';
  3825. }
  3826. if(ureq.attributes.resolvedOn != null)
  3827. {
  3828. let daysResolved = uroUtils.GetURAge(ureq,1,false);
  3829. if(daysResolved != -1)
  3830. {
  3831. result += '<br><i>Closed ' + uroUtils.ParseDaysAgo(daysResolved) + ' ';
  3832. if(ureq.attributes.resolvedBy != null)
  3833. {
  3834. result += ' by '+uroUtils.GetUserNameAndRank(ureq.attributes.resolvedBy);
  3835. }
  3836.  
  3837. if((ureq.attributes.open === true) && (ureq.attributes.resolvedOn != null))
  3838. {
  3839. result += '<br>Reopened by Waze';
  3840. }
  3841. result += '</i>';
  3842. }
  3843. }
  3844. uroPopup.result += result;
  3845. uroPopup.UMPExtras(ureq);
  3846. }
  3847. },
  3848. PUR: function()
  3849. {
  3850. let result = '';
  3851.  
  3852. uroPopup.unstackedX = uroUtils.ParsePxString(uroMarkers.elm.style.left);
  3853. uroPopup.unstackedY = uroUtils.ParsePxString(uroMarkers.elm.style.top);
  3854.  
  3855. if(uroShownFID != uroMarkers.id)
  3856. {
  3857. // check for stacking...
  3858. uroCheckStacking(uroMarkers.type, uroMarkers.id, uroPopup.unstackedX, uroPopup.unstackedY);
  3859. }
  3860.  
  3861. if(uroUtils.GetCBChecked('_cbInhibitPUPopup') === false)
  3862. {
  3863. let ureq = W.model.venues.objects[uroMarkers.id];
  3864.  
  3865. uroPopup.newPopupType = uroMarkers.type;
  3866. if(uroMousedOverMapComment !== null)
  3867. {
  3868. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for PUR highlight');
  3869. uroMousedOverOtherObjectWithinMapComment = true;
  3870. }
  3871.  
  3872. uroPopup.isPlaceUpdate = true;
  3873.  
  3874. uroFID = uroMarkers.id;
  3875.  
  3876. if(uroMarkers.type == uroLayers.ID.PUR)
  3877. {
  3878. uroDBG.AddLog('building popup for placeUpdate '+uroMarkers.id);
  3879. }
  3880. else if(uroMarkers.type == uroLayers.ID.RPUR)
  3881. {
  3882. uroDBG.AddLog('building popup for residentialPlaceUpdate '+uroMarkers.id);
  3883. }
  3884. else
  3885. {
  3886. uroDBG.AddLog('building popup for parkingPlaceUpdate '+uroMarkers.id);
  3887. }
  3888.  
  3889. result = '<b>';
  3890. if(ureq.attributes.name === '') result += 'Unnamed landmark';
  3891. else result += ureq.attributes.name;
  3892. result += '</b><br>';
  3893.  
  3894. result += '<ul>';
  3895. for(let idx = 0; idx < ureq.attributes.categories.length; idx++)
  3896. {
  3897. result += '<li>' + I18n.lookup("venues.categories." + ureq.attributes.categories[idx]);
  3898. }
  3899. result += '</ul>';
  3900.  
  3901. if(ureq.attributes.residential === true)
  3902. {
  3903. result += '<i>Residential</i>';
  3904. }
  3905.  
  3906. let daysOld = uroUtils.GetPURAge(ureq);
  3907. if(daysOld != -1)
  3908. {
  3909. result += '<br><i>Submitted '+uroUtils.ParseDaysAgo(daysOld)+'</i>';
  3910. }
  3911.  
  3912. uroPopup.result += result;
  3913. uroPopup.UMPExtras(ureq);
  3914. }
  3915. },
  3916. Venue: function()
  3917. {
  3918. if(uroUtils.GetCBChecked('_cbInhibitLandmarkPopup') === false)
  3919. {
  3920. let result = '';
  3921. let navpointPos=new OpenLayers.LonLat();
  3922. {
  3923. if(uroPopup.renderIntent === 'highlight')
  3924. {
  3925. if(W.map.getExtent().intersectsBounds(uroMarkers.obj.attributes.geometry.getBounds()))
  3926. {
  3927. if(uroMousedOverMapComment !== null)
  3928. {
  3929. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for place highlight');
  3930. uroMousedOverOtherObjectWithinMapComment = true;
  3931. }
  3932.  
  3933. if(uroPopup.newPopupType === null)
  3934. {
  3935. uroFID = uroMarkers.obj.attributes.id;
  3936. uroDBG.AddLog('building popup for place '+uroFID);
  3937.  
  3938. navpointPos = uroGetVenueNavPoint(uroFID);
  3939. result += '<b>';
  3940. if(uroMarkers.obj.attributes.name === '')
  3941. {
  3942. if(uroMarkers.obj.attributes.residential === true) result += '<i>Residential</i>';
  3943. else result += '<i>Unnamed</i>';
  3944. }
  3945. else result += uroUtils.Clickify(uroMarkers.obj.attributes.name, '');
  3946. if(uroMarkers.obj.attributes.externalProviderIDs.length > 0)
  3947. {
  3948. result += ' <i>(linked)</i>';
  3949. }
  3950. if(uroMarkers.obj.attributes.adLocked)
  3951. {
  3952. result += ' <i>(AdLocked)</i>';
  3953. }
  3954. result += '</b><br>';
  3955. if(uroMarkers.obj.attributes.brand !== null)
  3956. {
  3957. result += '<i>Brand: ' + uroMarkers.obj.attributes.brand + '</i><br>';
  3958. }
  3959. let vDesc = uroMarkers.obj.attributes.description;
  3960. if(vDesc !== '')
  3961. {
  3962. result += '"<i>' + uroUtils.Clickify(vDesc, '') + '</i>"<br>';
  3963. }
  3964.  
  3965. let userLock = uroMarkers.obj.attributes.lockRank;
  3966. result += '<b>Lock: </b>' + (userLock+1);
  3967.  
  3968. result += '<hr>';
  3969. result += uroGetAddress(uroMarkers.obj.attributes.streetID, uroMarkers.obj.attributes.houseNumber, false, false, false);
  3970. result += '<ul>';
  3971. for(let idx = 0; idx < uroMarkers.obj.attributes.categories.length; idx++)
  3972. {
  3973. result += '<li>' + I18n.lookup("venues.categories." + uroMarkers.obj.attributes.categories[idx]);
  3974. }
  3975. result += '</ul>';
  3976.  
  3977. let npLink = document.location.href;
  3978. let npLayers = '';
  3979. npLink = npLink.substr(0,npLink.indexOf('?zoomLevel'));
  3980. npLink += '?zoomLevel=17&lat='+navpointPos.lat+'&lon='+navpointPos.lon+npLayers;
  3981.  
  3982. let targetTab = "_uroTab_" + Math.round(Math.random()*1000000);
  3983. result += '<hr>Jump to nav point: <a href="'+npLink+'" id="_openInNewTab" target="'+targetTab+'">in new tab</a> - ';
  3984. uroPopup.hasOpenInNewTabLink = true;
  3985. result += '<a href="#" id="_recentreSession">in this tab</a>';
  3986. uroPopup.hasRecentreSessionLink = true;
  3987.  
  3988. uroPopup.newPopupType = 'venue';
  3989. uroPopup.isVenue = true;
  3990.  
  3991. uroPopup.result += result;
  3992. uroPopup.Show();
  3993. }
  3994. else
  3995. {
  3996. let otherID = uroMarkers.obj.attributes.id;
  3997. uroDBG.AddLog('venue '+otherID+' is also highlighted');
  3998. }
  3999. }
  4000. else
  4001. {
  4002. uroDBG.AddLog('landmark '+uroFID+' has renderIntent==highlight but is offscreen... blocking popup');
  4003. }
  4004. }
  4005. }
  4006. }
  4007. },
  4008. Camera: function()
  4009. {
  4010. if(uroUtils.GetCBChecked('_cbInhibitCamPopup') === false)
  4011. {
  4012. let result = '';
  4013. let ureq = uroMarkers.obj;
  4014.  
  4015. if(uroPopup.renderIntent === "highlight")
  4016. {
  4017. if(uroMousedOverMapComment !== null)
  4018. {
  4019. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for camera highlight');
  4020. uroMousedOverOtherObjectWithinMapComment = true;
  4021. }
  4022. uroPopup.newPopupType = 'camera';
  4023. uroFID = uroMarkers.id;
  4024. uroDBG.AddLog('building popup for camera '+uroFID);
  4025. if(I18n.lookup("edit.camera.fields.type") === undefined)
  4026. {
  4027. result += '<b>Camera: ' + ureq.TYPES[ureq.attributes.type] + '</b>';
  4028. }
  4029. else
  4030. {
  4031. result += '<b>Camera: ' + I18n.lookup("edit.camera.fields.type." + ureq.attributes.type) + '</b>';
  4032. }
  4033. result += '<br>';
  4034. result += '<b>ID:</b> ' + uroFID + ' - ';
  4035. result += uroPopup.GetFormattedLocks(uroMarkers.obj.attributes);
  4036. result += '<br>';
  4037.  
  4038. result += '<b>Created by</b> ';
  4039. let userID;
  4040.  
  4041. if(W.model.users.getByIds([ureq.attributes.createdBy])[0] != null)
  4042. {
  4043. userID = ureq.attributes.createdBy;
  4044. result += uroUtils.GetUserNameAndRank(userID);
  4045. }
  4046. else result += 'unknown';
  4047. result += ', ';
  4048. let camAge = uroUtils.GetCameraAge(ureq,1);
  4049. if(camAge != -1)
  4050. {
  4051. result += uroUtils.ParseDaysAgo(camAge);
  4052. }
  4053. else result += 'unknown days ago';
  4054. result += '<br><b>Updated by</b> ';
  4055. if(W.model.users.getByIds([ureq.attributes.updatedBy])[0] != null)
  4056. {
  4057. userID = ureq.attributes.updatedBy;
  4058. result += uroUtils.GetUserNameAndRank(userID);
  4059. }
  4060. else result += 'unknown';
  4061. result += ', ';
  4062. camAge = uroUtils.GetCameraAge(ureq,0);
  4063. if(camAge != -1)
  4064. {
  4065. result += uroUtils.ParseDaysAgo(camAge);
  4066. }
  4067. else result += 'unknown days ago';
  4068.  
  4069. if(ureq.attributes.type !== 4)
  4070. {
  4071. result += '<br><b>Speed data:</b> ';
  4072. result += uroUtils.GetLocalisedSpeedString(ureq.attributes.speed);
  4073. if(uroIsCamSpeedValid(ureq) === false)
  4074. {
  4075. result += ' (differs to nearest segment)';
  4076. }
  4077. }
  4078. result += '<hr><ul>';
  4079. if(uroOWL.IsCamOnWatchList(uroFID) != -1)
  4080. {
  4081. result += '<li><a href="#" id="_updatewatchlist">Update watchlist entry</a>';
  4082. result += '<li><a href="#" id="_removefromwatchlist">Remove from watchlist</a>';
  4083. uroPopup.hasUpdateWatchLink = true;
  4084. uroPopup.hasRemoveWatchLink = true;
  4085. }
  4086. else
  4087. {
  4088. result += '<li><a href="#" id="_addtowatchlist">Add to watchlist</a>';
  4089. uroPopup.hasAddWatchLink = true;
  4090. }
  4091. if(ureq.attributes.permissions !== 0)
  4092. {
  4093. result += '<li><a href="#" id="_deleteobject">Delete Camera</a>';
  4094. uroPopup.hasDeleteLink = true;
  4095. }
  4096. result += '</ul>';
  4097. uroPopup.result += result;
  4098. uroPopup.Show();
  4099. }
  4100. }
  4101. },
  4102. Comment: function()
  4103. {
  4104. if(uroUtils.GetCBChecked('_cbInhibitMapCommentPopup') === false)
  4105. {
  4106. if(uroMCLayer.name !== 'mapComments')
  4107. {
  4108. uroInit.WazeBits();
  4109. }
  4110. if(uroMCLayer !== null)
  4111. {
  4112. let result = '';
  4113.  
  4114. if(uroPopup.renderIntent == 'highlight')
  4115. {
  4116. let moAttrs = uroMarkers.obj.attributes;
  4117. if(W.map.getExtent().intersectsBounds(moAttrs.geometry.getBounds()))
  4118. {
  4119. if(uroPopup.newPopupType === null)
  4120. {
  4121. if((uroMousedOverMapComment === moAttrs.id) && (uroMousedOverOtherObjectWithinMapComment === true))
  4122. {
  4123. uroDBG.AddLog('inhibit popup for map comment '+uroMousedOverMapComment);
  4124. }
  4125. else
  4126. {
  4127. uroMousedOverOtherObjectWithinMapComment = false;
  4128. if(moAttrs.geometry.id.indexOf('Polygon') !== -1)
  4129. {
  4130. // only capture ID for area comments...
  4131. uroMousedOverMapComment = moAttrs.id;
  4132. }
  4133. uroFID = moAttrs.id;
  4134. uroDBG.AddLog('building popup for map comment '+uroFID);
  4135.  
  4136. result += '<b>';
  4137. if(moAttrs.subject === '')
  4138. {
  4139. result += '<i>No subject</i>';
  4140. }
  4141. else result += uroUtils.Clickify(moAttrs.subject, '');
  4142. result += '</b><br>';
  4143. result += uroUtils.Clickify(moAttrs.body, '<br>');
  4144.  
  4145. let mcDaysOld = uroUtils.GetMCAge(moAttrs, 0, false);
  4146. let mcSubmittedTS = uroUtils.GetMCAge(moAttrs, 0, true);
  4147. if(mcSubmittedTS != -1)
  4148. {
  4149. mcSubmittedTS = uroUtils.GetDateTimeString(mcSubmittedTS);
  4150. }
  4151. if(mcDaysOld != -1)
  4152. {
  4153. result += '<i>Submitted ' + uroUtils.ParseDaysAgo(mcDaysOld) + ' ';
  4154. if(mcSubmittedTS != -1) result += '(' + mcSubmittedTS + ') ';
  4155. if(moAttrs.createdBy != null)
  4156. {
  4157. result += ' by '+uroUtils.GetUserNameAndRank(moAttrs.createdBy);
  4158. }
  4159. result += '</i><br>';
  4160. }
  4161. mcDaysOld = uroUtils.GetMCAge(moAttrs, 1, false);
  4162. mcSubmittedTS = uroUtils.GetMCAge(moAttrs, 1, true);
  4163. if(mcSubmittedTS != -1)
  4164. {
  4165. mcSubmittedTS = uroUtils.GetDateTimeString(mcSubmittedTS);
  4166. }
  4167. if(mcDaysOld != -1)
  4168. {
  4169. result += '<i>Updated ' + uroUtils.ParseDaysAgo(mcDaysOld) + ' ';
  4170. if(mcSubmittedTS != -1) result += '(' + mcSubmittedTS + ') ';
  4171. if(moAttrs.createdBy != null)
  4172. {
  4173. result += ' by '+uroUtils.GetUserNameAndRank(moAttrs.updatedBy);
  4174. }
  4175. result += '</i><br>';
  4176. }
  4177.  
  4178. mcDaysOld = uroUtils.GetMCAge(moAttrs,2,false);
  4179. mcSubmittedTS = uroUtils.GetMCAge(moAttrs,2,true);
  4180. if(mcDaysOld != -1)
  4181. {
  4182. result += '<i>Expires ' + uroUtils.ParseDaysToGo(mcDaysOld) + ' ';
  4183. result += '(' + uroUtils.GetDateTimeString(mcSubmittedTS) +')</i><br>';
  4184. }
  4185.  
  4186. let mcHasMyComments = false;
  4187. let mcNComments = moAttrs.conversation.length;
  4188. if(mcNComments > 0)
  4189. {
  4190. for(let j=0; j<mcNComments; j++)
  4191. {
  4192. if(moAttrs.conversation[j].userID == uroUserID)
  4193. {
  4194. mcHasMyComments = true;
  4195. break;
  4196. }
  4197. }
  4198. }
  4199. result += '<br>' + mcNComments +' comment';
  4200. if(mcNComments != 1) result += 's';
  4201. if((mcHasMyComments === false) && (mcNComments > 0)) result += ' (none by me)';
  4202.  
  4203. // add "ignore for this session" link
  4204. result += '<br><a href="#" id="_addtoignore">Hide for this session</a>';
  4205. uroPopup.hasIgnoreLink = true;
  4206.  
  4207. uroPopup.newPopupType = 'map_comment';
  4208. uroPopup.isMapComment = true;
  4209.  
  4210. uroPopup.result += result;
  4211. uroPopup.Show();
  4212. }
  4213. }
  4214. else
  4215. {
  4216. let mcOtherID = moAttrs.id;
  4217. uroDBG.AddLog('map comment '+mcOtherID+' is also highlighted');
  4218. }
  4219. }
  4220. else
  4221. {
  4222. uroDBG.AddLog('map comment '+uroFID+' has renderIntent==highlight but is offscreen... blocking popup');
  4223. }
  4224. }
  4225. }
  4226. }
  4227. },
  4228. AddClosureRow: function(rcObj)
  4229. {
  4230. let startDate = rcObj.attributes.startDate;
  4231. let endDate = "unknown";
  4232. if(rcObj.attributes.endDate !== null)
  4233. {
  4234. endDate = rcObj.attributes.endDate;
  4235. }
  4236. let provider = "---";
  4237. if(rcObj.attributes.provider !== null)
  4238. {
  4239. provider = rcObj.attributes.provider;
  4240. }
  4241. else if(rcObj.attributes.createdBy !== null)
  4242. {
  4243. provider = uroUtils.GetUserNameAndRank(rcObj.attributes.createdBy);
  4244. }
  4245. let reason = "---";
  4246. if(rcObj.attributes.reason !== null)
  4247. {
  4248. reason = rcObj.attributes.reason;
  4249. }
  4250. let mte = "---";
  4251. if(rcObj.attributes.eventId !== null)
  4252. {
  4253. try
  4254. {
  4255. mte = W.model.majorTrafficEvents.objects[rcObj.attributes.eventId].attributes.names[0].value;
  4256. }
  4257. catch(err)
  4258. {
  4259. }
  4260. }
  4261. let startOffset = uroGetRTCOffset(rcObj.attributes.startDate);
  4262. let duration = uroGetRTCDuration(rcObj);
  4263. if(duration === 0) duration = '<1 day';
  4264. else if(duration === 1) duration = '1 day';
  4265. else duration = duration + ' days';
  4266. let state = uroGetRTCState(rcObj);
  4267. let status = '';
  4268. let bgCol = '';
  4269. if(state === URO_SRTC.EXPIRED)
  4270. {
  4271. status = "Expired";
  4272. bgCol = '#A0A0A0';
  4273. }
  4274. else if(state === URO_SRTC.ACTIVE)
  4275. {
  4276. status = 'Active';
  4277. bgCol = '#FFFFFF';
  4278. }
  4279. else if(state === URO_SRTC.FUTURE)
  4280. {
  4281. if(startOffset == 0)
  4282. {
  4283. status = 'Today';
  4284. }
  4285. else if(startOffset == 1)
  4286. {
  4287. status = 'In 1 day';
  4288. }
  4289. else
  4290. {
  4291. status = 'In ' + startOffset + ' days';
  4292. }
  4293. bgCol = '#C0C0C0';
  4294. }
  4295. let result = '';
  4296. result += '<tr bgcolor="' + bgCol + '">';
  4297. result += '<td nowrap>' + status + '</td>';
  4298. result += '<td nowrap>' + startDate + ' to ' + endDate + ' (' + duration + ')</td>';
  4299. result += '<td nowrap>' + provider + '</td>';
  4300. result += '<td nowrap>' + reason + '</td>';
  4301. result += '<td nowrap>' + mte + '</td>';
  4302. result += '</td></tr>';
  4303. return result;
  4304. },
  4305. AddClosureDetails: function(cTypes, addType, addDesc)
  4306. {
  4307. let retval = '';
  4308. if((cTypes & addType) === addType)
  4309. {
  4310. retval += '<tr><td colspan=4><b>' + addDesc + ':</b></td></tr>';
  4311. for(let closure in uroRTCObjs)
  4312. {
  4313. if(uroRTCObjs.hasOwnProperty(closure))
  4314. {
  4315. let cObj = uroRTCObjs[closure];
  4316. if(cObj.direction === addType)
  4317. {
  4318. retval += uroPopup.AddClosureRow(cObj);
  4319. }
  4320. }
  4321. }
  4322. }
  4323. return retval;
  4324. },
  4325. Segment: function()
  4326. {
  4327. if(uroUtils.GetCBChecked('_cbInhibitSegPopup') === false)
  4328. {
  4329. {
  4330. if(W.map.getExtent().intersectsBounds(uroMarkers.obj.attributes.geometry.getBounds()))
  4331. {
  4332. let result = '';
  4333. let doPopUp = false;
  4334. let restObj;
  4335.  
  4336. if(uroMousedOverMapComment !== null)
  4337. {
  4338. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for segment highlight');
  4339. uroMousedOverOtherObjectWithinMapComment = true;
  4340. }
  4341.  
  4342. let streetID = uroMarkers.obj.attributes.primaryStreetID;
  4343. if(streetID !== null)
  4344. {
  4345. // generic segment data
  4346. if(uroUtils.GetCBChecked('_cbInhibitSegGenericPopup') === false)
  4347. {
  4348. doPopUp = true;
  4349. uroDBG.AddLog('building popup for segment '+streetID);
  4350.  
  4351. let isToll = ((uroMarkers.obj.attributes.fwdToll == true) || (uroMarkers.obj.attributes.revToll == true));
  4352. result += uroGetAddress(streetID, null, true, false, isToll);
  4353.  
  4354. if(uroMarkers.obj.attributes.streetIDs.length > 0)
  4355. {
  4356. // list any alternate names
  4357. result += '<br>Alternate names:<br>';
  4358. for(let i = 0; i < uroMarkers.obj.attributes.streetIDs.length; ++i)
  4359. {
  4360. result += '&nbsp;<i>' + W.model.streets.objects[uroMarkers.obj.attributes.streetIDs[i]].attributes.name + ', ';
  4361. let cityName = "";
  4362. if(W.model.cities.objects[W.model.streets.objects[uroMarkers.obj.attributes.streetIDs[i]].attributes.cityID] != undefined)
  4363. {
  4364. cityName = W.model.cities.objects[W.model.streets.objects[uroMarkers.obj.attributes.streetIDs[i]].attributes.cityID].attributes.name;
  4365. }
  4366. if(cityName != "")
  4367. {
  4368. result += cityName;
  4369. }
  4370. else
  4371. {
  4372. result += ' no city';
  4373. }
  4374. result += '</i><br>';
  4375. }
  4376. result += '<br>';
  4377. }
  4378.  
  4379. result += '<b>ID: </b>'+uroMarkers.obj.attributes.id+' - ';
  4380. result += uroPopup.GetFormattedLocks(uroMarkers.obj.attributes);
  4381. result += ' - ';
  4382.  
  4383. let level = uroMarkers.obj.attributes.level;
  4384. result += '<b>' + I18n.lookup("edit.segment.fields.level") +': </b>';
  4385. if(level == 0)
  4386. {
  4387. result += I18n.lookup("edit.segment.levels")[0];
  4388. }
  4389. else
  4390. {
  4391. result += level;
  4392. }
  4393. result += '<br>';
  4394.  
  4395. let leBy = uroMarkers.obj.attributes.updatedBy;
  4396. let leOn = uroMarkers.obj.attributes.updatedOn;
  4397. if(leOn == null)
  4398. {
  4399. leBy = uroMarkers.obj.attributes.createdBy;
  4400. leOn = uroMarkers.obj.attributes.createdOn;
  4401. }
  4402. result += "<b>Last edit by</b> " + uroUtils.GetUserNameAndRank(leBy) + " <b>on</b> " + uroUtils.GetDateTimeString(leOn) + "<br><br>";
  4403.  
  4404. let fwdSpeed = uroMarkers.obj.attributes.fwdMaxSpeed;
  4405. let revSpeed = uroMarkers.obj.attributes.revMaxSpeed;
  4406. let fwdLanes = uroMarkers.obj.attributes.fwdLaneCount;
  4407. let revLanes = uroMarkers.obj.attributes.revLaneCount;
  4408. let fwdWidth = 'Not set';
  4409. let revWidth = 'Not set';
  4410. if(uroMarkers.obj.attributes.fromLanesInfo != null)
  4411. {
  4412. fwdWidth = uroGetLengthString(uroMarkers.obj.attributes.fromLanesInfo.laneWidth);
  4413. }
  4414. if(uroMarkers.obj.attributes.toLanesInfo != null)
  4415. {
  4416. revWidth = uroGetLengthString(uroMarkers.obj.attributes.toLanesInfo.laneWidth);
  4417. }
  4418. let fwdUnverified = uroMarkers.obj.attributes.fwdMaxSpeedUnverified;
  4419. let revUnverified = uroMarkers.obj.attributes.revMaxSpeedUnverified;
  4420. let fwdASC = ((uroMarkers.obj.attributes.fwdFlags & 1) === 1);
  4421. let revASC = ((uroMarkers.obj.attributes.revFlags & 1) === 1);
  4422. let roadType = uroMarkers.obj.attributes.roadType;
  4423. let verifyLimits = true;
  4424. if((roadType === 17) || (roadType === 20))
  4425. {
  4426. verifyLimits = false;
  4427. }
  4428.  
  4429. result += '<table border=1><tr><th>Dir</th><th>Speed</th><th>ASC</th><th>Lanes</th><th>Width</th></tr>';
  4430. if(uroMarkers.obj.attributes.fwdDirection)
  4431. {
  4432. result += '<tr><td><b>A-B</b></td><td>'+uroUtils.GetLocalisedSpeedString(fwdSpeed)+'</td><td>';
  4433. if(fwdASC == true)
  4434. {
  4435. result += 'Yes';
  4436. }
  4437. else
  4438. {
  4439. result += 'No';
  4440. }
  4441. result += '</td><td>';
  4442. if(fwdLanes > 0)
  4443. {
  4444. result += fwdLanes;
  4445. }
  4446. else
  4447. {
  4448. result += 'Not set';
  4449. }
  4450. result += '</td><td>'+fwdWidth+'</td></tr>';
  4451. }
  4452. if(uroMarkers.obj.attributes.revDirection)
  4453. {
  4454. result += '<tr><td><b>B-A</b></td><td>'+uroUtils.GetLocalisedSpeedString(revSpeed)+'</td><td>';
  4455. if(revASC == true)
  4456. {
  4457. result += 'Yes';
  4458. }
  4459. else
  4460. {
  4461. result += 'No';
  4462. }
  4463. result += '</td><td>';
  4464. if(revLanes > 0)
  4465. {
  4466. result += revLanes;
  4467. }
  4468. else
  4469. {
  4470. result += 'Not set';
  4471. }
  4472. result += '</td><td>'+revWidth+'</td></tr>';
  4473. }
  4474. result += '</table>';
  4475.  
  4476. if((uroMarkers.obj.attributes.fwdDirection) && (uroMarkers.obj.attributes.revDirection) && (fwdSpeed != revSpeed) && (!fwdUnverified) && (!revUnverified))
  4477. {
  4478. result += '<br>Two-way segment has different verified speed limits...';
  4479. }
  4480. }
  4481.  
  4482. // segment restrictions
  4483. if(uroMarkers.obj.attributes.restrictions.length > 0)
  4484. {
  4485. result += '<br><table border=1>';
  4486. doPopUp = true;
  4487. let fwdResult = '<tr><td colspan=13><b>A-B restrictions:</b></td></tr>';
  4488. let revResult = '<tr><td colspan=13><b>B-A restrictions:</b></td></tr>';
  4489. let bothResult = '<tr><td colspan=13><b>Two-way restrictions:</b></td></tr>';
  4490.  
  4491. let nABRestrictions = 0;
  4492. let nBARestrictions = 0;
  4493. let nBothRestrictions = 0;
  4494. for(let idx = 0; idx < uroMarkers.obj.attributes.restrictions.length; idx++)
  4495. {
  4496. restObj = uroMarkers.obj.attributes.restrictions[idx];
  4497. if(restObj._direction === "FWD")
  4498. {
  4499. nABRestrictions++;
  4500. fwdResult += uroFormatRestriction(restObj);
  4501. }
  4502. else if(restObj._direction === "REV")
  4503. {
  4504. nBARestrictions++;
  4505. revResult += uroFormatRestriction(restObj);
  4506. }
  4507. else if(restObj._direction === "BOTH")
  4508. {
  4509. nBothRestrictions++;
  4510. bothResult += uroFormatRestriction(restObj);
  4511. }
  4512. else
  4513. {
  4514. uroDBG.AddLog("unknown restriction direction...");
  4515. }
  4516. }
  4517. if(nABRestrictions > 0)
  4518. {
  4519. result += fwdResult;
  4520. }
  4521. if(nBARestrictions > 0)
  4522. {
  4523. result += revResult;
  4524. }
  4525. if(nBothRestrictions > 0)
  4526. {
  4527. result += bothResult;
  4528. }
  4529. result += '</table>';
  4530. }
  4531. if(uroLayers.layers[uroLayers.ID.RTC].l.getVisibility() === true)
  4532. {
  4533. let closureTypes = uroGetSelectedSegmentRTCs(uroMarkers.obj.attributes.id);
  4534. if(closureTypes !== URO_DRTC.NONE)
  4535. {
  4536. result += '<br><table border=1 width="100%">';
  4537.  
  4538. result += uroPopup.AddClosureDetails(closureTypes, URO_DRTC.SEG_AB, "A-B closures");
  4539. result += uroPopup.AddClosureDetails(closureTypes, URO_DRTC.SEG_BA, "B-A closures");
  4540. result += uroPopup.AddClosureDetails(closureTypes, URO_DRTC.SEG_BI, "Two-way closures");
  4541. result += uroPopup.AddClosureDetails(closureTypes, URO_DRTC.TURN_OUT, "Outbound turn closures");
  4542. result += uroPopup.AddClosureDetails(closureTypes, URO_DRTC.TURN_IN, "Inbound turn closures");
  4543. doPopUp = true;
  4544. result += '</table>';
  4545. }
  4546. }
  4547.  
  4548. if(doPopUp === true)
  4549. {
  4550. uroFID = uroMarkers.obj.attributes.id;
  4551. uroPopup.newPopupType = 'segment_restriction';
  4552. }
  4553. }
  4554. uroPopup.result += result;
  4555. uroPopup.Show();
  4556. }
  4557. else
  4558. {
  4559. uroDBG.AddLog('segment '+uroFID+' has renderIntent==highlight but is offscreen... blocking popup');
  4560. }
  4561. }
  4562. }
  4563. },
  4564. Node: function()
  4565. {
  4566. if(uroUtils.GetCBChecked('_cbInhibitNodesPopup') === false)
  4567. {
  4568. let result = '';
  4569. let ureq = W.model.nodes.objects[uroMarkers.id];
  4570. if(ureq === undefined)
  4571. {
  4572. uroMarkers.id = null;
  4573. }
  4574. else
  4575. {
  4576. if(uroMousedOverMapComment !== null)
  4577. {
  4578. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for node highlight');
  4579. uroMousedOverOtherObjectWithinMapComment = true;
  4580. }
  4581. uroPopup.newPopupType = 'node';
  4582. uroFID = uroMarkers.id;
  4583. uroDBG.AddLog('building popup for node '+uroFID);
  4584. result += '<b>Node: ' + uroFID + '</b><br>';
  4585. for(let k=0; k<ureq.attributes.segIDs.length; k++)
  4586. {
  4587. let nodeSegID = ureq.attributes.segIDs[k];
  4588. let nodeSegObj = W.model.segments.objects[nodeSegID];
  4589. if(nodeSegObj !== undefined)
  4590. {
  4591. let nodeStreetID = nodeSegObj.attributes.primaryStreetID;
  4592. result += uroGetAddress(nodeStreetID, null, false, true, false);
  4593. }
  4594. }
  4595. }
  4596. uroPopup.result += result;
  4597. uroPopup.Show();
  4598. }
  4599. },
  4600. UMPExtras: function(ureq)
  4601. {
  4602. // add "open new WME tab" link
  4603. let urPos=new OpenLayers.LonLat();
  4604. if(uroPopup.isPlaceUpdate)
  4605. {
  4606. urPos.lon = ureq.getOLGeometry().getCentroid().x;
  4607. urPos.lat = ureq.getOLGeometry().getCentroid().y;
  4608. }
  4609. else
  4610. {
  4611. if(ureq.attributes.geometry.realX === undefined)
  4612. {
  4613. urPos.lon = ureq.attributes.geometry.x;
  4614. urPos.lat = ureq.attributes.geometry.y;
  4615. }
  4616. else
  4617. {
  4618. urPos.lon = ureq.attributes.geometry.realX;
  4619. urPos.lat = ureq.attributes.geometry.realY;
  4620. }
  4621. }
  4622. urPos = uroUtils.ConvertMercatorToWGS84(urPos);
  4623. let urLink = document.location.href;
  4624. let urLayers = '';
  4625. urLink = urLink.substr(0,urLink.indexOf('?zoomLevel'));
  4626. urLink += '?zoomLevel=17&lat='+urPos.lat+'&lon='+urPos.lon+urLayers;
  4627.  
  4628. if(uroPopup.isUR) urLink += '&mapUpdateRequest='+uroMarkers.id;
  4629. else if(uroPopup.isTurnProb) urLink += '&showturn='+uroMarkers.id+'&endshow';
  4630. else if(uroPopup.isProblem) urLink += '&mapProblem='+uroMarkers.id;
  4631. else if(uroPopup.isPlaceUpdate)
  4632. {
  4633. if(uroMarkers.type == uroLayers.ID.PUR)
  4634. {
  4635. urLink += '&showpur='+uroMarkers.id+'&endshow';
  4636. }
  4637. else
  4638. {
  4639. urLink += '&showppur='+uroMarkers.id+'&endshow';
  4640. }
  4641. }
  4642.  
  4643. let targetTab = "_uroTab_" + Math.round(Math.random()*1000000);
  4644. uroPopup.result += '<hr><ul><li><a href="'+urLink+'" id="_openInNewTab" target="'+targetTab+'">Open in new tab</a> - ';
  4645. uroPopup.hasOpenInNewTabLink = true;
  4646. uroPopup.result += '<a href="#" id="_recentreSession">centre in current tab</a>';
  4647. uroPopup.hasRecentreSessionLink = true;
  4648.  
  4649. // add "open new livemap tab" link
  4650. let lmLink = null;
  4651. if(document.getElementById("livemap-link") != null)
  4652. {
  4653. uroDBG.AddLog('Livemap link in livemap-link id element');
  4654. lmLink = document.getElementById("livemap-link").href;
  4655. }
  4656. else if(document.getElementsByClassName("livemap-link") != null)
  4657. {
  4658. uroDBG.AddLog('Livemap link in livemap-link class element');
  4659. lmLink = document.getElementsByClassName("livemap-link")[0].href;
  4660. }
  4661. else
  4662. {
  4663. uroDBG.AddLog('Livemap link not found...');
  4664. }
  4665. if(lmLink !== null)
  4666. {
  4667. let zpos = lmLink.indexOf('?');
  4668. if(zpos > -1) lmLink = lmLink.substr(0,zpos);
  4669. lmLink += '?zoom=17&lat='+urPos.lat+'&lon='+urPos.lon+'&layers=BTTTT';
  4670. uroPopup.result += '<li><a href="'+lmLink+'" target="_lmTab">Open in new livemap tab</a>';
  4671. }
  4672. if(!uroPopup.isPlaceUpdate)
  4673. {
  4674. // add "ignore for this session" link
  4675. uroPopup.result += '<li><a href="#" id="_addtoignore">Hide for this session</a></ul>';
  4676. uroPopup.hasIgnoreLink = true;
  4677. }
  4678.  
  4679. uroPopup.Show();
  4680. },
  4681. Preamble: function()
  4682. {
  4683. let retval = true;
  4684.  
  4685. if
  4686. (
  4687. (uroMarkers.type === null) &&
  4688. (uroPopup.timer === 0)
  4689. )
  4690. {
  4691. if(uroPopup.shown === true)
  4692. {
  4693. uroPopup.Hide();
  4694. }
  4695. uroMousedOverMapComment = null;
  4696. retval = false;
  4697. }
  4698. if(retval === true)
  4699. {
  4700. if(uroMTEMode)
  4701. {
  4702. retval = false;
  4703. }
  4704. }
  4705.  
  4706. if(retval === true)
  4707. {
  4708. if(!uroInit.initialised)
  4709. {
  4710. retval = false;
  4711. }
  4712. }
  4713.  
  4714. if(retval === true)
  4715. {
  4716. if((uroMouseIsDown) && (uroMarkers.mouseButtons === 0))
  4717. {
  4718. uroDBG.AddLog('trapped erroneous mousedown state');
  4719. uroMouseIsDown = false;
  4720. }
  4721. if(uroMouseIsDown)
  4722. {
  4723. retval = false;
  4724. }
  4725. }
  4726.  
  4727. if(retval === true)
  4728. {
  4729. if(OpenLayers === null)
  4730. {
  4731. if(uroNullOpenLayers === false)
  4732. {
  4733. uroDBG.AddLog('caught null OpenLayers');
  4734. uroNullOpenLayers = true;
  4735. }
  4736. retval = false;
  4737. }
  4738. else
  4739. {
  4740. uroNullOpenLayers = false;
  4741. }
  4742. }
  4743.  
  4744. if(retval === true)
  4745. {
  4746. if(uroLayers.layers[uroLayers.ID.UR].l === null)
  4747. {
  4748. if(uroNullURLayer === false)
  4749. {
  4750. uroDBG.AddLog('caught null UR layer');
  4751. uroNullURLayer = true;
  4752. }
  4753. retval = false;
  4754. }
  4755. else
  4756. {
  4757. uroNullURLayer = false;
  4758. }
  4759. }
  4760.  
  4761. if(retval === true)
  4762. {
  4763. if(uroLayers.layers[uroLayers.ID.MP].l === null)
  4764. {
  4765. if(uroNullProblemLayer === false)
  4766. {
  4767. uroDBG.AddLog('caught null problem layer');
  4768. uroNullProblemLayer = true;
  4769. }
  4770. retval = false;
  4771. }
  4772. else
  4773. {
  4774. uroNullProblemLayer = false;
  4775. }
  4776. }
  4777.  
  4778. if(retval === true)
  4779. {
  4780. if(uroUtils.GetCBChecked('_cbMasterEnable') === false)
  4781. {
  4782. retval = false;
  4783. }
  4784. }
  4785.  
  4786. if(retval === true)
  4787. {
  4788. if(uroTestPointerOutsideMap(uroMarkers.clientX, uroMarkers.clientY))
  4789. {
  4790. retval = false;
  4791. }
  4792. }
  4793.  
  4794.  
  4795. if(retval === true)
  4796. {
  4797. uroPopup.mouseX = uroMarkers.mouseX;
  4798. uroPopup.mouseY = uroMarkers.mouseY;
  4799. uroPopup.result = '';
  4800. uroPopup.hasIgnoreLink = false;
  4801. uroPopup.hasDeleteLink = false;
  4802. uroPopup.hasAddWatchLink = false;
  4803. uroPopup.hasRemoveWatchLink = false;
  4804. uroPopup.hasUpdateWatchLink = false;
  4805. uroPopup.hasRecentreSessionLink = false;
  4806. uroPopup.hasOpenInNewTabLink = false;
  4807. uroPopup.isVenue = false;
  4808. uroPopup.isMapComment = false;
  4809. uroPopup.newPopupType = null;
  4810. uroPopup.ureqID = null;
  4811. uroPopup.isUR = false;
  4812. uroPopup.isProblem = false;
  4813. uroPopup.isTurnProb = false;
  4814. uroPopup.isPlaceUpdate = false;
  4815. uroPopup.renderIntent = uroGetFeatureRenderIntent(uroMarkers.obj);
  4816.  
  4817. uroInit.WazeBits();
  4818.  
  4819. let mouseLonLat = W.map.getLonLatFromViewPortPx(new OpenLayers.Pixel(uroPopup.mouseX, uroPopup.mouseY));
  4820. let mousePoint = new OpenLayers.Geometry.Point(mouseLonLat.lon, mouseLonLat.lat);
  4821. if(uroMousedOverMapComment !== null)
  4822. {
  4823. if(W.model.mapComments.objects[uroMousedOverMapComment] === undefined)
  4824. {
  4825. uroDBG.AddLog('clearing uroMousedOverMapComment: object no longer exists in current map view');
  4826. uroMousedOverMapComment = null;
  4827. }
  4828. else if(W.model.mapComments.objects[uroMousedOverMapComment].attributes.geometry.containsPoint(mousePoint) === false)
  4829. {
  4830. uroDBG.AddLog('clearing uroMousedOverMapComment: pointer no longer within comment boundary');
  4831. uroMousedOverMapComment = null;
  4832. }
  4833. }
  4834. let popupXOffset = document.getElementById('editor-container').getBoundingClientRect().x;
  4835. let popupYOffset = $(document.getElementById("WazeMap")).offset().top;
  4836. uroPopup.pX = uroPopup.mouseX + popupXOffset + 10;
  4837. uroPopup.pY = uroPopup.mouseY + popupYOffset;
  4838. }
  4839.  
  4840. return retval;
  4841. },
  4842. Show: function()
  4843. {
  4844. if(uroPopup.suppressed === false)
  4845. {
  4846. if((uroFID != uroShownFID) || (uroPopup.newPopupType != uroPopup.shownType))
  4847. {
  4848. if(uroFID != uroShownFID) uroDBG.AddLog('FID mismatch, show popup: '+uroFID+'/'+uroShownFID);
  4849. else uroDBG.AddLog('Popup type mismatch: '+uroPopup.newPopupType+'/'+uroPopup.shownType);
  4850. uroShownFID = uroFID;
  4851. uroPopup.shownType = uroPopup.newPopupType;
  4852. uroPopup.shown = false;
  4853. }
  4854. if(uroPopup.shown === false)
  4855. {
  4856. uroPopup.shown = true;
  4857. uroDiv.style.height = "auto";
  4858. uroDiv.style.width = "auto";
  4859. uroDiv.style.overflow = "auto";
  4860. uroDiv.innerHTML = uroUtils.ModifyHTML(uroPopup.result);
  4861. if((uroFID != -1) && (uroPopup.hasIgnoreLink === true))
  4862. {
  4863. uroUtils.AddEventListener('_addtoignore','click', uroIgnore.Add, true);
  4864. }
  4865. if(uroPopup.hasDeleteLink === true)
  4866. {
  4867. uroUtils.AddEventListener('_deleteobject','click', uroDeleteObject, true);
  4868. }
  4869. if(uroPopup.hasRemoveWatchLink === true)
  4870. {
  4871. uroUtils.AddEventListener('_removefromwatchlist','click', uroOWL.RemoveCamFromWatchList, true);
  4872. }
  4873. if(uroPopup.hasAddWatchLink === true)
  4874. {
  4875. uroUtils.AddEventListener('_addtowatchlist','click', uroOWL.AddCamToWatchList, true);
  4876. }
  4877. if(uroPopup.hasUpdateWatchLink === true)
  4878. {
  4879. uroUtils.AddEventListener('_updatewatchlist','click', uroOWL.UpdateCamWatchList, true);
  4880. }
  4881. if(uroPopup.hasOpenInNewTabLink === true)
  4882. {
  4883. uroUtils.AddEventListener('_openInNewTab','mouseup', uroOpenNewTab, true);
  4884. }
  4885. if(uroPopup.hasRecentreSessionLink === true)
  4886. {
  4887. if(uroPopup.isUR) uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnUR, true);
  4888. else if((uroPopup.isProblem)||(uroPopup.isTurnProb)) uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnMP, true);
  4889. else if(uroPopup.isPlaceUpdate)
  4890. {
  4891. if(uroPopup.newPopupType == uroLayers.ID.PUR)
  4892. {
  4893. uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnPUR, true);
  4894. }
  4895. else
  4896. {
  4897. uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnPPUR, true);
  4898. }
  4899. }
  4900. else if(uroPopup.isVenue) uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnVenueNavPoint, true);
  4901. }
  4902. // restrict the popup width to be no wider than just under half the window width to avoid it
  4903. // completely overlapping the marker it's associated with - by keeping it to just below half
  4904. // the window width we guarantee that it'll fit either to the left or the right of the marker
  4905. // no matter how far across the screen the marker is located...
  4906. let rw = parseInt(uroDiv.clientWidth);
  4907. if(rw > (window.innerWidth * 0.45))
  4908. {
  4909. rw = (window.innerWidth * 0.45);
  4910. uroDiv.style.width = rw+'px';
  4911. }
  4912. // get the div height after any adjustment of the width above, to account for whatever content
  4913. // reflow may have occurred as a result of reducing the width...
  4914. let rh = parseInt(uroDiv.clientHeight);
  4915. // similarly restrict the popup height to avoid it dropping of the bottom of the screen if a
  4916. // segment has a bunch of closures/restrictions
  4917. rh = parseInt(uroDiv.clientHeight);
  4918. if(rh > (window.innerHeight * 0.80))
  4919. {
  4920. rh = (window.innerHeight * 0.80);
  4921. uroDiv.style.height = rh+'px';
  4922. uroDiv.style.overflow = 'scroll';
  4923. }
  4924. let origPopupX = uroPopup.pX;
  4925. let movedLeft = false;
  4926. if((uroPopup.pX + rw) > window.innerWidth)
  4927. {
  4928. // where the popup would be off the right hand side of the screen, move it completely over to the
  4929. // other side of the mouse pointer
  4930. uroPopup.pX -= (rw + 20);
  4931. if(uroPopup.pX < 0) uroPopup.pX = 0;
  4932. movedLeft = true;
  4933. }
  4934. if((uroPopup.pY + rh) > window.innerHeight)
  4935. {
  4936. // where the popup would be off the bottom of the screen, shift it up just far enough to be
  4937. // fully visible
  4938. uroPopup.pY -= (((uroPopup.pY + rh) - window.innerHeight) + 30);
  4939. }
  4940. if(uroPopup.pY < 0) uroPopup.pY = 0;
  4941. uroDiv.style.top = uroPopup.pY+'px';
  4942. uroDiv.style.left = uroPopup.pX+'px';
  4943. if(movedLeft === true)
  4944. {
  4945. // after relocating the popup to the left of the pointer, it may end up resizing itself
  4946. // which may then cause it to completely overlap the UR marker, so perform one more check
  4947. // of the div width and nudge to the left if required...
  4948. rw = parseInt(uroDiv.clientWidth);
  4949. if(rw > (window.innerWidth * 0.45))
  4950. {
  4951. rw = (window.innerWidth * 0.45);
  4952. uroDiv.style.width = rw+'px';
  4953. }
  4954. let nudgeDist = parseInt(20 + (uroPopup.pX + rw) - origPopupX);
  4955. if((uroPopup.pX + rw + 30) >= origPopupX)
  4956. {
  4957. uroDiv.style.left = parseInt(uroPopup.pX - nudgeDist)+'px';
  4958. }
  4959. }
  4960.  
  4961. uroDBG.AddLog('display popup at '+uroPopup.pX+','+uroPopup.pY);
  4962. uroDiv.style.visibility = 'visible';
  4963. uroPopup.autoHideTimer = (uroUtils.GetElmValue('_inputPopupAutoHideTimeout') * 10);
  4964. }
  4965. uroPopup.timer = -1;
  4966. }
  4967. },
  4968. Generate: function()
  4969. {
  4970. if(uroPopup.Preamble() === true)
  4971. {
  4972. if(uroMarkers.type === uroLayers.ID.UR) uroPopup.UR();
  4973. else if(uroMarkers.type === uroLayers.ID.MP) uroPopup.MP();
  4974. else if((uroMarkers.type === uroLayers.ID.PUR)||(uroMarkers.type === uroLayers.ID.PPUR)||(uroMarkers.type === uroLayers.ID.RPUR)) uroPopup.PUR();
  4975. else if(uroMarkers.type === "venue") uroPopup.Venue();
  4976. else if(uroMarkers.type === "cam") uroPopup.Camera();
  4977. else if(uroMarkers.type === "comment") uroPopup.Comment();
  4978. else if(uroMarkers.type === "segment") uroPopup.Segment();
  4979. else if(uroMarkers.type === "node") uroPopup.Node();
  4980. else
  4981. {
  4982. uroDBG.AddLog("request to generate popup for unknown type - " + uroMarkers.type);
  4983. }
  4984. }
  4985. },
  4986. Hide: function()
  4987. {
  4988. if(uroPopup.shown)
  4989. {
  4990. uroDiv.style.visibility = 'hidden';
  4991. uroPopup.shown = false;
  4992. uroPopup.timer = -2;
  4993. uroShownFID = -1;
  4994. }
  4995. uroPopup.suppressed = false;
  4996. },
  4997. Suppress: function()
  4998. {
  4999. uroDiv.style.visibility = 'hidden';
  5000. window.getSelection().removeAllRanges();
  5001. uroPopup.suppressed = true;
  5002. },
  5003. MouseOver: function()
  5004. {
  5005. uroPopup.mouseIn = true;
  5006. },
  5007. MouseOut: function()
  5008. {
  5009. uroPopup.mouseIn = false;
  5010. }
  5011. };
  5012. const uroURExtras = // UR marker enhancements
  5013. {
  5014. urList : [],
  5015. URListEntry: function(id, customType, hasMyComments, nComments, ageLastComment)
  5016. {
  5017. this.id = id;
  5018. this.customType = customType;
  5019. this.hasMyComments = hasMyComments;
  5020. this.nComments = nComments;
  5021. this.ageLastComment = ageLastComment;
  5022. },
  5023. AddToList: function(urID, customType, hasMyComments, nComments, ageLastComment)
  5024. {
  5025. let useCustomMarker = false;
  5026. if(uroUtils.GetCBChecked('_cbMasterEnable') === true)
  5027. {
  5028. if(customType === 0) useCustomMarker = (uroUtils.GetCBChecked('_cbCustomRoadworksMarkers'));
  5029. else if(customType === 1) useCustomMarker = (uroUtils.GetCBChecked('_cbCustomConstructionMarkers'));
  5030. else if(customType === 2) useCustomMarker = (uroUtils.GetCBChecked('_cbCustomClosuresMarkers'));
  5031. else if(customType === 3) useCustomMarker = (uroUtils.GetCBChecked('_cbCustomEventsMarkers'));
  5032. else if(customType === 4) useCustomMarker = (uroUtils.GetCBChecked('_cbCustomNotesMarkers'));
  5033. else if(customType === 5) useCustomMarker = (uroUtils.GetCBChecked('_cbCustomWSLMMarkers'));
  5034. else if(customType === 6) useCustomMarker = (uroUtils.GetCBChecked('_cbCustomBOGMarkers'));
  5035. else if(customType === 7) useCustomMarker = (uroUtils.GetCBChecked('_cbCustomDifficultMarkers'));
  5036. else if(customType === 98) useCustomMarker = (uroUtils.GetCBChecked('_cbCustomNativeSLMarkers'));
  5037. else if(customType === 99) useCustomMarker = (uroUtils.GetCBChecked('_cbCustomKeywordMarkers'));
  5038. }
  5039. if(!useCustomMarker) customType = -1;
  5040. uroURExtras.urList.push(new uroURExtras.URListEntry(urID, customType, hasMyComments, nComments, ageLastComment));
  5041. },
  5042. AddCommentCounts: function()
  5043. {
  5044. // Remove existing count elements before (re-)rendering, as WME doesn't automatically do this
  5045. // for us now that the way it handles the marker layers has changed...
  5046. let toRemove = document.querySelectorAll('#uroCommentCount');
  5047. let trCount = toRemove.length;
  5048. while(trCount > 0)
  5049. {
  5050. --trCount;
  5051. toRemove[trCount].remove();
  5052. }
  5053. let addCommentCount = false;
  5054. let nURs = uroURExtras.urList.length;
  5055.  
  5056. if(uroUtils.GetCBChecked('_cbMasterEnable') === true)
  5057. {
  5058. addCommentCount = ((nURs > 0) && (uroUtils.GetCBChecked('_cbCommentCount') === true));
  5059. }
  5060.  
  5061. if(addCommentCount === true)
  5062. {
  5063. for(let i = 0; i < nURs; ++i)
  5064. {
  5065. let uObj = uroURExtras.urList[i];
  5066. let nComments = uObj.nComments;
  5067. let marker = uroGetMarker(uroLayers.ID.UR, uObj.id);
  5068. if((marker !== null) && (nComments !== 0))
  5069. {
  5070. let mx = (marker.x.baseVal.value - 15);
  5071. let my = (marker.y.baseVal.value + 35);
  5072. let newSpan = '<foreignObject id="uroCommentCount" x="' + mx + '" y="' + my + '" width="100%" height="100%" style="pointer-events: none;">';
  5073.  
  5074. newSpan += '<div style="position:absolute;';
  5075. if(uObj.hasMyComments === true)
  5076. {
  5077. newSpan += 'background-color: yellow;';
  5078. }
  5079. else
  5080. {
  5081. newSpan += 'background-color: white;';
  5082. }
  5083. newSpan += 'font-size: 14px;font-weight: 800;';
  5084. newSpan += 'border-width: 1px;border-style: solid;border-radius: 12px;padding-left: 4px;padding-right: 4px;z-index: 1;';
  5085. newSpan += '">';
  5086. newSpan += nComments + 'c ';
  5087. newSpan += uObj.ageLastComment + 'd';
  5088. newSpan += '</div>';
  5089.  
  5090. newSpan += '</foreignObject>';
  5091. marker.insertAdjacentHTML("afterend", newSpan);
  5092. }
  5093. }
  5094. }
  5095. }
  5096. };
  5097. const uroInit = // script initialisation
  5098. {
  5099. initialised : false,
  5100. setupListeners : true,
  5101. finalisingListenerSetup : false,
  5102.  
  5103. WazeBitsAvailable: function()
  5104. {
  5105. uroDBG.AddLog('All WazeBits present and correct...');
  5106. W.prefs.on('change:isImperial', uroInit.Initialise);
  5107. uroLayers.Init();
  5108. // To avoid creating multiple URO tabs in the event that the initialise code
  5109. // gets called more than once, we now test for the presence of our tab and skip
  5110. // if it's already present
  5111. if(document.getElementById('uroTabHeader') === null)
  5112. {
  5113. uroInit.SetupUI();
  5114. }
  5115. },
  5116. WaitForW: function()
  5117. {
  5118. if(document.getElementsByClassName("sandbox").length > 0)
  5119. {
  5120. uroDBG.AddLog('WME practice mode detected, script is disabled...');
  5121. return;
  5122. }
  5123. if(window.W === undefined)
  5124. {
  5125. window.setTimeout(uroInit.WaitForW, 100);
  5126. return;
  5127. }
  5128. if (W.userscripts?.state?.isReady)
  5129. {
  5130. uroInit.WazeBitsAvailable();
  5131. }
  5132. else
  5133. {
  5134. document.addEventListener("wme-ready", uroInit.WazeBitsAvailable, {once: true});
  5135. }
  5136. },
  5137. AddInterceptor: function()
  5138. {
  5139. uroDBG.AddLog('Adding interceptor functions...');
  5140. // add interceptor function for window.confirm(), to inhibit the closure deletion confirmation that would
  5141. // pop up for each individual closure when we're using the delete all button - the user has already
  5142. // confirmed the delete action using our own requester
  5143. let _confirm = window.confirm;
  5144. window.confirm = function(msg)
  5145. {
  5146. let cm_delete_confirm = I18n.lookup("closures.delete_confirm").split('"')[0].trimRight(1);
  5147. if(msg.indexOf(cm_delete_confirm) != -1)
  5148. {
  5149. uroDBG.AddLog('intercepted closure delete confirmation...');
  5150. if(uroRTCClone.ConfirmDelete)
  5151. {
  5152. return _confirm(msg);
  5153. }
  5154. else
  5155. {
  5156. return true;
  5157. }
  5158. }
  5159. else if(typeof(msg) == 'undefined')
  5160. {
  5161. uroDBG.AddLog('Intercepted blank confirmation...');
  5162. return true;
  5163. }
  5164. else
  5165. {
  5166. return _confirm(msg);
  5167. }
  5168. };
  5169. uroConfirmIntercepted = true;
  5170. },
  5171. Initialise: function()
  5172. {
  5173. uroInit.initialised = false;
  5174. uroInit.setupListeners = true;
  5175. uroInit.finalisingListenerSetup = false;
  5176. uroInit.WaitForW();
  5177. },
  5178. WaitForControlsContainer: function()
  5179. {
  5180. if(document.getElementById('uroControlsContainer') === null)
  5181. {
  5182. window.setTimeout(uroInit.WaitForControlsContainer,500);
  5183. }
  5184. else
  5185. {
  5186. let updateURL = 'https://greasyfork.org/scripts/1952-uroverview-plus-uro';
  5187. uroDBG.AddLog('adding controls to sidebar container...');
  5188. let tabbyHTML = '<div id="uroTabHeader"><b><a href="'+updateURL+'" target="_blank">UROverview Plus</a></b> <label id="_uroVersion">'+uroRelease.version+'</label>';
  5189. tabbyHTML += '<label id="_uroDebugMode">(dbg)</label>';
  5190. tabbyHTML += '&nbsp;<input type="checkbox" id="_cbMasterEnable" checked>Enabled</input>';
  5191. tabbyHTML += uroTabs.CreateTabHeaders();
  5192. tabbyHTML += '</div>';
  5193. document.getElementById('uroControlsContainer').innerHTML = uroUtils.ModifyHTML(tabbyHTML);
  5194. uroTabs.CreateTabBodies();
  5195. // other sidebar elements
  5196. uroAMList = document.createElement('div');
  5197. uroAMList.style.color = "#ffff00";
  5198. uroCtrlHides = document.createElement('div');
  5199. // Object watchlist tab
  5200. {
  5201. uroOWL.CWLGroups = [];
  5202. uroTabs.PopulateOWL();
  5203. }
  5204. // footer for tabs container
  5205. uroCtrlHides.id = 'uroCtrlHides';
  5206. let tHTML = '<input type="button" id="_btnUndoLastHide" value="Undo last hide" />&nbsp;&nbsp;&nbsp;';
  5207. tHTML += '<input type="button" id="_btnClearSessionHides" value="Undo all hides" /><p>';
  5208. uroCtrlHides.innerHTML = uroUtils.ModifyHTML(tHTML);
  5209. // footer for AM list
  5210. uroAMList.id = 'uroAMList';
  5211. uroTabs.CtrlTabs[0][uroTabs.FIELDS.SHOWFN]();
  5212. window.addEventListener("beforeunload", uroConfig.SaveSettings, false);
  5213. }
  5214. },
  5215. AddTab_API: async function()
  5216. {
  5217. let {tabLabel, tabPane} = W.userscripts.registerSidebarTab("URO+");
  5218. tabLabel.innerText = "URO+";
  5219. tabPane.innerHTML = uroUtils.ModifyHTML(uroControls.innerHTML);
  5220. await W.userscripts.waitForElementConnected(tabPane);
  5221. uroInit.CompleteUISetup();
  5222. },
  5223. CompleteUISetup: function()
  5224. {
  5225. uroDBG.AddLog('waiting for controls container...');
  5226. uroInit.WaitForControlsContainer();
  5227. uroGetProblemTypes();
  5228. uroTabs.AddToDOM();
  5229. document.getElementById('uroControlsContainer').appendChild(uroCtrlHides);
  5230. uroInit.WazeBits();
  5231. uroDiv.addEventListener("mouseover", uroPopup.MouseOver, false);
  5232. uroDiv.addEventListener("mouseout", uroPopup.MouseOut, false);
  5233. if(sessionStorage.UROverview_FID_IgnoreList === undefined) sessionStorage.UROverview_FID_IgnoreList = '';
  5234. if(sessionStorage.UROverview_FID_WatchList === undefined) sessionStorage.UROverview_FID_WatchList = '';
  5235. if(uroConfirmIntercepted === false) uroInit.AddInterceptor();
  5236. uroUtils.AddStyle('urostyle_UnstackedMarkers', '.map-marker.marker-selected { transform: scale(1) !important; }');
  5237. uroMainTickHandlerID = window.setInterval(uroMainTick,1000);
  5238. },
  5239. SetupUI: function()
  5240. {
  5241. // create a new div to display the UR details floaty-box
  5242. uroDiv = document.createElement('div');
  5243. uroDiv.id = "uroDiv";
  5244. uroDiv.style.position = 'absolute';
  5245. uroDiv.style.visibility = 'hidden';
  5246. uroDiv.style.top = '0';
  5247. uroDiv.style.left = '0';
  5248. uroDiv.style.zIndex = 10000;
  5249. uroDiv.style.backgroundColor = 'aliceblue';
  5250. uroDiv.style.borderWidth = '3px';
  5251. uroDiv.style.borderStyle = 'solid';
  5252. uroDiv.style.borderRadius = '10px';
  5253. uroDiv.style.boxShadow = '5px 5px 10px Silver';
  5254. uroDiv.style.padding = '4px';
  5255. document.body.appendChild(uroDiv);
  5256. // create a new div to display script alerts
  5257. uroAlerts = document.createElement('div');
  5258. uroAlerts.id = "uroAlerts";
  5259. uroAlerts.style.position = 'fixed';
  5260. uroAlerts.style.visibility = 'hidden';
  5261. uroAlerts.style.top = '50%';
  5262. uroAlerts.style.left = '50%';
  5263. uroAlerts.style.zIndex = 10000;
  5264. uroAlerts.style.backgroundColor = 'aliceblue';
  5265. uroAlerts.style.borderWidth = '3px';
  5266. uroAlerts.style.borderStyle = 'solid';
  5267. uroAlerts.style.borderRadius = '10px';
  5268. uroAlerts.style.boxShadow = '5px 5px 10px Silver';
  5269. uroAlerts.style.padding = '4px';
  5270. uroAlerts.style.webkitTransform = "translate(-50%, -50%)";
  5271. uroAlerts.style.transform = "translate(-50%, -50%)";
  5272. let alertsHTML = '<div id="header" style="padding: 4px; background-color:LightGreen; font-weight: bold;">Alert title goes here...</div>';
  5273. alertsHTML += '<div id="content" style="padding: 4px; background-color:White; overflow:auto;max-height:500px">Alert content goes here...</div>';
  5274. alertsHTML += '<div id="controls" align="center" style="padding: 4px;">';
  5275. alertsHTML += '<span id="uroAlertTickBtn" style="cursor:pointer;font-size:14px;border:thin outset black;padding:2px 10px 2px 10px;">';
  5276. alertsHTML += '<i class="fa fa-check"> </i>';
  5277. alertsHTML += '<span id="uroAlertTickBtnCaption" style="font-weight: bold;"></span>';
  5278. alertsHTML += '</span>';
  5279. alertsHTML += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
  5280. alertsHTML += '<span id="uroAlertCrossBtn" style="cursor:pointer;font-size:14px;border:thin outset black;padding:2px 10px 2px 10px;">';
  5281. alertsHTML += '<i class="fa fa-times"> </i>';
  5282. alertsHTML += '<span id="uroAlertCrossBtnCaption" style="font-weight: bold;"></span>';
  5283. alertsHTML += '</span>';
  5284. alertsHTML += '</div>';
  5285. uroAlerts.innerHTML = uroUtils.ModifyHTML(alertsHTML);
  5286. document.body.appendChild(uroAlerts);
  5287. uroControls = document.createElement('section');
  5288. uroControls.style.fontSize = '12px';
  5289. uroControls.style.height = '100%';
  5290. uroControls.id = "sidepanel-uroverview";
  5291. uroControls.className = "tab-pane";
  5292. uroControls.innerHTML = uroUtils.ModifyHTML('<div id="uroControlsContainer" style="display:flex;flex-direction:column;height:80vh;"></div>');
  5293. uroInit.AddTab_API();
  5294. },
  5295. WazeBits: function()
  5296. {
  5297. uroMCLayer = null;
  5298.  
  5299. for(let i=0; i < W.map.layers.length; i++)
  5300. {
  5301. if(W.map.layers[i].name == 'mapComments') uroMCLayer = W.map.layers[i];
  5302. if(W.map.layers[i].name == 'venues') uroVenueLayer = W.map.layers[i];
  5303. }
  5304. },
  5305. FinalizeListenerSetup: function()
  5306. {
  5307. uroInit.finalisingListenerSetup = true;
  5308. // filter markers when the marker objects are modified (this happens whenever WME needs to load fresh marker data
  5309. // due to having panned/zoomed the map beyond the extents of the previously loaded data)
  5310. W.model.mapUpdateRequests.on("objectschanged", uroFilterURs_onObjectsChanged);
  5311. W.model.mapUpdateRequests.on("objectsadded", uroFilterURs_onObjectsAdded);
  5312. W.model.mapUpdateRequests.on("objectsremoved", uroFilterURs_onObjectsRemoved);
  5313. W.model.updateRequestSessions.on("objectsadded", uroUREvent_onObjectsAdded);
  5314. W.model.cameras.on("objectschanged", uroFilterCameras);
  5315. W.model.cameras.on("objectsadded", uroFilterCameras);
  5316. W.model.cameras.on("objectsremoved", uroFilterCameras);
  5317. W.model.mapProblems.on("objectschanged", uroFilterProblems);
  5318. W.model.mapProblems.on("objectsadded", uroFilterProblems);
  5319. W.model.mapProblems.on("objectsremoved", uroFilterProblems);
  5320. W.model.venues.on("objectschanged", uroFilterPlaces);
  5321. W.model.venues.on("objectsadded", uroFilterPlaces);
  5322. W.model.venues.on("objectsremoved", uroFilterPlaces);
  5323. W.model.mapComments.on("objectschanged", uroLayers.MCLayerChanged_changed);
  5324. W.model.mapComments.on("objectsadded", uroLayers.MCLayerChanged_added);
  5325. W.model.mapComments.on("objectsremoved", uroLayers.MCLayerChanged_removed);
  5326. uroMarkers.RegisterEvents();
  5327. uroLayers.InitialiseMOs();
  5328. uroUtils.AddEventListener('_btnUndoLastHide', "click", uroIgnore.RemoveLastAdded, true);
  5329. uroUtils.AddEventListener('_btnClearSessionHides', "click", uroIgnore.RemoveAll, true);
  5330. uroIgnore.EnableControls();
  5331. uroUtils.AddEventListener('_btnClearCamWatchList', "click", uroOWL.ClearCamWatchList, true);
  5332. uroUtils.AddEventListener('_btnSettingsToText', "click", uroConfig.SettingsToText, true);
  5333. uroUtils.AddEventListener('_btnTextToSettings', "click", uroConfig.TextToSettings, true);
  5334. uroUtils.AddEventListener('_btnResetSettings', "click", uroConfig.DefaultSettings, true);
  5335. uroUtils.AddEventListener('_btnClearSettingsText', "click", uroConfig.ClearSettingsText, true);
  5336. uroUtils.AddEventListener('_cbMasterEnable', "click", uroFilterItems_MasterEnableClick, true);
  5337. /*
  5338. uroUtils.AddEventListener('_btnDebugToScreen',"click", uroDBG.Dump, true);
  5339. */
  5340. uroUtils.AddEventListener('uroDiv', "dblclick", uroPopup.Suppress, true);
  5341. uroUtils.AddEventListener('_selectCameraUserID', "change", uroCamEditorSelected, true);
  5342. uroUtils.AddEventListener('_selectPlacesUserID', "change", uroPlacesEditorSelected, true);
  5343. uroUtils.AddEventListener('_selectHidePlacesUserID', "change", uroHidePlacesEditorSelected, true);
  5344. uroUtils.AddEventListener('uroAlertTickBtn', 'click', uroAlertBox.CloseWithTick, true);
  5345. uroUtils.AddEventListener('uroAlertCrossBtn', 'click', uroAlertBox.CloseWithCross, true);
  5346. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  5347. {
  5348. uroUtils.SetOnClick(uroTabs.CtrlTabs[i][uroTabs.FIELDS.LINKID], uroTabs.CtrlTabs[i][uroTabs.FIELDS.SHOWFN]);
  5349. }
  5350. for(let idx=0;idx<W.Config.venues.categories.length;idx++)
  5351. {
  5352. uroUtils.SetOnClick('_uroPlacesGroupState-'+idx,uroPlacesGroupCollapseExpand);
  5353. }
  5354. uroDBG.AddLog('finalise onload');
  5355. uroNewLookCheckDetailsRequest();
  5356. // filter markers as and when the map is moved
  5357. W.map.events.register("moveend", null, uroMapMoveEnd.Handler);
  5358. W.map.events.register("moveend", null, uroGetAMs); // uroGetAMs accesses e, so has to be called directly from the event handler
  5359. W.map.events.register("mousemove", null, uroGetAMs);
  5360. W.map.events.register("mousemove", null, uroMarkers.MouseMove);
  5361. W.map.events.registerPriority("mousedown", null, uroMouseDown);
  5362. // trap mousedown on Streetview marker drag
  5363. if(document.getElementsByClassName('street-view-control').length === 0) return;
  5364. document.getElementsByClassName('street-view-control')[0].onmousedown = uroMouseDown;
  5365. W.map.events.register("mouseup", null, uroMouseUp);
  5366. W.map.events.register("mouseout", null, uroMouseOut);
  5367. uroSetSectionTabStyles();
  5368. uroConfig.LoadSettings();
  5369. uroDBG.AddLog('getting user ID...');
  5370. uroUserID = W.loginManager.user.attributes.id;
  5371. uroDBG.AddLog('...ID is '+uroUserID);
  5372. uroDBG.AddLog('filtering...');
  5373. uroFilterItems();
  5374. uroDBG.AddLog('...done');
  5375. uroDBG.showDebugOutput = uroDBG.persistentDebugOutput;
  5376. let dbgMode = "none";
  5377. if(uroDBG.showDebugOutput)
  5378. {
  5379. dbgMode = "inline";
  5380. }
  5381. document.getElementById('_uroDebugMode').style.display = dbgMode;
  5382. uroUtils.AddEventListener('_uroVersion',"click", uroDBG.Toggle, true);
  5383. // add exclusiveCB click handlers to all checkboxes with a pairedWith attribute
  5384. uroDBG.AddLog('adding exclusiveCB handlers...');
  5385. let cbList = document.getElementsByTagName('input');
  5386. for (let optIdx=0;optIdx<cbList.length;optIdx++)
  5387. {
  5388. if((cbList[optIdx].id.indexOf('_cb') === 0) && (cbList[optIdx].attributes.pairedWith != null))
  5389. {
  5390. uroUtils.SetOnClick(cbList[optIdx].id,uroExclusiveCB);
  5391. }
  5392. }
  5393. uroDBG.AddLog('...done');
  5394. // manually call the layer-change handlers on startup, since there's a good chance WME will already have
  5395. // completed its own startup layer changes before our handlers get registered, preventing the marker handlers
  5396. // from being set up as expected on any markers which are visible in the startup map view before the user forces
  5397. // a layer update by panning/zooming/etc...
  5398. uroLayers.RunChangeHandlers();
  5399.  
  5400. uroUITweaks.Setup();
  5401. uroInit.setupListeners = false;
  5402. uroMainTickStage = 0;
  5403. window.clearInterval(uroMainTickHandlerID);
  5404. window.setInterval(uroMainTick, 10);
  5405. uroInit.initialised = true;
  5406. }
  5407. };
  5408. const uroUITweaks = // native UI enhancements
  5409. {
  5410. MO_SidePanel : null,
  5411. MO_ReportPanel : null,
  5412.  
  5413. ChangeMapBGColour: function()
  5414. {
  5415. let mapviewport = document.getElementById("WazeMap").getElementsByClassName("olMapViewport")[0];
  5416. if((uroUtils.GetCBChecked('_cbWhiteBackground') === true) && (uroUtils.GetCBChecked('_cbMasterEnable') === true))
  5417. {
  5418. let customColour = '#' + uroUtils.ToHex(uroUtils.GetElmValue('_inputCustomBackgroundRed'),2);
  5419. customColour += uroUtils.ToHex(uroUtils.GetElmValue('_inputCustomBackgroundGreen'),2);
  5420. customColour += uroUtils.ToHex(uroUtils.GetElmValue('_inputCustomBackgroundBlue'),2);
  5421. mapviewport.style.setProperty('background',customColour,'important');
  5422. }
  5423. else
  5424. {
  5425. mapviewport.style.setProperty('background',"#354148",'important');
  5426. }
  5427. },
  5428. HideAMLayer: function()
  5429. {
  5430. // If this sounds like a weird function - why not just switch off the layer from the layers menu? - then
  5431. // remember that in order for URO+ to be able to display in its own tab the list of AMs under the current
  5432. // mouse pointer location, which is somewhat more useful than the list given in the topbar, it needs the
  5433. // AM layer to be activated so that the AM areas data is loaded into WME. It doesn't however need the layer
  5434. // to then be visible, and since having a bunch of purple polygons covering the map can make for a rather
  5435. // difficult editing experience, being able to hide the polys whilst retaining the area information is
  5436. // of real benefit...
  5437. if((uroUtils.GetCBChecked('_cbHideAMLayer')) && (uroUtils.GetCBChecked('_cbMasterEnable')))
  5438. {
  5439. W.map.managedAreasLayer.setOpacity(0);
  5440. }
  5441. else
  5442. {
  5443. W.map.managedAreasLayer.setOpacity(1);
  5444. }
  5445. },
  5446. HideSegments: function()
  5447. {
  5448. // Hides the vector segments when the raster segment layer is hidden
  5449. if(uroUtils.GetCBChecked('_cbHideSegmentsWhenRoadsHidden'))
  5450. {
  5451. W.map.segmentLayer.drawn = W.map.roadLayer.visibility;
  5452. W.map.nodeLayer.drawn = W.map.roadLayer.visibility;
  5453. }
  5454. else
  5455. {
  5456. W.map.segmentLayer.drawn = true;
  5457. W.map.nodeLayer.drawn = true;
  5458. }
  5459. },
  5460. ReportPanelChange: function()
  5461. {
  5462. if(uroMarkers.inhibitSetCenter === true)
  5463. {
  5464. let bcr = document.querySelector('#panel-container').getBoundingClientRect();
  5465. if(bcr.width > 0)
  5466. {
  5467. uroMarkers.inhibitSetCenter = false;
  5468. W.map.setCenter(uroMarkers.clickedOnCenter);
  5469. }
  5470. }
  5471. },
  5472. SidePanelChange: function()
  5473. {
  5474. if(uroUtils.IsClosureUIActive() === true)
  5475. {
  5476. // Closure panel active
  5477. let uroMO_ClosureUI = new MutationObserver(uroClosureEditUIChanged);
  5478. uroMO_ClosureUI.disconnect();
  5479. uroMO_ClosureUI.observe(document.querySelector('wz-tab.closures-tab'),{subtree: true, attributes: true});
  5480. uroClosureEditUIChanged();
  5481. }
  5482. },
  5483. Setup: function()
  5484. {
  5485. uroUITweaks.MO_SidePanel = new MutationObserver(uroUITweaks.SidePanelChange);
  5486. uroUITweaks.MO_SidePanel.observe(document.getElementById('edit-panel'), {childList: true, subtree: true});
  5487. uroUITweaks.MO_ReportPanel = new MutationObserver(uroUITweaks.ReportPanelChange);
  5488. uroUITweaks.MO_ReportPanel.observe(document.getElementById('panel-container'), {childList: true, subtree: true});
  5489.  
  5490. uroUITweaks.ChangeMapBGColour();
  5491. uroUITweaks.HideAMLayer();
  5492. uroUITweaks.HideSegments();
  5493. }
  5494. };
  5495. const uroMapMoveEnd = // things that happen after a move of the map view
  5496. {
  5497. lat : null,
  5498. lon: null,
  5499. zoom: null,
  5500. Handler: function()
  5501. {
  5502. let mc = W.map.getCenter();
  5503. let z = W.map.getZoom();
  5504. if((mc.lat != this.lat) || (mc.lon != this.lon) || (z != this.zoom))
  5505. {
  5506. // Apply any filters which need to be updated when the map view changes,
  5507. // and which won't be applied via an event handler or mutation observer
  5508. // attached to the relevant layer etc...
  5509. uroFilterProblems();
  5510. uroFilterPlaces();
  5511. uroFilterCameras();
  5512. uroFilterURs();
  5513. uroFilterRAs();
  5514. uroFilterMapComments();
  5515.  
  5516. uroMiscUITweaksHandler();
  5517. uroLayers.MCLayerChanged();
  5518. this.lat = mc.lat;
  5519. this.lon = mc.lon;
  5520. this.zoom = z;
  5521. }
  5522. }
  5523. };
  5524.  
  5525.  
  5526. // ================================================================================================
  5527. // Here be the unfactored wilderness...
  5528. // ================================================================================================
  5529.  
  5530.  
  5531. function uroTempFixMTEDropDown()
  5532. {
  5533. // Auto-selects the "None" event in the closures tab to avoid the user having to manually select it for almost
  5534. // every single closure they'll ever add - the only time you'd need to select anything other than None is when
  5535. // adding a closure related to a MTE...
  5536.  
  5537. let retval = false;
  5538.  
  5539. let tObj = document.getElementById('closure_eventId');
  5540. // Make sure the closure event list is available, and that we haven't already messed with it.
  5541. if((tObj !== null) && (tObj.tag != "touchedByURO"))
  5542. {
  5543. // The event dropdown is now some byzantine piece of DOM manipulation to generate something which looks like a
  5544. // regular select list, but which can't be manipulated like one... The first gotcha is that the selected item
  5545. // exists only within a shadow DOM section within the dropdown rather than simply being part of the list from
  5546. // which we'd be able to read off its selected index. So to check whether or not the user has selected an
  5547. // event already, we need to drill down into this shadow DOM to get its text contents, and compare those against
  5548. // the I18n translation for the choose event text. What a palaver...
  5549. let shadowElm = tObj.shadowRoot.querySelectorAll('.selected-value')[0];
  5550. if(shadowElm !== undefined)
  5551. {
  5552. let eventText = tObj.shadowRoot.querySelectorAll('.selected-value')[0].innerText;
  5553. // Sometimes we get here before WME has finished rendering, so if the event text hasn't been set yet then we
  5554. // need to return false and let the caller deal with it...
  5555. if(eventText !== '')
  5556. {
  5557. if(eventText == I18n.lookup('closures.choose_event'))
  5558. {
  5559. // Having now established that, yes, the closure hasn't yet been associated with any event, it's surprisingly
  5560. // easy to change it to "None" - we just generate a click event on the first child element in the main DOM (not
  5561. // the shadow DOM this time), which replicates what the user would do to select None manually.
  5562. tObj.children[0].click();
  5563. }
  5564. // Tag the event list to prevent further processing attempts whilst this closure remains open.
  5565. tObj.tag = "touchedByURO";
  5566. retval = true;
  5567. }
  5568. }
  5569. }
  5570.  
  5571. return retval;
  5572. }
  5573. let uroPendingURSessionsTotal;
  5574. let uroFinalizeTimeoutHandle = null;
  5575. function uroFinalizeURSessionsGet()
  5576. {
  5577. if(uroPendingURSessionsTotal != uroPendingURSessionIDs.length)
  5578. {
  5579. uroPendingURSessionsTotal = uroPendingURSessionIDs.length;
  5580. if(uroFinalizeTimeoutHandle !== null)
  5581. {
  5582. window.clearTimeout(uroFinalizeTimeoutHandle);
  5583. uroFinalizeTimeoutHandle = null;
  5584. }
  5585. uroFinalizeTimeoutHandle = window.setTimeout(uroFinalizeURSessionsGet, 500);
  5586. return;
  5587. }
  5588.  
  5589. let idList = [];
  5590.  
  5591. while((idList.length < 50) && (uroPendingURSessionIDs.length))
  5592. {
  5593. let id = uroPendingURSessionIDs.shift();
  5594. idList.push(id);
  5595. }
  5596.  
  5597. if(idList.length > 0)
  5598. {
  5599. uroDBG.AddLog('grabbing '+idList.length+' updateRequestSessions, IDs: '+idList);
  5600. W.model.updateRequestSessions.getAsync(idList);
  5601. }
  5602.  
  5603. if((uroPendingURSessionIDs.length) || (uroRequestedURSessionIDs.length))
  5604. {
  5605. window.setTimeout(uroGetUpdateRequestSessions,1000);
  5606. }
  5607. else
  5608. {
  5609. uroPopulatingRequestSessions = false;
  5610. }
  5611. }
  5612. function uroGetUpdateRequestSessions()
  5613. {
  5614. uroPendingURSessionsTotal = uroPendingURSessionIDs.length;
  5615. if(uroFinalizeTimeoutHandle !== null)
  5616. {
  5617. window.clearTimeout(uroFinalizeTimeoutHandle);
  5618. uroFinalizeTimeoutHandle = null;
  5619. }
  5620. uroFinalizeTimeoutHandle = window.setTimeout(uroFinalizeURSessionsGet,500);
  5621. }
  5622. function uroRefreshUpdateRequestSessions()
  5623. {
  5624. let urcount = 0;
  5625. uroPendingURSessionIDs = [];
  5626. uroRequestedURSessionIDs = [];
  5627. uroPopulatingRequestSessions = true;
  5628. for (let urID in W.model.mapUpdateRequests.objects)
  5629. {
  5630. if(W.model.mapUpdateRequests.objects.hasOwnProperty(urID))
  5631. {
  5632. if(W.model.updateRequestSessions.objects[urID] === undefined)
  5633. {
  5634. uroPendingURSessionIDs.push(urID);
  5635. }
  5636. urcount++;
  5637. }
  5638. }
  5639. uroGetUpdateRequestSessions();
  5640. }
  5641. function uroURHasMyComments(fid)
  5642. {
  5643. if(uroUserID === -1)
  5644. {
  5645. return false;
  5646. }
  5647. let nComments = W.model.updateRequestSessions.objects[fid].attributes.comments.length;
  5648. if(nComments === 0)
  5649. {
  5650. return false;
  5651. }
  5652.  
  5653. for(let cidx=0; cidx<nComments; cidx++)
  5654. {
  5655. if(W.model.updateRequestSessions.objects[fid].attributes.comments[cidx].userID == uroUserID)
  5656. {
  5657. return true;
  5658. }
  5659. }
  5660.  
  5661. return false;
  5662. }
  5663. function uroIsFilteringEnabled(ignoreZoom)
  5664. {
  5665. let retval = false;
  5666. if
  5667. (
  5668. (uroUtils.GetCBChecked('_cbMasterEnable') === true) &&
  5669. (
  5670. (ignoreZoom === true) ||
  5671. (W.map.getZoom() <= uroUtils.GetElmValue('_inputFilterMinZoomLevel'))
  5672. )
  5673. )
  5674. {
  5675. retval = true;
  5676. }
  5677. return retval;
  5678. }
  5679. function uroUpdateMTEList()
  5680. {
  5681. if(Object.keys(W.model.majorTrafficEvents.objects).length === 0) return;
  5682.  
  5683. let selectedIdx = null;
  5684. let idx;
  5685. let mteNames = [];
  5686. let mteIDs = [];
  5687. for(idx in W.model.majorTrafficEvents.objects)
  5688. {
  5689. if(W.model.majorTrafficEvents.objects.hasOwnProperty(idx))
  5690. {
  5691. let name = W.model.majorTrafficEvents.objects[idx].attributes.names[0]?.value;
  5692. if(mteNames.indexOf(name) == -1)
  5693. {
  5694. mteNames.push(name);
  5695. mteIDs.push(idx);
  5696. }
  5697. }
  5698. }
  5699. // check for any previously selected ID in the list, then clear it and repopulate
  5700. // using the newly gathered ID collection from above, and finally reselect the
  5701. // previously selected MTE if its still present in the new list...
  5702. let selector;
  5703. let selectedID;
  5704. let selectorEntry;
  5705.  
  5706. selector = document.getElementById('_selectRTCMTE');
  5707. selectedID = null;
  5708. if(selector.selectedOptions[0] != null)
  5709. {
  5710. selectedID = selector.selectedOptions[0].value;
  5711. }
  5712. while(selector.options.length > 0)
  5713. {
  5714. selector.options.remove(0);
  5715. }
  5716. selector.options.add(new Option('<select a MTE>', null));
  5717. if(mteNames.length > 0)
  5718. {
  5719. selectorEntry = '';
  5720. for(idx=0; idx<mteNames.length; idx++)
  5721. {
  5722. selectorEntry = mteNames[idx];
  5723. selector.options.add(new Option(selectorEntry, mteIDs[idx]));
  5724. if(mteIDs[idx] == selectedID)
  5725. {
  5726. selectedIdx = idx+1;
  5727. }
  5728. }
  5729. }
  5730.  
  5731. if(selectedIdx !== null)
  5732. {
  5733. selector.selectedIndex = selectedIdx;
  5734. }
  5735. }
  5736. function uroRTCMarkerInfo(mIdx, isVisible)
  5737. {
  5738. let pri = null;
  5739. let status = null;
  5740. let dir = null;
  5741. let pos = null;
  5742. let mID = null;
  5743.  
  5744. let mObj = uroLayers.layers[uroLayers.ID.RTC].l.markers[mIdx];
  5745. if(mObj !== undefined)
  5746. {
  5747. // Store the marker status - if we've already made a note of the original
  5748. // status by adding an _orig-suffixed classname, extract the status from
  5749. // that rather than from the class currently being used to display the
  5750. // marker, to preserve the original status regardless of what we may have
  5751. // done to it subsequently as a result of our RTC filtering setup...
  5752. let cList = mObj.element.classList;
  5753. for(let i = 0; i < cList.length; ++i)
  5754. {
  5755. if(cList[i].indexOf('_orig') != -1)
  5756. {
  5757. status = cList[i].replace('_orig', '');
  5758. }
  5759. }
  5760. if(status === null)
  5761. {
  5762. for(let i = 0; i < cList.length; ++i)
  5763. {
  5764. if(cList[i].indexOf('status-') != -1)
  5765. {
  5766. status = cList[i];
  5767. }
  5768. }
  5769. }
  5770.  
  5771. // Assign a priority level to the marker so we know whether to show or hide
  5772. // it if it's stacked up with others on the same segment - the level set here
  5773. // follows the priority used by WME to decide which closures to show normally.
  5774. if(status == "status-active")
  5775. {
  5776. pri = 2;
  5777. }
  5778. else if(status == "status-not-started")
  5779. {
  5780. pri = 1;
  5781. }
  5782. else
  5783. {
  5784. pri = 0;
  5785. }
  5786.  
  5787. // To avoid the need to cross-reference with the closure model object, use the
  5788. // classname of the arrow attached to this marker to determine if the closure is
  5789. // in the forward or reverse direction.
  5790. if(mObj.element.childNodes.length == 1)
  5791. {
  5792. if(mObj.element.childNodes[0].className.indexOf('forward') != -1)
  5793. {
  5794. dir = "fwd";
  5795. }
  5796. else if(mObj.element.childNodes[0].className.indexOf('backward') != -1)
  5797. {
  5798. dir = "rev";
  5799. }
  5800. }
  5801.  
  5802. pos = mObj.px;
  5803. mID = mObj.element.dataset.id;
  5804. }
  5805.  
  5806. this.isVisible = isVisible;
  5807. this.pos = pos;
  5808. this.pri = pri;
  5809. this.mID = mID;
  5810. this.status = status;
  5811. this.dir = dir;
  5812. }
  5813. function uroFilterRTCs()
  5814. {
  5815. let pmTStart = performance.now();
  5816. let pmFunction = "uroFilterRTCs";
  5817.  
  5818. if(uroFilterPreamble() === false) return;
  5819.  
  5820. let closureLayer = uroLayers.layers[uroLayers.ID.RTC].l;
  5821. if(closureLayer.markers.length === 0) return;
  5822.  
  5823. let uFR_filterActiveFromWME = uroUtils.GetCBChecked('_cbHideEditorRTCs');
  5824. let uFR_filterActiveFromWazeFeed = uroUtils.GetCBChecked('_cbHideWazeFeedRTCs');
  5825. let uFR_filterActiveFromWazeOther = uroUtils.GetCBChecked('_cbHideWazeRTCs');
  5826. let uFR_filterFutureFromWME = uroUtils.GetCBChecked('_cbHideFutureEditorRTCs');
  5827. let uFR_filterFutureFromWazeFeed = uroUtils.GetCBChecked('_cbHideFutureWazeFeedRTCs');
  5828. let uFR_filterFutureFromWazeOther = uroUtils.GetCBChecked('_cbHideFutureWazeRTCs');
  5829. let uFR_filterExpiredFromWME = uroUtils.GetCBChecked('_cbHideExpiredEditorRTCs');
  5830. let uFR_filterExpiredFromWazeFeed = uroUtils.GetCBChecked('_cbHideExpiredWazeFeedRTCs');
  5831. let uFR_filterExpiredFromWazeOther = uroUtils.GetCBChecked('_cbHideExpiredWazeRTCs');
  5832. let uFR_filterShowForMTE = uroUtils.GetCBChecked('_cbShowMTERTCs');
  5833. let uFR_filterHideForMTE = uroUtils.GetCBChecked('_cbHideMTERTCs');
  5834. let uFR_filterHideDurationLessThan = uroUtils.GetCBChecked('_cbEnableRTCDurationFilterLessThan');
  5835. let uFR_filterHideDurationMoreThan = uroUtils.GetCBChecked('_cbEnableRTCDurationFilterMoreThan');
  5836. let uFR_thresholdDurationLessThan = uroUtils.GetElmValue('_inputFilterRTCDurationLessThan');
  5837. let uFR_thresholdDurationMoreThan = uroUtils.GetElmValue('_inputFilterRTCDurationMoreThan');
  5838.  
  5839. let uFR_filterShowForTS = uroUtils.GetCBChecked('_cbRTCFilterShowForTS');
  5840. let uFR_filterHideForTS = uroUtils.GetCBChecked('_cbRTCFilterHideForTS');
  5841. let tsD = uroUtils.GetElmValue('_inputRTCFilterDay');
  5842. let tsMo = uroUtils.GetElmValue('_inputRTCFilterMonth');
  5843. let tsY = uroUtils.GetElmValue('_inputRTCFilterYear');
  5844. let tsH = uroUtils.GetElmValue('_inputRTCFilterHour');
  5845. let tsMi = uroUtils.GetElmValue('_inputRTCFilterMin');
  5846. let filterTS = uroUtils.GetTS(tsD, tsMo, tsY, tsH, tsMi);
  5847. uroUpdateMTEList();
  5848. let mteID = null;
  5849. let selectorMTE = document.getElementById('_selectRTCMTE');
  5850. if(selectorMTE?.selectedOptions[0] != null)
  5851. {
  5852. mteID = selectorMTE.selectedOptions[0].value;
  5853. }
  5854.  
  5855. let uFR_masterEnable = uroIsFilteringEnabled(false);
  5856.  
  5857. let markerInfo = [];
  5858.  
  5859. // Pass 1 - determine which filtering to apply to each of the RTC markers
  5860. let markerIdx = 0;
  5861. for (let rtcObj in W.model.roadClosures.objects)
  5862. {
  5863. let isVisible = true;
  5864.  
  5865. if(uFR_masterEnable === true)
  5866. {
  5867. let rtcModel = W.model.roadClosures.objects[rtcObj];
  5868.  
  5869. if(mteID !== null)
  5870. {
  5871. if((uFR_filterShowForMTE === true) && (rtcModel.attributes.eventId !== mteID))
  5872. {
  5873. isVisible = false;
  5874. }
  5875. if((uFR_filterHideForMTE === true) && (rtcModel.attributes.eventId === mteID))
  5876. {
  5877. isVisible = false;
  5878. }
  5879. }
  5880.  
  5881. let rtcType = uroGetRTCOrigin(rtcModel);
  5882. let rtcState = uroGetRTCState(rtcModel);
  5883.  
  5884. if(rtcType == URO_TRTC.WAZEFEED)
  5885. {
  5886. if
  5887. (
  5888. ((rtcState === URO_SRTC.ACTIVE) && (uFR_filterActiveFromWazeFeed === true)) ||
  5889. ((rtcState === URO_SRTC.FUTURE) && (uFR_filterFutureFromWazeFeed === true)) ||
  5890. ((rtcState === URO_SRTC.EXPIRED) && (uFR_filterExpiredFromWazeFeed === true))
  5891. )
  5892. {
  5893. isVisible = false;
  5894. }
  5895. }
  5896. else if(rtcType == URO_TRTC.WAZEOTHER)
  5897. {
  5898. if
  5899. (
  5900. ((rtcState === URO_SRTC.ACTIVE) && (uFR_filterActiveFromWazeOther === true)) ||
  5901. ((rtcState === URO_SRTC.FUTURE) && (uFR_filterFutureFromWazeOther === true)) ||
  5902. ((rtcState === URO_SRTC.EXPIRED) && (uFR_filterExpiredFromWazeOther === true))
  5903. )
  5904. {
  5905. isVisible = false;
  5906. }
  5907. }
  5908. else
  5909. {
  5910. if
  5911. (
  5912. ((rtcState === URO_SRTC.ACTIVE) && (uFR_filterActiveFromWME === true)) ||
  5913. ((rtcState === URO_SRTC.FUTURE) && (uFR_filterFutureFromWME === true)) ||
  5914. ((rtcState === URO_SRTC.EXPIRED) && (uFR_filterExpiredFromWME === true))
  5915. )
  5916. {
  5917. isVisible = false;
  5918. }
  5919. }
  5920. let rtcDuration = uroGetRTCDuration(rtcModel);
  5921. if(uFR_filterHideDurationLessThan === true)
  5922. {
  5923. if(rtcDuration < uFR_thresholdDurationLessThan)
  5924. {
  5925. isVisible = false;
  5926. }
  5927. }
  5928. if(uFR_filterHideDurationMoreThan === true)
  5929. {
  5930. if(rtcDuration > uFR_thresholdDurationMoreThan)
  5931. {
  5932. isVisible = false;
  5933. }
  5934. }
  5935. if((uFR_filterShowForTS === true) || (uFR_filterHideForTS === true))
  5936. {
  5937. let startTS = new Date(rtcModel.attributes.startDate).getTime();
  5938. let endTS = new Date(rtcModel.attributes.endDate).getTime();
  5939. if(uFR_filterShowForTS === true)
  5940. {
  5941. if((filterTS < startTS) || (filterTS > endTS))
  5942. {
  5943. isVisible = false;
  5944. }
  5945. }
  5946. if (uFR_filterHideForTS === true)
  5947. {
  5948. if((filterTS >= startTS) && (filterTS <= endTS))
  5949. {
  5950. isVisible = false;
  5951. }
  5952. }
  5953. }
  5954. }
  5955.  
  5956. markerInfo.push(new uroRTCMarkerInfo(markerIdx, isVisible));
  5957. ++markerIdx;
  5958. }
  5959.  
  5960. // Pass 2 - based on the initial filtering results, determine which markers *actually* should be
  5961. // made visible or hidden according both to our filtering settings AND any masking of this marker
  5962. // due to the presence of other higher priority markers at the same position which have also been
  5963. // marked as visible following the filtering pass...
  5964. //
  5965. // For added merriment, we also deal with the WME limitation that prevents it displaying two
  5966. // different types of closure arrow if a segment has a one-way closure which is a higher priority
  5967. // than a closure in the opposite direction.
  5968.  
  5969. let cNodesDiv = uroLayers.layers[uroLayers.ID.RTCnode].l.div;
  5970. for (let i = 0; i < markerIdx; ++i)
  5971. {
  5972. let status = markerInfo[i].status;
  5973.  
  5974. // Only apply this pass to closures which haven't already been hidden in pass 1, AND which
  5975. // have a valid marker position
  5976. if((markerInfo[i].isVisible === true) && (markerInfo[i].pos !== null))
  5977. {
  5978. // Iterate through all the other markers, looking for any which are also still visible
  5979. // and have the same marker position as the one we're currently processing
  5980. for (let j = 0; j < markerIdx; ++j)
  5981. {
  5982. if(j != i)
  5983. {
  5984. if((markerInfo[j].isVisible === true) && (markerInfo[j].pos !== null))
  5985. {
  5986. if((markerInfo[i].pos.x == markerInfo[j].pos.x) && (markerInfo[i].pos.y == markerInfo[j].pos.y))
  5987. {
  5988. if(markerInfo[j].pri > markerInfo[i].pri)
  5989. {
  5990. if(markerInfo[j].dir == markerInfo[i].dir)
  5991. {
  5992. // Mark the currently processed marker to be hidden only if this higher priority
  5993. // marker is for a closure in the same direction - if it's not, then we need to
  5994. // leave the current marker visible so that its arrow remains visible...
  5995. markerInfo[i].isVisible = false;
  5996. }
  5997. else
  5998. {
  5999. // Otherwise, if we're leaving the current marker visible then we'll need to
  6000. // alter its status class to match this higher-priority marker, so that the
  6001. // marker which is shown to the user remains correct regardless of what the
  6002. // relative stacking order of the markers is on this segment.
  6003. status = markerInfo[j].status;
  6004. }
  6005. break;
  6006. }
  6007. }
  6008. }
  6009. }
  6010. }
  6011. }
  6012.  
  6013. let marker = closureLayer.markers[i].element;
  6014. let markerClass = marker.className;
  6015.  
  6016. // Remove the hidden class if present - this allows markers natively hidden by WME due to being masked
  6017. // by higher priority markers to become visible again if our own filtering settings have hidden those
  6018. // higher priority marker...
  6019. markerClass = markerClass.replace(" road-closure-hidden", "");
  6020. if(markerInfo[i].isVisible == false)
  6021. {
  6022. // Apply the hidden class for any markers WE'VE decided need to be hidden
  6023. markerClass += " road-closure-hidden";
  6024. }
  6025. else
  6026. {
  6027. // For any markers which we're leaving visible, first check to see if it's a marker we haven't yet
  6028. // seen. If so, then we need to store its original status class for future reference.
  6029. if(markerClass.indexOf('_orig') == -1)
  6030. {
  6031. markerClass += (' '+markerInfo[i].status + '_orig');
  6032. }
  6033. // Now, to ensure this segment displays the appropriate marker for the highest priority closure
  6034. // still visible on it, we remove the existing status class and replace it with the one we
  6035. // chose above
  6036. markerClass = markerClass.replace(" status-finished "," ");
  6037. markerClass = markerClass.replace(" status-active "," ");
  6038. markerClass = markerClass.replace(" status-not-started "," ");
  6039. markerClass += ' '+status;
  6040. }
  6041. marker.className = markerClass;
  6042. let toHide = cNodesDiv.querySelectorAll("[data-id='"+markerInfo[i].mID+"']");
  6043. for(let j = 0; j < toHide.length; ++j)
  6044. {
  6045. if(markerInfo[i].isVisible === false)
  6046. {
  6047. toHide[j].style.visibility = "hidden";
  6048. }
  6049. else
  6050. {
  6051. toHide[j].style.visibility = "";
  6052. }
  6053. }
  6054. }
  6055.  
  6056. uroDBG.PerfMon(pmFunction, pmTStart);
  6057. }
  6058. function uroUpdateRAList()
  6059. {
  6060. if(Object.keys(W.model.restrictedDrivingAreas.objects).length === 0) return;
  6061.  
  6062. let selectedIdx = null;
  6063. let idx;
  6064. let raNames = [];
  6065. for(idx in W.model.restrictedDrivingAreas.objects)
  6066. {
  6067. if(W.model.restrictedDrivingAreas.objects.hasOwnProperty(idx))
  6068. {
  6069. let name = W.model.restrictedDrivingAreas.objects[idx].attributes.name;
  6070. if(raNames.indexOf(name) == -1)
  6071. {
  6072. raNames.push(name);
  6073. }
  6074. }
  6075. }
  6076. // check for any previously selected name in the list, then clear it and repopulate
  6077. // using the newly gathered collection from above, and finally reselect the
  6078. // previously selected MTE if its still present in the new list...
  6079. let selector;
  6080. let selectedName;
  6081. let selectorEntry;
  6082.  
  6083. selector = document.getElementById('_selectRA');
  6084. selectedName = null;
  6085. if(selector.selectedOptions[0] != null)
  6086. {
  6087. selectedName = selector.selectedOptions[0].value;
  6088. }
  6089. while(selector.options.length > 0)
  6090. {
  6091. selector.options.remove(0);
  6092. }
  6093. selector.options.add(new Option('<select a RA>', null));
  6094. if(raNames.length > 0)
  6095. {
  6096. selectorEntry = '';
  6097. for(idx=0; idx<raNames.length; idx++)
  6098. {
  6099. selectorEntry = raNames[idx];
  6100. selector.options.add(new Option(selectorEntry, selectorEntry));
  6101. if(selectorEntry == selectedName)
  6102. {
  6103. selectedIdx = idx+1;
  6104. }
  6105. }
  6106. }
  6107.  
  6108. if(selectedIdx !== null)
  6109. {
  6110. selector.selectedIndex = selectedIdx;
  6111. }
  6112. }
  6113. function uroUpdateEditorList(modelObj, listElement, useCreated, useUpdated, useResolved, useCommenter)
  6114. {
  6115. if(Object.keys(modelObj).length === 0) return;
  6116.  
  6117. let selector = document.getElementById(listElement);
  6118.  
  6119. let selectedUser = null;
  6120. if(selector.selectedOptions[0] != null)
  6121. {
  6122. selectedUser = parseInt(selector.selectedOptions[0].value);
  6123. }
  6124.  
  6125. while(selector.options.length > 0)
  6126. {
  6127. selector.options.remove(0);
  6128. }
  6129.  
  6130. let selectedIdx = null;
  6131. let listedIDs = [];
  6132. let idx;
  6133. for(idx in modelObj)
  6134. {
  6135. if(modelObj.hasOwnProperty(idx))
  6136. {
  6137. let obj;
  6138. if(useCommenter == true)
  6139. {
  6140. obj = modelObj[idx];
  6141. if(obj.attributes.comments.length > 0)
  6142. {
  6143. for(let cidx=0; cidx < obj.attributes.comments.length; cidx++)
  6144. {
  6145. let userID = obj.attributes.comments[cidx].userID;
  6146. if((listedIDs.indexOf(userID) == -1) && (userID != -1))
  6147. {
  6148. listedIDs.push(userID);
  6149. }
  6150. }
  6151. }
  6152. }
  6153. else
  6154. {
  6155. obj = modelObj[idx].attributes;
  6156. let cbID = null;
  6157. let ubID = null;
  6158. let rbID = null;
  6159. if(useCreated == true) cbID = obj.createdBy;
  6160. if(useUpdated == true) ubID = obj.updatedBy;
  6161. if(useResolved == true) ubID = obj.resolvedBy;
  6162. if((cbID !== null) && (listedIDs.indexOf(cbID) == -1))
  6163. {
  6164. listedIDs.push(cbID);
  6165. }
  6166. if((ubID !== null) && (listedIDs.indexOf(ubID) == -1))
  6167. {
  6168. listedIDs.push(ubID);
  6169. }
  6170. if((rbID !== null) && (listedIDs.indexOf(rbID) == -1))
  6171. {
  6172. listedIDs.push(rbID);
  6173. }
  6174. }
  6175. }
  6176. }
  6177.  
  6178. selector.options.add(new Option('<select a user>', null));
  6179. if(listedIDs.length > 0)
  6180. {
  6181. let users = W.model.users.getByIds(listedIDs);
  6182. let selectorEntry = '';
  6183. for(idx=0; idx<users.length; idx++)
  6184. {
  6185. if(listedIDs.indexOf(users[idx].id) != -1)
  6186. {
  6187. listedIDs.splice(listedIDs.indexOf(users[idx]), 1);
  6188. }
  6189. if(users[idx].attributes.userName === undefined)
  6190. {
  6191. selectorEntry = users[idx].attributes.id;
  6192. }
  6193. else
  6194. {
  6195. selectorEntry = users[idx].attributes.userName;
  6196. }
  6197. selector.options.add(new Option(selectorEntry, users[idx].id));
  6198. if(users[idx].attributes.id == selectedUser)
  6199. {
  6200. selectedIdx = idx+1;
  6201. }
  6202. }
  6203. }
  6204.  
  6205. if(selectedIdx !== null)
  6206. {
  6207. selector.selectedIndex = selectedIdx;
  6208. }
  6209. }
  6210. function uroGetUserID(filterNameID, tbUserName)
  6211. {
  6212. if(filterNameID === null)
  6213. {
  6214. for(let idx in W.model.users.objects)
  6215. {
  6216. if(W.model.users.objects.hasOwnProperty(idx))
  6217. {
  6218. if(W.model.users.objects[idx].attributes.userName == tbUserName)
  6219. {
  6220. filterNameID = W.model.users.objects[idx].attributes.id;
  6221. break;
  6222. }
  6223. }
  6224. }
  6225. }
  6226. return filterNameID;
  6227. }
  6228. function uroFilterRAs()
  6229. {
  6230. let pmTStart = performance.now();
  6231. let pmFunction = "uroFilterRAs";
  6232.  
  6233. if(uroFilterPreamble() === false) return;
  6234. let uFURs_masterEnable = uroIsFilteringEnabled(false);
  6235. let filterByArea = uroUtils.GetCBChecked('_cbShowSpecificRA');
  6236. let filterByLastEditor = uroUtils.GetCBChecked('_cbRAEditorIDFilter');
  6237. let filterByMinAge = uroUtils.GetCBChecked('_cbEnableRAAgeFilterLessThan');
  6238. let filterByMaxAge = uroUtils.GetCBChecked('_cbEnableRAAgeFilterMoreThan');
  6239. let thresholdMinAge = uroUtils.GetElmValue('_inputFilterRAAgeLessThan');
  6240. let thresholdMaxAge = uroUtils.GetElmValue('_inputFilterRAAgeMoreThan');
  6241. let selectorRA = document.getElementById('_selectRA');
  6242. if(filterByArea === false)
  6243. {
  6244. while(selectorRA.options.length > 0)
  6245. {
  6246. selectorRA.options.remove(0);
  6247. }
  6248. }
  6249. let shownRA = null;
  6250. if(filterByArea === true)
  6251. {
  6252. if(selectorRA.options.length === 0)
  6253. {
  6254. uroUpdateRAList();
  6255. }
  6256. if(selectorRA.selectedOptions[0] != null)
  6257. {
  6258. shownRA = selectorRA.selectedOptions[0].value;
  6259. }
  6260. }
  6261.  
  6262. let filterNameID = null;
  6263. if(filterByLastEditor == true)
  6264. {
  6265. uroUpdateEditorList(W.model.restrictedDrivingAreas.objects, '_selectRAEditorID', true, true, false, false);
  6266. let selector = document.getElementById('_selectRAEditorID');
  6267. if(selector.selectedIndex > 0)
  6268. {
  6269. filterNameID = document.getElementById('_selectRAEditorID').selectedOptions[0].value;
  6270. }
  6271. }
  6272. let nRANames = document.querySelectorAll('.restricted-driving-area-name-marker').length;
  6273. for (let raIdx = 0; raIdx < W.map.restrictedDrivingAreaLayer.features.length; raIdx++)
  6274. {
  6275. let raObj = W.map.restrictedDrivingAreaLayer.features[raIdx].attributes.wazeFeature;
  6276. if(raObj !== undefined)
  6277. {
  6278. let raStyle = 'visible';
  6279. if(uFURs_masterEnable === true)
  6280. {
  6281. if(shownRA !== null)
  6282. {
  6283. if(raObj._wmeObject.attributes.name != shownRA) raStyle = 'hidden';
  6284. }
  6285. if(filterNameID !== null)
  6286. {
  6287. if((raObj._wmeObject.attributes.createdBy != filterNameID) && (raObj._wmeObject.attributes.updatedBy != filterNameID))
  6288. {
  6289. raStyle = 'hidden';
  6290. }
  6291. }
  6292. let raAge = uroUtils.DateToDays(raObj._wmeObject.attributes.updatedOn);
  6293. if(filterByMinAge == true)
  6294. {
  6295. if(raAge < thresholdMinAge) raStyle = 'hidden';
  6296. }
  6297. if(filterByMaxAge == true)
  6298. {
  6299. if(raAge > thresholdMaxAge) raStyle = 'hidden';
  6300. }
  6301. }
  6302. let geoID = W.map.restrictedDrivingAreaLayer.features[raIdx].geometry.id;
  6303. if(document.getElementById(geoID) !== null)
  6304. {
  6305. document.getElementById(geoID).style.visibility = raStyle;
  6306. }
  6307.  
  6308. // This doesn't always work, as the order in which the markers are listed on their layer isn't guaranteed
  6309. // to match the order in which the corresponding RA polys are listed on theirs...
  6310. if(raIdx < nRANames)
  6311. {
  6312. document.querySelectorAll('.restricted-driving-area-name-marker')[raIdx].style.visibility = raStyle;
  6313. }
  6314. }
  6315. }
  6316. uroDBG.PerfMon(pmFunction, pmTStart);
  6317. }
  6318. function uroFilterPlaceMarker(mObj, vObj, uFP_masterEnable)
  6319. {
  6320. if((mObj === undefined) || (vObj === undefined))
  6321. {
  6322. return;
  6323. }
  6324.  
  6325. let purAge = null;
  6326. let placeStyle = 'visible';
  6327.  
  6328. if(uFP_masterEnable === true)
  6329. {
  6330. if(uro_uFP[URO_UFP_OPTS.filterInsideManagedAreas] === true)
  6331. {
  6332. let tPt = [];
  6333. tPt.push(mObj.lonlat.lon);
  6334. tPt.push(mObj.lonlat.lat);
  6335. if(uroCheckGeometryWithinManagedAreas(tPt) === true) placeStyle = 'hidden';
  6336. }
  6337.  
  6338. if((placeStyle == 'visible') && (uro_uFP[URO_UFP_OPTS.filterUneditable] === true))
  6339. {
  6340. if(vObj.attributes.permissions === 0)
  6341. {
  6342. placeStyle = 'hidden';
  6343. }
  6344. if((placeStyle == 'visible') && (uro_uFP[URO_UFP_OPTS.isLoggedIn]))
  6345. {
  6346. if(uro_uFP[URO_UFP_OPTS.userRank] < vObj.attributes.lockRank)
  6347. {
  6348. placeStyle = 'hidden';
  6349. }
  6350. }
  6351. if((placeStyle == 'visible') && (vObj.attributes.adLocked))
  6352. {
  6353. placeStyle = 'hidden';
  6354. }
  6355. }
  6356.  
  6357. if((placeStyle == 'visible') && (uro_uFP[URO_UFP_OPTS.filterLockRanked] === true))
  6358. {
  6359. if(vObj.attributes.lockRank !== 0)
  6360. {
  6361. placeStyle = 'hidden';
  6362. }
  6363. }
  6364.  
  6365. let urEntries = vObj.attributes.venueUpdateRequests;
  6366. if((placeStyle == 'visible') && (urEntries !== undefined))
  6367. {
  6368. for(let i = 0; i < urEntries.length; ++i)
  6369. {
  6370. let ut = urEntries[i].attributes.updateType;
  6371. if((uro_uFP[URO_UFP_OPTS.filterFlagged] === true) && (ut === "flag"))
  6372. {
  6373. placeStyle = 'hidden';
  6374. }
  6375. else if((uro_uFP[URO_UFP_OPTS.filterNewPlace] === true) && (ut === "ADD_VENUE"))
  6376. {
  6377. placeStyle = 'hidden';
  6378. }
  6379. else if((uro_uFP[URO_UFP_OPTS.filterUpdatedDetails] === true) && (ut === "UPDATE_VENUE"))
  6380. {
  6381. placeStyle = 'hidden';
  6382. }
  6383. else if((uro_uFP[URO_UFP_OPTS.filterNewPhoto] === true) && (ut === "ADD_IMAGE"))
  6384. {
  6385. placeStyle = 'hidden';
  6386. }
  6387. }
  6388.  
  6389. if((placeStyle == 'visible') && (uro_uFP[URO_UFP_OPTS.filterOnCFs] === true))
  6390. {
  6391. let nVUR = urEntries.length;
  6392. while(nVUR > 0)
  6393. {
  6394. nVUR--;
  6395. let tCF = urEntries[nVUR].attributes.changedFields;
  6396. if(tCF !== undefined)
  6397. {
  6398. if(tCF.length > 0)
  6399. {
  6400. let tFN = tCF[0].attributes.fieldName;
  6401. if((tFN == "phone") && (uro_uFP[URO_UFP_OPTS.filterCFPhone] === true))
  6402. {
  6403. placeStyle = 'hidden';
  6404. }
  6405. else if((tFN == "name") && (uro_uFP[URO_UFP_OPTS.filterCFName] === true))
  6406. {
  6407. placeStyle = 'hidden';
  6408. }
  6409. else if((tFN == "entryExitPoints") && (uro_uFP[URO_UFP_OPTS.filterCFEntryExitPoints] === true))
  6410. {
  6411. placeStyle = 'hidden';
  6412. }
  6413. else if((tFN == "openingHours") && (uro_uFP[URO_UFP_OPTS.filterCFOpeningHours] === true))
  6414. {
  6415. placeStyle = 'hidden';
  6416. }
  6417. else if((tFN == "aliases") && (uro_uFP[URO_UFP_OPTS.filterCFAliases] === true))
  6418. {
  6419. placeStyle = 'hidden';
  6420. }
  6421. else if((tFN == "services") && (uro_uFP[URO_UFP_OPTS.filterCFServices] === true))
  6422. {
  6423. placeStyle = 'hidden';
  6424. }
  6425. else if((tFN == "geometry") && (uro_uFP[URO_UFP_OPTS.filterCFGeometry] === true))
  6426. {
  6427. placeStyle = 'hidden';
  6428. }
  6429. else if((tFN == "houseNumber") && (uro_uFP[URO_UFP_OPTS.filterCFHouseNumber] === true))
  6430. {
  6431. placeStyle = 'hidden';
  6432. }
  6433. else if((tFN == "categories") && (uro_uFP[URO_UFP_OPTS.filterCFCategories] === true))
  6434. {
  6435. placeStyle = 'hidden';
  6436. }
  6437. else if((tFN == "description") && (uro_uFP[URO_UFP_OPTS.filterCFDescription] === true))
  6438. {
  6439. placeStyle = 'hidden';
  6440. }
  6441. }
  6442. }
  6443. }
  6444. }
  6445. }
  6446.  
  6447. if(uro_uFP[URO_UFP_OPTS.invertPURFilters] === true)
  6448. {
  6449. if(placeStyle == 'hidden') placeStyle = 'visible';
  6450. else placeStyle = 'hidden';
  6451. }
  6452.  
  6453. if(uro_uFP[URO_UFP_OPTS.filterMinPURAge] || uro_uFP[URO_UFP_OPTS.filterMaxPURAge])
  6454. {
  6455. purAge = uroUtils.GetPURAge(vObj);
  6456. if(uro_uFP[URO_UFP_OPTS.filterMinPURAge] === true)
  6457. {
  6458. if(purAge < uro_uFP[URO_UFP_OPTS.thresholdMinPURDays]) placeStyle = 'hidden';
  6459. }
  6460. if(uro_uFP[URO_UFP_OPTS.filterMaxPURAge] === true)
  6461. {
  6462. if(purAge > uro_uFP[URO_UFP_OPTS.thresholdMaxPURDays]) placeStyle = 'hidden';
  6463. }
  6464. }
  6465.  
  6466. if(uroPURsToHide.indexOf(vObj.attributes.id) !== -1)
  6467. {
  6468. placeStyle = 'hidden';
  6469. }
  6470. }
  6471.  
  6472. mObj.style.visibility = placeStyle;
  6473.  
  6474. if((uro_uFP[URO_UFP_OPTS.leavePURGeos] === false) && (placeStyle === 'hidden'))
  6475. {
  6476. if(vObj.model != null)
  6477. {
  6478. if(vObj.attributes.geometry != null)
  6479. {
  6480. let puGeo = document.getElementById(vObj.attributes.geometry.id);
  6481. if(puGeo !== null)
  6482. {
  6483. puGeo.style.visibility = 'hidden';
  6484. }
  6485. }
  6486. }
  6487. }
  6488. }
  6489. function uroFilterPlaces()
  6490. {
  6491. let pmTStart = performance.now();
  6492. let pmFunction = "uroFilterPlaces";
  6493.  
  6494. if(uroFilterPreamble() === false) return;
  6495.  
  6496. let moObj = uroGetHighlightedMapFeature();
  6497. let renderIntent = uroGetFeatureRenderIntent(moObj);
  6498. if(moObj != null)
  6499. {
  6500. if(moObj.featureType === 'venue')
  6501. {
  6502. if((renderIntent == 'select') || (renderIntent == 'highlightselected'))
  6503. {
  6504. return;
  6505. }
  6506. }
  6507. }
  6508.  
  6509. if(uroUtils.GetCBChecked('_cbDisablePlacesFiltering') === true) return;
  6510.  
  6511. uroUpdateVenueEditorLists();
  6512.  
  6513. let filterNameID = null;
  6514. let tbUserName = uroUtils.GetElmValue('_textPlacesEditor');
  6515. let selector = document.getElementById('_selectPlacesUserID');
  6516. if(selector.selectedIndex > 0)
  6517. {
  6518. let selUserName = document.getElementById('_selectPlacesUserID').selectedOptions[0].innerHTML;
  6519. if(selUserName == tbUserName)
  6520. {
  6521. filterNameID = document.getElementById('_selectPlacesUserID').selectedOptions[0].value;
  6522. }
  6523. }
  6524. filterNameID = uroGetUserID(filterNameID, tbUserName);
  6525.  
  6526. let filterHideNameID = null;
  6527. let tbHideUserName = uroUtils.GetElmValue('_textHidePlacesEditor');
  6528. let selectorHide = document.getElementById('_selectHidePlacesUserID');
  6529. if(selectorHide.selectedIndex > 0)
  6530. {
  6531. let selHideUserName = document.getElementById('_selectHidePlacesUserID').selectedOptions[0].innerHTML;
  6532. if(selHideUserName == tbHideUserName)
  6533. {
  6534. filterHideNameID = document.getElementById('_selectHidePlacesUserID').selectedOptions[0].value;
  6535. }
  6536. }
  6537. filterHideNameID = uroGetUserID(filterHideNameID, tbHideUserName);
  6538.  
  6539. let filterCats = [];
  6540. for(let i=0; i<W.Config.venues.categories.length; i++)
  6541. {
  6542. let parentCategory = W.Config.venues.categories[i];
  6543. let subCategory;
  6544.  
  6545. if(uroUtils.GetCBChecked('_cbPlacesFilter-'+parentCategory) === true)
  6546. {
  6547. filterCats.push(parentCategory);
  6548. for(let i1=0; i1<W.Config.venues.subcategories[parentCategory].length; i1++)
  6549. {
  6550. subCategory = W.Config.venues.subcategories[parentCategory][i1];
  6551. filterCats.push(subCategory);
  6552. }
  6553. }
  6554. else
  6555. {
  6556. for(let i2=0; i2<W.Config.venues.subcategories[parentCategory].length; i2++)
  6557. {
  6558. subCategory = W.Config.venues.subcategories[parentCategory][i2];
  6559. if(uroUtils.GetCBChecked('_cbPlacesFilter-'+subCategory) === true)
  6560. {
  6561. filterCats.push(subCategory);
  6562. }
  6563. }
  6564. }
  6565. }
  6566.  
  6567. let placeStyle;
  6568.  
  6569. let uFP_filterEditedLessThan = uroUtils.GetCBChecked('_cbPlaceFilterEditedLessThan');
  6570. let uFP_filterEditedMoreThan = uroUtils.GetCBChecked('_cbPlaceFilterEditedMoreThan');
  6571. let uFP_filterL0 = uroUtils.GetCBChecked('_cbHidePlacesL0');
  6572. let uFP_filterL1 = uroUtils.GetCBChecked('_cbHidePlacesL1');
  6573. let uFP_filterL2 = uroUtils.GetCBChecked('_cbHidePlacesL2');
  6574. let uFP_filterL3 = uroUtils.GetCBChecked('_cbHidePlacesL3');
  6575. let uFP_filterL4 = uroUtils.GetCBChecked('_cbHidePlacesL4');
  6576. let uFP_filterL5 = uroUtils.GetCBChecked('_cbHidePlacesL5');
  6577. let uFP_filterStaff = uroUtils.GetCBChecked('_cbHidePlacesStaff');
  6578. let uFP_filterAL = uroUtils.GetCBChecked('_cbHidePlacesAdLocked');
  6579. let uFP_filterOnLockLevel = (uFP_filterL0 || uFP_filterL1 || uFP_filterL2 || uFP_filterL3 || uFP_filterL4 || uFP_filterL5 || uFP_filterStaff);
  6580. let uFP_filterNoPhotos = uroUtils.GetCBChecked('_cbHideNoPhotoPlaces');
  6581. let uFP_filterWithPhotos = uroUtils.GetCBChecked('_cbHidePhotoPlaces');
  6582. let uFP_filterNoLinks = uroUtils.GetCBChecked('_cbHideNoLinkedPlaces');
  6583. let uFP_filterWithLinks = uroUtils.GetCBChecked('_cbHideLinkedPlaces');
  6584. let uFP_filterNoDescription = uroUtils.GetCBChecked('_cbHideNonDescribedPlaces');
  6585. let uFP_filterWithDescription = uroUtils.GetCBChecked('_cbHideDescribedPlaces');
  6586. let uFP_filterNoKeyword = uroUtils.GetCBChecked('_cbHideKeywordPlaces');
  6587. let uFP_filterKeyword = uroUtils.GetCBChecked('_cbHideNoKeywordPlaces');
  6588. let uFP_filterPrivate = uroUtils.GetCBChecked('_cbFilterPrivatePlaces');
  6589. let uFP_invertFilters = uroUtils.GetCBChecked('_cbInvertPlacesFilter');
  6590. let uFP_masterEnable = uroIsFilteringEnabled(false);
  6591. let uFP_filterAreaPlaces = uroUtils.GetCBChecked('_cbHideAreaPlaces');
  6592. let uFP_filterPointPlaces = uroUtils.GetCBChecked('_cbHidePointPlaces');
  6593. let uFP_filterCreatedBy = uroUtils.GetCBChecked('_cbShowOnlyPlacesCreatedBy');
  6594. let uFP_filterEditedBy = uroUtils.GetCBChecked('_cbShowOnlyPlacesEditedBy');
  6595. let uFP_filterHideCreatedBy = uroUtils.GetCBChecked('_cbHideOnlyPlacesCreatedBy');
  6596. let uFP_filterHideEditedBy = uroUtils.GetCBChecked('_cbHideOnlyPlacesEditedBy');
  6597.  
  6598. let uFP_hidePURsForFilteredPlaces = uroUtils.GetCBChecked('_cbHidePURsForFilteredPlaces');
  6599.  
  6600. let uFP_NameKeyword = document.getElementById('_textKeywordPlace').value.toLowerCase();
  6601. let uFP_thresholdMinDays = document.getElementById('_inputFilterPlaceEditMinDays').value;
  6602. let uFP_thresholdMaxDays = document.getElementById('_inputFilterPlaceEditMaxDays').value;
  6603.  
  6604. uroPURsToHide = [];
  6605.  
  6606. for(let v=0; v<uroVenueLayer.features.length; v++)
  6607. {
  6608. placeStyle = 'visible';
  6609. if(uFP_masterEnable === true)
  6610. {
  6611. let lmObj = uroVenueLayer.features[v];
  6612.  
  6613. // when an area place is selected, the drag points for editing the place outline now get added as objects into uroVenueLayer.features,
  6614. // however none of these objects had the .attributes.repositoryObject property - whilst the devs have now replaced this with the almost
  6615. // identical .wazeFeature._wmeObject property, it's unclear if drag points still need to be excluded from this scan, so the check
  6616. // remains in place as a "let's just make sure it has it before trying to use it"...
  6617. if(lmObj?.attributes?.wazeFeature?._wmeObject != null)
  6618. {
  6619. lmObj = lmObj.attributes.wazeFeature._wmeObject.attributes;
  6620. if(lmObj.id < 0)
  6621. {
  6622. // don't apply filtering to newly-created places - this allows the user to leave their filtering settings unchanged whilst
  6623. // adding a new place which, once saved, would then be hidden...
  6624. break;
  6625. }
  6626.  
  6627. if(uFP_filterAreaPlaces)
  6628. {
  6629. if(lmObj.geometry.id.indexOf('Polygon') !== -1)
  6630. {
  6631. placeStyle = 'hidden';
  6632. }
  6633. }
  6634. if(uFP_filterPointPlaces)
  6635. {
  6636. if(lmObj.geometry.id.indexOf('Point') !== -1)
  6637. {
  6638. placeStyle = 'hidden';
  6639. }
  6640. }
  6641.  
  6642.  
  6643. if(placeStyle == 'visible')
  6644. {
  6645. if((uFP_filterEditedLessThan) || (uFP_filterEditedMoreThan))
  6646. {
  6647. let editDate = lmObj.updatedOn;
  6648. if(editDate === undefined)
  6649. {
  6650. // where a place has never been edited since its creation, use the creation date instead...
  6651. editDate = lmObj.createdOn;
  6652. }
  6653. if(editDate != null)
  6654. {
  6655. let editDaysAgo = uroUtils.DateToDays(editDate);
  6656. if(uFP_filterEditedLessThan)
  6657. {
  6658. if(editDaysAgo < uFP_thresholdMinDays)
  6659. {
  6660. placeStyle = 'hidden';
  6661. }
  6662. }
  6663. if(uFP_filterEditedMoreThan)
  6664. {
  6665. if(editDaysAgo > uFP_thresholdMaxDays)
  6666. {
  6667. placeStyle = 'hidden';
  6668. }
  6669. }
  6670. }
  6671. }
  6672. }
  6673.  
  6674. if(placeStyle == 'visible')
  6675. {
  6676. if(uFP_filterOnLockLevel)
  6677. {
  6678. let lockLevel = lmObj.lockRank;
  6679. if ((uFP_filterL0) && (lockLevel === 0)) placeStyle = 'hidden';
  6680. if ((uFP_filterL1) && (lockLevel === 1)) placeStyle = 'hidden';
  6681. if ((uFP_filterL2) && (lockLevel === 2)) placeStyle = 'hidden';
  6682. if ((uFP_filterL3) && (lockLevel === 3)) placeStyle = 'hidden';
  6683. if ((uFP_filterL4) && (lockLevel === 4)) placeStyle = 'hidden';
  6684. if ((uFP_filterL5) && (lockLevel === 5)) placeStyle = 'hidden';
  6685. if ((uFP_filterStaff) && (lockLevel === 6)) placeStyle = 'hidden';
  6686. }
  6687. }
  6688.  
  6689. if(placeStyle == 'visible')
  6690. {
  6691. if(uFP_filterAL)
  6692. {
  6693. if(lmObj.adLocked) placeStyle = 'hidden';
  6694. }
  6695. }
  6696.  
  6697. if(placeStyle == 'visible')
  6698. {
  6699. if(uFP_filterNoPhotos || uFP_filterWithPhotos)
  6700. {
  6701. let nPhotos = 0;
  6702. for(let loop=0; loop<lmObj.images.length; loop++)
  6703. {
  6704. if(lmObj.images[loop].attributes.approved) nPhotos++;
  6705. }
  6706. if((uFP_filterNoPhotos) && (nPhotos === 0)) placeStyle = 'hidden';
  6707. if((uFP_filterWithPhotos) && (nPhotos !== 0)) placeStyle = 'hidden';
  6708. }
  6709. }
  6710.  
  6711. if(placeStyle == 'visible')
  6712. {
  6713. if(uFP_filterNoLinks || uFP_filterWithLinks)
  6714. {
  6715. let nLinks = lmObj.externalProviderIDs.length;
  6716. if((uFP_filterNoLinks) && (nLinks === 0)) placeStyle = 'hidden';
  6717. if((uFP_filterWithLinks) && (nLinks !== 0)) placeStyle = 'hidden';
  6718. }
  6719. }
  6720.  
  6721. if(placeStyle == 'visible')
  6722. {
  6723. if(uFP_filterNoDescription || uFP_filterWithDescription)
  6724. {
  6725. let lDesc = lmObj.description.length;
  6726. if((uFP_filterNoDescription) && (lDesc === 0)) placeStyle = 'hidden';
  6727. if((uFP_filterWithDescription) && (lDesc !== 0)) placeStyle = 'hidden';
  6728. }
  6729. }
  6730.  
  6731. if(placeStyle == 'visible')
  6732. {
  6733. if((uFP_filterPrivate === true) && (lmObj.residential === true))
  6734. {
  6735. placeStyle = 'hidden';
  6736. }
  6737. else
  6738. {
  6739. for(let cat=0; cat<filterCats.length; cat++)
  6740. {
  6741. if(_.includes(lmObj.categories, filterCats[cat]))
  6742. {
  6743. placeStyle = 'hidden';
  6744. break;
  6745. }
  6746. }
  6747. }
  6748. }
  6749.  
  6750. if(placeStyle == 'visible')
  6751. {
  6752. if(uFP_filterNoKeyword || uFP_filterKeyword)
  6753. {
  6754. let venueName = lmObj.name.toLowerCase();
  6755. let noKeywordMatch = true;
  6756. if(uFP_NameKeyword === '')
  6757. {
  6758. noKeywordMatch = (venueName !== '');
  6759. }
  6760. else
  6761. {
  6762. noKeywordMatch = (venueName.indexOf(uFP_NameKeyword) === -1);
  6763. }
  6764.  
  6765. if(!noKeywordMatch && uFP_filterNoKeyword) placeStyle = 'hidden';
  6766. if(noKeywordMatch && uFP_filterKeyword) placeStyle = 'hidden';
  6767. }
  6768. }
  6769.  
  6770. if(placeStyle == 'visible')
  6771. {
  6772. if(filterNameID != null)
  6773. {
  6774. if(uFP_filterCreatedBy === true)
  6775. {
  6776. if(filterNameID != lmObj.createdBy) placeStyle = 'hidden';
  6777. }
  6778. if(uFP_filterEditedBy === true)
  6779. {
  6780. if(filterNameID != lmObj.updatedBy) placeStyle = 'hidden';
  6781. }
  6782. }
  6783. }
  6784. if(placeStyle == 'visible')
  6785. {
  6786. if(filterHideNameID != null)
  6787. {
  6788. if(uFP_filterHideCreatedBy === true)
  6789. {
  6790. if(filterHideNameID == lmObj.createdBy) placeStyle = 'hidden';
  6791. }
  6792. if(uFP_filterHideEditedBy === true)
  6793. {
  6794. if(filterHideNameID == lmObj.updatedBy) placeStyle = 'hidden';
  6795. }
  6796. }
  6797. }
  6798.  
  6799. if(uFP_invertFilters === true)
  6800. {
  6801. if(placeStyle == 'hidden') placeStyle = 'visible';
  6802. else placeStyle = 'hidden';
  6803. }
  6804. }
  6805.  
  6806. if((placeStyle == 'hidden') && (uFP_hidePURsForFilteredPlaces === true))
  6807. {
  6808. uroPURsToHide.push(lmObj.id);
  6809. }
  6810. }
  6811.  
  6812. let geoID = uroVenueLayer.features[v].geometry.id;
  6813. if(document.getElementById(geoID) !== null)
  6814. {
  6815. document.getElementById(geoID).style.visibility = placeStyle;
  6816. }
  6817. }
  6818.  
  6819. uro_uFP[URO_UFP_OPTS.filterUneditable] = uroUtils.GetCBChecked('_cbFilterUneditablePlaceUpdates');
  6820. uro_uFP[URO_UFP_OPTS.filterInsideManagedAreas] = uroUtils.GetCBChecked('_cbPURFilterInsideManagedAreas');
  6821. uro_uFP[URO_UFP_OPTS.excludeMyAreas] = uroUtils.GetCBChecked('_cbPURExcludeUserArea');
  6822. uro_uFP[URO_UFP_OPTS.filterLockRanked] = uroUtils.GetCBChecked('_cbFilterLockRankedPlaceUpdates');
  6823. uro_uFP[URO_UFP_OPTS.filterFlagged] = uroUtils.GetCBChecked("_cbFilterFlaggedPUR");
  6824. uro_uFP[URO_UFP_OPTS.filterNewPlace] = uroUtils.GetCBChecked("_cbFilterNewPlacePUR");
  6825. uro_uFP[URO_UFP_OPTS.filterUpdatedDetails] = uroUtils.GetCBChecked("_cbFilterUpdatedDetailsPUR");
  6826. uro_uFP[URO_UFP_OPTS.filterNewPhoto] = uroUtils.GetCBChecked("_cbFilterNewPhotoPUR");
  6827. uro_uFP[URO_UFP_OPTS.filterMinPURAge] = uroUtils.GetCBChecked('_cbEnablePURMinAgeFilter');
  6828. uro_uFP[URO_UFP_OPTS.filterMaxPURAge] = uroUtils.GetCBChecked('_cbEnablePURMaxAgeFilter');
  6829. uro_uFP[URO_UFP_OPTS.invertPURFilters] = uroUtils.GetCBChecked('_cbInvertPURFilters');
  6830. uro_uFP[URO_UFP_OPTS.leavePURGeos] = uroUtils.GetCBChecked('_cbLeavePURGeos');
  6831. uro_uFP[URO_UFP_OPTS.filterCFPhone] = uroUtils.GetCBChecked('_cbPURFilterCFPhone');
  6832. uro_uFP[URO_UFP_OPTS.filterCFName] = uroUtils.GetCBChecked('_cbPURFilterCFName');
  6833. uro_uFP[URO_UFP_OPTS.filterCFEntryExitPoints] = uroUtils.GetCBChecked('_cbPURFilterCFEntryExitPoints');
  6834. uro_uFP[URO_UFP_OPTS.filterCFOpeningHours] = uroUtils.GetCBChecked('_cbPURFilterCFOpeningHours');
  6835. uro_uFP[URO_UFP_OPTS.filterCFAliases] = uroUtils.GetCBChecked('_cbPURFilterCFAliases');
  6836. uro_uFP[URO_UFP_OPTS.filterCFServices] = uroUtils.GetCBChecked('_cbPURFilterCFServices');
  6837. uro_uFP[URO_UFP_OPTS.filterCFGeometry] = uroUtils.GetCBChecked('_cbPURFilterCFGeometry');
  6838. uro_uFP[URO_UFP_OPTS.filterCFHouseNumber] = uroUtils.GetCBChecked('_cbPURFilterCFHouseNumber');
  6839. uro_uFP[URO_UFP_OPTS.filterCFCategories] = uroUtils.GetCBChecked('_cbPURFilterCFCategories');
  6840. uro_uFP[URO_UFP_OPTS.filterCFDescription] = uroUtils.GetCBChecked('_cbPURFilterCFDescription');
  6841.  
  6842. uro_uFP[URO_UFP_OPTS.filterOnCFs] = (uro_uFP[URO_UFP_OPTS.filterCFPhone] || uro_uFP[URO_UFP_OPTS.filterCFName] || uro_uFP[URO_UFP_OPTS.filterCFEntryExitPoints] || uro_uFP[URO_UFP_OPTS.filterCFOpeningHours]);
  6843. uro_uFP[URO_UFP_OPTS.filterOnCFs] = (uro_uFP[URO_UFP_OPTS.filterOnCFs] || uro_uFP[URO_UFP_OPTS.filterCFAliases] || uro_uFP[URO_UFP_OPTS.filterCFServices] || uro_uFP[URO_UFP_OPTS.filterCFGeometry]);
  6844. uro_uFP[URO_UFP_OPTS.filterOnCFs] = (uro_uFP[URO_UFP_OPTS.filterOnCFs] || uro_uFP[URO_UFP_OPTS.filterCFHouseNumber] || uro_uFP[URO_UFP_OPTS.filterCFCategories] || uro_uFP[URO_UFP_OPTS.filterCFDescription]);
  6845.  
  6846. uro_uFP[URO_UFP_OPTS.thresholdMinPURDays] = uroUtils.GetElmValue('_inputPURFilterMinDays');
  6847. uro_uFP[URO_UFP_OPTS.thresholdMaxPURDays] = uroUtils.GetElmValue('_inputPURFilterMaxDays');
  6848. uro_uFP[URO_UFP_OPTS.isLoggedIn] = W.loginManager.isLoggedIn();
  6849. uro_uFP[URO_UFP_OPTS.userRank] = W.loginManager.user.attributes.rank;
  6850.  
  6851. uro_uFP[URO_UFP_OPTS.filterInsideManagedAreas] = uro_uFP[URO_UFP_OPTS.filterInsideManagedAreas] && (uroGetManagedAreas() !== 0);
  6852. if(uroUtils.GetCBChecked('_cbPURExcludeUserArea') == true)
  6853. {
  6854. uroIgnoreAreasUserID = W.loginManager.user.attributes.id;
  6855. }
  6856.  
  6857. uroPrepForFilterPlaceMarker(uroLayers.ID.PUR, uFP_masterEnable);
  6858. uroPrepForFilterPlaceMarker(uroLayers.ID.PPUR, uFP_masterEnable);
  6859. uroPrepForFilterPlaceMarker(uroLayers.ID.RPUR, uFP_masterEnable);
  6860.  
  6861. uroDBG.PerfMon(pmFunction, pmTStart);
  6862. }
  6863. function uroPrepForFilterPlaceMarker(markerType, masterEnable)
  6864. {
  6865. if(uroLayers.layers[markerType].l?.getVisibility() === true)
  6866. {
  6867. let pu;
  6868. let mObj;
  6869. let vObj;
  6870. let idList = uroGetMarkerIDs(markerType);
  6871. for(pu of idList)
  6872. {
  6873. mObj = uroGetMarker(markerType, pu);
  6874. if(mObj !== null)
  6875. {
  6876. vObj = W.model.venues.objects[pu];
  6877. uroFilterPlaceMarker(mObj, vObj, masterEnable);
  6878. }
  6879. }
  6880. }
  6881. }
  6882. function uroGetClosestSegmentToPoint(p)
  6883. {
  6884. let retval = null;
  6885. if(W.map.getZoom() >= 16)
  6886. {
  6887. let minDist = 99999999;
  6888.  
  6889. for(let s in W.model.segments.objects)
  6890. {
  6891. if(W.model.segments.objects.hasOwnProperty(s))
  6892. {
  6893. let seg = W.model.segments.getObjectById(s);
  6894. let dist = seg.attributes.geometry.distanceTo(p);
  6895. if(dist < minDist)
  6896. {
  6897. minDist = dist;
  6898. retval = s;
  6899. }
  6900. }
  6901. }
  6902. }
  6903. return retval;
  6904. }
  6905. function uroIsCamSpeedValid(camObj)
  6906. {
  6907. let retval = true;
  6908.  
  6909. let cPoint = camObj.attributes.geometry.getCentroid();
  6910. let nSeg = uroGetClosestSegmentToPoint(cPoint);
  6911. if(nSeg !== null)
  6912. {
  6913. let fwdSpeed = W.model.segments.getObjectById(nSeg).attributes.fwdMaxSpeed;
  6914. let revSpeed = W.model.segments.getObjectById(nSeg).attributes.revMaxSpeed;
  6915. let camSpeed = camObj.attributes.speed;
  6916. if(W.model.isImperial == true)
  6917. {
  6918. fwdSpeed = Math.round(fwdSpeed / 1.609);
  6919. revSpeed = Math.round(revSpeed / 1.609);
  6920. camSpeed = Math.round(camSpeed / 1.609);
  6921. }
  6922. if((camSpeed !== fwdSpeed) && (camSpeed !== revSpeed))
  6923. {
  6924. retval = false;
  6925. }
  6926. }
  6927.  
  6928. return retval;
  6929. }
  6930. function uroFilterCameras()
  6931. {
  6932. let pmTStart = performance.now();
  6933. let pmFunction = "uroFilterCameras";
  6934.  
  6935. if(uroFilterPreamble() === false)
  6936. {
  6937. return;
  6938. }
  6939.  
  6940. if(uroMouseIsDown === false) W.map.camerasLayer.redraw();
  6941.  
  6942. if(uroIsFilteringEnabled(false) === true)
  6943. {
  6944. uroUpdateEditorList(W.model.cameras.objects, '_selectCameraUserID', true, true, false, false);
  6945. let tbUserName = uroUtils.GetElmValue('_textCameraEditor');
  6946. let selector = document.getElementById('_selectCameraUserID');
  6947. let filterNameID = null;
  6948. if(selector.selectedIndex > 0)
  6949. {
  6950. let selUserName = document.getElementById('_selectCameraUserID').selectedOptions[0].innerHTML;
  6951. if(selUserName == tbUserName)
  6952. {
  6953. filterNameID = document.getElementById('_selectCameraUserID').selectedOptions[0].value;
  6954. }
  6955. }
  6956. filterNameID = uroGetUserID(filterNameID, tbUserName);
  6957.  
  6958. let isChecked_cbShowOnlyCamsCreatedBy = uroUtils.GetCBChecked('_cbShowOnlyCamsCreatedBy');
  6959. let isChecked_cbShowOnlyCamsEditedBy = uroUtils.GetCBChecked('_cbShowOnlyCamsEditedBy');
  6960. let isChecked_cbShowOnlyMyCams = uroUtils.GetCBChecked('_cbShowOnlyMyCams');
  6961. let isChecked_cbShowWorldCams = uroUtils.GetCBChecked('_cbShowWorldCams');
  6962. let isChecked_cbShowUSACams = uroUtils.GetCBChecked('_cbShowUSACams');
  6963. let isChecked_cbShowNonWorldCams = uroUtils.GetCBChecked('_cbShowNonWorldCams');
  6964. let isChecked_cbShowSpeedCams = uroUtils.GetCBChecked('_cbShowSpeedCams');
  6965. let isChecked_cbShowRedLightCams = uroUtils.GetCBChecked('_cbShowRedLightCams');
  6966. let isChecked_cbShowDummyCams = uroUtils.GetCBChecked('_cbShowDummyCams');
  6967. let isChecked_cbShowIfNoSpeedSet = uroUtils.GetCBChecked('_cbShowIfNoSpeedSet');
  6968. let isChecked_cbShowIfSpeedSet = uroUtils.GetCBChecked('_cbShowIfSpeedSet');
  6969. let isChecked_cbShowIfInvalidSpeedSet = uroUtils.GetCBChecked('_cbShowIfInvalidSpeedSet');
  6970. let isChecked_cbShowRLCIfNoSpeedSet = uroUtils.GetCBChecked('_cbShowRLCIfNoSpeedSet');
  6971. let isChecked_cbShowRLCIfNonZeroSpeedSet = uroUtils.GetCBChecked('_cbShowRLCIfNonZeroSpeedSet');
  6972. let isChecked_cbShowRLCIfZeroSpeedSet = uroUtils.GetCBChecked('_cbShowRLCIfZeroSpeedSet');
  6973. let isChecked_cbHideCreatedByMe = uroUtils.GetCBChecked('_cbHideCreatedByMe');
  6974. let isChecked_cbHideCreatedByRank0 = uroUtils.GetCBChecked('_cbHideCreatedByRank0');
  6975. let isChecked_cbHideCreatedByRank1 = uroUtils.GetCBChecked('_cbHideCreatedByRank1');
  6976. let isChecked_cbHideCreatedByRank2 = uroUtils.GetCBChecked('_cbHideCreatedByRank2');
  6977. let isChecked_cbHideCreatedByRank3 = uroUtils.GetCBChecked('_cbHideCreatedByRank3');
  6978. let isChecked_cbHideCreatedByRank4 = uroUtils.GetCBChecked('_cbHideCreatedByRank4');
  6979. let isChecked_cbHideCreatedByRank5 = uroUtils.GetCBChecked('_cbHideCreatedByRank5');
  6980. let isChecked_cbHideUpdatedByMe = uroUtils.GetCBChecked('_cbHideUpdatedByMe');
  6981. let isChecked_cbHideUpdatedByRank0 = uroUtils.GetCBChecked('_cbHideUpdatedByRank0');
  6982. let isChecked_cbHideUpdatedByRank1 = uroUtils.GetCBChecked('_cbHideUpdatedByRank1');
  6983. let isChecked_cbHideUpdatedByRank2 = uroUtils.GetCBChecked('_cbHideUpdatedByRank2');
  6984. let isChecked_cbHideUpdatedByRank3 = uroUtils.GetCBChecked('_cbHideUpdatedByRank3');
  6985. let isChecked_cbHideUpdatedByRank4 = uroUtils.GetCBChecked('_cbHideUpdatedByRank4');
  6986. let isChecked_cbHideUpdatedByRank5 = uroUtils.GetCBChecked('_cbHideUpdatedByRank5');
  6987. let isChecked_HideManualLockedCams = uroUtils.GetCBChecked('_cbHideManualLockedCams');
  6988. let isChecked_cbHideCWLCams = uroUtils.GetCBChecked('_cbHideCWLCams');
  6989. let isChecked_cbHighlightInsteadOfHideCams = uroUtils.GetCBChecked('_cbHighlightInsteadOfHideCams');
  6990. let isChecked_InvertFiltere = uroUtils.GetCBChecked('_cbInvertCamFilters');
  6991.  
  6992. let nCameras = uroLayers.layers[uroLayers.ID.cam].l.features.length;
  6993. for (let i = 0; i < nCameras; ++i)
  6994. {
  6995. let uroCamUpdater = '';
  6996. let uroCamUpdaterRank = -1;
  6997. let uroCamCreator = '';
  6998. let uroCamCreatorRank = -1;
  6999. let wf = uroLayers.layers[uroLayers.ID.cam].l.features[i].attributes.wazeFeature;
  7000. // When a camera is selected, the alignment/positioning UI elements get added to features[].
  7001. // As these elements aren't camera markers and therefore have no attributes, we need to
  7002. // ignore them to prevent errors in the filtering code below...
  7003. if(wf !== undefined)
  7004. {
  7005. let uroCam = wf._wmeObject;
  7006. let uroCamStyle = 'visible';
  7007.  
  7008. if(uroCam.attributes.createdBy !== null)
  7009. {
  7010. if(W.model.users.objects[uroCam.attributes.createdBy] != null)
  7011. {
  7012. uroCamCreator = W.model.users.objects[uroCam.attributes.createdBy].attributes.userName;
  7013. uroCamCreatorRank = W.model.users.objects[uroCam.attributes.createdBy].attributes.rank;
  7014. }
  7015. }
  7016.  
  7017. if(uroCam.attributes.updatedBy !== null)
  7018. {
  7019. if(W.model.users.objects[uroCam.attributes.updatedBy] != null)
  7020. {
  7021. uroCamUpdater = W.model.users.objects[uroCam.attributes.updatedBy].attributes.userName;
  7022. uroCamUpdaterRank = W.model.users.objects[uroCam.attributes.updatedBy].attributes.rank;
  7023. }
  7024. }
  7025.  
  7026. let uroCamType = uroCam.attributes.type;
  7027. let camIsAutoLocked = (uroCam.attributes.lockRank === null);
  7028.  
  7029. if(isChecked_HideManualLockedCams === true)
  7030. {
  7031. if(camIsAutoLocked === false) uroCamStyle = 'hidden';
  7032. }
  7033.  
  7034. if(filterNameID != null)
  7035. {
  7036. if(isChecked_cbShowOnlyCamsCreatedBy === true)
  7037. {
  7038. if(filterNameID != uroCam.attributes.createdBy) uroCamStyle = 'hidden';
  7039. }
  7040. if(isChecked_cbShowOnlyCamsEditedBy === true)
  7041. {
  7042. if(filterNameID != uroCam.attributes.updatedBy) uroCamStyle = 'hidden';
  7043. }
  7044. }
  7045.  
  7046. if(isChecked_cbShowOnlyMyCams === true)
  7047. {
  7048. if((uroUserID != uroCam.attributes.createdBy)&&(uroUserID != uroCam.attributes.updatedBy)) uroCamStyle = 'hidden';
  7049. }
  7050.  
  7051. if((isChecked_cbShowWorldCams === false) || (isChecked_cbShowUSACams === false) || (isChecked_cbShowNonWorldCams === false))
  7052. {
  7053. let posWorld = uroCamCreator.indexOf('world_');
  7054. let posUSA = uroCamCreator.indexOf('usa_');
  7055.  
  7056. if((isChecked_cbShowWorldCams === false) && (posWorld === 0)) uroCamStyle = 'hidden';
  7057. if((isChecked_cbShowUSACams === false) && (posUSA === 0)) uroCamStyle = 'hidden';
  7058. if((isChecked_cbShowNonWorldCams === false) && (posWorld !== 0) && (posUSA !== 0)) uroCamStyle = 'hidden';
  7059. }
  7060.  
  7061. if((isChecked_cbShowSpeedCams === false) || (isChecked_cbShowRedLightCams === false) || (isChecked_cbShowDummyCams === false))
  7062. {
  7063. if((isChecked_cbShowSpeedCams === false) && (uroCamType == 2)) uroCamStyle = 'hidden';
  7064. if((isChecked_cbShowRedLightCams === false) && (uroCamType == 4)) uroCamStyle = 'hidden';
  7065. if((isChecked_cbShowDummyCams === false) && (uroCamType == 3)) uroCamStyle = 'hidden';
  7066. }
  7067.  
  7068. if((isChecked_cbShowSpeedCams === true) && (uroCamType == 2))
  7069. {
  7070. if((isChecked_cbShowIfNoSpeedSet === false) && (uroCam.attributes.speed === null)) uroCamStyle = 'hidden';
  7071. if((isChecked_cbShowIfSpeedSet === false) && (uroCam.attributes.speed !== null)) uroCamStyle = 'hidden';
  7072. if(isChecked_cbShowIfInvalidSpeedSet === false)
  7073. {
  7074. if(uroIsCamSpeedValid(uroCam) === false)
  7075. {
  7076. uroCamStyle = 'hidden';
  7077. }
  7078. }
  7079. }
  7080.  
  7081. if((isChecked_cbShowRedLightCams === true) && (uroCamType == 4))
  7082. {
  7083. if((isChecked_cbShowRLCIfNoSpeedSet === false) && (uroCam.attributes.speed === null)) uroCamStyle = 'hidden';
  7084. if((isChecked_cbShowRLCIfNonZeroSpeedSet === false) && (uroCam.attributes.speed > 0)) uroCamStyle = 'hidden';
  7085. if((isChecked_cbShowRLCIfZeroSpeedSet === false) && (uroCam.attributes.speed === 0)) uroCamStyle = 'hidden';
  7086. }
  7087.  
  7088. if(isChecked_cbHideCreatedByMe === true)
  7089. {
  7090. if(uroUserID == uroCam.attributes.createdBy) uroCamStyle = 'hidden';
  7091. }
  7092. if((isChecked_cbHideCreatedByRank0 === true) && (uroCamCreatorRank === 0)) uroCamStyle = 'hidden';
  7093. if((isChecked_cbHideCreatedByRank1 === true) && (uroCamCreatorRank == 1)) uroCamStyle = 'hidden';
  7094. if((isChecked_cbHideCreatedByRank2 === true) && (uroCamCreatorRank == 2)) uroCamStyle = 'hidden';
  7095. if((isChecked_cbHideCreatedByRank3 === true) && (uroCamCreatorRank == 3)) uroCamStyle = 'hidden';
  7096. if((isChecked_cbHideCreatedByRank4 === true) && (uroCamCreatorRank == 4)) uroCamStyle = 'hidden';
  7097. if((isChecked_cbHideCreatedByRank5 === true) && (uroCamCreatorRank == 5)) uroCamStyle = 'hidden';
  7098.  
  7099. if(isChecked_cbHideUpdatedByMe === true)
  7100. {
  7101. if(uroUserID == uroCam.attributes.updatedBy) uroCamStyle = 'hidden';
  7102. }
  7103. if((isChecked_cbHideUpdatedByRank0 === true) && (uroCamUpdaterRank === 0)) uroCamStyle = 'hidden';
  7104. if((isChecked_cbHideUpdatedByRank1 === true) && (uroCamUpdaterRank == 1)) uroCamStyle = 'hidden';
  7105. if((isChecked_cbHideUpdatedByRank2 === true) && (uroCamUpdaterRank == 2)) uroCamStyle = 'hidden';
  7106. if((isChecked_cbHideUpdatedByRank3 === true) && (uroCamUpdaterRank == 3)) uroCamStyle = 'hidden';
  7107. if((isChecked_cbHideUpdatedByRank4 === true) && (uroCamUpdaterRank == 4)) uroCamStyle = 'hidden';
  7108. if((isChecked_cbHideUpdatedByRank5 === true) && (uroCamUpdaterRank == 5)) uroCamStyle = 'hidden';
  7109.  
  7110. if((isChecked_cbHideCWLCams === true) && (uroOWL.IsCamOnWatchList(uroCam.attributes.id) != -1)) uroCamStyle = 'hidden';
  7111.  
  7112. if(isChecked_InvertFiltere === true)
  7113. {
  7114. if(uroCamStyle == "hidden")
  7115. {
  7116. uroCamStyle = "";
  7117. }
  7118. else
  7119. {
  7120. uroCamStyle = "hidden";
  7121. }
  7122. }
  7123.  
  7124. let uroCamGeometryID = uroLayers.layers[uroLayers.ID.cam].l.features[i].geometry.id;
  7125. let svgElm = document.getElementById(uroCamGeometryID);
  7126.  
  7127. if(svgElm !== null)
  7128. {
  7129. let origImage;
  7130. if(uroCamStyle == "hidden")
  7131. {
  7132. if(isChecked_cbHighlightInsteadOfHideCams === true)
  7133. {
  7134. // set the "highlight" camera image here...
  7135. let hrefImage = svgElm.getAttribute("xlink:href");
  7136. origImage = svgElm.getAttribute("origImage");
  7137. if((hrefImage === origImage) || (origImage === null))
  7138. {
  7139. svgElm.setAttribute("origImage", hrefImage);
  7140. svgElm.setAttribute("xlink:href", uroImages.HighlightedCameraImages[(uroCamType-2)]);
  7141.  
  7142. svgElm.addEventListener("mouseover", uroMarkers.MouseOver, false);
  7143. svgElm.addEventListener("mouseout", uroMarkers.MouseOut, false);
  7144. }
  7145. }
  7146. else
  7147. {
  7148. svgElm.remove();
  7149. }
  7150. }
  7151. else
  7152. {
  7153. // restore the original camera image here...
  7154. if(svgElm.getAttribute("origImage") !== null)
  7155. {
  7156. origImage = svgElm.getAttribute("origImage");
  7157. svgElm.setAttribute("xlink:href", origImage);
  7158. svgElm.removeAttribute("origImage");
  7159. }
  7160. }
  7161. }
  7162. }
  7163. }
  7164. }
  7165. uroDBG.PerfMon(pmFunction, pmTStart);
  7166. }
  7167. function uroFilterMapComments()
  7168. {
  7169. let pmTStart = performance.now();
  7170. let pmFunction = "uroFilterMapComments";
  7171.  
  7172. if(uroFilterPreamble() === false) return;
  7173.  
  7174. let uFURs_masterEnable = uroIsFilteringEnabled(false);
  7175. let filterDescMustBePresent = uroUtils.GetCBChecked('_cbMCDescriptionMustBePresent');
  7176. let filterDescMustBeAbsent = uroUtils.GetCBChecked('_cbMCDescriptionMustBeAbsent');
  7177. let filterKeywordMustBePresent = uroUtils.GetCBChecked('_cbMCEnableKeywordMustBePresent');
  7178. let filterKeywordMustBeAbsent = uroUtils.GetCBChecked('_cbMCEnableKeywordMustBeAbsent');
  7179. let filterMyFollowed = uroUtils.GetCBChecked('_cbMCHideMyFollowed');
  7180. let filterMyUnfollowed = uroUtils.GetCBChecked('_cbMCHideMyUnfollowed');
  7181. let filterRoadworks = uroUtils.GetCBChecked('_cbMCFilterRoadworks');
  7182. let filterConstruction = uroUtils.GetCBChecked('_cbMCFilterConstruction');
  7183. let filterClosure = uroUtils.GetCBChecked('_cbMCFilterClosure');
  7184. let filterEvent = uroUtils.GetCBChecked('_cbMCFilterEvent');
  7185. let filterNote = uroUtils.GetCBChecked('_cbMCFilterNote');
  7186. let filterWSLM = uroUtils.GetCBChecked('_cbMCFilterWSLM');
  7187. let filterBOG = uroUtils.GetCBChecked('_cbMCFilterBOG');
  7188. let filterDifficult = uroUtils.GetCBChecked('_cbMCFilterDifficult');
  7189. let invertFilters = uroUtils.GetCBChecked('_cbInvertMCFilter');
  7190. let keywordPresent = uroUtils.GetElmValue('_textMCKeywordPresent');
  7191. let keywordAbsent = uroUtils.GetElmValue('_textMCKeywordAbsent');
  7192. let caseInsensitive = uroUtils.GetCBChecked('_cbMCCaseInsensitive');
  7193. let filterCommentsMustBePresent = uroUtils.GetCBChecked('_cbMCCommentsMustBePresent');
  7194. let filterCommentsMustBeAbsent = uroUtils.GetCBChecked('_cbMCCommentsMustBeAbsent');
  7195.  
  7196. let filterExpiryMustBePresent = uroUtils.GetCBChecked('_cbMCExpiryMustBePresent');
  7197. let filterExpiryMustBeAbsent = uroUtils.GetCBChecked('_cbMCExpiryMustBeAbsent');
  7198. let filterByCreatorEnable = uroUtils.GetCBChecked('_cbMCCreatorIDFilter');
  7199. let filterL1 = uroUtils.GetCBChecked('_cbHideMCRank0');
  7200. let filterL2 = uroUtils.GetCBChecked('_cbHideMCRank1');
  7201. let filterL3 = uroUtils.GetCBChecked('_cbHideMCRank2');
  7202. let filterL4 = uroUtils.GetCBChecked('_cbHideMCRank3');
  7203. let filterL5 = uroUtils.GetCBChecked('_cbHideMCRank4');
  7204. let filterL6 = uroUtils.GetCBChecked('_cbHideMCRank5');
  7205. let filterWRCMC = uroUtils.GetCBChecked('_cbHideWRCMCs');
  7206. let selectorCreator = document.getElementById('_selectMCCreatorID');
  7207.  
  7208. if(filterByCreatorEnable === false)
  7209. {
  7210. while(selectorCreator.options.length > 0)
  7211. {
  7212. selectorCreator.options.remove(0);
  7213. }
  7214. }
  7215. let creatorUser = null;
  7216. if(filterByCreatorEnable === true)
  7217. {
  7218. if(selectorCreator.options.length === 0)
  7219. {
  7220. uroUpdateEditorList(W.model.mapComments.objects, '_selectMCCreatorID', true, false, false, false);
  7221. }
  7222. if(selectorCreator.selectedOptions[0] != null)
  7223. {
  7224. creatorUser = parseInt(selectorCreator.selectedOptions[0].value);
  7225. }
  7226. }
  7227.  
  7228. for (let mcIdx = 0; mcIdx < uroMCLayer.features.length; mcIdx++)
  7229. {
  7230. {
  7231. let mcObj = uroMCLayer?.features[mcIdx]?.attributes?.wazeFeature?._wmeObject;
  7232. if(mcObj !== undefined)
  7233. {
  7234. let desc = '';
  7235. if(mcObj.attributes.subject !== null) desc += mcObj.attributes.subject.replace(/<\/?[^>]+(>|$)/g, "");
  7236. if(mcObj.attributes.body !== null) desc += mcObj.attributes.body.replace(/<\/?[^>]+(>|$)/g, "");
  7237. let nComments = mcObj.attributes.conversation.length;
  7238. if(nComments > 0)
  7239. {
  7240. for(let cIdx=0; cIdx < nComments; cIdx++)
  7241. {
  7242. desc += mcObj.attributes.conversation[cIdx].text.replace(/<\/?[^>]+(>|$)/g, "");
  7243. }
  7244. }
  7245.  
  7246. let mcStyle = 'visible';
  7247. if(uroIgnore.IsOnList(mcObj.attributes.id)) mcStyle = 'hidden';
  7248. if(uFURs_masterEnable === true)
  7249. {
  7250. let ukroadworks_ur = false;
  7251. let construction_ur = false;
  7252. let closure_ur = false;
  7253. let event_ur = false;
  7254. let note_ur = false;
  7255. let wslm_ur = false;
  7256. let bog_ur = false;
  7257. let difficult_ur = false;
  7258.  
  7259. let filterByNotIncludedKeyword = false;
  7260. let filterByIncludedKeyword = true;
  7261.  
  7262. let customType = uroGetCustomType(null, "mc", desc);
  7263. if(customType === 0) ukroadworks_ur = true;
  7264. else if(customType === 1) construction_ur = true;
  7265. else if(customType === 2) closure_ur = true;
  7266. else if(customType === 3) event_ur = true;
  7267. else if(customType === 4) note_ur = true;
  7268. else if(customType === 5) wslm_ur = true;
  7269. else if(customType === 6) bog_ur = true;
  7270. else if(customType === 7) difficult_ur = true;
  7271.  
  7272. let rank = mcObj.attributes.lockRank;
  7273. let expiry = mcObj.attributes.endDate;
  7274.  
  7275. // keywords
  7276. if(mcStyle == 'visible')
  7277. {
  7278. if(filterDescMustBePresent === true)
  7279. {
  7280. if(desc === '') mcStyle = 'hidden';
  7281. }
  7282. if(filterDescMustBeAbsent === true)
  7283. {
  7284. if(desc !== '') mcStyle = 'hidden';
  7285. }
  7286.  
  7287. if(filterCommentsMustBePresent === true)
  7288. {
  7289. if(nComments === 0) mcStyle = 'hidden';
  7290. }
  7291. if(filterCommentsMustBeAbsent === true)
  7292. {
  7293. if(nComments > 0) mcStyle = 'hidden';
  7294. }
  7295.  
  7296. if(filterKeywordMustBePresent === true)
  7297. {
  7298. let keywordIsPresentInDesc = uroUtils.KeywordPresent(desc,keywordPresent,caseInsensitive);
  7299. filterByIncludedKeyword = (filterByIncludedKeyword && (!keywordIsPresentInDesc));
  7300. }
  7301. if(filterKeywordMustBeAbsent === true)
  7302. {
  7303. let keywordIsAbsentInDesc = uroUtils.KeywordPresent(desc,keywordAbsent,caseInsensitive);
  7304. filterByNotIncludedKeyword = (filterByNotIncludedKeyword || keywordIsAbsentInDesc);
  7305. }
  7306.  
  7307. filterByNotIncludedKeyword = (filterByNotIncludedKeyword && filterKeywordMustBeAbsent);
  7308. filterByIncludedKeyword = (filterByIncludedKeyword && filterKeywordMustBePresent);
  7309. if(filterByNotIncludedKeyword || filterByIncludedKeyword)
  7310. {
  7311. mcStyle = 'hidden';
  7312. }
  7313.  
  7314. }
  7315.  
  7316. //lock rank
  7317. if(mcStyle == 'visible')
  7318. {
  7319. if((filterL1 === true) && (rank == 0)) mcStyle = 'hidden';
  7320. if((filterL2 === true) && (rank == 1)) mcStyle = 'hidden';
  7321. if((filterL3 === true) && (rank == 2)) mcStyle = 'hidden';
  7322. if((filterL4 === true) && (rank == 3)) mcStyle = 'hidden';
  7323. if((filterL5 === true) && (rank == 4)) mcStyle = 'hidden';
  7324. if((filterL6 === true) && (rank == 5)) mcStyle = 'hidden';
  7325. }
  7326.  
  7327. // expiry
  7328. if(mcStyle == 'visible')
  7329. {
  7330. if((filterExpiryMustBePresent === true) && (expiry === null)) mcStyle = 'hidden';
  7331. if((filterExpiryMustBeAbsent === true) && (expiry != null)) mcStyle = 'hidden';
  7332. }
  7333.  
  7334. // is following?
  7335. if(mcStyle == 'visible')
  7336. {
  7337. if(mcObj.attributes.isFollowing === true)
  7338. {
  7339. if(filterMyFollowed === true) mcStyle = 'hidden';
  7340. }
  7341. else
  7342. {
  7343. if(filterMyUnfollowed === true) mcStyle = 'hidden';
  7344. }
  7345. }
  7346.  
  7347. if(mcStyle == 'visible')
  7348. {
  7349. if(creatorUser !== null)
  7350. {
  7351. if(mcObj.attributes.createdBy != creatorUser) mcStyle = 'hidden';
  7352. }
  7353. if(filterWRCMC === true)
  7354. {
  7355. if(mcObj.attributes.createdBy == 304740435) mcStyle = 'hidden';
  7356. }
  7357. }
  7358.  
  7359. // custom tags
  7360. if(mcStyle == 'visible')
  7361. {
  7362. if(ukroadworks_ur === true)
  7363. {
  7364. if(filterRoadworks === true) mcStyle = 'hidden';
  7365. }
  7366. else if(construction_ur === true)
  7367. {
  7368. if(filterConstruction === true) mcStyle = 'hidden';
  7369. }
  7370. else if(closure_ur === true)
  7371. {
  7372. if(filterClosure === true) mcStyle = 'hidden';
  7373. }
  7374. else if(event_ur === true)
  7375. {
  7376. if(filterEvent === true) mcStyle = 'hidden';
  7377. }
  7378. else if(note_ur === true)
  7379. {
  7380. if(filterNote === true) mcStyle = 'hidden';
  7381. }
  7382. else if(wslm_ur === true)
  7383. {
  7384. if(filterWSLM === true) mcStyle = 'hidden';
  7385. }
  7386. else if(bog_ur === true)
  7387. {
  7388. if(filterBOG === true) mcStyle = 'hidden';
  7389. }
  7390. else if(difficult_ur === true)
  7391. {
  7392. if(filterDifficult === true) mcStyle = 'hidden';
  7393. }
  7394.  
  7395. if(invertFilters === true)
  7396. {
  7397. if(mcStyle == 'hidden') mcStyle = 'visible';
  7398. else mcStyle = 'hidden';
  7399. }
  7400. }
  7401. }
  7402.  
  7403. let geoID = uroMCLayer.features[mcIdx].geometry.id;
  7404. if(document.getElementById(geoID) !== null)
  7405. {
  7406. document.getElementById(geoID).style.visibility = mcStyle;
  7407. }
  7408. }
  7409. }
  7410. }
  7411. uroDBG.PerfMon(pmFunction, pmTStart);
  7412. }
  7413. function uroFilterURs_onObjectsChanged()
  7414. {
  7415. if(uroFilterPreamble())
  7416. {
  7417. if(uroURDialogIsOpen === true)
  7418. {
  7419. uroFilterURs();
  7420. }
  7421. }
  7422. }
  7423. function uroFilterURs_onObjectsAdded()
  7424. {
  7425. if(uroFilterPreamble())
  7426. {
  7427. }
  7428. }
  7429. function uroFilterURs_onObjectsRemoved()
  7430. {
  7431. if(uroFilterPreamble())
  7432. {
  7433. }
  7434. }
  7435. function uroGetManagedAreas()
  7436. {
  7437. uroManagedAreas = [];
  7438. uroIgnoreAreasUserID = null;
  7439.  
  7440. for(let maObj in W.model.managedAreas.objects)
  7441. {
  7442. if(W.model.managedAreas.objects.hasOwnProperty(maObj))
  7443. {
  7444. uroManagedAreas.push(W.model.managedAreas.objects[maObj]);
  7445. }
  7446. }
  7447. return uroManagedAreas.length;
  7448. }
  7449. function uroCheckGeometryWithinManagedAreas(geo)
  7450. {
  7451. let retval = false;
  7452. let ignoreUserMA = false;
  7453.  
  7454. // If we're ignoring the user's managed area, then we first check to see if
  7455. // the geopoint lies within that - if so then we can skip checking all the
  7456. // other areas in the list...
  7457. if(uroIgnoreAreasUserID !== null)
  7458. {
  7459. for(let uma = 0; uma < uroManagedAreas.length; ++uma)
  7460. {
  7461. if(uroIgnoreAreasUserID == uroManagedAreas[uma].attributes.userID)
  7462. {
  7463. ignoreUserMA = uroContainsPoint(uroManagedAreas[uma].attributes.geoJSONGeometry.coordinates[0], geo);
  7464. break;
  7465. }
  7466. }
  7467. }
  7468.  
  7469. // Point either isn't within the user's area, or we're not ignoring it, so
  7470. // check the rest of the areas in the list
  7471. if(ignoreUserMA == false)
  7472. {
  7473. for(let ma = 0; ma < uroManagedAreas.length; ++ma)
  7474. {
  7475. if(uroIgnoreAreasUserID != uroManagedAreas[ma].attributes.userID)
  7476. {
  7477. retval = uroContainsPoint(uroManagedAreas[ma].attributes.geoJSONGeometry.coordinates[0], geo);
  7478. break;
  7479. }
  7480. }
  7481. }
  7482.  
  7483. return retval;
  7484. }
  7485. function uroGetURDriveGeoms()
  7486. {
  7487. let retval = [];
  7488.  
  7489. for (let urobj in W.model.mapUpdateRequests.objects)
  7490. {
  7491. if(W.model.mapUpdateRequests.objects.hasOwnProperty(urobj))
  7492. {
  7493. let ureq = W.model.mapUpdateRequests.objects[urobj];
  7494. let ureqID = ureq.attributes.id;
  7495.  
  7496. let hasGeo = false;
  7497. let thisRet = [];
  7498. thisRet.push(ureqID);
  7499. thisRet.push(null);
  7500. thisRet.push([]);
  7501.  
  7502. let latMin = 9999;
  7503. let latMax = -9999;
  7504. let lonMin = 9999;
  7505. let lonMax = -9999;
  7506.  
  7507. let urs = W.model.updateRequestSessions.objects[ureqID];
  7508. if((urs !== undefined) && (urs.attributes.driveGeometry !== undefined))
  7509. {
  7510. let cPairs = [];
  7511. for(let i = 0; i < urs.attributes.driveGeometry.coordinates.length; ++i)
  7512. {
  7513. for(let j = 0; j < urs.attributes.driveGeometry.coordinates[i].length; ++j)
  7514. {
  7515. if((i === 0) || (j > 0))
  7516. {
  7517. let coords = urs.attributes.driveGeometry.coordinates[i][j];
  7518. cPairs.push(coords);
  7519.  
  7520. if(coords[0] > lonMax)
  7521. {
  7522. lonMax = coords[0];
  7523. }
  7524. if(coords[0] < lonMin)
  7525. {
  7526. lonMin = coords[0];
  7527. }
  7528. if(coords[1] > latMax)
  7529. {
  7530. latMax = coords[1];
  7531. }
  7532. if(coords[1] < latMin)
  7533. {
  7534. latMin = coords[1];
  7535. }
  7536.  
  7537. hasGeo = true;
  7538. }
  7539. }
  7540. }
  7541. let bbox = [];
  7542. bbox.push(lonMin);
  7543. bbox.push(lonMax);
  7544. bbox.push(latMin);
  7545. bbox.push(latMax);
  7546. thisRet.push(bbox);
  7547. thisRet.push(cPairs);
  7548. }
  7549.  
  7550. if(hasGeo === true)
  7551. {
  7552. retval.push(thisRet);
  7553. }
  7554. }
  7555. }
  7556. return retval;
  7557. }
  7558. function uroCompareDriveGeos(geoA, geoB)
  7559. {
  7560. const matchLength = 5;
  7561. let retval = false;
  7562.  
  7563. if((geoA.length >= matchLength) && (geoB.length >= matchLength))
  7564. {
  7565. for(let i = 0; i < (geoA.length - matchLength); ++i)
  7566. {
  7567. for(let j = 0; j < (geoB.length - matchLength); ++j)
  7568. {
  7569. if((geoA[i][0] == geoB[j][0]) && (geoA[i][1] == geoB[j][1]))
  7570. {
  7571. retval = true;
  7572. for(let k = 1; k < matchLength; ++k)
  7573. {
  7574. if((geoA[i+k][0] != geoB[j+k][0]) || (geoA[i+k][1] != geoB[j+k][1]))
  7575. {
  7576. retval = false;
  7577. break;
  7578. }
  7579. }
  7580. }
  7581. if(retval === true)
  7582. {
  7583. break;
  7584. }
  7585. }
  7586.  
  7587. if(retval === true)
  7588. {
  7589. break;
  7590. }
  7591. }
  7592. }
  7593. return retval;
  7594. }
  7595. function uroCompareDriveBBoxes(bbA, bbB)
  7596. {
  7597. let retval = true;
  7598.  
  7599. if
  7600. (
  7601. (bbA[0] > bbB[1]) ||
  7602. (bbA[1] < bbB[0]) ||
  7603. (bbA[2] > bbB[3]) ||
  7604. (bbA[3] < bbB[2])
  7605. )
  7606. {
  7607. retval = false;
  7608. }
  7609.  
  7610. return retval;
  7611. }
  7612. function uroGetURDupes()
  7613. {
  7614. uroURDupes = [];
  7615.  
  7616. // To determine which URs are duplicates of one another (i.e. have been raised by the same user
  7617. // during the same section of a journey), we first compare the geometries of the drive tracks
  7618. // attached to any URs which have them - as this is based on the users GPS position rather than
  7619. // the WME map data, it makes it vanishingly unlikely that any two users would have identical
  7620. // GPS positions (especially given the level of accuracy to which the track points are stored)
  7621. // even if they were driving exactly the same route at the same speed, in the same lane etc.
  7622. //
  7623. // To accelerate this geometry comparison, we start by performing a simple bounding box overlap
  7624. // check for the two geometries under consideration - if there's no overlap then there can't be
  7625. // any geometry match, so no need to continue onto the more detailed comparision of the GPS
  7626. // tracks themselves...
  7627. let driveGeos = uroGetURDriveGeoms();
  7628. if(driveGeos.length > 1)
  7629. {
  7630. for(let i = 0; i < (driveGeos.length - 1); ++i)
  7631. {
  7632. if(driveGeos[i].length !== 5)
  7633. {
  7634. driveGeos[i][1] = false;
  7635. }
  7636. else
  7637. {
  7638. for(let j = (i + 1); j < driveGeos.length; ++j)
  7639. {
  7640. if(driveGeos[j].length === 5)
  7641. {
  7642. let geoMatch = uroCompareDriveBBoxes(driveGeos[i][3], driveGeos[j][3]);
  7643. if(geoMatch === true)
  7644. {
  7645. geoMatch = uroCompareDriveGeos(driveGeos[i][4], driveGeos[j][4]);
  7646. if(geoMatch === true)
  7647. {
  7648. driveGeos[i][2].push(driveGeos[j][0]);
  7649. driveGeos[j][2].push(driveGeos[i][0]);
  7650. }
  7651. }
  7652. }
  7653. }
  7654. }
  7655. }
  7656.  
  7657. for(let i = 0; i < driveGeos.length; ++i)
  7658. {
  7659. if(driveGeos[i][2].length > 0)
  7660. {
  7661. let res = [];
  7662. res.push(driveGeos[i][0]);
  7663. res.push(driveGeos[i][2]);
  7664. uroURDupes.push(res);
  7665. }
  7666. }
  7667. }
  7668.  
  7669. // Once we've done the initial drive track comparision, uroURDupes will contain a list of
  7670. // all the URs which were matched up based on that. However, as the track comparision is
  7671. // inherently limited by the amount of track data included with each UR, this initial
  7672. // comparison may mean some more widely spaced URs aren't flagged as duplicates simply
  7673. // because there's insufficient overlap between their tracks, even though there may have
  7674. // been further URs dropped inbetween to which they were matched.
  7675. //
  7676. // e.g. if a user drops 4 URs along a section of their journey, spaced such that each of
  7677. // the GPS tracks generates a comparison match with the UR either side of it, but no
  7678. // further than that, we would get:
  7679. //
  7680. // UR A......UR B.......UR C......UR D
  7681. //
  7682. // Matches: A to B, B to A & C, C to B & D, D to C
  7683. //
  7684. // Note how, although we know all of these URs are in fact duplicates, and can infer this
  7685. // from seeing that e.g. A is flagged only as a duplicate of B, however as B is flagged as
  7686. // a duplicate of A & C, and C is flagged as a duplicate of B & D, A MUST therefore be a
  7687. // duplicate of B, C & D...
  7688. //
  7689. // To fix this, we now run a merging pass over each of the entries in uroURDupes - for
  7690. // each entry we see if its ID appears in any of the other entries as a duplicate, and
  7691. // if so we merge the duplicates for both entries.
  7692.  
  7693. for(let i = 0; i < uroURDupes.length; ++i)
  7694. {
  7695. let urID = uroURDupes[i][0];
  7696. for(let j = 0; j < uroURDupes.length; ++j)
  7697. {
  7698. if(i != j)
  7699. {
  7700. if(uroURDupes[j][1].includes(urID) === true)
  7701. {
  7702. // https://stackoverflow.com/questions/1584370/how-to-merge-two-arrays-in-javascript-and-de-duplicate-items
  7703. let mergedDupes = [...new Set([...uroURDupes[i][1], ...uroURDupes[j][1]])];
  7704. uroURDupes[i][1] = mergedDupes;
  7705. uroURDupes[j][1] = mergedDupes;
  7706. }
  7707. }
  7708. }
  7709. }
  7710. }
  7711. function uroFilterURs()
  7712. {
  7713. let pmTStart = performance.now();
  7714. let pmFunction = "uroFilterURs";
  7715.  
  7716. if(uroUserID === -1)
  7717. {
  7718. return;
  7719. }
  7720.  
  7721. if(uroInhibitURFiltering === true)
  7722. {
  7723. return;
  7724. }
  7725.  
  7726.  
  7727. // compatibility fix for URComments - based on code supplied by RickZabel
  7728. let hasActiveURFilters = false;
  7729. if(uroIsFilteringEnabled(false) === true)
  7730. {
  7731. let urTabInputs = uroTabs.CtrlTabs[uroTabs.IDS.URS][uroTabs.FIELDS.TABBODY].getElementsByTagName('input');
  7732. for(let loop = 0; loop < urTabInputs.length; loop++)
  7733. {
  7734. if(urTabInputs[loop].type == 'checkbox')
  7735. {
  7736. let ignoreCB = false;
  7737. ignoreCB = ignoreCB || (urTabInputs[loop].id == '_cbCaseInsensitive');
  7738. ignoreCB = ignoreCB || (urTabInputs[loop].id == '_cbNoFilterForTaggedURs');
  7739. if((urTabInputs[loop].checked) && (ignoreCB === false))
  7740. {
  7741. hasActiveURFilters = true;
  7742. break;
  7743. }
  7744. }
  7745. }
  7746. }
  7747. sessionStorage.UROverview_hasActiveURFilters = hasActiveURFilters;
  7748. if(uroFilterPreamble() === false) return;
  7749. uroRefreshUpdateRequestSessions();
  7750. let selectorResolver = document.getElementById('_selectURResolverID');
  7751. let selectorCommentUser = document.getElementById('_selectURUserID');
  7752. if(uroUtils.GetCBChecked('_cbURResolverIDFilter') === false)
  7753. {
  7754. while(selectorResolver.options.length > 0)
  7755. {
  7756. selectorResolver.options.remove(0);
  7757. }
  7758. }
  7759. if(uroUtils.GetCBChecked('_cbURUserIDFilter') === false)
  7760. {
  7761. while(selectorCommentUser.options.length > 0)
  7762. {
  7763. selectorCommentUser.options.remove(0);
  7764. }
  7765. }
  7766. if(Object.keys(W.model.updateRequestSessions.objects).length === 0)
  7767. {
  7768. // This may be the case if the user has disabled the UR layer, so call
  7769. // AddCommentCounts to clear any existing ones from the map view...
  7770. uroURExtras.AddCommentCounts();
  7771. return;
  7772. }
  7773. let commenterUser = null;
  7774. if(uroUtils.GetCBChecked('_cbURUserIDFilter') === true)
  7775. {
  7776. if(selectorCommentUser.options.length === 0)
  7777. {
  7778. uroUpdateEditorList(W.model.updateRequestSessions.objects, '_selectURUserID', false, false, false, true);
  7779. }
  7780. if(selectorCommentUser.selectedOptions[0] != null)
  7781. {
  7782. commenterUser = parseInt(selectorCommentUser.selectedOptions[0].value);
  7783. }
  7784. }
  7785. let resolverUser = null;
  7786. if(uroUtils.GetCBChecked('_cbURResolverIDFilter') === true)
  7787. {
  7788. if(selectorResolver.options.length === 0)
  7789. {
  7790. uroUpdateEditorList(W.model.mapUpdateRequests.objects, '_selectURResolverID', false, false, true, false);
  7791. }
  7792. if(selectorResolver.selectedOptions[0] != null)
  7793. {
  7794. resolverUser = parseInt(selectorResolver.selectedOptions[0].value);
  7795. }
  7796. }
  7797. uroURExtras.urList = [];
  7798. uroGetURDupes();
  7799.  
  7800. let uFURs_masterEnable = uroIsFilteringEnabled(false);
  7801. let filterOutsideEditableArea = uroUtils.GetCBChecked('_cbURFilterOutsideArea');
  7802. let filterInsideManagedAreas = uroUtils.GetCBChecked('_cbURFilterInsideManagedAreas');
  7803. let filterSolved = uroUtils.GetCBChecked('_cbFilterSolved');
  7804. let filterUnidentified = uroUtils.GetCBChecked('_cbFilterUnidentified');
  7805. let filterClosed = uroUtils.GetCBChecked('_cbFilterClosedUR');
  7806. let filterOpen = uroUtils.GetCBChecked('_cbFilterOpenUR');
  7807. let filterDescMustBePresent = uroUtils.GetCBChecked('_cbURDescriptionMustBePresent');
  7808. let filterDescMustBeAbsent = uroUtils.GetCBChecked('_cbURDescriptionMustBeAbsent');
  7809. let filterKeywordMustBePresent = uroUtils.GetCBChecked('_cbEnableKeywordMustBePresent');
  7810. let filterKeywordMustBeAbsent = uroUtils.GetCBChecked('_cbEnableKeywordMustBeAbsent');
  7811. let filterMinURAge = uroUtils.GetCBChecked('_cbEnableMinAgeFilter');
  7812. let filterMaxURAge = uroUtils.GetCBChecked('_cbEnableMaxAgeFilter');
  7813. let filterMinComments = uroUtils.GetCBChecked('_cbEnableMinCommentsFilter');
  7814. let filterMaxComments = uroUtils.GetCBChecked('_cbEnableMaxCommentsFilter');
  7815. let filterReporterLastCommenter = uroUtils.GetCBChecked('_cbHideIfReporterLastCommenter');
  7816. let filterReporterNotLastCommenter = uroUtils.GetCBChecked('_cbHideIfReporterNotLastCommenter');
  7817. let filterHideAnyComments = uroUtils.GetCBChecked('_cbHideAnyComments');
  7818. let filterHideNotLastCommenter = uroUtils.GetCBChecked('_cbHideIfNotLastCommenter');
  7819. let filterHideMyComments = uroUtils.GetCBChecked('_cbHideMyComments');
  7820. let filterIfLastCommenter = uroUtils.GetCBChecked('_cbHideIfLastCommenter');
  7821. let filterIfNotLastCommenter = uroUtils.GetCBChecked('_cbHideIfNotLastCommenter');
  7822. let filterCommentMinAge = uroUtils.GetCBChecked('_cbEnableCommentAgeFilter2');
  7823. let filterCommentMaxAge = uroUtils.GetCBChecked('_cbEnableCommentAgeFilter');
  7824. let filterUserID = uroUtils.GetCBChecked('_cbURUserIDFilter');
  7825. let filterMyFollowed = uroUtils.GetCBChecked('_cbHideMyFollowed');
  7826. let filterMyUnfollowed = uroUtils.GetCBChecked('_cbHideMyUnfollowed');
  7827.  
  7828. let filterWazeAuto = uroUtils.GetCBChecked('_cbFilterWazeAuto');
  7829. let filterRoadworks = uroUtils.GetCBChecked('_cbFilterRoadworks');
  7830. let filterConstruction = uroUtils.GetCBChecked('_cbFilterConstruction');
  7831. let filterClosure = uroUtils.GetCBChecked('_cbFilterClosure');
  7832. let filterEvent = uroUtils.GetCBChecked('_cbFilterEvent');
  7833. let filterNote = uroUtils.GetCBChecked('_cbFilterNote');
  7834. let filterWSLM = uroUtils.GetCBChecked('_cbFilterWSLM');
  7835. let filterBOG = uroUtils.GetCBChecked('_cbFilterBOG');
  7836. let filterDifficult = uroUtils.GetCBChecked('_cbFilterDifficult');
  7837.  
  7838. let filterIncorrectTurn = uroUtils.GetCBChecked('_cbFilterIncorrectTurn');
  7839. let filterIncorrectAddress = uroUtils.GetCBChecked('_cbFilterIncorrectAddress');
  7840. let filterIncorrectRoute = uroUtils.GetCBChecked('_cbFilterIncorrectRoute');
  7841. let filterMissingRoundabout = uroUtils.GetCBChecked('_cbFilterMissingRoundabout');
  7842. let filterGeneralError = uroUtils.GetCBChecked('_cbFilterGeneralError');
  7843. let filterTurnNotAllowed = uroUtils.GetCBChecked('_cbFilterTurnNotAllowed');
  7844. let filterIncorrectJunction = uroUtils.GetCBChecked('_cbFilterIncorrectJunction');
  7845. let filterMissingBridgeOverpass = uroUtils.GetCBChecked('_cbFilterMissingBridgeOverpass');
  7846. let filterWrongDrivingDirection = uroUtils.GetCBChecked('_cbFilterWrongDrivingDirection');
  7847. let filterMissingExit = uroUtils.GetCBChecked('_cbFilterMissingExit');
  7848. let filterMissingRoad = uroUtils.GetCBChecked('_cbFilterMissingRoad');
  7849. let filterMissingLandmark = uroUtils.GetCBChecked('_cbFilterMissingLandmark');
  7850. let filterNativeSpeedLimit = uroUtils.GetCBChecked('_cbFilterSpeedLimits');
  7851. let filterBlockedRoad = uroUtils.GetCBChecked('_cbFilterBlockedRoad');
  7852. let filterUndefined = uroUtils.GetCBChecked('_cbFilterUndefined');
  7853.  
  7854. let invertURFilters = uroUtils.GetCBChecked('_cbInvertURFilter');
  7855. let invertURStateFilters = uroUtils.GetCBChecked('_cbInvertURStateFilter');
  7856. let noFilterTaggedURs = uroUtils.GetCBChecked('_cbNoFilterForTaggedURs');
  7857. let noFilterURInURL = uroUtils.GetCBChecked('_cbNoFilterForURInURL');
  7858. let showOnlyDupes = uroUtils.GetCBChecked('_cbURFilterDupes');
  7859.  
  7860. let keywordPresent = uroUtils.GetElmValue('_textKeywordPresent');
  7861. let keywordAbsent = uroUtils.GetElmValue('_textKeywordAbsent');
  7862. let caseInsensitive = uroUtils.GetCBChecked('_cbCaseInsensitive');
  7863. let thresholdMinAge = uroUtils.GetElmValue('_inputFilterMinDays');
  7864. let thresholdMaxAge = uroUtils.GetElmValue('_inputFilterMaxDays');
  7865. let thresholdMinComments = uroUtils.GetElmValue('_inputFilterMinComments');
  7866. let thresholdMaxComments = uroUtils.GetElmValue('_inputFilterMaxComments');
  7867. let thresholdMaxCommentAge = uroUtils.GetElmValue('_inputFilterCommentDays');
  7868. let thresholdMinCommentAge = uroUtils.GetElmValue('_inputFilterCommentDays2');
  7869. let ignoreOtherEditorComments = uroUtils.GetCBChecked('_cbIgnoreOtherEditorComments');
  7870. let urcFilteringIsActive = false;
  7871. let urcCB = document.getElementById('URCommentsFilterEnabled');
  7872. if(urcCB !== null)
  7873. {
  7874. if(urcCB.checked)
  7875. {
  7876. urcFilteringIsActive = true;
  7877. }
  7878. }
  7879. urcCB = document.getElementById('URCommentUROOnlyMyUR');
  7880. if(urcCB !== null)
  7881. {
  7882. if(urcCB.checked)
  7883. {
  7884. urcFilteringIsActive = true;
  7885. }
  7886. }
  7887. urcCB = document.getElementById('URCommentUROHideTagged');
  7888. if(urcCB !== null)
  7889. {
  7890. if(urcCB.checked)
  7891. {
  7892. urcFilteringIsActive = true;
  7893. }
  7894. }
  7895.  
  7896. filterInsideManagedAreas = filterInsideManagedAreas && (uroGetManagedAreas() !== 0);
  7897. if(uroUtils.GetCBChecked('_cbURExcludeUserArea') == true)
  7898. {
  7899. uroIgnoreAreasUserID = W.loginManager.user.attributes.id;
  7900. }
  7901.  
  7902. for (let urobj in W.model.mapUpdateRequests.objects)
  7903. {
  7904. if(W.model.mapUpdateRequests.objects.hasOwnProperty(urobj))
  7905. {
  7906. let ureq = W.model.mapUpdateRequests.objects[urobj];
  7907. let ureqID = ureq.attributes.id;
  7908.  
  7909. let urStyle = 'visible';
  7910. let inhibitFiltering = ((ureqID == uroSelectedURID) && (noFilterURInURL));
  7911.  
  7912. let hasMyComments = false;
  7913. let nComments = 0;
  7914. let desc = ureq.attributes.description;
  7915. let customType = uroGetCustomType(ureqID, uroLayers.ID.UR, desc);
  7916. let ageLastComment = null;
  7917. if(W.model.updateRequestSessions.objects[ureqID] != null)
  7918. {
  7919. nComments = W.model.updateRequestSessions.objects[ureqID].attributes.comments.length;
  7920. if(nComments != 0)
  7921. {
  7922. ageLastComment = uroUtils.GetCommentAge(W.model.updateRequestSessions.objects[ureqID].attributes.comments[nComments-1]);
  7923. }
  7924. if((uFURs_masterEnable === false) && (nComments === 0))
  7925. {
  7926. // when master enable is turned off, we want to make sure that all URs, including ones that were previously hidden, are correctly
  7927. // displayed in their native form - i.e. no comment count or custom conversation bubbles. The easiest way to achieve this is to
  7928. // force the AddCommentCounts code to test for the presence of these bubbles on each UR, which we do by setting a non-zero
  7929. // comment count for each UR... For URs which genuinely do have no comments we use -1 to indicate that we're not really setting
  7930. // a comment count, but that we still need to do something that wouldn't be achieved by using 0.
  7931. nComments = -1;
  7932. }
  7933. }
  7934.  
  7935. // check UR against current session ignore list...
  7936. if(uroIgnore.IsOnList(ureqID)) urStyle = 'hidden';
  7937.  
  7938. if((uFURs_masterEnable === true) && (inhibitFiltering === false))
  7939. {
  7940. let wazeauto_ur = false;
  7941. let ukroadworks_ur = false;
  7942. let construction_ur = false;
  7943. let closure_ur = false;
  7944. let event_ur = false;
  7945. let note_ur = false;
  7946. let wslm_ur = false;
  7947. let bog_ur = false;
  7948. let difficult_ur = false;
  7949.  
  7950. let filterByNotIncludedKeyword = false;
  7951. let filterByIncludedKeyword = true;
  7952.  
  7953. if(desc !== null) desc = desc.replace(/<\/?[^>]+(>|$)/g, "");
  7954. else desc = '';
  7955.  
  7956. if(customType === 0) ukroadworks_ur = true;
  7957. else if(customType === 1) construction_ur = true;
  7958. else if(customType === 2) closure_ur = true;
  7959. else if(customType === 3) event_ur = true;
  7960. else if(customType === 4) note_ur = true;
  7961. else if(customType === 5) wslm_ur = true;
  7962. else if(customType === 6) bog_ur = true;
  7963. else if(customType === 7) difficult_ur = true;
  7964.  
  7965. // check UR against editable area...
  7966.  
  7967. if(filterOutsideEditableArea === true)
  7968. {
  7969. if(ureq.canEdit() === false) urStyle = 'hidden';
  7970. }
  7971.  
  7972. if(filterInsideManagedAreas === true)
  7973. {
  7974. if(uroCheckGeometryWithinManagedAreas(ureq.attributes.geoJSONGeometry.coordinates) === true) urStyle = 'hidden';
  7975. }
  7976.  
  7977. if(showOnlyDupes === true)
  7978. {
  7979. let isDupe = false;
  7980. for(let i = 0; i < uroURDupes.length; ++i)
  7981. {
  7982. if(uroURDupes[i][0] === ureqID)
  7983. {
  7984. isDupe = true;
  7985. break;
  7986. }
  7987. }
  7988. if(isDupe === false) urStyle = 'hidden';
  7989. }
  7990.  
  7991. // state-age filtering
  7992. if(urStyle == 'visible')
  7993. {
  7994. // check against closed/not identified filtering if enabled...
  7995. if(filterSolved === true)
  7996. {
  7997. if(ureq.attributes.resolution === 0) urStyle = 'hidden';
  7998. }
  7999. if(filterUnidentified === true)
  8000. {
  8001. if(ureq.attributes.resolution == 1) urStyle = 'hidden';
  8002. }
  8003.  
  8004. if((ureq.attributes.resolvedOn !== null) && (filterClosed === true))
  8005. {
  8006. urStyle = 'hidden';
  8007. }
  8008.  
  8009. if((ureq.attributes.resolvedOn === null) && (filterOpen === true))
  8010. {
  8011. urStyle = 'hidden';
  8012. }
  8013.  
  8014. if(urStyle == 'visible')
  8015. {
  8016. // check UR against keyword filtering if enabled...
  8017. if(filterDescMustBePresent === true)
  8018. {
  8019. if(desc === '') urStyle = 'hidden';
  8020. }
  8021. if(filterDescMustBeAbsent === true)
  8022. {
  8023. if(desc !== '') urStyle = 'hidden';
  8024. }
  8025.  
  8026. if(filterKeywordMustBePresent === true)
  8027. {
  8028. let keywordIsPresentInDesc = uroUtils.KeywordPresent(desc,keywordPresent,caseInsensitive);
  8029. filterByIncludedKeyword = (filterByIncludedKeyword && (!keywordIsPresentInDesc));
  8030. }
  8031. if(filterKeywordMustBeAbsent === true)
  8032. {
  8033. let keywordIsAbsentInDesc = uroUtils.KeywordPresent(desc,keywordAbsent,caseInsensitive);
  8034. filterByNotIncludedKeyword = (filterByNotIncludedKeyword || keywordIsAbsentInDesc);
  8035. }
  8036. }
  8037.  
  8038. if(urStyle == 'visible')
  8039. {
  8040. // do age-based filtering if enabled
  8041. if(filterMinURAge === true)
  8042. {
  8043. if(uroUtils.GetURAge(ureq,0,false) < thresholdMinAge) urStyle = 'hidden';
  8044. }
  8045. if(filterMaxURAge === true)
  8046. {
  8047. if(uroUtils.GetURAge(ureq,0,false) > thresholdMaxAge) urStyle = 'hidden';
  8048. }
  8049. }
  8050.  
  8051. if(urStyle == 'visible')
  8052. {
  8053. if(resolverUser !== null)
  8054. {
  8055. if(ureq.attributes.resolvedBy != resolverUser) urStyle = 'hidden';
  8056. }
  8057. }
  8058.  
  8059. if(urStyle == 'visible')
  8060. {
  8061. // do comments/following filtering
  8062. if(W.model.updateRequestSessions.objects[ureqID] != null)
  8063. {
  8064. nComments = W.model.updateRequestSessions.objects[ureqID].attributes.comments.length;
  8065. let commentDaysOld = -1;
  8066.  
  8067.  
  8068. if(filterMinComments === true)
  8069. {
  8070. if(nComments < thresholdMinComments) urStyle = 'hidden';
  8071. }
  8072. if(filterMaxComments === true)
  8073. {
  8074. if(nComments > thresholdMaxComments) urStyle = 'hidden';
  8075. }
  8076.  
  8077.  
  8078. if(nComments > 0)
  8079. {
  8080. let reporterIsLastCommenter = false;
  8081. if(W.model.updateRequestSessions.objects[ureqID].attributes.comments[nComments-1].userID == -1) reporterIsLastCommenter = true;
  8082.  
  8083. if(filterReporterLastCommenter === true)
  8084. {
  8085. if(reporterIsLastCommenter === true) urStyle = 'hidden';
  8086. }
  8087. else if(filterReporterNotLastCommenter === true)
  8088. {
  8089. if(reporterIsLastCommenter === false) urStyle = 'hidden';
  8090. }
  8091.  
  8092. hasMyComments = uroURHasMyComments(ureqID);
  8093. if(hasMyComments === false)
  8094. {
  8095. if(filterHideAnyComments === true) urStyle = 'hidden';
  8096. if(filterHideNotLastCommenter === true) urStyle = 'hidden';
  8097. }
  8098. else
  8099. {
  8100. if(filterHideMyComments === true) urStyle = 'hidden';
  8101.  
  8102. let userIsLastCommenter = false;
  8103. if(W.model.updateRequestSessions.objects[ureqID].attributes.comments[nComments-1].userID == uroUserID) userIsLastCommenter = true;
  8104.  
  8105. if(filterIfLastCommenter === true)
  8106. {
  8107. if(userIsLastCommenter === true) urStyle = 'hidden';
  8108. }
  8109. else if(filterIfNotLastCommenter === true)
  8110. {
  8111. if(userIsLastCommenter === false) urStyle = 'hidden';
  8112. }
  8113. }
  8114.  
  8115. let cidx;
  8116. if(ignoreOtherEditorComments === false)
  8117. {
  8118. commentDaysOld = ageLastComment;
  8119. }
  8120. else
  8121. {
  8122. for(cidx=0; cidx<nComments; cidx++)
  8123. {
  8124. let cObj = W.model.updateRequestSessions.objects[ureqID].attributes.comments[cidx];
  8125. if((cObj.userID == uroUserID) || (cObj.userID == -1))
  8126. {
  8127. commentDaysOld = uroUtils.GetCommentAge(cObj);
  8128. }
  8129. }
  8130. }
  8131. if((filterCommentMinAge === true) && (commentDaysOld != -1))
  8132. {
  8133. if(thresholdMinCommentAge > commentDaysOld) urStyle = 'hidden';
  8134. }
  8135. if((filterCommentMaxAge === true) && (commentDaysOld != -1))
  8136. {
  8137. if(thresholdMaxCommentAge < commentDaysOld) urStyle = 'hidden';
  8138. }
  8139.  
  8140. if((commenterUser !== null) && (urStyle != 'hidden'))
  8141. {
  8142. urStyle = 'hidden';
  8143. for(cidx=0; cidx<nComments; cidx++)
  8144. {
  8145. if(W.model.updateRequestSessions.objects[ureqID].attributes.comments[cidx].userID == commenterUser)
  8146. {
  8147. urStyle = 'visible';
  8148. break;
  8149. }
  8150. }
  8151. }
  8152.  
  8153. let commentText = '';
  8154. for(cidx=0; cidx<nComments; cidx++)
  8155. {
  8156. commentText += W.model.updateRequestSessions.objects[ureqID].attributes.comments[cidx].text;
  8157. }
  8158.  
  8159. if(filterKeywordMustBePresent === true)
  8160. {
  8161. let keywordIsPresentInComments = uroUtils.KeywordPresent(commentText,keywordPresent,caseInsensitive);
  8162. filterByIncludedKeyword = (filterByIncludedKeyword && (!keywordIsPresentInComments));
  8163. }
  8164. if(filterKeywordMustBeAbsent === true)
  8165. {
  8166. let keywordIsAbsentInComments = uroUtils.KeywordPresent(commentText,keywordAbsent,caseInsensitive);
  8167. filterByNotIncludedKeyword = (filterByNotIncludedKeyword || keywordIsAbsentInComments);
  8168. }
  8169. }
  8170. else
  8171. {
  8172. if(filterUserID === true)
  8173. {
  8174. urStyle = 'hidden';
  8175. }
  8176. }
  8177.  
  8178. filterByNotIncludedKeyword = (filterByNotIncludedKeyword && filterKeywordMustBeAbsent);
  8179. filterByIncludedKeyword = (filterByIncludedKeyword && filterKeywordMustBePresent);
  8180. if(filterByNotIncludedKeyword || filterByIncludedKeyword)
  8181. {
  8182. urStyle = 'hidden';
  8183. }
  8184.  
  8185. if(W.model.updateRequestSessions.objects[ureqID].attributes.isFollowing === true)
  8186. {
  8187. if(filterMyFollowed === true) urStyle = 'hidden';
  8188. }
  8189. else
  8190. {
  8191. if(filterMyUnfollowed === true) urStyle = 'hidden';
  8192. }
  8193. }
  8194. }
  8195.  
  8196. if(invertURStateFilters === true)
  8197. {
  8198. if(urStyle == 'hidden') urStyle = 'visible';
  8199. else urStyle = 'hidden';
  8200. }
  8201. }
  8202.  
  8203. // type filtering
  8204. if(urStyle == 'visible')
  8205. {
  8206. // Test for Waze automatic URs before any others - these always (?) get inserted as General Error URs,
  8207. // so we can't filter them by type...
  8208. if(desc.indexOf('Waze Automatic:') != -1)
  8209. {
  8210. wazeauto_ur = true;
  8211. }
  8212.  
  8213. if(wazeauto_ur === true)
  8214. {
  8215. if(filterWazeAuto === true) urStyle = 'hidden';
  8216. }
  8217.  
  8218. else if(ukroadworks_ur === true)
  8219. {
  8220. if(filterRoadworks === true) urStyle = 'hidden';
  8221. }
  8222. else if(construction_ur === true)
  8223. {
  8224. if(filterConstruction === true) urStyle = 'hidden';
  8225. }
  8226. else if(closure_ur === true)
  8227. {
  8228. if(filterClosure === true) urStyle = 'hidden';
  8229. }
  8230. else if(event_ur === true)
  8231. {
  8232. if(filterEvent === true) urStyle = 'hidden';
  8233. }
  8234. else if(note_ur === true)
  8235. {
  8236. if(filterNote === true) urStyle = 'hidden';
  8237. }
  8238. else if(wslm_ur === true)
  8239. {
  8240. if(filterWSLM === true) urStyle = 'hidden';
  8241. }
  8242. else if(bog_ur === true)
  8243. {
  8244. if(filterBOG === true) urStyle = 'hidden';
  8245. }
  8246. else if(difficult_ur === true)
  8247. {
  8248. if(filterDifficult === true) urStyle = 'hidden';
  8249. }
  8250.  
  8251. else if(ureq.attributes.type == 6)
  8252. {
  8253. if(filterIncorrectTurn === true) urStyle = 'hidden';
  8254. }
  8255. else if(ureq.attributes.type == 7)
  8256. {
  8257. if (filterIncorrectAddress === true) urStyle = 'hidden';
  8258. }
  8259. else if(ureq.attributes.type == 8)
  8260. {
  8261. if(filterIncorrectRoute === true) urStyle = 'hidden';
  8262. }
  8263. else if(ureq.attributes.type == 9)
  8264. {
  8265. if(filterMissingRoundabout === true) urStyle = 'hidden';
  8266. }
  8267. else if(ureq.attributes.type == 10)
  8268. {
  8269. if(filterGeneralError === true) urStyle = 'hidden';
  8270. }
  8271. else if(ureq.attributes.type == 11)
  8272. {
  8273. if(filterTurnNotAllowed === true) urStyle = 'hidden';
  8274. }
  8275. else if(ureq.attributes.type == 12)
  8276. {
  8277. if(filterIncorrectJunction === true) urStyle = 'hidden';
  8278. }
  8279. else if(ureq.attributes.type == 13)
  8280. {
  8281. if(filterMissingBridgeOverpass === true) urStyle = 'hidden';
  8282. }
  8283. else if(ureq.attributes.type == 14)
  8284. {
  8285. if(filterWrongDrivingDirection === true) urStyle = 'hidden';
  8286. }
  8287. else if(ureq.attributes.type == 15)
  8288. {
  8289. if(filterMissingExit === true) urStyle = 'hidden';
  8290. }
  8291. else if(ureq.attributes.type == 16)
  8292. {
  8293. if(filterMissingRoad === true) urStyle = 'hidden';
  8294. }
  8295. else if(ureq.attributes.type == 18)
  8296. {
  8297. if(filterMissingLandmark === true) urStyle = 'hidden';
  8298. }
  8299. else if(ureq.attributes.type == 19)
  8300. {
  8301. if(filterBlockedRoad === true) urStyle = 'hidden';
  8302. }
  8303. else if(ureq.attributes.type == 23)
  8304. {
  8305. if(filterNativeSpeedLimit === true) urStyle = 'hidden';
  8306. }
  8307. else if(filterUndefined === true) urStyle = 'hidden';
  8308.  
  8309. if(invertURFilters === true)
  8310. {
  8311. if(urStyle == 'hidden') urStyle = 'visible';
  8312. else urStyle = 'hidden';
  8313. }
  8314. }
  8315.  
  8316. // stage-age filtering override for tagged URs
  8317. if(noFilterTaggedURs === true)
  8318. {
  8319. if(ukroadworks_ur === true)
  8320. {
  8321. if(filterRoadworks === false) urStyle = 'visible';
  8322. }
  8323. else if(construction_ur === true)
  8324. {
  8325. if(filterConstruction === false) urStyle = 'visible';
  8326. }
  8327. else if(closure_ur === true)
  8328. {
  8329. if(filterClosure === false) urStyle = 'visible';
  8330. }
  8331. else if(event_ur === true)
  8332. {
  8333. if(filterEvent === false) urStyle = 'visible';
  8334. }
  8335. else if(note_ur === true)
  8336. {
  8337. if(filterNote === false) urStyle = 'visible';
  8338. }
  8339. else if(wslm_ur === true)
  8340. {
  8341. if(filterWSLM === false) urStyle = 'visible';
  8342. }
  8343. }
  8344. }
  8345. // only touch marker visibility if we've got active filter settings, or if URComments is not
  8346. // doing any filtering of its own
  8347. if((hasActiveURFilters === true) || (urcFilteringIsActive === false) || (uFURs_masterEnable === false))
  8348. {
  8349. let urMarker = uroGetMarker(uroLayers.ID.UR,urobj);
  8350. if(urMarker !== null)
  8351. {
  8352. urMarker.style.visibility = urStyle;
  8353. }
  8354. }
  8355. if(urStyle != 'hidden')
  8356. {
  8357. uroURExtras.AddToList(ureqID, customType, hasMyComments, nComments, ageLastComment);
  8358. }
  8359. }
  8360. }
  8361. uroURExtras.AddCommentCounts();
  8362. uroDBG.PerfMon(pmFunction, pmTStart);
  8363. }
  8364. function uroGetProblemTypes()
  8365. {
  8366. uroKnownProblemTypeIDs = [];
  8367. uroKnownProblemTypeNames = [];
  8368. let tProblemList = I18n.lookup("problems.types");
  8369. for(let tObj in tProblemList)
  8370. {
  8371. if(tObj !== undefined)
  8372. {
  8373. uroKnownProblemTypeIDs.push(parseInt(tObj));
  8374. uroKnownProblemTypeNames.push(tProblemList[tObj].title);
  8375. }
  8376. }
  8377. }
  8378. function uroFilterProblems()
  8379. {
  8380. let pmTStart = performance.now();
  8381. let pmFunction = "uroFilterProblems";
  8382.  
  8383. if(uroFilterPreamble() === false) return;
  8384. let selector;
  8385.  
  8386. if((uroUtils.GetCBChecked('_cbMPNotClosedUserIDFilter') === false) && (uroUtils.GetCBChecked('_cbMPClosedUserIDFilter') === false))
  8387. {
  8388. selector = document.getElementById('_selectMPUserID');
  8389. while(selector.options.length > 0)
  8390. {
  8391. selector.options.remove(0);
  8392. }
  8393. }
  8394.  
  8395. let solverUser = null;
  8396. if((uroUtils.GetCBChecked('_cbMPNotClosedUserIDFilter') === true) || (uroUtils.GetCBChecked('_cbMPClosedUserIDFilter') === true))
  8397. {
  8398. selector = document.getElementById('_selectMPUserID');
  8399. if(selector.options.length === 0)
  8400. {
  8401. uroUpdateEditorList(W.model.mapProblems.objects, '_selectMPUserID', false, false, true, false);
  8402. }
  8403. if(selector.selectedOptions[0] != null)
  8404. {
  8405. solverUser = parseInt(selector.selectedOptions[0].value);
  8406. }
  8407. }
  8408.  
  8409. let uFP_masterEnable = uroIsFilteringEnabled(false);
  8410. let filter_OutsideEditableArea = uroUtils.GetCBChecked('_cbMPFilterOutsideArea');
  8411. let filter_Solved = uroUtils.GetCBChecked('_cbMPFilterSolved');
  8412. let filter_Unidentified = uroUtils.GetCBChecked('_cbMPFilterUnidentified');
  8413. let filter_Closed = uroUtils.GetCBChecked('_cbMPFilterClosed');
  8414. let filter_NotClosedUserID = uroUtils.GetCBChecked('_cbMPNotClosedUserIDFilter');
  8415. let filter_ClosedUserID = uroUtils.GetCBChecked('_cbMPClosedUserIDFilter');
  8416. let filter_Reopened = uroUtils.GetCBChecked('_cbMPFilterReopenedProblem');
  8417.  
  8418. let filter_LowSeverity = uroUtils.GetCBChecked('_cbMPFilterLowSeverity');
  8419. let filter_MediumSeverity = uroUtils.GetCBChecked('_cbMPFilterMediumSeverity');
  8420. let filter_HighSeverity = uroUtils.GetCBChecked('_cbMPFilterHighSeverity');
  8421.  
  8422. let filterTypes = [];
  8423. let i;
  8424. for(i=0; i<uroKnownProblemTypeIDs.length; i++)
  8425. {
  8426. if(uroUtils.GetCBChecked('_cbMPFilter_T'+uroKnownProblemTypeIDs[i])) filterTypes.push(uroKnownProblemTypeIDs[i]);
  8427. }
  8428. let filter_TypeUnknown = uroUtils.GetCBChecked('_cbMPFilterUnknownProblem');
  8429.  
  8430. let filter_TaggedElgin = uroUtils.GetCBChecked('_cbFilterElgin');
  8431. let filter_TaggedTrafficCast = uroUtils.GetCBChecked('_cbFilterTrafficCast');
  8432. let filter_TaggedTrafficMaster = uroUtils.GetCBChecked('_cbFilterTrafficMaster');
  8433. let filter_TaggedCaltrans = uroUtils.GetCBChecked('_cbFilterCaltrans');
  8434. let filter_TaggedTFL = uroUtils.GetCBChecked('_cbFilterTFL');
  8435.  
  8436. let filter_Invert = uroUtils.GetCBChecked('_cbInvertMPFilter');
  8437.  
  8438. let filter_StartDateEnabled = uroUtils.GetCBChecked('_cbMPFilterStartDate');
  8439. let filter_EndDateEnabled = uroUtils.GetCBChecked('_cbMPFilterEndDate');
  8440. let filter_EndDatePassed = uroUtils.GetCBChecked('_cbMPFilterEndDatePassed');
  8441.  
  8442. let tsD = uroUtils.GetElmValue('_inputMPFilterStartDay');
  8443. let tsM = uroUtils.GetElmValue('_inputMPFilterStartMonth');
  8444. let tsY = uroUtils.GetElmValue('_inputMPFilterStartYear');
  8445. let startDate = uroUtils.GetTS(tsD, tsM, tsY, 0, 0);
  8446.  
  8447. tsD = uroUtils.GetElmValue('_inputMPFilterEndDay');
  8448. tsM = uroUtils.GetElmValue('_inputMPFilterEndMonth');
  8449. tsY = uroUtils.GetElmValue('_inputMPFilterEndYear');
  8450. let endDate = uroUtils.GetTS(tsD, tsM, tsY, 0, 0);
  8451. let nowTime = (new Date()).getTime();
  8452.  
  8453. for (let urobj in W.model.mapProblems.objects)
  8454. {
  8455. if(W.model.mapProblems.objects.hasOwnProperty(urobj))
  8456. {
  8457. let problem = W.model.mapProblems.objects[urobj];
  8458.  
  8459. if(problem.attributes.origJSONGeo === undefined)
  8460. {
  8461. // Store a copy of the original marker position if we haven't already done so
  8462. problem.attributes.origJSONGeo = uroUtils.CloneObject(problem.attributes.geoJSONGeometry);
  8463. }
  8464. else
  8465. {
  8466. // Restore the original position if we do have a copy of it, to undo any adjustments
  8467. // that may have been made in the last filtering pass
  8468. problem.attributes.geoJSONGeometry = uroUtils.CloneObject(problem.attributes.origJSONGeo);
  8469. }
  8470.  
  8471.  
  8472. let ureqID = problem.attributes.id;
  8473.  
  8474. let problemStyle = 'visible';
  8475. // check problem against current session ignore list...
  8476. if(uroIgnore.IsOnList(ureqID)) problemStyle = 'hidden';
  8477.  
  8478. if(uFP_masterEnable === true)
  8479. {
  8480. if(filter_OutsideEditableArea === true)
  8481. {
  8482. if(problem.canEdit() === false)
  8483. {
  8484. problemStyle = 'hidden';
  8485. }
  8486. }
  8487.  
  8488. if(filter_EndDatePassed == true)
  8489. {
  8490. if(problem.attributes.endTime > nowTime)
  8491. {
  8492. problemStyle = 'hidden';
  8493. }
  8494. }
  8495. if(filter_StartDateEnabled == true)
  8496. {
  8497. let tStart = new Date(problem.attributes.startTime);
  8498. tStart.setHours(0);
  8499. tStart.setMinutes(0);
  8500. tStart.setSeconds(0);
  8501. tStart = tStart.getTime();
  8502. if(tStart != startDate)
  8503. {
  8504. problemStyle = 'hidden';
  8505. }
  8506. }
  8507. if(filter_EndDateEnabled == true)
  8508. {
  8509. let tEnd = new Date(problem.attributes.endTime);
  8510. tEnd.setHours(0);
  8511. tEnd.setMinutes(0);
  8512. tEnd.setSeconds(0);
  8513. tEnd = tEnd.getTime();
  8514. if(tEnd != endDate)
  8515. {
  8516. problemStyle = 'hidden';
  8517. }
  8518. }
  8519.  
  8520. // check against closed/not identified filtering if enabled...
  8521. if(problem.geometry.id !== null)
  8522. {
  8523. if(document.getElementById(problem.geometry.id) !== null)
  8524. {
  8525. let problem_marker_img = document.getElementById(problem.geometry.id).href.baseVal;
  8526. if(filter_Solved === true)
  8527. {
  8528. if(problem_marker_img.indexOf('_solved') != -1) problemStyle = 'hidden';
  8529. }
  8530. if(filter_Unidentified === true)
  8531. {
  8532. if(problem_marker_img.indexOf('_rejected') != -1) problemStyle = 'hidden';
  8533. }
  8534. }
  8535. }
  8536.  
  8537. if(filter_Closed === true)
  8538. {
  8539. if(problem.attributes.open === false)
  8540. {
  8541. problemStyle = 'hidden';
  8542. }
  8543. }
  8544.  
  8545. if(problemStyle == 'visible')
  8546. {
  8547. if(solverUser !== null)
  8548. {
  8549. if((filter_NotClosedUserID === true) && (problem.attributes.resolvedBy == solverUser)) problemStyle = 'hidden';
  8550. if((filter_ClosedUserID === true) && (problem.attributes.resolvedBy != solverUser)) problemStyle = 'hidden';
  8551. }
  8552. }
  8553.  
  8554. if(problemStyle == 'visible')
  8555. {
  8556. let problemType = problem.attributes.subType;
  8557. let desc = '';
  8558. if(problem.attributes.description != null)
  8559. {
  8560. desc = problem.attributes.description;
  8561. }
  8562. let customType = uroGetCustomType(ureqID, uroLayers.ID.MP, desc);
  8563.  
  8564. if(customType === 100)
  8565. {
  8566. if(filter_TaggedElgin === true) problemStyle = 'hidden';
  8567. }
  8568. else if(customType === 101)
  8569. {
  8570. if(filter_TaggedTrafficCast === true) problemStyle = 'hidden';
  8571. }
  8572. else if(customType === 102)
  8573. {
  8574. if(filter_TaggedTrafficMaster === true) problemStyle = 'hidden';
  8575. }
  8576. else if(customType === 103)
  8577. {
  8578. if(filter_TaggedCaltrans === true) problemStyle = 'hidden';
  8579. }
  8580. else if(customType === 104)
  8581. {
  8582. if(filter_TaggedTFL === true) problemStyle = 'hidden';
  8583. }
  8584. else if(uroKnownProblemTypeIDs.indexOf(problemType) !== -1)
  8585. {
  8586. if(filterTypes.indexOf(problemType) !== -1)
  8587. {
  8588. problemStyle = 'hidden';
  8589. }
  8590. }
  8591. else if(filter_TypeUnknown === true) problemStyle = 'hidden';
  8592.  
  8593. if(filter_Reopened === true)
  8594. {
  8595. if((problem.attributes.open === true) && (problem.attributes.resolvedOn !== null))
  8596. {
  8597. problemStyle = 'hidden';
  8598. }
  8599. }
  8600.  
  8601.  
  8602. if(filter_Invert === true)
  8603. {
  8604. if(problemStyle == 'hidden') problemStyle = 'visible';
  8605. else problemStyle = 'hidden';
  8606. }
  8607.  
  8608.  
  8609. if(problem.attributes.weight <= 3)
  8610. {
  8611. if(filter_LowSeverity === true) problemStyle = 'hidden';
  8612. }
  8613. else if(problem.attributes.weight <= 7)
  8614. {
  8615. if(filter_MediumSeverity === true) problemStyle = 'hidden';
  8616. }
  8617. else if(filter_HighSeverity === true) problemStyle = 'hidden';
  8618. }
  8619. }
  8620.  
  8621. let marker = uroGetMarker(uroLayers.ID.MP, urobj);
  8622. if(marker !== null)
  8623. {
  8624. marker.style.visibility = problemStyle;
  8625. if(problemStyle === 'hidden')
  8626. {
  8627. // To ensure WME displays the details for the topmost marker that's
  8628. // left visible in a stack, alter the coords for any hidden markers
  8629. // to place them in a location that isn't likely to be clicked on...
  8630. problem.attributes.geoJSONGeometry.coordinates[0] = 0;
  8631. problem.attributes.geoJSONGeometry.coordinates[1] = 90;
  8632. }
  8633. }
  8634. }
  8635. }
  8636.  
  8637. uroDBG.PerfMon(pmFunction, pmTStart);
  8638. }
  8639. function uroFilterPreamble()
  8640. {
  8641. let mapviewport = document.getElementsByClassName("olMapViewport")[0];
  8642. if(mapviewport === null)
  8643. {
  8644. if(uroNullMapViewport === false)
  8645. {
  8646. uroDBG.AddLog('caught null mapviewport');
  8647. uroNullMapViewport = true;
  8648. }
  8649. return false;
  8650. }
  8651.  
  8652. let uiElms = uroTabs.CtrlTabs[uroTabs.IDS.MISC][uroTabs.FIELDS.TABBODY];
  8653. if(uiElms == null)
  8654. {
  8655. uroDBG.AddLog('caught missing UI');
  8656. return false;
  8657. }
  8658. if(uiElms.innerHTML.length === 0)
  8659. {
  8660. uroDBG.AddLog('caught empty UI');
  8661. return false;
  8662. }
  8663.  
  8664. if(uroSettingsApplied === false)
  8665. {
  8666. return false;
  8667. }
  8668.  
  8669. uroNullMapViewport = false;
  8670.  
  8671. return true;
  8672. }
  8673. function uroFilterItems_MasterEnableClick()
  8674. {
  8675. if(uroUtils.GetCBChecked('_cbMasterEnable') === false)
  8676. {
  8677. uroPopup.Hide();
  8678. }
  8679. uroFilterItems();
  8680. }
  8681. function uroFilterItems()
  8682. {
  8683. uroFilterProblems();
  8684. uroFilterPlaces();
  8685. uroFilterCameras();
  8686. uroFilterURs();
  8687. uroFilterRTCs();
  8688. uroFilterRAs();
  8689. uroFilterMapComments();
  8690. }
  8691. function uroFilterItemsOnMove()
  8692. {
  8693. W.map.events.unregister('mousemove',null,uroFilterItemsOnMove);
  8694. uroFilterItems();
  8695. }
  8696. function uroDeleteObject()
  8697. {
  8698. uroDBG.AddLog('delete camera ID '+uroShownFID);
  8699. if(W.model.cameras.objects[uroShownFID] === null)
  8700. {
  8701. uroDBG.AddLog('camera object not found...');
  8702. return false;
  8703. }
  8704. uroOWL.RemoveCamFromWatchList();
  8705. let actionObj = require('Waze/Action/DeleteObject');
  8706. let deleteAction = new actionObj(W.model.cameras.objects[uroShownFID], null);
  8707. W.model.actionManager.add(deleteAction);
  8708. uroPopup.MouseOut();
  8709. uroPopup.Hide();
  8710. return false;
  8711. }
  8712. function uroCheckCommentsForTag(idSrc, customText)
  8713. {
  8714. let ursObj = W.model.updateRequestSessions.objects[idSrc];
  8715. if(typeof(ursObj) == 'undefined') return -1;
  8716. if(ursObj.attributes.comments.length === 0) return -1;
  8717.  
  8718. for(let idx=ursObj.attributes.comments.length-1; idx>=0; idx--)
  8719. {
  8720. for(let tag=0; tag<uroCustomURTags.length; tag++)
  8721. {
  8722. let keyword = uroCustomURTags[tag];
  8723. if(ursObj.attributes.comments[idx].text.indexOf(keyword) != -1)
  8724. {
  8725. return tag;
  8726. }
  8727. }
  8728.  
  8729. if(customText !== '')
  8730. {
  8731. if(ursObj.attributes.comments[idx].text.toLowerCase().indexOf(customText) != -1)
  8732. {
  8733. return 99;
  8734. }
  8735. }
  8736. }
  8737. return -1;
  8738. }
  8739. function uroGetCustomType(idSrc, markerType, desc)
  8740. {
  8741. let provider = '';
  8742. let customText = '';
  8743. if(uroUtils.GetCBChecked('_cbCustomKeywordMarkers')) customText = document.getElementById('_textCustomKeyword').value.toLowerCase();
  8744. if(desc === null) desc = '';
  8745. if(markerType == uroLayers.ID.UR)
  8746. {
  8747. let ureq = W.model.mapUpdateRequests.objects[idSrc];
  8748. // early test for native speed limit URs
  8749. if(ureq.attributes.type == 23) return 98;
  8750. }
  8751. else if(markerType == uroLayers.ID.MP)
  8752. {
  8753. let mp = W.model.mapProblems.objects[idSrc];
  8754. if(mp.attributes.provider != null)
  8755. {
  8756. provider = mp.attributes.provider;
  8757. }
  8758. }
  8759.  
  8760. if(desc !== '')
  8761. {
  8762. if((markerType == uroLayers.ID.UR) || (markerType == 'mc'))
  8763. {
  8764. for(let tag=0; tag<uroCustomURTags.length; tag++)
  8765. {
  8766. let keyword = uroCustomURTags[tag];
  8767. if(desc.indexOf(keyword) != -1)
  8768. {
  8769. return tag;
  8770. }
  8771. }
  8772. }
  8773.  
  8774. if(markerType == uroLayers.ID.UR)
  8775. {
  8776. if((uroUtils.GetCBChecked('_cbCustomKeywordMarkers')) && (customText !== ''))
  8777. {
  8778. if(desc.toLowerCase().indexOf(customText) != -1) return 99;
  8779. }
  8780. }
  8781.  
  8782. if(markerType == uroLayers.ID.MP)
  8783. {
  8784. if(desc.indexOf('[Elgin]') != -1) return 100;
  8785. if(desc.indexOf('[ELGIN]') != -1) return 100;
  8786. if(desc.indexOf('[elginroadworks]') != -1) return 100;
  8787. if(desc.indexOf('[one.network]') != -1) return 100;
  8788. if(desc.indexOf('[TrafficCast]') != -1) return 101;
  8789. if(desc.indexOf('[TM]') != -1) return 102;
  8790. if(desc.indexOf('[Caltrans]') != -1) return 103;
  8791. if(desc.indexOf('[TfL Open Data]') != -1) return 104;
  8792. if(provider.indexOf('London TFL Closures') != -1) return 104;
  8793. }
  8794. }
  8795. if(markerType == uroLayers.ID.UR)
  8796. {
  8797. return uroCheckCommentsForTag(idSrc, customText);
  8798. }
  8799.  
  8800. return -1;
  8801. }
  8802. function uroGetRestrictionLanes(disposition)
  8803. {
  8804. let retval = '';
  8805. if(disposition == 1) retval += 'All lanes';
  8806. else if(disposition == 2) retval += 'Left lane';
  8807. else if(disposition == 3) retval += 'Middle lane';
  8808. else if(disposition == 4) retval += 'Right lane';
  8809. else retval += ' - ';
  8810. return retval;
  8811. }
  8812. function uroGetRestrictionLaneType(laneType)
  8813. {
  8814. let retval = '';
  8815. if(laneType === null) retval += ' - ';
  8816. else
  8817. {
  8818. if(laneType == 1) retval += 'HOV';
  8819. else if(laneType == 2) retval += 'HOT';
  8820. else if(laneType == 3) retval += 'Express';
  8821. else if(laneType == 4) retval += 'Bus lane';
  8822. else if(laneType == 5) retval += 'Fast lane';
  8823. else retval += ' - ';
  8824. }
  8825. return retval;
  8826. }
  8827. let uroVehicleTypes =
  8828. [
  8829. [1280, 'fa-car'],
  8830. [1024, 'fa-motorcycle'],
  8831. [272, 'fa-taxi'],
  8832. [1808, 'fa-bolt']
  8833. ];
  8834. function uroGetRestrictionVehicleTypes(restObj, allowInit, profileKey)
  8835. {
  8836. let i;
  8837. let j;
  8838. let k;
  8839. let tVT;
  8840. let retval = [];
  8841. for(i = 0; i < uroVehicleTypes.length; ++i)
  8842. {
  8843. retval.push(allowInit);
  8844. }
  8845. let tRest = restObj._driveProfiles.get(profileKey);
  8846. if(tRest !== undefined)
  8847. {
  8848. for(i = 0; i < tRest._driveProfiles.length; ++i)
  8849. {
  8850. tVT = tRest._driveProfiles[i].getVehicleTypes();
  8851. {
  8852. if(tVT.length > 0)
  8853. {
  8854. for(j = 0; j < tVT.length; ++j)
  8855. {
  8856. for(k = 0; k < uroVehicleTypes.length; ++k)
  8857. {
  8858. if(tVT[j] == uroVehicleTypes[k][0])
  8859. {
  8860. retval[k] = !allowInit;
  8861. }
  8862. }
  8863. }
  8864. }
  8865. }
  8866. }
  8867. }
  8868. return retval;
  8869. }
  8870. function uroFormatRestriction(restObj)
  8871. {
  8872. let retval = '';
  8873.  
  8874. if(restObj._defaultType == "DIFFICULT")
  8875. {
  8876. retval = '<tr><td colspan=13>Difficult Turn';
  8877. }
  8878. else
  8879. {
  8880. let roDays = null;
  8881. let roFromDate = null;
  8882. let roToDate = null;
  8883. let roFromTime = null;
  8884. let roToTime = null;
  8885. let roRepeats = false;
  8886. let roAllDay = false;
  8887. if(restObj._days !== undefined)
  8888. {
  8889. roDays = restObj._days;
  8890. roFromDate = restObj._fromDate;
  8891. roToDate = restObj._toDate;
  8892. roFromTime = restObj._fromTime;
  8893. roToTime = restObj._toTime;
  8894. }
  8895. else if(restObj._timeFrames.length > 0)
  8896. {
  8897. if(restObj._timeFrames[0]._weekdays !== undefined)
  8898. {
  8899. roDays = restObj._timeFrames[0]._weekdays;
  8900. roFromDate = restObj._timeFrames[0]._startDate;
  8901. roToDate = restObj._timeFrames[0]._endDate;
  8902. roFromTime = restObj._timeFrames[0]._fromTime;
  8903. roToTime = restObj._timeFrames[0]._toTime;
  8904. roRepeats = restObj._timeFrames[0]._repeatYearly;
  8905. }
  8906. }
  8907.  
  8908. if((roFromTime === null) && (roToTime === null))
  8909. {
  8910. roFromTime = "0:00";
  8911. roToTime = "23:59";
  8912. roAllDay = true;
  8913. }
  8914.  
  8915. let hasExpired = false;
  8916. let isFuture = false;
  8917. let tNow = Date.now();
  8918. let tFrom = null;
  8919. let tTo = null;
  8920. if(roFromDate !== null)
  8921. {
  8922. tFrom = new Date(roFromDate + " " + roFromTime);
  8923. isFuture = (tFrom.getTime() > tNow);
  8924. }
  8925. if(roToDate !== null)
  8926. {
  8927. tTo = new Date(roToDate + " " + roToTime);
  8928. hasExpired = (tTo.getTime() < tNow);
  8929. }
  8930. if((hasExpired === true) && (roRepeats === true))
  8931. {
  8932. while(tTo.getTime() < tNow)
  8933. {
  8934. tFrom.setFullYear(tFrom.getFullYear() + 1);
  8935. tTo.setFullYear(tTo.getFullYear() + 1);
  8936. }
  8937. isFuture = (tFrom.getTime() > tNow);
  8938. hasExpired = false;
  8939. }
  8940.  
  8941.  
  8942. if(isFuture === true)
  8943. {
  8944. retval = '<tr bgcolor="#8080FF">';
  8945. }
  8946. else if(hasExpired === true)
  8947. {
  8948. retval = '<tr bgcolor="#FFFFC0">';
  8949. }
  8950. else
  8951. {
  8952. retval = '<tr>';
  8953. }
  8954.  
  8955. if(roDays === null)
  8956. {
  8957. roDays = 127;
  8958. }
  8959.  
  8960. retval += '<td style="text-align:center;">';
  8961. if((roDays & 1) == 1) retval += 'M';
  8962. else retval += '-';
  8963. retval += '</td><td style="text-align:center;">';
  8964. if((roDays & 2) == 2) retval += 'Tu';
  8965. else retval += '-';
  8966. retval += '</td><td style="text-align:center;">';
  8967. if((roDays & 4) == 4) retval += 'W';
  8968. else retval += '-';
  8969. retval += '</td><td style="text-align:center;">';
  8970. if((roDays & 8) == 8) retval += 'Th';
  8971. else retval += '-';
  8972. retval += '</td><td style="text-align:center;">';
  8973. if((roDays & 16) == 16) retval += 'F';
  8974. else retval += '-';
  8975. retval += '</td><td style="text-align:center;">';
  8976. if((roDays & 32) == 32) retval += 'Sa';
  8977. else retval += '-';
  8978. retval += '</td><td style="text-align:center;">';
  8979. if((roDays & 64) == 64) retval += 'Su';
  8980. else retval += '-';
  8981.  
  8982. retval += '</td><td nowrap style="text-align:center;">';
  8983.  
  8984. if(roFromDate === null) retval += 'All dates';
  8985. else retval += tFrom.toISOString().slice(0,10) + ' to ' + tTo.toISOString().slice(0,10);
  8986. if(roRepeats === true)
  8987. {
  8988. retval += '&nbsp;<i class="fa fa-repeat"> </i>';
  8989. }
  8990.  
  8991. retval += '</td><td nowrap style="text-align:center;">';
  8992.  
  8993. if((restObj._allDay === true) || (roAllDay === true)) retval += 'All day';
  8994. else retval += roFromTime + ' to ' + roToTime;
  8995.  
  8996. retval += '</td><td nowrap style="text-align:center;">';
  8997.  
  8998. retval += uroGetRestrictionLanes(restObj._disposition);
  8999.  
  9000. retval += '</td><td nowrap style="text-align:center;">';
  9001.  
  9002. retval += uroGetRestrictionLaneType(restObj._laneType);
  9003.  
  9004. retval += '</td><td nowrap style="text-align:center;">';
  9005.  
  9006. // for brevity, the popup only displays the allowed/prohibited restriction for the driveable vehicle types in the app...
  9007. let typesAllowed = [];
  9008. if((restObj._defaultType == "BLOCKED") || (restObj._defaultType == "TOLL"))
  9009. {
  9010. if(restObj._defaultType == "TOLL")
  9011. {
  9012. retval += I18n.lookup('restrictions.editing.segment.toll_road');
  9013. }
  9014. typesAllowed = uroGetRestrictionVehicleTypes(restObj, false, "FREE");
  9015. }
  9016. else
  9017. {
  9018. typesAllowed = uroGetRestrictionVehicleTypes(restObj, true, "BLOCKED");
  9019. }
  9020.  
  9021. let i;
  9022. for(i = 0; i < uroVehicleTypes.length; ++i)
  9023. {
  9024. if(typesAllowed[i] === true)
  9025. {
  9026. retval += '<i class="fa '+uroVehicleTypes[i][1]+'" style="color:#000000;"> </i>&nbsp;';
  9027. }
  9028. else
  9029. {
  9030. retval += '<i class="fa '+uroVehicleTypes[i][1]+'" style="color:#d0d0d0;"> </i>&nbsp;';
  9031. }
  9032. }
  9033.  
  9034. retval += '</td><td>';
  9035. retval += uroUtils.Clickify(restObj._description, '');
  9036. }
  9037.  
  9038. retval += '</td></tr>';
  9039.  
  9040. return retval;
  9041. }
  9042. function uroOpenURDialog(urID)
  9043. {
  9044. let t = {showNext: false, nextButtonString: I18n.lookup('problems.panel.done')};
  9045. let urObj = W.model.mapUpdateRequests.objects[urID];
  9046. W.reqres.request("problems:browse", _.extend(t, {problem: urObj}));
  9047. }
  9048. function uroRecentreSessionOnUR()
  9049. {
  9050. //uroGetMarker(uroLayers.ID.UR, uroShownFID).element.click();
  9051. uroOpenURDialog(uroShownFID);
  9052. W.map.moveTo(uroGetMarker(uroLayers.ID.UR, uroShownFID).lonlat, 17);
  9053. uroPopup.Hide();
  9054. return false;
  9055. }
  9056. function uroRecentreSessionOnMP()
  9057. {
  9058. uroGetMarker(uroLayers.ID.MP, uroShownFID).element.click();
  9059. W.map.moveTo(uroGetMarker(uroLayers.ID.MP, uroShownFID).lonlat, 17);
  9060. uroPopup.Hide();
  9061. return false;
  9062. }
  9063. function uroRecentreSessionOnPUR()
  9064. {
  9065. uroGetMarker(uroLayers.ID.PUR, uroShownFID).element.click();
  9066. W.map.moveTo(uroGetMarker(uroLayers.ID.PUR, uroShownFID).lonlat, 17);
  9067. uroPopup.Hide();
  9068. return false;
  9069. }
  9070. function uroRecentreSessionOnPPUR()
  9071. {
  9072. uroGetMarker(uroLayers.ID.PPUR, uroShownFID).element.click();
  9073. W.map.moveTo(uroGetMarker(uroLayers.ID.PPUR, uroShownFID).lonlat, 17);
  9074. uroPopup.Hide();
  9075. return false;
  9076. }
  9077. function uroRecentreSessionOnVenueNavPoint()
  9078. {
  9079. W.map.moveTo(uroGetVenueNavPoint(uroShownFID), 17);
  9080. uroPopup.Hide();
  9081. return false;
  9082. }
  9083. function uroStackListObj(fid,x,y)
  9084. {
  9085. this.fid = fid;
  9086. this.x = uroUtils.TypeCast(x);
  9087. this.y = uroUtils.TypeCast(y);
  9088. }
  9089. function uroRestackMarkers()
  9090. {
  9091. if(uroStackList.length === 0) return;
  9092.  
  9093. if(uroLayers.layers[uroStackType].mf !== null)
  9094. {
  9095. uroDBG.AddLog('restacking markers...');
  9096. // strip off the .realX/realY attributes from any UR object we've previously added it to, to allow
  9097. // the native recentering to work again...
  9098. let idList = uroGetMarkerIDs(uroStackType);
  9099. for(let marker of idList)
  9100. {
  9101. let testMarkerAttributes = uroGetAttributes(uroStackType, marker);
  9102. if(testMarkerAttributes.geometry.realX != null)
  9103. {
  9104. testMarkerAttributes.geometry.x = testMarkerAttributes.geometry.realX;
  9105. testMarkerAttributes.geometry.y = testMarkerAttributes.geometry.realY;
  9106. delete(testMarkerAttributes.geometry.realX);
  9107. delete(testMarkerAttributes.geometry.realY);
  9108. }
  9109. }
  9110. // now restack any markers that were repositioned...
  9111. for(let idx=0; idx<uroStackList.length; idx++)
  9112. {
  9113. let orig_x = uroStackList[idx].x + 'px';
  9114. let orig_y = uroStackList[idx].y + 'px';
  9115. let fid = uroStackList[idx].fid;
  9116.  
  9117. if(uroGetMarker(uroStackType, fid) != null)
  9118. {
  9119. uroGetMarker(uroStackType, fid).element.style.left = orig_x;
  9120. uroGetMarker(uroStackType, fid).element.style.top = orig_y;
  9121. }
  9122. }
  9123. uroStackList = [];
  9124. uroUnstackedMasterID = null;
  9125. uroStackType = null;
  9126. uroDBG.AddLog('...stacked!');
  9127. }
  9128. }
  9129. function uroIsIDAlreadyUnstacked(idSrc)
  9130. {
  9131. if(uroStackList.length === 0) return false;
  9132. for(let idx=0; idx<uroStackList.length; idx++)
  9133. {
  9134. if(uroStackList[idx].fid == idSrc) return true;
  9135. }
  9136. return false;
  9137. }
  9138. function uroCheckStacking(stackType, masterID, unstackedX, unstackedY)
  9139. {
  9140. //// WIP
  9141. return;
  9142. if(typeof(masterID) === 'number')
  9143. {
  9144. masterID = masterID.toString();
  9145. }
  9146.  
  9147. if(uroIsIDAlreadyUnstacked(masterID) === true) return;
  9148. if(uroStackType !== null) return;
  9149.  
  9150. uroDBG.AddLog('checking for marker stack, masterID: '+masterID+', stackType: '+stackType);
  9151. let stackList = [];
  9152. stackList.push(masterID);
  9153. let threshSquared = uroUtils.GetElmValue('_inputUnstackSensitivity');
  9154. threshSquared *= threshSquared;
  9155.  
  9156. let marker;
  9157.  
  9158. let offset = 0.000000001;
  9159. if(uroLayers.layers[stackType].mf !== null)
  9160. {
  9161. let idList = uroGetMarkerIDs(stackType);
  9162. let showOpen = true;
  9163. let showClosed = false;
  9164. let showTypes = null;
  9165. if(stackType === uroLayers.ID.UR)
  9166. {
  9167. showTypes = W?.issueTrackerController?.app?.attributes?.issueTrackerFilter?.attributes?.mapUpdateRequestsFilter?.attributes?.status;
  9168. }
  9169. else if(stackType === uroLayers.ID.MP)
  9170. {
  9171. showTypes = W?.issueTrackerController?.app?.attributes?.issueTrackerFilter?.attributes?.mapProblemsFilter?.attributes?.status;
  9172. }
  9173. if(showTypes !== null)
  9174. {
  9175. showOpen = ((showTypes == 'OPEN') || (showTypes == 'BOTH'));
  9176. showClosed = ((showTypes == 'CLOSED') || (showTypes == 'BOTH'));
  9177. }
  9178.  
  9179. for(marker of idList)
  9180. {
  9181. let testMarkerObj = uroGetMarker(stackType, marker);
  9182. let testMarkerAttributes = uroGetAttributes(stackType, marker);
  9183. if((testMarkerAttributes !== null) && (testMarkerObj !== null))
  9184. {
  9185. // 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
  9186. // top of the stack in the absence of any URO+ filtering, regardless of which UR pin actually receives the click event. To prevent
  9187. // this, we give each pin in the stack a unique set of false coordinates, storing the original coordinates in newly created
  9188. // properties so they can be restored later on.
  9189. //
  9190. // 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
  9191. // 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
  9192. // is being viewed. By using a small fractional offset added to each stacked marker, the risk of accidentally setting the offset coords to
  9193. // those of another marker is low
  9194. if(testMarkerAttributes.geometry.realX === undefined)
  9195. {
  9196. testMarkerAttributes.geometry.realX = testMarkerAttributes.geometry.x;
  9197. testMarkerAttributes.geometry.x += offset;
  9198. testMarkerAttributes.geometry.realY = testMarkerAttributes.geometry.y;
  9199. testMarkerAttributes.geometry.y += offset;
  9200. offset += 0.000000001;
  9201. }
  9202.  
  9203. let includeInStack = (testMarkerObj.element.style.visibility != 'hidden');
  9204. let isClosed = testMarkerObj.element.classList.contains("recently-closed");
  9205. includeInStack = includeInStack && ((isClosed && showClosed) || (!isClosed && showOpen));
  9206. if(includeInStack)
  9207. {
  9208. if(testMarkerAttributes.id != masterID)
  9209. {
  9210. let bcr = testMarkerObj.element.getBoundingClientRect();
  9211. let xdiff = unstackedX - bcr.x;
  9212. let ydiff = unstackedY - bcr.y;
  9213. let distSquared = ((xdiff * xdiff) + (ydiff * ydiff));
  9214. if(distSquared < threshSquared)
  9215. {
  9216. stackList.push(testMarkerAttributes.id);
  9217. }
  9218. }
  9219. }
  9220. }
  9221. }
  9222. }
  9223.  
  9224. let inhibitUnstacking = (W.map.getZoom() < uroUtils.GetElmValue('_inputUnstackZoomLevel'));
  9225. inhibitUnstacking = inhibitUnstacking || (stackList.length < 2);
  9226.  
  9227. if(inhibitUnstacking == false)
  9228. {
  9229. uroStackType = stackType;
  9230. if(uroUnstackedMasterID != masterID)
  9231. {
  9232. uroDBG.AddLog('unstacked ID mismatch, relocating markers...');
  9233. uroRestackMarkers();
  9234. uroUnstackedMasterID = masterID;
  9235. uroStackList = [];
  9236.  
  9237. // push the highlighted marker onto the stacklist so uroIsIDAlreadyUnstacked() will return true
  9238. uroStackList.push(new uroStackListObj(masterID,unstackedX,unstackedY));
  9239.  
  9240. for(let shoveIdx=0; shoveIdx < stackList.length; shoveIdx++)
  9241. {
  9242. let fid = stackList[shoveIdx];
  9243. let stackMarker = uroGetMarker(stackType, fid);
  9244. if(stackMarker !== null)
  9245. {
  9246. let x = uroUtils.ParsePxString(stackMarker.element.style.left);
  9247. let y = uroUtils.ParsePxString(stackMarker.element.style.top);
  9248. // store the unstacked marker positions so they can be reinstated later
  9249. uroStackList.push(new uroStackListObj(fid,x,y));
  9250. stackMarker.element.style.left = unstackedX + 'px';
  9251. stackMarker.element.style.top = unstackedY + 'px';
  9252. unstackedX += 5;
  9253. unstackedY -= 20;
  9254. }
  9255. }
  9256.  
  9257.  
  9258. // hide other markers to prevent confusion with the unstacked markers
  9259. let listIDs = uroGetMarkerIDs(stackType);
  9260. for(marker in listIDs)
  9261. {
  9262. if(listIDs.hasOwnProperty(marker))
  9263. {
  9264. let toHideMarker = uroGetMarker(stackType, marker);
  9265. if(toHideMarker !== null)
  9266. {
  9267. let toHideID = toHideMarker.id;
  9268. if(uroIsIDAlreadyUnstacked(toHideID) === false)
  9269. {
  9270. toHideMarker = uroGetMarker(stackType, toHideID);
  9271. if(toHideMarker !== null)
  9272. {
  9273. toHideMarker.element.style.visibility = 'hidden';
  9274. }
  9275. }
  9276. }
  9277. }
  9278. }
  9279. }
  9280. }
  9281. else
  9282. {
  9283. uroRestackMarkers();
  9284. }
  9285. }
  9286. function uroGetVenueNavPoint(uroFID)
  9287. {
  9288. let retval = W.map.getUnprojectedCenter(); // allow the function to return a safe value in case we can't find the requested venue object...
  9289.  
  9290. let vObj = W.model.venues.objects[uroFID];
  9291. if(vObj !== undefined)
  9292. {
  9293. if(vObj.attributes.entryExitPoints.length > 0)
  9294. {
  9295. // if the venue has any navpoints defined, use the position of the first one
  9296. let tPoint = vObj.attributes.entryExitPoints[0].getPoint();
  9297. retval.lon = tPoint.coordinates[0];
  9298. retval.lat = tPoint.coordinates[1];
  9299. }
  9300. else
  9301. {
  9302. // otherwise use the centrepoint of the venue point or polygon
  9303. let tPoint = vObj.attributes.geometry.getCentroid();
  9304. let tLL = new OpenLayers.LonLat();
  9305. tLL.lon = tPoint.x;
  9306. tLL.lat = tPoint.y;
  9307. tLL = uroUtils.ConvertMercatorToWGS84(tLL);
  9308. retval.lon = tLL.lon;
  9309. retval.lat = tLL.lat;
  9310. }
  9311. }
  9312. return retval;
  9313. }
  9314. function uroOpenNewTab()
  9315. {
  9316. // flush the current settings into localStorage before the new tab opens, so that when its instance of
  9317. // URO+ fires up it'll have the same settings as this one
  9318. uroConfig.SaveSettings();
  9319. return true;
  9320. }
  9321. function uroGetRTCDuration(rcObj)
  9322. {
  9323. let duration = new Date(rcObj.attributes.endDate) - new Date(rcObj.attributes.startDate);
  9324. return Math.floor(duration / 86400000);
  9325. }
  9326. function uroGetRTCOffset(rcDate)
  9327. {
  9328. let dateObj = new Date(rcDate);
  9329. return (0 - uroUtils.DateToDays(dateObj));
  9330. }
  9331. function uroGetRTCOrigin(rcObj)
  9332. {
  9333. let retval = URO_TRTC.UNKNOWN;
  9334.  
  9335. if(rcObj !== undefined)
  9336. {
  9337. if(rcObj.attributes.createdBy == -5)
  9338. {
  9339. retval = URO_TRTC.WAZEFEED;
  9340. }
  9341. else if((W.model.users.objects[rcObj.attributes.createdBy] !== undefined) && (W.model.users.objects[rcObj.attributes.createdBy].attributes.rank == 6))
  9342. {
  9343. retval = URO_TRTC.WAZEOTHER;
  9344. }
  9345. else
  9346. {
  9347. retval = URO_TRTC.WME;
  9348. }
  9349. }
  9350.  
  9351. return retval;
  9352. }
  9353. function uroGetRTCState(rcObj)
  9354. {
  9355. let retval = URO_SRTC.UNKNOWN;
  9356.  
  9357. let nowDate = new Date();
  9358. let startInPast = ((new Date(rcObj.attributes.startDate) - nowDate) < 0);
  9359. let endInPast = ((new Date(rcObj.attributes.endDate) - nowDate) < 0);
  9360.  
  9361. if(endInPast === true)
  9362. {
  9363. retval = URO_SRTC.EXPIRED;
  9364. }
  9365. else if(startInPast === true)
  9366. {
  9367. retval = URO_SRTC.ACTIVE;
  9368. }
  9369. else
  9370. {
  9371. retval = URO_SRTC.FUTURE;
  9372. }
  9373.  
  9374. return retval;
  9375. }
  9376. function uroGetAddress(streetID, houseNumber, formatForSegmentPopup, formatForNodePopup, showAsToll)
  9377. {
  9378. let result = '';
  9379. if((houseNumber !== undefined) && (houseNumber !== null))
  9380. {
  9381. result += houseNumber + ' ';
  9382. }
  9383.  
  9384. if(streetID != null)
  9385. {
  9386. let streetName = I18n.lookup('edit.address.no_street');
  9387. let doesStreetIDExist = true;
  9388. if(W.model.streets.objects[streetID] === undefined)
  9389. {
  9390. streetName = 'non-existent streetID';
  9391. doesStreetIDExist = false;
  9392. }
  9393. else
  9394. {
  9395. if((streetName !== null) && (W.model.streets.objects[streetID].attributes.isEmpty === false))
  9396. {
  9397. streetName = W.model.streets.objects[streetID].attributes.name;
  9398. }
  9399. }
  9400. if(formatForSegmentPopup === true)
  9401. {
  9402. if(showAsToll == true)
  9403. {
  9404. result += '<i class="fa fa-credit-card"></i> ';
  9405. }
  9406. result += '<b>'+streetName+'</b><br>';
  9407. }
  9408. else
  9409. {
  9410. result += streetName + ', ';
  9411. }
  9412.  
  9413. if(doesStreetIDExist === true)
  9414. {
  9415. let cityName = I18n.lookup('edit.address.no_city');
  9416. let doesCityIDExist = true;
  9417. let cityID = W.model.streets.objects[streetID].attributes.cityID;
  9418. if(W.model.cities.objects[cityID] === undefined)
  9419. {
  9420. cityName = 'non-existent cityID';
  9421. doesCityIDExist = false;
  9422. }
  9423. else
  9424. {
  9425. if(W.model.cities.objects[cityID].attributes.name !== "")
  9426. {
  9427. cityName = W.model.cities.objects[cityID].attributes.name;
  9428. }
  9429. }
  9430. result += cityName + ', ';
  9431.  
  9432. if(doesCityIDExist === true)
  9433. {
  9434. let stateID = W.model.cities.objects[cityID].attributes.stateID;
  9435. if(W.model.states.objects[stateID] === undefined)
  9436. {
  9437. result += 'non-existent stateID';
  9438. }
  9439. else
  9440. {
  9441. result += W.model.states.objects[stateID].attributes.name;
  9442. }
  9443. }
  9444. }
  9445. }
  9446. result += '<br>';
  9447.  
  9448. return result;
  9449. }
  9450. function uroGetSelectedSegmentRTCs(segID)
  9451. {
  9452. let closureTypes = URO_DRTC.NONE;
  9453. let RTCObjs = [];
  9454. let selectedSegs = [];
  9455.  
  9456. if(segID === null)
  9457. {
  9458. // segID should always be set to a valid segment ID if we're being called from the segment mouseover
  9459. // handler, so if it's null it implies we've instead been called from the closure panel handler where
  9460. // we might therefore be dealing with a multi-segment selection...
  9461. selectedSegs = W.selectionManager.getSegmentSelection().segments;
  9462. }
  9463.  
  9464. if((selectedSegs.length > 0) || (segID !== null))
  9465. {
  9466. for(let roadClosure in W.model.roadClosures.objects)
  9467. {
  9468. if(W.model.roadClosures.objects.hasOwnProperty(roadClosure))
  9469. {
  9470. let rcObj = W.model.roadClosures.objects[roadClosure];
  9471. rcObj.segIDs = [rcObj.attributes.segID]; // copy the segID property into an array so we can push extra segIDs into it later...
  9472.  
  9473. // 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
  9474. // into a two-way closure, we can then change the direction value to indicate this as well
  9475. if(rcObj.attributes.forward === true)
  9476. {
  9477. rcObj.direction = URO_DRTC.SEG_AB;
  9478. }
  9479. else
  9480. {
  9481. rcObj.direction = URO_DRTC.SEG_BA;
  9482. }
  9483.  
  9484. // for each of the selected or moused-over segments, find all the closures which have matching segIDs
  9485. if(segID !== null)
  9486. {
  9487. if(rcObj.attributes.segID == segID)
  9488. {
  9489. RTCObjs.push(rcObj);
  9490. }
  9491. }
  9492. else
  9493. {
  9494. for(let i = 0; i < selectedSegs.length; ++i)
  9495. {
  9496. if(rcObj.attributes.segID == selectedSegs[i].attributes.id)
  9497. {
  9498. RTCObjs.push(rcObj);
  9499. break;
  9500. }
  9501. }
  9502. }
  9503. }
  9504. }
  9505.  
  9506. // RTCObjs now contains all of the segment closures relating to all of the segments of interest, so
  9507. // we can begin to organise them such that by the time we exit this function, the array will then contain
  9508. // an optimised list of closures that matches up to the list shown in the closure sidepanel, taking into
  9509. // account closures applying to all segments vs some, closures that can be merged into two-ways etc.
  9510.  
  9511. // first sort the closure by their start date, with a secondary sort by direction for those closures
  9512. // that have the same start date
  9513. RTCObjs = RTCObjs.sort(function(a,b)
  9514. {
  9515. if(a.attributes.startDate === b.attributes.startDate)
  9516. {
  9517. if(a.direction == URO_DRTC.SEG_AB) return -1;
  9518. return 1;
  9519. }
  9520. if(a.attributes.startDate > b.attributes.startDate) return 1;
  9521. return -1;
  9522. });
  9523.  
  9524. // if we've got at least two closures in the sorted list, we then test adjacent list entries
  9525. // to see if they contain closure details which are identical except for their segment IDs, and
  9526. // combine them if so
  9527. if(RTCObjs.length > 1)
  9528. {
  9529. let i = 0;
  9530. while(i < (RTCObjs.length - 1))
  9531. {
  9532. if(
  9533. (RTCObjs[i].attributes.createdBy == RTCObjs[i+1].attributes.createdBy) &&
  9534. (RTCObjs[i].attributes.endDate == RTCObjs[i+1].attributes.endDate) &&
  9535. (RTCObjs[i].attributes.eventId == RTCObjs[i+1].attributes.eventId) &&
  9536. (RTCObjs[i].attributes.location == RTCObjs[i+1].attributes.location) &&
  9537. (RTCObjs[i].attributes.reason == RTCObjs[i+1].attributes.reason) &&
  9538. (RTCObjs[i].attributes.startDate == RTCObjs[i+1].attributes.startDate) &&
  9539. (RTCObjs[i].direction == RTCObjs[i+1].direction)
  9540. )
  9541. {
  9542. RTCObjs[i].segIDs.push(RTCObjs[i+1].attributes.segID);
  9543. RTCObjs.splice(i+1, 1);
  9544. }
  9545. else
  9546. {
  9547. ++i;
  9548. }
  9549. }
  9550. }
  9551.  
  9552. // after that first trimming of the list, if there are still two or more entries then
  9553. // we perform a second pass, this time merging any adjacent entries which have the same
  9554. // segment IDs in their segIDs arrays - these are two-way closures applying to all those
  9555. // segments, and so we also change the direction value to indicate two-way vs A-B or B-A
  9556. if(RTCObjs.length > 1)
  9557. {
  9558. let i = 0;
  9559. while(i < (RTCObjs.length - 1))
  9560. {
  9561. if
  9562. (
  9563. (RTCObjs[i].segIDs.sort().join(',') == RTCObjs[i+1].segIDs.sort().join(',')) &&
  9564. (RTCObjs[i].attributes.createdBy == RTCObjs[i+1].attributes.createdBy) &&
  9565. (RTCObjs[i].attributes.endDate == RTCObjs[i+1].attributes.endDate) &&
  9566. (RTCObjs[i].attributes.eventId == RTCObjs[i+1].attributes.eventId) &&
  9567. (RTCObjs[i].attributes.location == RTCObjs[i+1].attributes.location) &&
  9568. (RTCObjs[i].attributes.reason == RTCObjs[i+1].attributes.reason) &&
  9569. (RTCObjs[i].attributes.startDate == RTCObjs[i+1].attributes.startDate)
  9570. )
  9571. {
  9572. RTCObjs[i].direction = URO_DRTC.SEG_BI;
  9573. RTCObjs.splice(i+1, 1);
  9574. }
  9575. ++i;
  9576. }
  9577. }
  9578. }
  9579.  
  9580. let RTTCObjs = [];
  9581. if(segID !== null)
  9582. {
  9583. // If we've been called from the segment popup handler, we now also check for any turn closures
  9584. // associated with this segment, so that their details can also be shown in the popup...
  9585. for(let turnClosure in W.model.turnClosures.objects)
  9586. {
  9587. if(W.model.turnClosures.objects.hasOwnProperty(turnClosure))
  9588. {
  9589. let tcObj = W.model.turnClosures.objects[turnClosure];
  9590. if(tcObj.attributes.fromSegID === segID)
  9591. {
  9592. tcObj.direction = URO_DRTC.TURN_OUT;
  9593. RTTCObjs.push(tcObj);
  9594. }
  9595. else if(tcObj.attributes.toSegID === segID)
  9596. {
  9597. tcObj.direction = URO_DRTC.TURN_IN;
  9598. RTTCObjs.push(tcObj);
  9599. }
  9600. }
  9601. }
  9602.  
  9603. if(RTTCObjs.length > 1)
  9604. {
  9605. RTTCObjs = RTTCObjs.sort(function(a,b)
  9606. {
  9607. if(a.attributes.startDate === b.attributes.startDate)
  9608. {
  9609. if(a.direction == URO_DRTC.TURN_OUT) return -1;
  9610. return 1;
  9611. }
  9612. if(a.attributes.startDate > b.attributes.startDate) return 1;
  9613. return -1;
  9614. });
  9615. }
  9616. }
  9617.  
  9618. uroRTCObjs = RTCObjs.concat(RTTCObjs);
  9619. for(let i = 0; i < uroRTCObjs.length; ++i)
  9620. {
  9621. closureTypes |= uroRTCObjs[i].direction;
  9622. }
  9623.  
  9624. // the closure list ordering at this point doesn't always match up to the order used by the closures panel when
  9625. // a mixture of "all segment" and "some segment" closures are present - need to work out what ordering rules
  9626. // WME is using here...
  9627. return closureTypes;
  9628. }
  9629. function uroGetLengthString(length)
  9630. {
  9631. let retval = '';
  9632. if(length == null)
  9633. {
  9634. retval = "Default";
  9635. }
  9636. else if(W.model.isImperial == true)
  9637. {
  9638. retval = (length / (12 * 2.54)).toFixed(1) + "ft";
  9639. }
  9640. else
  9641. {
  9642. retval = (length / 100).toFixed(1) + "m";
  9643. }
  9644.  
  9645. return retval;
  9646. }
  9647. function uroGetHighlightedMapFeature()
  9648. {
  9649. let featureID = W.selectionManager.getWebMapSelectionManager().mouseInFeature;
  9650. let retval = null;
  9651.  
  9652. if(featureID !== null)
  9653. {
  9654. let isSelected = W.selectionManager.isSelected(featureID);
  9655. if(isSelected === false)
  9656. {
  9657. retval = W.selectionManager.getWebMapSelectionManager().getFeature(featureID);
  9658. }
  9659. }
  9660. return retval;
  9661. }
  9662. function uroGetFeatureRenderIntent(moObj)
  9663. {
  9664. let retval = "unknown";
  9665.  
  9666. if(moObj !== null)
  9667. {
  9668. let isSelected = moObj.selected;
  9669.  
  9670. if(isSelected === true)
  9671. {
  9672. retval = "highlightselected";
  9673. }
  9674. else
  9675. {
  9676. retval = "highlight";
  9677. }
  9678. }
  9679.  
  9680. return retval;
  9681. }
  9682. function uroExclusiveCB()
  9683. {
  9684. let cbChecked = uroUtils.GetCBChecked(this.id);
  9685.  
  9686. if(cbChecked === true)
  9687. {
  9688. let pairedList = this.attributes.pairedWith.value.split(',');
  9689. for(let i=0; i<pairedList.length; i++)
  9690. {
  9691. uroUtils.SetCBChecked(pairedList[i], false);
  9692. }
  9693. }
  9694. }
  9695. function uroContainsPoint(geo, point)
  9696. {
  9697. let retval = false;
  9698. try
  9699. {
  9700. let j = 1;
  9701. for(let i = 0; i < geo.length; ++i)
  9702. {
  9703. if
  9704. (
  9705. ((point[1] >= geo[i][1]) && (point[1] <= geo[j][1])) ||
  9706. ((point[1] >= geo[j][1]) && (point[1] <= geo[i][1]))
  9707. )
  9708. {
  9709. let lx = geo[i][0];
  9710. if(geo[i][1] != geo[j][1])
  9711. {
  9712. let g = ((point[1] - geo[i][1]) / (geo[j][1] - geo[i][1]));
  9713. lx += (g * (geo[j][0] - geo[i][0]));
  9714. }
  9715.  
  9716. if(point[0] <= lx)
  9717. {
  9718. retval = !retval;
  9719. }
  9720. }
  9721. if(++j == geo.length)
  9722. {
  9723. j = 0;
  9724. }
  9725. }
  9726. }
  9727. catch
  9728. {
  9729. }
  9730. return retval;
  9731. }
  9732. function uroGetAMs(e)
  9733. {
  9734. if(uroMTEMode) return;
  9735. if(!uroFilterPreamble) return;
  9736. if(!uroInit.initialised) return;
  9737. if(document.getElementById("uroAMList") == null) return;
  9738. if(document.getElementsByClassName('topbar') == null) return;
  9739.  
  9740. if(uroUtils.GetCBChecked("_cbMoveAMList") === false)
  9741. {
  9742. document.getElementsByClassName('area-managers-region')[0].style.display = "block";
  9743. uroAMList.innerHTML = uroUtils.ModifyHTML("");
  9744. document.getElementsByClassName('topbar')[0].style.backgroundColor=null;
  9745. return;
  9746. }
  9747.  
  9748. document.getElementsByClassName('topbar')[0].style.backgroundColor="#000000";
  9749. document.getElementsByClassName('area-managers-region')[0].style.display = "none";
  9750.  
  9751. let amList = '';
  9752. let tName = '';
  9753. if(W.map.managedAreasLayer.getVisibility() === true)
  9754. {
  9755. let mouseX = e.pageX - document.getElementById('map').getBoundingClientRect().left;
  9756. let mouseY = e.pageY - document.getElementById('map').getBoundingClientRect().top;
  9757. let mousePixel = W.map.getLonLatFromPixel(new OpenLayers.Pixel(mouseX, mouseY));
  9758. let mousePoint = [];
  9759. mousePoint.push(mousePixel.lon);
  9760. mousePoint.push(mousePixel.lat);
  9761.  
  9762. for(let amObj in W.model.managedAreas.objects)
  9763. {
  9764. let nc = W.model.managedAreas.objects[amObj].attributes.geoJSONGeometry.coordinates.length;
  9765. for(let i = 0; i < nc; ++i)
  9766. {
  9767. let geo = W.model.managedAreas.objects[amObj].attributes.geoJSONGeometry.coordinates[i];
  9768. if(nc > 1)
  9769. {
  9770. geo = geo[0];
  9771. }
  9772.  
  9773. if(uroContainsPoint(geo, mousePoint) === true)
  9774. {
  9775. let amName = uroUtils.GetUserNameFromID(W.model.managedAreas.objects[amObj].attributes.userID);
  9776. if(amList.indexOf(amName) === -1)
  9777. {
  9778. if(amList !== '') amList += ', ';
  9779. tName = uroUtils.GetUserNameAndRank(W.model.managedAreas.objects[amObj].attributes.userID);
  9780. if(tName.indexOf('a href') !== -1)
  9781. {
  9782. tName = tName.replace('a href', 'a style="color:#c0c0ff;" href');
  9783. }
  9784. amList += tName;
  9785. }
  9786. }
  9787. }
  9788. }
  9789. if(amList === '')
  9790. {
  9791. amList = 'none';
  9792. }
  9793. amList = "&nbsp;-&nbsp;<b>Area Managers:</b> "+amList;
  9794. }
  9795. document.getElementById("uroAMList").innerHTML = uroUtils.ModifyHTML(amList);
  9796. }
  9797. function uroNewTabAtMouseLoc(x, y)
  9798. {
  9799. let tPix = new OpenLayers.Pixel(x,y);
  9800. let mPos = uroUtils.ConvertMercatorToWGS84(W.map.getLonLatFromPixel(tPix));
  9801. let nZoom = W.map.getZoom();
  9802. if(nZoom < 17) nZoom = 17;
  9803. let nHref = window.location.origin + window.location.pathname;
  9804. nHref += '?lon=' + mPos.lon;
  9805. nHref += '&lat=' + mPos.lat;
  9806. nHref += '&zoomLevel=' + nZoom;
  9807. window.open(nHref);
  9808. }
  9809. function uroMouseDown(e)
  9810. {
  9811. uroMouseIsDown = true;
  9812. if((e.altKey === true) && (e.ctrlKey === true))
  9813. {
  9814. uroNewTabAtMouseLoc(e.offsetX, e.offsetY);
  9815. }
  9816. }
  9817. function uroMouseUp()
  9818. {
  9819. uroMouseIsDown = false;
  9820. }
  9821. function uroTestPointerOutsideMap(mX, mY)
  9822. {
  9823. let mapElm = document.getElementById("map");
  9824. if(mapElm === undefined) return;
  9825. let mapBCR = mapElm.getBoundingClientRect();
  9826.  
  9827. if
  9828. (
  9829. (mX < mapBCR.left) ||
  9830. (mX > mapBCR.right) ||
  9831. (mY < mapBCR.top) ||
  9832. (mY > mapBCR.bottom)
  9833. )
  9834. {
  9835. if(uroUtils.GetCBChecked('_cbKillInertialPanning') === true)
  9836. {
  9837. let controller = null;
  9838. if (W.map.navigationControl)
  9839. {
  9840. controller = W.map.navigationControl;
  9841. }
  9842. else if(W.map.controls.find(control => control.CLASS_NAME == 'OpenLayers.Control.Navigation'))
  9843. {
  9844. controller = W.map.controls.find(control => control.CLASS_NAME == 'OpenLayers.Control.Navigation');
  9845. }
  9846. if (controller !== null)
  9847. {
  9848. controller.dragPan.panMapStart();
  9849. }
  9850. }
  9851. return true;
  9852. }
  9853. else
  9854. {
  9855. return false;
  9856. }
  9857. }
  9858. function uroMouseOut(e)
  9859. {
  9860. if(uroTestPointerOutsideMap(e.clientX, e.clientY))
  9861. {
  9862. uroPopup.Hide();
  9863. }
  9864. }
  9865. function uroUREvent_onObjectsAdded()
  9866. {
  9867. if(uroUtils.GetCBChecked('_cbURResolverIDFilter') === true)
  9868. {
  9869. uroUpdateEditorList(W.model.mapUpdateRequests.objects, '_selectURResolverID', false, false, true, false);
  9870. }
  9871. if(uroPopulatingRequestSessions === false)
  9872. {
  9873. uroFilterURs();
  9874. }
  9875. }
  9876. function uroGetSelectedURCommentCount()
  9877. {
  9878. if(W.model.updateRequestSessions.objects[uroSelectedURID] != null)
  9879. {
  9880. let cachedCommentCount = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments.length;
  9881. uroDBG.AddLog(uroSelectedURID+':'+cachedCommentCount+' '+uroExpectedCommentCount);
  9882.  
  9883. // if there aren't the same number of cached comments as there are comments in the UR dialog list, initiate
  9884. // a refresh of the comment data...
  9885. if(cachedCommentCount != uroExpectedCommentCount)
  9886. {
  9887. if(uroPendingCommentDataRefresh === true)
  9888. {
  9889. if(cachedCommentCount > 0)
  9890. {
  9891. uroCachedLastCommentID = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments[cachedCommentCount-1].id;
  9892. }
  9893. else
  9894. {
  9895. uroCachedLastCommentID = null;
  9896. }
  9897. uroDBG.AddLog('updateRequestSessions refresh required for UR '+uroSelectedURID);
  9898. if(uroCachedLastCommentID !== null)
  9899. {
  9900. uroDBG.AddLog('last comment ID for this UR is '+uroCachedLastCommentID);
  9901. }
  9902. else
  9903. {
  9904. uroDBG.AddLog('first comment for this UR, no previous comment to ID');
  9905. }
  9906. let idList = [];
  9907. idList.push(uroSelectedURID);
  9908. // need to delete the existing cache object first, as .get() is only capable of creating new objects,
  9909. // it doesn't seem able to update an existing object with new data
  9910. W.model.updateRequestSessions.remove(W.model.updateRequestSessions.objects[uroSelectedURID]);
  9911. W.model.updateRequestSessions.getAsync(idList);
  9912.  
  9913. // the call to .get() initiates a XMLHttpRequest for the data, so we now need to switch modes - the
  9914. // refresh process has started so we're no longer pending, but we are now waiting for the XMLHttpRequest
  9915. // to return something...
  9916. uroPendingCommentDataRefresh = false;
  9917. uroWaitingCommentDataRefresh = true;
  9918. }
  9919. else
  9920. {
  9921. if(cachedCommentCount > 0)
  9922. {
  9923. let currentLastCommentID = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments[cachedCommentCount-1].id;
  9924. if(currentLastCommentID == uroCachedLastCommentID)
  9925. {
  9926. // most recent comment loaded for this UR is the same one that was present at the start of this
  9927. // refresh process, so kick back into pending mode so we can retry the .get()...
  9928. uroDBG.AddLog('latest comment ID still the same, reverting to pending mode...');
  9929. uroPendingCommentDataRefresh = true;
  9930. }
  9931. else
  9932. {
  9933. // something may have gone awry here - the most recent comment loaded for this UR doesn't have the
  9934. // same ID as the one present at the start of the refresh process, yet the comment counts still don't
  9935. // match up, which suggests either a comment got lost along the way or someone else has commented on
  9936. // the same UR at almost the same time. To get out of the loop this would create, assume that a
  9937. // mismatch in the IDs means the .get() has completed successfully no matter what the new comment
  9938. // count is, and take this new count to be the count we were expecting all along...
  9939. uroDBG.AddLog('latest comment ID different, but expected count not correct...');
  9940. uroExpectedCommentCount = cachedCommentCount;
  9941. }
  9942. }
  9943. else
  9944. {
  9945. uroDBG.AddLog('first comment on this UR not received yet, reverting to pending mode...');
  9946. uroPendingCommentDataRefresh = true;
  9947. }
  9948. }
  9949.  
  9950. }
  9951. else
  9952. {
  9953. // if the WME session is loaded with a UR already selected, such that WME has opened the UR dialog as part
  9954. // of the session startup process, adding new comments to the UR cause the cached data to be updated immediately.
  9955. // This prevents URO+ from switching into waiting mode in the above block of code, so we have to instead do
  9956. // it here by comparing the cached count against the expected count following the Send click event.
  9957. if(cachedCommentCount >= uroExpectedCommentCount)
  9958. {
  9959. uroPendingCommentDataRefresh = false;
  9960. uroWaitingCommentDataRefresh = true;
  9961. uroExpectedCommentCount = null;
  9962. }
  9963.  
  9964. // once the cached data has been updated, refilter the URs so that the new comment count is taken into account
  9965. // immediately for filtering and display purposes
  9966. if(uroWaitingCommentDataRefresh === true)
  9967. {
  9968. uroWaitingCommentDataRefresh = false;
  9969. uroFilterURs();
  9970. uroDBG.AddLog('refresh complete');
  9971. }
  9972. }
  9973. }
  9974. }
  9975. function uroAddedComment()
  9976. {
  9977. // when the user clicks the Send button to submit a new UR comment, this event handler fires before the new comment is
  9978. // posted to the server and thus also before the comment list gets updated in the UR dialog. So we take the current
  9979. // comment count and, if the new comment edit box isn't empty, increment it by 1 to get the expected count. Then we
  9980. // set the pending flag true to initiate a session refresh on the next 100ms tick
  9981. uroExpectedCommentCount = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments.length;
  9982. if(document.getElementsByClassName('new-comment-text')[0].value !== '')
  9983. {
  9984. uroExpectedCommentCount++;
  9985. uroDBG.AddLog('new comment added to UR '+uroSelectedURID+', cache refresh required...');
  9986. uroPendingCommentDataRefresh = true;
  9987. }
  9988. else
  9989. {
  9990. uroPendingCommentDataRefresh = false;
  9991. }
  9992. }
  9993. function uroInhibitNextUpdateRequestButton(e)
  9994. {
  9995. e.stopPropagation();
  9996.  
  9997. let doClick = true;
  9998. if(document.getElementsByClassName('form-control new-comment-text').length > 0)
  9999. {
  10000. if(document.getElementsByClassName('form-control new-comment-text')[0].textLength > 0)
  10001. {
  10002. uroAlertBox.Show("fa-warning", "URO+ Warning", "Comment not sent, close report panel anyway?", true, "Yes", "No", uroCloseReportPanel, null);
  10003. // set doClick to false here, as uroCloseReportPanel will be called by the alert box handler if required...
  10004. doClick = false;
  10005. }
  10006. }
  10007. // no alert box has been generated, so close the panel
  10008. if(doClick)
  10009. {
  10010. uroCloseReportPanel();
  10011. }
  10012. }
  10013. function uroCloseReportPanel()
  10014. {
  10015. document.getElementsByClassName('close-panel')[0].click();
  10016. }
  10017. function uroIncrementClosureDate(oldDate, incByDays)
  10018. {
  10019. // Thanks to WME no longer using consistent ISO8601 date formatting when displaying
  10020. // closure details, parsing the date string is now somewhat more involved. Thanks devs...
  10021.  
  10022. // Default to returning the existing date, just in case we can't increment it
  10023. let retval = oldDate;
  10024. let sepChar = null;
  10025.  
  10026. // Search through oldDate for a non-digit character, so we know what's
  10027. // being used to seperate the year, month and date values by this locale...
  10028. for(let i = 0; i < oldDate.length; ++i)
  10029. {
  10030. if((oldDate[i] < '0') || (oldDate[i] > '9'))
  10031. {
  10032. sepChar = oldDate[i];
  10033. break;
  10034. }
  10035. }
  10036.  
  10037. if(sepChar != null)
  10038. {
  10039. // First build a "probe" date object we can use to determine what the user's WME locale
  10040. // does with dates.
  10041. let incDate = new Date();
  10042. incDate.setFullYear(3000);
  10043. incDate.setMonth(10);
  10044. incDate.setDate(22);
  10045.  
  10046. // With these three carefully chosen date elements set, we now generate a localised datestring
  10047. // using the WME locale setting - the first character of which then tells us the date
  10048. // format - 1 = MDY (ack ptui), 2 = DMY (good), 3 = YMD (sweet!)
  10049. let localeDate = incDate.toLocaleDateString(I18n.locale);
  10050. let dateFormat = localeDate[0];
  10051.  
  10052. // Now we know the seperator character and the date format, so we can finally start to parse
  10053. // the existing date string...
  10054. let oldDateBits = oldDate.split(sepChar);
  10055. let datePos;
  10056. let monthPos;
  10057. let yearPos;
  10058. if(dateFormat == '1')
  10059. {
  10060. datePos = 1;
  10061. monthPos = 0;
  10062. yearPos = 2;
  10063. }
  10064. else if(dateFormat == '2')
  10065. {
  10066. datePos = 0;
  10067. monthPos = 1;
  10068. yearPos = 2;
  10069. }
  10070. else
  10071. {
  10072. datePos = 2;
  10073. monthPos = 1;
  10074. yearPos = 0;
  10075. }
  10076. incDate.setFullYear(parseInt(oldDateBits[yearPos]));
  10077. incDate.setMonth(parseInt(oldDateBits[monthPos]) - 1);
  10078. incDate.setDate(parseInt(oldDateBits[datePos]));
  10079. let tDate = new Date(incDate.getTime());
  10080. incDate.setDate(tDate.getDate() + incByDays);
  10081.  
  10082. retval = incDate.toLocaleDateString(I18n.locale);
  10083.  
  10084. // Except for those pesky locales where toLocaleDateString() doesn't *quite*
  10085. // return what WME is expecting. Because, you know, why make it easy for
  10086. // scripters when you can chuck in a few subtle curveballs like this, eh...
  10087.  
  10088. if(I18n.locale == 'bg')
  10089. {
  10090. // Remove the "r." suffix
  10091. retval = retval.split(" ")[0] + " ";
  10092. }
  10093. }
  10094. return retval;
  10095. }
  10096. function uroGetElementProperty(elmName, elmOffset, elmProperty)
  10097. {
  10098. let retval = null;
  10099. if(document.getElementsByName(elmName).length > elmOffset)
  10100. {
  10101. retval = document.getElementsByName(elmName)[elmOffset][elmProperty];
  10102. }
  10103. else if(document.getElementById(elmName) !== null)
  10104. {
  10105. retval = document.getElementById(elmName)[elmProperty];
  10106. }
  10107. return retval;
  10108. }
  10109. function uroGetShadowElementProperty(elmName, shadowElmType, property)
  10110. {
  10111. let retval = null;
  10112. let tObj = document.getElementById(elmName);
  10113. if(tObj !== null)
  10114. {
  10115. let sObj = tObj.shadowRoot.querySelector(shadowElmType);
  10116. if(sObj !== null)
  10117. {
  10118. retval = sObj[property];
  10119. }
  10120. }
  10121. return retval;
  10122. }
  10123. function uroClosureEditUIChanged()
  10124. {
  10125. if(document.getElementsByClassName('edit-closure').length === 1)
  10126. {
  10127. // note: this also fires when the UI is closed, due to the change events triggered as its elements are removed
  10128. // prior to the tab itself closing...
  10129.  
  10130. let notReady = 0;
  10131. if(document.getElementById('closure_reason').shadowRoot.querySelector('input') === null) notReady += 1;
  10132. if(document.getElementById('closure_direction').shadowRoot.querySelector('.selected-value') === null) notReady += 2;
  10133. else if(document.getElementById('closure_direction').shadowRoot.querySelector('.selected-value').innerText === "") notReady += 4;
  10134. if(document.getElementById('closure_startDate') === null) notReady += 8;
  10135. if(document.getElementById('closure_endDate') === null) notReady += 16;
  10136. if(document.getElementById('closure_eventId').shadowRoot.querySelector('.selected-value') === null) notReady += 32;
  10137. else if(document.getElementById('closure_eventId').shadowRoot.querySelector('.selected-value').innerText === "") notReady += 64;
  10138. if(document.getElementById('closure_permanent').shadowRoot.querySelector('.wz-checkbox') === null) notReady += 128;
  10139. if(notReady === 0)
  10140. {
  10141. if(uroRTCClone.PendingClone === -3)
  10142. {
  10143. uroRTCClone.Complete();
  10144. }
  10145. else if(uroRTCClone.PendingClone !== -1)
  10146. {
  10147. uroRTCClone.Copy(uroRTCClone.PendingClone);
  10148. }
  10149. else
  10150. {
  10151. uroTempFixMTEDropDown();
  10152. }
  10153. }
  10154. }
  10155. else
  10156. {
  10157. if(uroRTCClone.PendingClone === -2)
  10158. {
  10159. // generate a click event on the Add a closure button to open up the closure editing UI, then
  10160. // wait for the UI to finish opening...
  10161. document.getElementsByClassName('add-closure-button')[0].click();
  10162. uroRTCClone.PendingClone = -3;
  10163. }
  10164. uroClosureListHandler();
  10165. }
  10166. }
  10167. function uroTSTPopupHandler()
  10168. {
  10169. if(document.getElementsByClassName('panel')[0] === undefined)
  10170. {
  10171. uroHidePopupOnPanelOpen = true;
  10172. }
  10173.  
  10174. if(uroPopup.shown === true)
  10175. {
  10176. let hidePopup = false;
  10177.  
  10178. if(document.getElementsByClassName('panel')[0] != null)
  10179. {
  10180. if(uroHidePopupOnPanelOpen === true)
  10181. {
  10182. hidePopup = true;
  10183. uroHidePopupOnPanelOpen = false;
  10184. }
  10185. }
  10186.  
  10187. if(hidePopup === true)
  10188. {
  10189. uroPopup.Hide();
  10190. }
  10191. }
  10192.  
  10193. if((uroAFN.hoverObj !== null) && (uroAFN.hoverTime != -1) && (uroAFN.overlayShown === false))
  10194. {
  10195. if(++uroAFN.hoverTime > 5)
  10196. {
  10197. uroAFN.OverlaySetup();
  10198. }
  10199. }
  10200. uroAFN.ReplaceAreaNames(false);
  10201.  
  10202. if(uroPopup.autoHideTimer > 0)
  10203. {
  10204. if(--uroPopup.autoHideTimer === 0)
  10205. {
  10206. uroPopup.Hide();
  10207. }
  10208. }
  10209.  
  10210. if(uroPopup.timer > 0)
  10211. {
  10212. if(uroPopup.mouseIn === false)
  10213. {
  10214. uroPopup.timer--;
  10215. }
  10216. }
  10217. if(uroPopup.timer === 0)
  10218. {
  10219. uroPopup.Hide();
  10220. }
  10221. }
  10222. function uroTSTNextBtnHandler()
  10223. {
  10224. // replaces the "next xxx" button on UR, MP and PUR editing UIs
  10225.  
  10226. // Correctly determining what WME is displaying for the "next" button in the UR/MP/(P)PUR panel is not trivial due to
  10227. // inconsistencies in the panel behaviour depending on whether it was opened by clicking directly on the relevant
  10228. // marker, or by clicking on the associated feed entry... For PURs, there's also the added complication of multi-part
  10229. // update requests, where the same marker/panel are used to access more than one request and where, therefore, we need
  10230. // to enable access to all requests contained within the PUR, but still inhibit the "next" button once the last
  10231. // request in the multi-part sequence has been viewed.
  10232. //
  10233. // For directly-accesed markers, the "next" button caption is:
  10234. //
  10235. // URs = "Next update request" (update_requests.panel.next)
  10236. // MPs = "Next map problem" (problems.panel.next)
  10237. // PURs = "Next place" for single-part PURs or for the last part of a multi-part PUR (venues.update_requests.panel.next_venue)
  10238. // = "Next" for all but the last part of a multi-part PUR (venues.update_requests.panel.next)
  10239. // PPURs = "Next place" (venues.update_requests.panel.next_venue)
  10240. //
  10241. // For markers accessed via the feed, the "next" button caption always appears to be "Next issue" (feed.issues.next)
  10242.  
  10243.  
  10244.  
  10245. if(W.map.panelRegion.hasView() === true)
  10246. {
  10247. let nurButton = W.map.panelRegion.$el[0].getElementsByClassName('next')[0];
  10248. if(nurButton === undefined)
  10249. {
  10250. nurButton = W.map.panelRegion.$el[0].getElementsByClassName('next-venue')[0];
  10251. }
  10252. if(nurButton !== undefined)
  10253. {
  10254. let doneString = I18n.lookup('problems.panel.done');
  10255. let btnCaptionIsNextPlace = (nurButton.innerHTML.indexOf(I18n.lookup('venues.update_requests.panel.next_venue')) !== -1);
  10256. let btnCaptionIsDefaultUR = (nurButton.innerHTML.indexOf(I18n.lookup('update_requests.panel.next')) !== -1);
  10257. let btnCaptionIsDefaultMP = (nurButton.innerHTML.indexOf(I18n.lookup('problems.panel.next')) !== -1);
  10258. let btnCaptionIsNextIssue = (nurButton.innerHTML.indexOf(I18n.lookup('feed.issues.next')) !== -1);
  10259.  
  10260. let updateButton = false;
  10261.  
  10262. let panelClass = W.map.panelRegion.$el[0].childNodes[0].childNodes[0].className;
  10263. let isURorMPPanel = (panelClass.indexOf('problem-edit') !== -1);
  10264. let isPURPanel = (panelClass.indexOf('place-update') !== -1);
  10265.  
  10266. if(isURorMPPanel === true)
  10267. {
  10268. // user has enabled UR button mod?
  10269. if(uroUtils.GetCBChecked('_cbInhibitNURButton') === true)
  10270. {
  10271. // the native UR panel button will always either be "Next update request" or "Next issue"
  10272. updateButton = ((btnCaptionIsDefaultUR) || (btnCaptionIsNextIssue));
  10273. }
  10274.  
  10275. // user has enabled MP button mod?
  10276. if(uroUtils.GetCBChecked('_cbInhibitNMPButton') === true)
  10277. {
  10278. // there's no way to determine if the edit panel has been opened for a UR or a MP, however as MPs
  10279. // don't currently appear in the feed, the native button only uses "Next map problem" as its caption
  10280. updateButton = (updateButton || btnCaptionIsDefaultMP);
  10281. }
  10282. }
  10283. else if(isPURPanel === true)
  10284. {
  10285. if(uroUtils.GetCBChecked('_cbInhibitNPURButton') === true)
  10286. {
  10287. // for a (P)PUR, only modify the button if it's showing the "Next place" or "Next issue" caption, to
  10288. // avoid messing up the "Next" button used to move to the next part of a multi-part PUR...
  10289. updateButton = ((btnCaptionIsNextPlace === true) || (btnCaptionIsNextIssue));
  10290. }
  10291. }
  10292.  
  10293. if(updateButton === true)
  10294. {
  10295. uroDBG.AddLog('inhibit Next UR/MP/PUR button');
  10296.  
  10297. // alter the button caption
  10298. nurButton.innerHTML = uroUtils.ModifyHTML(doneString);
  10299. // 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
  10300. // moving to the next UR/MP/PUR, and also allows us to warn about closing the UR panel if there's an unsent comment...
  10301. nurButton.addEventListener("click", uroInhibitNextUpdateRequestButton, false);
  10302. }
  10303.  
  10304. uroInhibitURFiltering = false;
  10305. }
  10306. }
  10307. }
  10308. function uroTSTCommentAddedHandler()
  10309. {
  10310. // test for the opening or closing of the UR editing dialog so we can detect when a new comment is added
  10311. let URDialogIsOpen = false;
  10312. let panelOpen = (document.getElementById('panel-container').firstChild !== null);
  10313.  
  10314. if(panelOpen)
  10315. {
  10316. URDialogIsOpen = (document.getElementById('panel-container').getElementsByClassName('conversation').length > 0);
  10317. }
  10318.  
  10319. if(URDialogIsOpen)
  10320. {
  10321. let thisSelectedURID = document.getElementsByClassName('permalink')[0].href.split('&mapUpdateRequest=');
  10322. if(thisSelectedURID.length > 1)
  10323. {
  10324. thisSelectedURID = thisSelectedURID[1].split('&')[0];
  10325. }
  10326. else
  10327. {
  10328. thisSelectedURID = null;
  10329. }
  10330.  
  10331. if((thisSelectedURID != uroSelectedURID) || ((thisSelectedURID != uroMarkers.clickedOnID) && (uroMarkers.clickedOnID != null)))
  10332. {
  10333. // if the user selects a new UR whilst the editing dialog is still open, treat it in the
  10334. // same way as if the user had selected that UR with the dialog closed
  10335. uroURDialogIsOpen = false;
  10336. uroSelectedURID = null;
  10337. }
  10338.  
  10339. if(((uroURDialogIsOpen === false) && (uroSelectedURID === null)) || (uroURReclickAttempts > 0))
  10340. {
  10341. // user is editing a new UR
  10342.  
  10343. // add our own click event handler to the Send button, so we can do stuff whenever a new comment is added
  10344. if(document.getElementsByClassName('new-comment-form').length > 0)
  10345. {
  10346. if(document.getElementsByClassName('new-comment-form')[0].getElementsByClassName('send-button').length > 0)
  10347. {
  10348. document.getElementsByClassName('new-comment-form')[0].getElementsByClassName('send-button')[0].addEventListener("click", uroAddedComment, false);
  10349.  
  10350. uroSelectedURID = thisSelectedURID;
  10351. uroDBG.AddLog('user is editing UR '+uroSelectedURID);
  10352. uroExpectedCommentCount = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments.length;
  10353.  
  10354. if((uroHoveredURID !== null) && (uroSelectedURID !== null) && (parseInt(uroHoveredURID) !== parseInt(uroSelectedURID)))
  10355. {
  10356. if(uroURReclickAttempts === 0)
  10357. {
  10358. 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...');
  10359. }
  10360. if(++uroURReclickAttempts < 3)
  10361. {
  10362. //uroRestackMarkers();
  10363. let urMarker = uroGetMarker(uroLayers.ID.UR,uroHoveredURID);
  10364. if(urMarker !== null)
  10365. {
  10366. let urMarkerAttributes = uroGetAttributes(uroLayers.ID.UR, uroHoveredURID);
  10367. if(urMarkerAttributes !== null)
  10368. {
  10369. urMarkerAttributes.geometry.x = urMarkerAttributes.geometry.realX;
  10370. urMarkerAttributes.geometry.y = urMarkerAttributes.geometry.realY;
  10371. uroOpenURDialog(uroHoveredURID);
  10372. }
  10373. }
  10374. return;
  10375. }
  10376. else
  10377. {
  10378. uroDBG.AddLog('Woe is me, attempting to open UR ID '+uroHoveredURID+' has failed...');
  10379. 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);
  10380. }
  10381. }
  10382. uroURReclickAttempts = 0;
  10383. uroFilterURs();
  10384. }
  10385. }
  10386. }
  10387. }
  10388. else if(uroURDialogIsOpen === true)
  10389. {
  10390. // dialog was open and has now been closed
  10391. uroSelectedURID = null;
  10392. uroMarkers.clickedOnID = null;
  10393. uroFilterURs();
  10394. }
  10395. uroURDialogIsOpen = URDialogIsOpen;
  10396.  
  10397. if(((uroPendingCommentDataRefresh === true) || (uroWaitingCommentDataRefresh === true)) && (uroSelectedURID !== null))
  10398. {
  10399. uroDBG.AddLog('check completion of comment data refresh for UR '+uroSelectedURID+' ('+uroPendingCommentDataRefresh+','+uroWaitingCommentDataRefresh+')');
  10400. uroGetSelectedURCommentCount();
  10401. }
  10402.  
  10403. }
  10404. function uroClosureListHandler()
  10405. {
  10406. // Handles adjustments to the closure list in the sidepanel...
  10407. //
  10408. if(uroUtils.GetCBChecked('_cbMasterEnable') === false)
  10409. {
  10410. return;
  10411. }
  10412.  
  10413. // List entry filtering
  10414. let nEntries = document.querySelectorAll('.closure-item').length;
  10415. if(nEntries > 0)
  10416. {
  10417. let filterExpired = uroUtils.GetCBChecked('_cbHideExpiredSidepanelRTCs');
  10418. let filterCurrent = uroUtils.GetCBChecked('_cbHideSidepanelRTCs');
  10419. let filterFuture = uroUtils.GetCBChecked('_cbHideFutureSidepanelRTCs');
  10420. for(let i = 0; i < nEntries; ++i)
  10421. {
  10422. let hide = false;
  10423. let cElm = document.querySelectorAll('.closure-item')[i];
  10424. let ciSrc = cElm.querySelector('img')?.src;
  10425. if(ciSrc != undefined)
  10426. {
  10427. hide |= ((ciSrc.indexOf('finished') != -1) && (filterExpired == true));
  10428. hide |= ((ciSrc.indexOf('active') != -1) && (filterCurrent == true));
  10429. hide |= ((ciSrc.indexOf('not-started') != -1) && (filterFuture == true));
  10430. }
  10431.  
  10432. if(hide == true)
  10433. {
  10434. cElm.style.display = "none";
  10435. }
  10436. else
  10437. {
  10438. cElm.style.display = "block";
  10439. }
  10440. }
  10441. }
  10442.  
  10443. // Closure cloning controls
  10444. if((document.querySelectorAll('.closures-list').length > 0) && (document.querySelector('.closures-list').getAttribute('touchedbyuro') === null))
  10445. {
  10446. let nClosures;
  10447. let cLoop;
  10448. let btnElm;
  10449.  
  10450. // Cloning doesn't work with certain locales due to the way the date strings are formatted...
  10451. if
  10452. (
  10453. (I18n.locale == "fa-IR") ||
  10454. (I18n.locale == 'ar') ||
  10455. (I18n.locale == 'zh') ||
  10456. (I18n.locale == 'ko')
  10457. )
  10458. {
  10459. // Sorry :-(
  10460. }
  10461. else
  10462. {
  10463. // for the others, are there any closures defined for all of the selected segment(s)...
  10464. if(document.getElementsByClassName('full-closures').length > 0)
  10465. {
  10466. nClosures = document.getElementsByClassName('full-closures')[0].querySelectorAll('.closure-item.is-editable').length;
  10467. if(nClosures > 0)
  10468. {
  10469. // Force a refresh of uroRTCObjs for the selected segment, as this is no longer guaranteed to have already occurred...
  10470. let segID = W.selectionManager.getSelectedFeatureIds()[0];
  10471. uroGetSelectedSegmentRTCs(segID);
  10472.  
  10473. // and if so, have we already added the clone icon?
  10474. for(cLoop = 0; cLoop < nClosures; cLoop++)
  10475. {
  10476. btnElm = document.getElementsByClassName('full-closures')[0].querySelectorAll('.closure-item.is-editable')[cLoop].getElementsByClassName('closure-title')[0];
  10477. if((btnElm.innerHTML.indexOf('_uroCloneClosure-') == -1) && (uroGetRTCOrigin(uroRTCObjs[cLoop]) !== URO_TRTC.UNKNOWN))
  10478. {
  10479. let newNode = document.createElement("div");
  10480. let anchorID1 = '_uroCloneClosure-1-'+cLoop;
  10481. let anchorID2 = '_uroCloneClosure-7-'+cLoop;
  10482. let newAnchor = '<a id="'+anchorID1+'" href="#">';
  10483. newAnchor += "<i style='font-size: 150%; cursor: copy' class='fa fa-copy'></i>";
  10484. newAnchor += "</a><sup>+1</sup>&nbsp;";
  10485. newAnchor += '<a id="'+anchorID2+'" href="#">';
  10486. newAnchor += "<i style='font-size: 150%; cursor: copy' class='fa fa-copy'></i>";
  10487. newAnchor += "</a><sup>+7</sup>";
  10488. newNode.innerHTML = uroUtils.ModifyHTML(newAnchor);
  10489. btnElm.prepend(newNode);
  10490. uroUtils.AddEventListener(anchorID1,"click",uroRTCClone.Clone,false);
  10491. uroUtils.AddEventListener(anchorID2,"click",uroRTCClone.Clone,false);
  10492.  
  10493. let chipElm = btnElm.querySelector("wz-image-chip");
  10494. chipElm.innerHTML = chipElm.innerHTML.split('>')[0] + '>';
  10495. }
  10496. }
  10497. }
  10498. }
  10499. }
  10500.  
  10501. // if there's more than one closure (full or partial) listed, also add the delete all button if not already present
  10502. nClosures = document.querySelectorAll('.closure-item.is-editable').length;
  10503. if(nClosures > 0)
  10504. {
  10505. if(document.getElementById('_btnDeleteAllClosures') === null)
  10506. {
  10507. let daDiv = document.createElement('wz-button');
  10508. daDiv.className = 'delete-all-button btn is-expanded'; //btn-primary';
  10509. daDiv.id = '_btnDeleteAllClosures';
  10510.  
  10511. let tHTML = '<i class="fa fa-trash"></i> '+I18n.lookup("closures.delete_confirm_no_reason");
  10512. if(nClosures > 1)
  10513. {
  10514. tHTML += ' ('+I18n.lookup("closures.apply_to_all")+')';
  10515. }
  10516. daDiv.innerHTML = uroUtils.ModifyHTML(tHTML);
  10517. daDiv.style.width = '100%';
  10518. daDiv.style.marginBottom = '10px';
  10519.  
  10520. let acBtn = document.getElementsByClassName('add-closure-button')[0];
  10521. if(acBtn !== undefined)
  10522. {
  10523. acBtn.parentNode.insertBefore(daDiv, acBtn.nextSibling);
  10524. uroUtils.AddEventListener('_btnDeleteAllClosures',"click", uroRTCClone.DeleteAll, false);
  10525. }
  10526. }
  10527. }
  10528.  
  10529. let deferTouching = false;
  10530. if(uroUtils.GetCBChecked('_cbAutoScrollClosureList') == true)
  10531. {
  10532. // Scroll to the end of the closure tab, as that's where the closure you're most likely to be cloning
  10533. // is located...
  10534. let cItems = document.getElementsByClassName('closure-item');
  10535. if(cItems.length > 0)
  10536. {
  10537. let lastOne = cItems[cItems.length - 1];
  10538. if(lastOne.getBoundingClientRect().height === 0)
  10539. {
  10540. deferTouching = true;
  10541. }
  10542. else
  10543. {
  10544. lastOne.scrollIntoView();
  10545. }
  10546. }
  10547. }
  10548.  
  10549. if(deferTouching === false)
  10550. {
  10551. document.getElementsByClassName('closures-list')[0].setAttribute('touchedbyuro','true');
  10552. }
  10553. }
  10554. }
  10555. function uroMiscUITweaksHandler()
  10556. {
  10557. if(uroFilterPreamble())
  10558. {
  10559. // clickifies the ExtraInfo URL present in some MPs
  10560. {
  10561. if(document.getElementById('panel-container').getElementsByClassName('extraInfo').length > 0)
  10562. {
  10563. if(document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].touchedByURO === undefined)
  10564. {
  10565. let tDesc = document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].innerHTML;
  10566. tDesc = uroUtils.Clickify(tDesc, '');
  10567. document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].innerHTML = uroUtils.ModifyHTML(tDesc);
  10568. document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].touchedByURO = true;
  10569. }
  10570. }
  10571. }
  10572. }
  10573. }
  10574. function uroMainTick()
  10575. {
  10576. if(uroMTEMode) return;
  10577. if(uroInit.setupListeners)
  10578. {
  10579. if(uroInit.finalisingListenerSetup === false)
  10580. {
  10581. if(W.loginManager.isLoggedIn())
  10582. {
  10583. if(document.getElementsByClassName('topbar').length === 0) return;
  10584. uroInit.FinalizeListenerSetup();
  10585. document.getElementsByClassName('topbar')[0].appendChild(uroAMList);
  10586. }
  10587. }
  10588. }
  10589. else
  10590. {
  10591. if(uroUtils.GetCBChecked('_cbMasterEnable') === true)
  10592. {
  10593. // do one maintick handler call in each 10ms cycle to minimise the time stuck within the maintick handler without
  10594. // unduly affecting the overall response time for each individual handler
  10595.  
  10596. if(uroMainTickStage === 0) uroTSTPopupHandler();
  10597. if(uroMainTickStage == 1) uroTSTNextBtnHandler();
  10598. if(uroMainTickStage == 2) uroTSTCommentAddedHandler();
  10599. if(uroMainTickStage == 4) uroMiscUITweaksHandler();
  10600.  
  10601. if(++uroMainTickStage == 6) uroMainTickStage = 0;
  10602. }
  10603. }
  10604. }
  10605. function uroNewLookCheckDetailsRequest()
  10606. {
  10607. let thisurl = document.location.href;
  10608. let doRetry = true;
  10609. let urID;
  10610. let endmarkerpos = thisurl.indexOf('&endshow');
  10611. let showmarkerpos = thisurl.indexOf('&showturn=');
  10612.  
  10613. if((endmarkerpos != -1) && (showmarkerpos != -1))
  10614. {
  10615. showmarkerpos += 10;
  10616. uroDBG.AddLog('showturn tab opened');
  10617. urID = thisurl.substr(showmarkerpos,endmarkerpos-showmarkerpos);
  10618. uroDBG.AddLog(' turn problem ID = '+urID);
  10619.  
  10620. try
  10621. {
  10622. uroGetMarker(uroLayers.ID.MP,urID).element.click();
  10623. doRetry = false;
  10624. }
  10625. catch(err)
  10626. {
  10627. uroDBG.AddLog('problems not fully loaded, retrying...');
  10628. }
  10629.  
  10630. if(doRetry) window.setTimeout(uroNewLookCheckDetailsRequest,500);
  10631. }
  10632. else
  10633. {
  10634. showmarkerpos = thisurl.indexOf('&showpur=');
  10635. if((endmarkerpos != -1) && (showmarkerpos != -1))
  10636. {
  10637. showmarkerpos += 9;
  10638. uroDBG.AddLog('showPUR tab opened');
  10639. urID = thisurl.substr(showmarkerpos,endmarkerpos-showmarkerpos);
  10640. uroDBG.AddLog(' PUR ID = '+urID);
  10641.  
  10642. try
  10643. {
  10644. uroGetMarker(uroLayers.ID.PUR, urID).element.click();
  10645. doRetry = false;
  10646. }
  10647. catch(err)
  10648. {
  10649. uroDBG.AddLog('PURs not fully loaded, retrying...');
  10650. }
  10651.  
  10652. if(doRetry) window.setTimeout(uroNewLookCheckDetailsRequest,500);
  10653. }
  10654.  
  10655. else
  10656. {
  10657. showmarkerpos = thisurl.indexOf('&showppur=');
  10658. if((endmarkerpos != -1) && (showmarkerpos != -1))
  10659. {
  10660. showmarkerpos += 10;
  10661. uroDBG.AddLog('showPPUR tab opened');
  10662. urID = thisurl.substr(showmarkerpos,endmarkerpos-showmarkerpos);
  10663. uroDBG.AddLog(' PPUR ID = '+urID);
  10664.  
  10665. try
  10666. {
  10667. uroGetMarker(uroLayers.ID.PPUR, urID).element.click();
  10668. doRetry = false;
  10669. }
  10670. catch(err)
  10671. {
  10672. uroDBG.AddLog('PPURs not fully loaded, retrying...');
  10673. }
  10674.  
  10675. if(doRetry) window.setTimeout(uroNewLookCheckDetailsRequest,500);
  10676. }
  10677. }
  10678. }
  10679.  
  10680. }
  10681. function uroUpdateVenueEditorLists()
  10682. {
  10683. if(Object.keys(W.model.venues.objects).length === 0) return;
  10684.  
  10685. // build the list of all userIDs contained in the currently loaded venue objects
  10686. let selectedIdx = null;
  10687. let listedIDs = [];
  10688. let idx;
  10689. for(idx in W.model.venues.objects)
  10690. {
  10691. if(W.model.venues.objects.hasOwnProperty(idx))
  10692. {
  10693. let obj = W.model.venues.objects[idx].attributes;
  10694. let cbID = obj.createdBy;
  10695. let ubID = obj.updatedBy;
  10696.  
  10697. if((cbID !== null) && (listedIDs.indexOf(cbID) == -1))
  10698. {
  10699. listedIDs.push(cbID);
  10700. }
  10701. if((ubID !== null) && (ubID !== cbID) && (listedIDs.indexOf(ubID) == -1))
  10702. {
  10703. listedIDs.push(ubID);
  10704. }
  10705. }
  10706. }
  10707.  
  10708. // check for any previously selected userIDs in the two selector lists, then clear both lists
  10709. // and repopulate using the newly gathered ID collection from above, and finally reselect the
  10710. // previously selected user if they're still present in the new list...
  10711. let selector;
  10712. let selectedUser;
  10713. let users = W.model.users.getByIds(listedIDs);
  10714. let selectorEntry;
  10715.  
  10716. for(let i=0; i<2; i++)
  10717. {
  10718. if(i === 0) selector = document.getElementById('_selectPlacesUserID');
  10719. else selector = document.getElementById('_selectHidePlacesUserID');
  10720.  
  10721. selectedUser = null;
  10722. if(selector.selectedOptions[0] != null)
  10723. {
  10724. selectedUser = parseInt(selector.selectedOptions[0].value);
  10725. }
  10726. while(selector.options.length > 0)
  10727. {
  10728. selector.options.remove(0);
  10729. }
  10730. selector.options.add(new Option('<select a user>', null));
  10731. if(listedIDs.length > 0)
  10732. {
  10733. selectorEntry = '';
  10734. for(idx=0; idx<users.length; idx++)
  10735. {
  10736. if(users[idx].attributes.userName === undefined)
  10737. {
  10738. selectorEntry = users[idx].attributes.id;
  10739. }
  10740. else
  10741. {
  10742. selectorEntry = users[idx].attributes.userName;
  10743. }
  10744. selector.options.add(new Option(selectorEntry, users[idx].id));
  10745. if(users[idx].attributes.id == selectedUser)
  10746. {
  10747. selectedIdx = idx+1;
  10748. }
  10749. }
  10750. }
  10751.  
  10752. if(selectedIdx !== null)
  10753. {
  10754. selector.selectedIndex = selectedIdx;
  10755. }
  10756. }
  10757. }
  10758. function uroPlacesEditorSelected()
  10759. {
  10760. let selector = document.getElementById('_selectPlacesUserID');
  10761. if(selector.selectedIndex > 0)
  10762. {
  10763. document.getElementById('_textPlacesEditor').value = document.getElementById('_selectPlacesUserID').selectedOptions[0].innerHTML;
  10764. }
  10765. }
  10766. function uroHidePlacesEditorSelected()
  10767. {
  10768. let selector = document.getElementById('_selectHidePlacesUserID');
  10769. if(selector.selectedIndex > 0)
  10770. {
  10771. document.getElementById('_textHidePlacesEditor').value = document.getElementById('_selectHidePlacesUserID').selectedOptions[0].innerHTML;
  10772. }
  10773. }
  10774. function uroCamEditorSelected()
  10775. {
  10776. let selector = document.getElementById('_selectCameraUserID');
  10777. if(selector.selectedIndex > 0)
  10778. {
  10779. document.getElementById('_textCameraEditor').value = document.getElementById('_selectCameraUserID').selectedOptions[0].innerHTML;
  10780. }
  10781. }
  10782. function uroSetStyles(obj)
  10783. {
  10784. obj.style.fontSize = '12px';
  10785. obj.style.lineHeight = '100%';
  10786. obj.style.flex = '1';
  10787. obj.style.overflowY = 'auto';
  10788. }
  10789. function uroSetSectionTabStyles()
  10790. {
  10791. for(let i =0; i < uroTabs.CtrlTabs.length; ++i)
  10792. {
  10793. uroSetStyles(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY]);
  10794. }
  10795. }
  10796. function uroPlacesGroupCEHandler(groupidx)
  10797. {
  10798. if(uroPlacesGroupsCollapsed[groupidx] === false)
  10799. {
  10800. document.getElementById('_uroPlacesGroup-'+groupidx).style.display = "block";
  10801. document.getElementById('_uroPlacesGroupState-'+groupidx).className = "fa fa-minus-square-o";
  10802. }
  10803. else
  10804. {
  10805. document.getElementById('_uroPlacesGroup-'+groupidx).style.display = "none";
  10806. document.getElementById('_uroPlacesGroupState-'+groupidx).className = "fa fa-plus-square-o";
  10807. }
  10808. }
  10809. function uroPlacesGroupCollapseExpand()
  10810. {
  10811. let groupidx = this.id.substr(21);
  10812. if(uroPlacesGroupsCollapsed[groupidx] === true) uroPlacesGroupsCollapsed[groupidx] = false;
  10813. else uroPlacesGroupsCollapsed[groupidx] = true;
  10814. uroPlacesGroupCEHandler(groupidx);
  10815. return false;
  10816. }
  10817. function uroGetMarkerIDs(markerType)
  10818. {
  10819. let idList = [];
  10820.  
  10821. if(uroLayers.layers[markerType].mf !== null)
  10822. {
  10823. for(let i = 0; i < uroLayers.layers[markerType].mf.length; ++i)
  10824. {
  10825. let dID = uroLayers.layers[markerType].mf[i]?.element?.attributes['data-id']?.value;
  10826. if(dID === undefined)
  10827. {
  10828. dID = uroLayers.layers[markerType].mf[i]?.attributes?.wazeFeature?.id;
  10829. }
  10830. if(dID !== undefined)
  10831. {
  10832. idList.push(dID);
  10833. }
  10834. }
  10835. }
  10836. return idList;
  10837. }
  10838. function uroGetAttributes(markerType, markerID)
  10839. {
  10840. if(markerType == uroLayers.ID.UR) return W.model.mapUpdateRequests.objects[markerID].attributes;
  10841. if(markerType == uroLayers.ID.MP) return W.model.mapProblems.objects[markerID].attributes;
  10842. return null;
  10843. }
  10844. function uroGetMarker(markerType, markerID)
  10845. {
  10846. if(typeof(markerID) === 'number')
  10847. {
  10848. markerID = markerID.toString();
  10849. }
  10850.  
  10851. let retval = null;
  10852.  
  10853. if(markerID !== null)
  10854. {
  10855. let mObj = null;
  10856. if(markerType === uroLayers.ID.UR)
  10857. {
  10858. mObj = W.model.mapUpdateRequests.getObjectById(markerID);
  10859. }
  10860. else if(markerType === uroLayers.ID.MP)
  10861. {
  10862. mObj = W.model.mapProblems.getObjectById(markerID);
  10863. }
  10864. else if(markerType === uroLayers.ID.RTC)
  10865. {
  10866. mObj = W.model.roadClosures.getObjectById(markerID);
  10867. }
  10868.  
  10869. if(mObj !== null)
  10870. {
  10871. retval = W.userscripts.getMapElementByDataModel(mObj);
  10872. }
  10873. else
  10874. {
  10875. for(let i = 0; i < uroLayers.layers[markerType].mf.length; ++i)
  10876. {
  10877. if(uroLayers.layers[markerType].mf[i]?.attributes?.wazeFeature?.id === markerID)
  10878. {
  10879. let geoID = uroLayers.layers[markerType].mf[i].geometry.id;
  10880. retval = document.getElementById(geoID);
  10881. break;
  10882. }
  10883. }
  10884. }
  10885. }
  10886. return retval;
  10887. }
  10888.  
  10889. uroInit.Initialise();