UROverview Plus (URO+)

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

当前为 2024-04-23 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name UROverview Plus (URO+)
  3. // @namespace http://greasemonkey.chizzum.com
  4. // @description Adds a whole bunch of features to WME, which someday I may get around to documenting properly...
  5. // @include https://*.waze.com/*editor*
  6. // @exclude https://editor-beta.waze.com/*
  7. // @exclude https://beta.waze.com/*
  8. // @exclude https://www.waze.com/user/*editor/*
  9. // @exclude https://www.waze.com/*/user/*editor/*
  10. // @grant none
  11. // @version 4.4
  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.4",
  40. date : "20240424",
  41. changes :
  42. [
  43. 'Removed a bug that could prevent UR filtering & comment count updates from taking place',
  44. 'Improved reliability of adding closure UI enhancements...'
  45. ]
  46. };
  47.  
  48. const URO_UFP_OPTS =
  49. {
  50. filterUneditable: 0,
  51. filterInsideManagedAreas: 1,
  52. excludeMyAreas: 2,
  53. filterLockRanked: 3,
  54. filterFlagged: 4,
  55. filterNewPlace: 5,
  56. filterUpdatedDetails: 6,
  57. filterNewPhoto: 7,
  58. filterMinPURAge: 8,
  59. filterMaxPURAge: 9,
  60. invertPURFilters: 10,
  61. filterHighSeverity: 11,
  62. filterMedSeverity: 12,
  63. filterLowSeverity: 13,
  64. leavePURGeos: 14,
  65. filterCFPhone: 15,
  66. filterCFName: 16,
  67. filterCFEntryExitPoints: 17,
  68. filterCFOpeningHours: 18,
  69. filterCFAliases: 19,
  70. filterCFServices: 20,
  71. filterCFGeometry: 21,
  72. filterCFHouseNumber: 22,
  73. filterCFCategories: 23,
  74. filterCFDescription: 24,
  75. filterOnCFs: 25,
  76. thresholdMinPURDays: 26,
  77. thresholdMaxPURDays: 27,
  78. isLoggedIn: 28,
  79. userRank: 29,
  80. N_OPTS: 30
  81. };
  82. const URO_TRTC =
  83. {
  84. UNKNOWN: 0,
  85. WME: 1,
  86. WAZEFEED: 2,
  87. WAZEOTHER: 3
  88. };
  89. const URO_SRTC =
  90. {
  91. UNKNOWN: 0,
  92. EXPIRED: 1,
  93. ACTIVE: 2,
  94. FUTURE: 3
  95. };
  96. const URO_DRTC =
  97. {
  98. NONE: 0,
  99. SEG_AB: 1,
  100. SEG_BA: 2,
  101. SEG_BI: 4,
  102. TURN_OUT: 8,
  103. TURN_IN: 16
  104. };
  105. const uroCustomURTags = ['[ROADWORKS]','[CONSTRUCTION]','[CLOSURE]','[EVENT]','[NOTE]','[WSLM]','[BOG]','[DIFFICULT]'];
  106. const uroImages =
  107. {
  108. HighlightedCameraImages :
  109. [
  110. // speed
  111. ["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/Y7ux4zK5Wfz6T8O4R3GLyQ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KICAgPHBsdXM6SW1hZ2VDcmVhdG9yPgogICAgPHJkZjpTZXEvPgogICA8L3BsdXM6SW1hZ2VDcmVhdG9yPgogICA8cGx1czpDb3B5cmlnaHRPd25lcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkNvcHlyaWdodE93bmVyPgogICA8cGx1czpMaWNlbnNvcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkxpY2Vuc29yPgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgIAo8P3hwYWNrZXQgZW5kPSJ3Ij8+txeqYAAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAuIwAALiMBeKU/dgAAAAd0SU1FB+IDAw8pAmNZfO0AAA7kSURBVHja1Zx5kB1FHcc/8459b+9N2GSPhBiBBAQBBeVSI4GEoFQFSIASj+CRshDFQstAgXiiJcT7SLQKUVkQhOIIRVFA1gSSYCFHAgIakFSwSNjdhGU3yR7v7b43M/7Rr/N6erpn3stuTJyqrp7p6Zk3/X2/4/v7dc84HLrNiTme6ObHHFe1pQ4hOM4kA+cfpL4H5V+sFiS9LepY7W+SFj/mGEvbYQuUqTYVUx8bOL7Wphci6sNa9UzAJLRaBSdhuZ9nAMjTah0s50BUL3WI1M4ETkI5Thr6mFRPB8Qt9fdKfVXQdJWrCrDUIbJRaEAkI2onRvUkQJ4Ckqv09wygOP8PqudoUpRUSkqrdUlzNJA8pbhAUQHJjfB0h43qOTF2SZWYVEQxSRYGSZIgJUt1Aihoz+FrNs2pBrTUQQZHB0qXIhWUtFJSSp3UpApNmiRIhVJJWOgHBlV0KpWy1CQC5MRQgYRmf1SQarZv5w3fB1k8L1hHtet9fB/OOovZMUTTq4aMpg6SemFx/zpIUoJqAk+qPKrjBAEwtct97foaC+cqWoioE6WSziRJkWPwZI7B9auGO60BlQEyr7/OUyCkxCQpNgnzfXBdOPNMPgSMKWW8VAqawXc1ahFJSlOTpHI2XmS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FcQAdMpAqASoOLCzA2L5kYXPJPvHfdzpkIFUKVKXeUQcpCiio7KthhwVI1QBVCWDV3rMSiTnkAO0P3/6HIFcKwmEDzmQO9mCDdths/wXji1Blzxb9QAAAAABJRU5ErkJggg=="],
  112. // dummy
  113. ["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/JxCSc4ScoZGfPRkf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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgCjw/eHBhY2tldCBlbmQ9InciPz73ndT8AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH4gMDDykcmVZBjgAADbFJREFUeNrtXGuMVcUd/805595z774X9gWlIFIVl0dJUWEhtSDoxpA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BwbGllcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkltYWdlU3VwcGxpZXI+CiAgIDxwbHVzOkltYWdlQ3JlYXRvcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkltYWdlQ3JlYXRvcj4KICAgPHBsdXM6Q29weXJpZ2h0T3duZXI+CiAgICA8cmRmOlNlcS8+CiAgIDwvcGx1czpDb3B5cmlnaHRPd25lcj4KICAgPHBsdXM6TGljZW5zb3I+CiAgICA8cmRmOlNlcS8+CiAgIDwvcGx1czpMaWNlbnNvcj4KICA8L3JkZjpEZXNjcmlwdGlvbj4KIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAKPD94cGFja2V0IGVuZD0idyI/PvOQ5mMAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQfiAwMPKBseKeVsAAAJfElEQVR42u1bXWgcxx3/ze7e7VnWl2vJ0jnCrkiKbRUbxw92nFIwwQ0plIIcDCmUvMQUTB+DyAfkrU8u5K0USvISQp5KbUoJIa2NnbYPwSGxQxI3NdhWPmxJOTknyWeddLe7eZjb3Oz//vNxurtEDxkYdnfuP7czv/l/z6xAd4vQ3Ls820rSxnPSycB7AQJtMz2r9NwkE8tzR2D0AgjuylWORjf5hLTRCsPVqQQ9Eg1u4h65qpP3NP8XMwDE5ErBEBsRjaBHYsFN3lOefYaGEw064ahBHzdoVVCoSLQFSNAjHQEyUd9wFRbRSAGIFRAihT5mJi02g2gIwgW+UgNypZwiCAixUiMAdQWEqJtWI+iSKFAQ1BUPDJXjDDCckILgN64egBoZR0J0imgHlKDDyVMgKBeok84pNVCuPuEKEG5IQag1qqcxz2BERbhySdCmJTCZSo/IvwpC/sYN3EwSIK1xnL2a2ilNkgCPPoofW5yu2NExswJhYn9ozCMFIeWAfGYkylCEyE6Qa0/vSf+8xueoaxwtYRIZsUHnyGOUIlWMOQJECCC8fh3/AeQqcyut45AkAaIIOHoUPwOwptT1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XvkMuFCyg3ChJGlbgPg7UH5fsweh0JU/MQNh4wIOqHv3dr333HOf/xHN07oRmDMRTjoiSaSzZALjQknS6JKn1/4ALF3hlZ4AsPQJ8P+/uAVIpnxGM+IU8dzcvr+ePr34+8ZBkXWFI+omjrAe5++qi/2A9C4rs8C8g4utxhu6Y0RxHK5Wq4PzpdLou2+/XTuriIN6ENXp6NDtzRB+a8oigJNMsEQ/X0hrjdQ64Qj1tH9GRAIAFxu5iM1Y3gNQ0cQJCVGAdTLhOqMfjKKRJmY2W05iCcAJAPNMBEnPRUUMd9QtIGQUpg9gGcAbDfEYATDwPQOwAOA8gNMAvtCwuq7WNbrAGnSZTue3cyidPtP/ADr/tFL33af6gVvMPJu+CExcgNBdueO/uuPA3QLBBIbp+KDzZwrCHC2wwJi+7dTRdru4fhwLW/jdzkq5fsqko+0VR8BhpW2fTW9ogL38AL7bwDhnrzsdsOjif/UKFOvkfyhM+QYKVFliJfC7TQAAAABJRU5ErkJggg=="]
  116. ]
  117. };
  118.  
  119. let uroURDupes = [];
  120. let uroFID = -1;
  121. let uroShownFID = -1;
  122. let uroInhibitSave = true;
  123. let uroConfirmIntercepted = false;
  124. let uroMCLayer = null;
  125. let uroVenueLayer = null;
  126. let uro_uFP = [];
  127. let uroPendingURSessionIDs = [];
  128. let uroRequestedURSessionIDs = [];
  129. let uroPlacesGroupsCollapsed = [];
  130. let uroKnownProblemTypeIDs = [];
  131. let uroKnownProblemTypeNames = [];
  132. let uroPURsToHide = [];
  133. let uroNullOpenLayers = false;
  134. let uroNullURLayer = false;
  135. let uroNullProblemLayer = false;
  136. let uroNullMapViewport = false;
  137. let uroURDialogIsOpen = false;
  138. let uroHoveredURID = null;
  139. let uroSelectedURID = null;
  140. let uroURReclickAttempts = 0;
  141. let uroPendingCommentDataRefresh = false;
  142. let uroWaitingCommentDataRefresh = false;
  143. let uroExpectedCommentCount = null;
  144. let uroCachedLastCommentID = null;
  145. let uroMouseIsDown = false;
  146. let uroPopulatingRequestSessions = false;
  147. let uroHidePopupOnPanelOpen = false;
  148. let uroUserID = -1;
  149. let uroMTEMode = false;
  150. let uroDiv = null;
  151. let uroAlerts = null;
  152. let uroControls = null;
  153. let uroCtrlHides = null;
  154. let uroAMList = [];
  155. let uroManagedAreas = [];
  156. let uroIgnoreAreasUserID = null;
  157. let uroMousedOverMapComment = null;
  158. let uroMousedOverOtherObjectWithinMapComment = false;
  159. let uroRTCObjs = null;
  160. let uroUnstackedMasterID = null;
  161. let uroStackList = [];
  162. let uroStackType = null;
  163. let uroMainTickHandlerID = null;
  164. let uroMainTickStage = 0;
  165. let uroSettingsApplied = false;
  166. let uroInhibitURFiltering = false;
  167.  
  168.  
  169. const uroUtils = // utility functions
  170. {
  171. ModifyHTML: function(htmlIn)
  172. {
  173. if(typeof trustedTypes === "undefined")
  174. {
  175. return htmlIn;
  176. }
  177. else
  178. {
  179. const escapeHTMLPolicy = trustedTypes.createPolicy("forceInner", {createHTML: (to_escape) => to_escape});
  180. return escapeHTMLPolicy.createHTML(htmlIn);
  181. }
  182. },
  183. CloneObject: function(objIn)
  184. {
  185. return JSON.parse(JSON.stringify(objIn));
  186. },
  187. GetCBChecked: function(cbID)
  188. {
  189. try
  190. {
  191. return(document.getElementById(cbID).checked);
  192. }
  193. catch(err)
  194. {
  195. uroDBG.AddLog('GetCBChecked() - '+cbID+' not found!');
  196. return null;
  197. }
  198. },
  199. SetCBChecked: function(cbID, state)
  200. {
  201. try
  202. {
  203. document.getElementById(cbID).checked = state;
  204. }
  205. catch(err)
  206. {
  207. uroDBG.AddLog('SetCBChecked() - '+cbID+' not found!');
  208. }
  209. },
  210. GetElmValue: function(elmID)
  211. {
  212. try
  213. {
  214. return(document.getElementById(elmID).value);
  215. }
  216. catch(err)
  217. {
  218. uroDBG.AddLog('GetElmValue() - '+elmID+' not found!');
  219. return null;
  220. }
  221. },
  222. SetOnClick: function(elm,fn)
  223. {
  224. try
  225. {
  226. if(typeof elm == 'object')
  227. {
  228. elm.onclick = fn;
  229. }
  230. else
  231. {
  232. document.getElementById(elm).onclick = fn;
  233. }
  234. }
  235. catch(err)
  236. {
  237. uroDBG.AddLog('SetOnClick() - '+elm+' not found!');
  238. }
  239. },
  240. AddEventListener: function(elm, eventType, eventFn, eventBool)
  241. {
  242. try
  243. {
  244. document.getElementById(elm).addEventListener(eventType, eventFn, eventBool);
  245. }
  246. catch(err)
  247. {
  248. uroDBG.AddLog('AddEventListener() - '+elm+' not found!');
  249. }
  250. },
  251. DateToDays: function(dateToConvert)
  252. {
  253. let dateNow = new Date();
  254. let elapsedSinceEpoch = dateNow.getTime();
  255. let elapsedSinceEvent = elapsedSinceEpoch - dateToConvert;
  256. dateNow.setHours(0);
  257. dateNow.setMinutes(0);
  258. dateNow.setSeconds(0);
  259. dateNow.setMilliseconds(0);
  260. let elapsedSinceMidnight = elapsedSinceEpoch - dateNow.getTime();
  261. dateNow.setHours(24);
  262. let pendingUntilMidnight = elapsedSinceEpoch - dateNow.getTime();
  263. if((elapsedSinceEvent < elapsedSinceMidnight) && (elapsedSinceEvent > pendingUntilMidnight))
  264. {
  265. // event occurred today...
  266. return 0;
  267. }
  268. else if(elapsedSinceEvent < 0)
  269. {
  270. // event occurrs at some point in the future after midnight today, so return a minimum value of -1...
  271. return -1 - Math.floor((pendingUntilMidnight - elapsedSinceEvent) / 86400000);
  272. }
  273. else
  274. {
  275. // event occurred at some point prior to midnight this morning, so return a minimum value of 1...
  276. return 1 + Math.floor((elapsedSinceEvent - elapsedSinceMidnight) / 86400000);
  277. }
  278. },
  279. GetURAge: function(urObj,ageType,getRaw)
  280. {
  281. if(ageType === 0)
  282. {
  283. if((urObj.attributes.driveDate === null)||(urObj.attributes.driveDate === 0)) return -1;
  284. if(getRaw) return urObj.attributes.driveDate;
  285. else return uroUtils.DateToDays(urObj.attributes.driveDate);
  286. }
  287. else if(ageType === 1)
  288. {
  289. if((urObj.attributes.resolvedOn === null)||(urObj.attributes.resolvedOn === 0)) return -1;
  290. if(getRaw) return urObj.attributes.resolvedOn;
  291. else return uroUtils.DateToDays(urObj.attributes.resolvedOn);
  292. }
  293. else
  294. {
  295. return -1;
  296. }
  297. },
  298. GetMCAge: function(mcAttrs, ageType, getRaw)
  299. {
  300. if(ageType === 0)
  301. {
  302. if((mcAttrs.createdOn === null)||(mcAttrs.createdOn === 0)) return -1;
  303. if(getRaw) return mcAttrs.createdOn;
  304. else return uroUtils.DateToDays(mcAttrs.createdOn);
  305. }
  306. else if(ageType === 1)
  307. {
  308. if((mcAttrs.updatedOn === null)||(mcAttrs.updatedOn === 0)) return -1;
  309. if(getRaw) return mcAttrs.updatedOn;
  310. else return uroUtils.DateToDays(mcAttrs.updatedOn);
  311. }
  312. else if(ageType === 2)
  313. {
  314. if((mcAttrs.endDate === null)||(mcAttrs.endDate === 0)) return -1;
  315. let tDate = new Date(mcAttrs.endDate);
  316. if(getRaw) return tDate;
  317. else return uroUtils.DateToDays(tDate);
  318. }
  319. else
  320. {
  321. return -1;
  322. }
  323. },
  324. GetPURAge: function(purObj)
  325. {
  326. if(purObj.attributes.venueUpdateRequests[0].attributes.dateAdded !== null)
  327. {
  328. return uroUtils.DateToDays(purObj.attributes.venueUpdateRequests[0].attributes.dateAdded);
  329. }
  330. else
  331. {
  332. return -1;
  333. }
  334. },
  335. GetCameraAge: function(camObj, mode)
  336. {
  337. if(mode === 0)
  338. {
  339. if(camObj.attributes.updatedOn === null) return -1;
  340. return uroUtils.DateToDays(camObj.attributes.updatedOn);
  341. }
  342. if(mode === 1)
  343. {
  344. if(camObj.attributes.createdOn === null) return -1;
  345. return uroUtils.DateToDays(camObj.attributes.createdOn);
  346. }
  347. },
  348. GetCommentAge: function(commentObj)
  349. {
  350. if(commentObj.createdOn === null) return -1;
  351. return uroUtils.DateToDays(commentObj.createdOn);
  352. },
  353. ParseDaysAgo: function(days)
  354. {
  355. if(days === 0) return 'today';
  356. else if(days === 1) return '1 day ago';
  357. else return days+' days ago';
  358. },
  359. ParseDaysToGo: function(days)
  360. {
  361. days = 0 - days;
  362. if(days === 0) return 'today';
  363. else if(days === 1) return 'in 1 day';
  364. else return 'in '+days+' days';
  365. },
  366. GetLocalisedSpeedString: function(thisSpeed)
  367. {
  368. if(thisSpeed !== null)
  369. {
  370. let conversionFactor = 1; // default to metric
  371. let multipleFactor = 10; // default to limits being set in multiples of 10
  372. let country = null;
  373. if((W.model.getTopCountry()) && (W.model.getTopCountry().attributes.name !== undefined))
  374. {
  375. country = W.model.getTopCountry().attributes.name;
  376. }
  377. if(country !== null)
  378. {
  379. // country-specific deviations from the above...
  380. if
  381. (
  382. (country == "United Kingdom") ||
  383. (country == "Jersey") ||
  384. (country == "Guernsey") ||
  385. (country == "United States")
  386. )
  387. {
  388. // countries using MPH
  389. conversionFactor = 1.609;
  390. }
  391. if
  392. (
  393. (country == "United States") ||
  394. (country == "Guernsey")
  395. )
  396. {
  397. // countries with speed limits set in multiples of 5
  398. multipleFactor = 5;
  399. }
  400. }
  401. let speed = Math.round(thisSpeed / conversionFactor);
  402. let retval = speed;
  403. if(conversionFactor == 1) retval += "KM/H";
  404. else retval += "MPH";
  405. return retval;
  406. }
  407. else return "not set";
  408. },
  409. Clickify: function(desc, suffix)
  410. {
  411. // The terminators array consists of pairs of characters which may be found at either
  412. // end of a URL. The first entry in each pair indicates which character needs to be
  413. // found immediately prior to the URL ('' indicates any character) in order for the
  414. // second entry to be considered as a potential end of URL marker
  415. let terminators = [
  416. ['', ' '],
  417. ['', ','],
  418. ['(', ')'],
  419. ['[', ']'],
  420. ['', '\r'],
  421. ['', '\n']
  422. ];
  423. if(desc === null) return '';
  424. if(desc === undefined) return '';
  425. if(desc === '') return '';
  426. if(desc.indexOf("https: one.network") == 0)
  427. {
  428. desc = desc.replaceAll(' ','/');
  429. }
  430. desc = desc.replace(/<\/?[^>]+(>|$)/g, "");
  431. if(desc !== "null")
  432. {
  433. // At the moment we can only clickify links that start with http or https...
  434. if(desc.indexOf('http') != -1)
  435. {
  436. let links = desc.split("http");
  437. desc = '';
  438. let i, j, linkEndPos, descPostLink;
  439. for(i=0; i<links.length; i++)
  440. {
  441. if(links[i].indexOf('://') != -1)
  442. {
  443. let prefix = links[i - 1][links[i - 1].length - 1];
  444. links[i] = "http" + links[i];
  445. linkEndPos = links[i].length + 1;
  446. // work out where the end of the URL is, based on what the character immediately
  447. // preceding the "http" is
  448. for(j=0; j<terminators.length; j++)
  449. {
  450. if(links[i].indexOf(terminators[j][1]) !== -1)
  451. {
  452. if((prefix === terminators[j][0]) || (terminators[j][0] === ''))
  453. {
  454. linkEndPos = Math.min(linkEndPos, links[i].indexOf(terminators[j][1]));
  455. }
  456. }
  457. }
  458. descPostLink = '';
  459. if(linkEndPos < links[i].length)
  460. {
  461. descPostLink = links[i].slice(linkEndPos);
  462. links[i] = links[i].slice(0,linkEndPos);
  463. }
  464. desc += '<a target="_wazeUR" href="'+links[i]+'">'+links[i]+'</a>' + descPostLink;
  465. }
  466. else
  467. {
  468. desc += links[i];
  469. }
  470. }
  471. }
  472. desc = desc.replace(/\n/g,"<br>");
  473. return desc + suffix;
  474. }
  475. else
  476. {
  477. return '';
  478. }
  479. },
  480. GetUserNameFromID: function(userID)
  481. {
  482. let userName;
  483. if(W.model.users.objects[userID] != null)
  484. {
  485. userName = W.model.users.objects[userID].attributes.userName;
  486. if(userName === undefined)
  487. {
  488. userName = userID;
  489. }
  490. }
  491. else
  492. {
  493. userName = userID;
  494. }
  495. return userName;
  496. },
  497. GetUserNameAndRank: function(userID)
  498. {
  499. let userName;
  500. let userLevel;
  501. if(W.model.users.objects[userID] != null)
  502. {
  503. userName = W.model.users.objects[userID].attributes.userName;
  504. if(userName === undefined)
  505. {
  506. userName = userID;
  507. }
  508. else
  509. {
  510. userName = '<a href="' + (W.Config.user_profile.url + userName) + '" target="_blank">' + userName + '</a>';
  511. }
  512. userLevel = W.model.users.objects[userID].attributes.rank + 1;
  513. }
  514. else
  515. {
  516. userName = userID;
  517. userLevel = '?';
  518. }
  519. return userName + ' (' + userLevel + ')';
  520. },
  521. GetDateTimeString: function(ts)
  522. {
  523. let tDateObj = new Date(ts);
  524. let dateLocale;
  525. let timeLocale;
  526. if(uroUtils.GetCBChecked('_cbDateFmtDDMMYY')) dateLocale = 'en-gb';
  527. if(uroUtils.GetCBChecked('_cbDateFmtMMDDYY')) dateLocale = 'en-us';
  528. if(uroUtils.GetCBChecked('_cbDateFmtYYMMDD')) dateLocale = 'ja';
  529. if(uroUtils.GetCBChecked('_cbTimeFmt24H')) timeLocale = 'en-gb';
  530. if(uroUtils.GetCBChecked('_cbTimeFmt12H')) timeLocale = 'en-us';
  531. return tDateObj.toLocaleDateString(dateLocale) + ' ' + tDateObj.toLocaleTimeString(timeLocale);
  532. },
  533. ParsePxString: function(pxString)
  534. {
  535. return parseInt(pxString.split("px")[0]);
  536. },
  537. TypeCast: function(varin)
  538. {
  539. if(varin == "null") return null;
  540. if(typeof varin == "string") return parseInt(varin);
  541. return varin;
  542. },
  543. Truncate: function(val)
  544. {
  545. if(val === null) return val;
  546. if(val < 0) return Math.ceil(val);
  547. return Math.floor(val);
  548. },
  549. KeywordPresent: function(desc, keyword, caseInsensitive)
  550. {
  551. let re;
  552. if(caseInsensitive) re = RegExp(keyword,'i');
  553. else re = RegExp(keyword);
  554. if(desc.search(re) != -1) return true;
  555. else return false;
  556. },
  557. AddStyle: function(ID, css)
  558. {
  559. let head, style;
  560. head = document.getElementsByTagName('head')[0];
  561. if (!head)
  562. {
  563. return;
  564. }
  565. uroUtils.RemoveStyle(ID); // in case it is already there
  566. style = document.createElement('style');
  567. style.type = 'text/css';
  568. style.innerHTML = uroUtils.ModifyHTML(css);
  569. style.id = ID;
  570. head.appendChild(style);
  571. },
  572. RemoveStyle: function(ID)
  573. {
  574. let style = document.getElementById(ID);
  575. if (style)
  576. {
  577. style.parentNode.removeChild(style);
  578. }
  579. },
  580. GetTS: function(day, month, year, hours, mins)
  581. {
  582. let retval = new Date(0);
  583. retval.setDate(day);
  584. retval.setMonth(month - 1);
  585. retval.setYear(year);
  586. retval.setHours(hours);
  587. retval.setMinutes(mins);
  588. return retval.getTime();
  589. },
  590. ToHex: function(decValue, digits)
  591. {
  592. let modifier = 1;
  593. for(let i=0; i < digits; i++)
  594. {
  595. modifier *= 16;
  596. }
  597. // make sure decValue actually is an integer
  598. decValue = parseInt(decValue);
  599. // adding the modifier ensures we have enough digits, including
  600. // any leading zeros which may be required, for the required output
  601. decValue += modifier;
  602. let retval = decValue.toString(16);
  603. // after converting to hex with the modifier included, we'll have
  604. // as many digits as we need to represent decValue, but also an
  605. // extra leading 1, which now needs to be removed before returning
  606. // the result...
  607. retval = retval.substr(-digits);
  608. retval = retval.toUpperCase();
  609. return retval;
  610. },
  611. GetActiveSidebarTab: function()
  612. {
  613. let retval = null;
  614.  
  615. let tabIcons = document.querySelectorAll('wz-navigation-item');
  616. for(let i = 0; i < tabIcons.length; ++i)
  617. {
  618. if(tabIcons[i].selected === true)
  619. {
  620. retval = tabIcons[i].attributes['data-for'].value;
  621. break;
  622. }
  623. }
  624. return retval;
  625. },
  626. IsClosureUIActive: function()
  627. {
  628. let retval = false;
  629.  
  630. if(W.selectionManager.getSelectedFeatures()[0]?.featureType === 'segment')
  631. {
  632. let ast = uroUtils.GetActiveSidebarTab();
  633. if(ast === 'feature_editor')
  634. {
  635. retval = document.querySelector('wz-tab.closures-tab').attributes['is-active'].value !== 'false';
  636. }
  637. }
  638.  
  639. return retval;
  640. },
  641. ConvertWGS84ToMercator: function(point)
  642. {
  643. return point.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
  644. },
  645. ConvertMercatorToWGS84: function(point)
  646. {
  647. return point.transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326"));
  648. }
  649. };
  650. const uroTabs = // script tab handling
  651. {
  652. MAX_PER_ROW: 6,
  653. IDS:
  654. {
  655. URS: 0,
  656. MPS: 1,
  657. MCS: 2,
  658. RTCS: 3,
  659. RAS: 4,
  660. PLACES: 5,
  661. CAMS: 6,
  662. OWL: 7,
  663. MISC: 8
  664. },
  665. FIELDS:
  666. {
  667. TABHEADER: 0,
  668. TABBODY: 1,
  669. LINKID: 2,
  670. TABTITLE: 3,
  671. SHOWFN: 4,
  672. CLICKFN: 5,
  673. STORAGE: 6,
  674. POPULATEFN: 7
  675. },
  676. CtrlTabs: [],
  677. selectedOWLGroup: null,
  678.  
  679. SetStyleDisplay: function(elm,style)
  680. {
  681. try
  682. {
  683. if(typeof elm == 'object')
  684. {
  685. elm.style.display = style;
  686. }
  687. else
  688. {
  689. document.getElementById(elm).style.display = style;
  690. }
  691. }
  692. catch(err)
  693. {
  694. uroDBG.AddLog('SetStyleDisplay() - '+elm+' not found!');
  695. }
  696. },
  697. PopulateMP: function()
  698. {
  699. let tHTML = '';
  700. tHTML += '<input type="checkbox" id="_cbMPFilterOutsideArea">Hide MPs outside my editable area</input><br><br>';
  701. tHTML += '<b>Filter MPs by type:</b><br>';
  702. let i;
  703. for(i=0; i<uroKnownProblemTypeNames.length; i++)
  704. {
  705. tHTML += '<input type="checkbox" id="_cbMPFilter_T'+uroKnownProblemTypeIDs[i]+'">'+uroKnownProblemTypeNames[i]+'</input><br>';
  706. }
  707. tHTML += '<br><input type="checkbox" id="_cbMPFilterUnknownProblem">Unknown problem type</input><br><br>';
  708.  
  709. tHTML += '&nbsp;&nbsp;<i>Specially tagged types</i><br>';
  710. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterElgin">[Elgin]</input><br>';
  711. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterTrafficCast">[TrafficCast]</input><br>';
  712. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterTrafficMaster">[TM]</input><br>';
  713. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterCaltrans">[Caltrans]</input><br>';
  714. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterTFL">TfL</input><br>';
  715.  
  716. tHTML += '<input type="checkbox" id="_cbMPFilterReopenedProblem">Reopened Problems</input><br><br>';
  717.  
  718. tHTML += '<input type="checkbox" id="_cbInvertMPFilter">Invert operation of type filters?</input><br>';
  719.  
  720. tHTML += '<br><b>Hide closed/solved/unidentified Problems:</b><br>';
  721. tHTML += '<input type="checkbox" id="_cbMPFilterClosed">Closed</input><br>';
  722. tHTML += '<input type="checkbox" id="_cbMPFilterSolved">Solved</input><br>';
  723. tHTML += '<input type="checkbox" id="_cbMPFilterUnidentified">Not identified</input><br><br>';
  724.  
  725. tHTML += '<input type="checkbox" id="_cbMPClosedUserIDFilter" pairedWith="_cbMPNotClosedUserIDFilter">Closed</input> or ';
  726. tHTML += '<input type="checkbox" id="_cbMPNotClosedUserIDFilter" pairedWith="_cbMPClosedUserIDFilter">Not Closed</input> by user';
  727. tHTML += '<select id="_selectMPUserID" style="width:80%; height:22px;"></select><br>';
  728.  
  729. tHTML += '<br><b>Hide problems (not turn) by severity:</b><br>';
  730. tHTML += '<input type="checkbox" id="_cbMPFilterLowSeverity">Low</input>&nbsp;&nbsp;';
  731. tHTML += '<input type="checkbox" id="_cbMPFilterMediumSeverity">Medium</input>&nbsp;&nbsp;';
  732. tHTML += '<input type="checkbox" id="_cbMPFilterHighSeverity">High</input><br>';
  733.  
  734. tHTML += '<br><b>Show MPs based on start/end dates:</b><br>';
  735. tHTML += '<input type="checkbox" id="_cbMPFilterStartDate">Start</input>&nbsp;&nbsp;';
  736. tHTML += '<input type="number" min="1" max="31" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterStartDay"> / ';
  737. tHTML += '<input type="number" min="1" max="12" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterStartMonth"> / ';
  738. tHTML += '<input type="number" min="2010" max="2100" size="4" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterStartYear"><br>';
  739. tHTML += '<input type="checkbox" id="_cbMPFilterEndDate">End</input>&nbsp;&nbsp;';
  740. tHTML += '<input type="number" min="1" max="31" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterEndDay"> / ';
  741. tHTML += '<input type="number" min="1" max="12" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterEndMonth"> / ';
  742. tHTML += '<input type="number" min="2010" max="2100" size="4" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterEndYear"><br>';
  743. tHTML += '<input type="checkbox" id="_cbMPFilterEndDatePassed">End date in the past</input>';
  744.  
  745. return tHTML;
  746. },
  747. PopulatePlaces: function()
  748. {
  749. let tHTML = '';
  750. tHTML += '<b>Filter PURs by category/status:</b><br>';
  751. tHTML += '<input type="checkbox" id="_cbFilterUneditablePlaceUpdates">Ones I can\'t edit</input><br>';
  752. tHTML += '<input type="checkbox" id="_cbPURFilterInsideManagedAreas">Ones within AM areas</input>';
  753. tHTML += '&nbsp;(<input type="checkbox" id="_cbPURExcludeUserArea">except my area)</input><br>';
  754. tHTML += '<i>Requires Area Manager layer to be enabled</i><br>';
  755. tHTML += '<input type="checkbox" id="_cbFilterLockRankedPlaceUpdates">Ones with non-zero lockRanks</input><br>';
  756. tHTML += '<input type="checkbox" id="_cbFilterNewPlacePUR">Ones for new places</input><br>';
  757. tHTML += '<input type="checkbox" id="_cbFilterUpdatedDetailsPUR">Ones for updated place details</input><br>';
  758.  
  759. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFPhone">Phone number</input><br>';
  760. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFName">Name</input><br>';
  761. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFEntryExitPoints">Entry//exit points</input><br>';
  762. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFOpeningHours">Opening hours</input><br>';
  763. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFAliases">Aliases</input><br>';
  764. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFServices">Services</input><br>';
  765. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFGeometry">Geometry</input><br>';
  766. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFHouseNumber">House number</input><br>';
  767. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFCategories">Categories</input><br>';
  768. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFDescription">Description</input><br>';
  769.  
  770. tHTML += '<input type="checkbox" id="_cbFilterNewPhotoPUR">Ones for new photos</input><br>';
  771. tHTML += '<input type="checkbox" id="_cbFilterFlaggedPUR">Ones flagged for attention</input><br>';
  772. tHTML += '<br><input type="checkbox" id="_cbInvertPURFilters">Invert PUR filters</input><br>';
  773.  
  774. tHTML += '<br><b>Filter PURs by age of submission:</b><br>';
  775. tHTML += '<input type="checkbox" id="_cbEnablePURMinAgeFilter">Hide PURs less than </input>';
  776. tHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputPURFilterMinDays"> days old<br>';
  777. tHTML += '<input type="checkbox" id="_cbEnablePURMaxAgeFilter">Hide PURs more than </input>';
  778. tHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputPURFilterMaxDays"> days old<br>';
  779.  
  780. tHTML += '<hr>';
  781.  
  782. tHTML += '<br><b>Filter Places by state:</b><br>';
  783. tHTML += 'Hide if last edited<br>';
  784. tHTML += '<input type="checkbox" id="_cbPlaceFilterEditedLessThan"> less than </input>';
  785. tHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterPlaceEditMinDays"> days ago<br>';
  786. tHTML += '<input type="checkbox" id="_cbPlaceFilterEditedMoreThan"> more than </input>';
  787. tHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterPlaceEditMaxDays"> days ago<br>';
  788.  
  789. tHTML += '<br>Hide if locked at level:<br>';
  790. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL0">1</input>';
  791. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL1">2</input>';
  792. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL2">3</input>';
  793. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL3">4</input>';
  794. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL4">5</input>';
  795. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL5">6</input>';
  796. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesStaff">Staff</input>';
  797. tHTML += '<br>&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesAdLocked">AdLocked</input><br>';
  798.  
  799. tHTML += '<br>Hide by geometry:<br>';
  800. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideAreaPlaces">Areas</input>';
  801. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePointPlaces">Points</input>';
  802.  
  803. tHTML += '<br><br><input type="checkbox" id="_cbHidePhotoPlaces" pairedWith="_cbHideNoPhotoPlaces">Hide or </input>';
  804. tHTML += '<input type="checkbox" id="_cbHideNoPhotoPlaces" pairedWith="_cbHidePhotoPlaces">show ones with photos</input><br>';
  805.  
  806. tHTML += '<input type="checkbox" id="_cbHideLinkedPlaces" pairedWith="_cbHideNoLinkedPlaces">Hide or </input>';
  807. tHTML += '<input type="checkbox" id="_cbHideNoLinkedPlaces" pairedWith="_cbHideLinkedPlaces">show ones with external links</input><br>';
  808.  
  809. tHTML += '<input type="checkbox" id="_cbHideDescribedPlaces" pairedWith="_cbHideNonDescribedPlaces">Hide or </input>';
  810. tHTML += '<input type="checkbox" id="_cbHideNonDescribedPlaces" pairedWith="_cbHideDescribedPlaces">show ones with descriptive text</input><br>';
  811.  
  812. tHTML += '<input type="checkbox" id="_cbHideKeywordPlaces" pairedWith="_cbHideNoKeywordPlaces">Hide or </input>';
  813. tHTML += '<input type="checkbox" id="_cbHideNoKeywordPlaces" pairedWith="_cbHideKeywordPlaces">show ones with a name including</input><br>';
  814. tHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textKeywordPlace"><br>';
  815.  
  816. tHTML += '<br><b>Show Places touched by a specific editor:</b><br>';
  817. tHTML += '<input type="checkbox" id="_cbShowOnlyPlacesCreatedBy">Created by</input>&nbsp;/&nbsp;';
  818. tHTML += '<input type="checkbox" id="_cbShowOnlyPlacesEditedBy">edited by</input><br>';
  819. tHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textPlacesEditor"><br>';
  820. tHTML += '<select id="_selectPlacesUserID" style="width:80%; height:22px;"></select><br>';
  821.  
  822. tHTML += '<br><b>Hide Places touched by a specific editor:</b><br>';
  823. tHTML += '<input type="checkbox" id="_cbHideOnlyPlacesCreatedBy">Created by</input>&nbsp;/&nbsp;';
  824. tHTML += '<input type="checkbox" id="_cbHideOnlyPlacesEditedBy">edited by</input><br>';
  825. tHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textHidePlacesEditor"><br>';
  826. tHTML += '<select id="_selectHidePlacesUserID" style="width:80%; height:22px;"></select><br>';
  827.  
  828. tHTML += '<br><br><b>Filter Places by category:</b><br>';
  829. tHTML += '<input type="checkbox" id="_cbLeavePURGeos" pairedWith="_cbHidePURsForFilteredPlaces">Keep place visible if linked PUR is hidden, or</input><br>';
  830. tHTML += '<input type="checkbox" id="_cbHidePURsForFilteredPlaces" pairedWith="_cbLeavePURGeos">Hide PURs linked to hidden places</input><br><br>';
  831.  
  832. let nCategories = W.Config.venues.categories.length;
  833. let i;
  834. if(uroPlacesGroupsCollapsed.length != nCategories)
  835. {
  836. for(i=0; i<nCategories; i++)
  837. {
  838. uroPlacesGroupsCollapsed.push(false);
  839. }
  840. }
  841.  
  842. for(i=0; i<nCategories; i++)
  843. {
  844. let parentCategory = W.Config.venues.categories[i];
  845. let localisedName = I18n.lookup("venues.categories." + parentCategory);
  846.  
  847. if(uroPlacesGroupsCollapsed[i] === true)
  848. {
  849. tHTML += '<i class="fa fa-plus-square-o" style="cursor:pointer;font-size:14px;" id="_uroPlacesGroupState-'+i+'"></i>';
  850. }
  851. else
  852. {
  853. tHTML += '<i class="fa fa-minus-square-o" style="cursor:pointer;font-size:14px;" id="_uroPlacesGroupState-'+i+'"></i>';
  854. }
  855.  
  856. tHTML += '&nbsp;<input type="checkbox" id="_cbPlacesFilter-'+parentCategory+'"><b>'+localisedName+'</b></input><br>';
  857. tHTML += '<div id="_uroPlacesGroup-'+i+'" style="padding:3px;border-width:2px;border-style:solid;border-color:#FFFFFF">';
  858.  
  859. for(let ii=0; ii<W.Config.venues.subcategories[parentCategory].length; ii++)
  860. {
  861. let subCategory = W.Config.venues.subcategories[parentCategory][ii];
  862. localisedName = I18n.lookup("venues.categories." + subCategory);
  863. tHTML += '&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbPlacesFilter-'+subCategory+'">'+localisedName+'</input><br>';
  864. }
  865. tHTML += '</div>';
  866. }
  867. tHTML += '<input type="checkbox" id="_cbFilterPrivatePlaces"><b>Residential Places</b></input><br>';
  868. tHTML += '<br><input type="checkbox" id="_cbInvertPlacesFilter">Invert Place filters?</input>';
  869.  
  870. return tHTML;
  871. },
  872. PopulateUR: function()
  873. {
  874. let iHTML = '';
  875. iHTML = '<br>';
  876.  
  877. iHTML += '<input type="checkbox" id="_cbURFilterOutsideArea">Hide URs outside my editable area</input><br>';
  878. iHTML += '<input type="checkbox" id="_cbURFilterInsideManagedAreas">Hide URs within AM areas</input>';
  879. iHTML += '&nbsp;(<input type="checkbox" id="_cbURExcludeUserArea">except my area)</input><br>';
  880. iHTML += '&nbsp;<i>Requires Area Manager layer to be enabled</i><br>';
  881. iHTML += '<input type="checkbox" id="_cbNoFilterForURInURL">Don\'t filter selected UR</input><br><br>';
  882. iHTML += '<input type="checkbox" id="_cbURFilterDupes">Show only duplicate URs</input><br><br>';
  883.  
  884. iHTML += '<b>Filter by type:</b><br>';
  885. iHTML += '<input type="checkbox" id="_cbFilterWazeAuto">Waze Automatic</input><br>';
  886. iHTML += '<input type="checkbox" id="_cbFilterIncorrectTurn">Incorrect turn</input><br>';
  887. iHTML += '<input type="checkbox" id="_cbFilterIncorrectAddress">Incorrect address</input><br>';
  888. iHTML += '<input type="checkbox" id="_cbFilterIncorrectRoute">Incorrect route</input><br>';
  889. iHTML += '<input type="checkbox" id="_cbFilterMissingRoundabout">Missing roundabout</input><br>';
  890. iHTML += '<input type="checkbox" id="_cbFilterGeneralError">General error</input><br>';
  891. iHTML += '<input type="checkbox" id="_cbFilterTurnNotAllowed">Turn not allowed</input><br>';
  892. iHTML += '<input type="checkbox" id="_cbFilterIncorrectJunction">Incorrect junction</input><br>';
  893. iHTML += '<input type="checkbox" id="_cbFilterMissingBridgeOverpass">Missing bridge overpass</input><br>';
  894. iHTML += '<input type="checkbox" id="_cbFilterWrongDrivingDirection">Wrong driving direction</input><br>';
  895. iHTML += '<input type="checkbox" id="_cbFilterMissingExit">Missing exit</input><br>';
  896. iHTML += '<input type="checkbox" id="_cbFilterMissingRoad">Missing road</input><br>';
  897. iHTML += '<input type="checkbox" id="_cbFilterBlockedRoad">Blocked road</input><br>';
  898. iHTML += '<input type="checkbox" id="_cbFilterMissingLandmark">Missing Landmark</input><br>';
  899. iHTML += '<input type="checkbox" id="_cbFilterSpeedLimits">Missing or Invalid Speed limit</input><br>';
  900. iHTML += '<input type="checkbox" id="_cbFilterUndefined">Undefined</input><br>';
  901.  
  902. iHTML += '&nbsp;&nbsp;<i>Specially tagged types</i><br>';
  903. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterRoadworks">[ROADWORKS]</input><br>';
  904. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterConstruction">[CONSTRUCTION]</input><br>';
  905. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterClosure">[CLOSURE]</input><br>';
  906. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterEvent">[EVENT]</input><br>';
  907. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterNote">[NOTE]</input><br>';
  908. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterBOG">[BOG]</input><br>';
  909. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterDifficult">[DIFFICULT]</input><br>';
  910. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterWSLM">[WSLM]</input><br><br>';
  911. iHTML += '<input type="checkbox" id="_cbInvertURFilter">Invert operation of type filters?</input><br>';
  912.  
  913. iHTML += '<hr>';
  914.  
  915. iHTML += '<br><b>Hide by state:</b><br>';
  916. iHTML += '<input type="checkbox" id="_cbFilterOpenUR">Open</input><br>';
  917. iHTML += '<input type="checkbox" id="_cbFilterClosedUR">Closed</input><br>';
  918. iHTML += '<input type="checkbox" id="_cbFilterSolved">Solved</input><br>';
  919. iHTML += '<input type="checkbox" id="_cbFilterUnidentified">Not identified</input><br><br>';
  920.  
  921.  
  922. iHTML += '<br><b>Filter by age of submission:</b><br>';
  923. iHTML += '<input type="checkbox" id="_cbEnableMinAgeFilter">Hide URs less than </input>';
  924. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMinDays"> days old<br>';
  925. iHTML += '<input type="checkbox" id="_cbEnableMaxAgeFilter">Hide URs more than </input>';
  926. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMaxDays"> days old<br>';
  927.  
  928. iHTML += '<br><b>Filter by other details:</b><br>';
  929. iHTML += '<input type="checkbox" id="_cbHideMyFollowed" pairedWith="_cbHideMyUnfollowed">Hide</input> or ';
  930. iHTML += '<input type="checkbox" id="_cbHideMyUnfollowed" pairedWith="_cbHideMyFollowed">show</input> URs I\'m following<br><br>';
  931.  
  932. iHTML += '<input type="checkbox" id="_cbURDescriptionMustBePresent" pairedWith="_cbURDescriptionMustBeAbsent">Hide</input> or ';
  933. iHTML += '<input type="checkbox" id="_cbURDescriptionMustBeAbsent" pairedWith="_cbURDescriptionMustBePresent">show</input> URs with no description<br>';
  934. iHTML += '<input type="checkbox" id="_cbEnableKeywordMustBePresent">Hide URs not including </input>';
  935. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textKeywordPresent"><br>';
  936. iHTML += '<input type="checkbox" id="_cbEnableKeywordMustBeAbsent">Hide URs including </input>';
  937. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textKeywordAbsent"><br>';
  938. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbCaseInsensitive"><i>Case-insensitive matches?</i></input><br><br>';
  939.  
  940. iHTML += 'With comments from me?<br>';
  941. iHTML += '<input type="checkbox" id="_cbHideMyComments" pairedWith="_cbHideAnyComments">Yes </input>';
  942. iHTML += '<input type="checkbox" id="_cbHideAnyComments" pairedWith="_cbHideMyComments">No</input><br>';
  943. iHTML += 'If last comment made by me?<br>';
  944. iHTML += '<input type="checkbox" id="_cbHideIfLastCommenter" pairedWith="_cbHideIfNotLastCommenter">Yes </input>';
  945. iHTML += '<input type="checkbox" id="_cbHideIfNotLastCommenter" pairedWith="_cbHideIfLastCommenter">No </input><br>';
  946. iHTML += 'If last comment made by UR reporter?<br>';
  947. iHTML += '<input type="checkbox" id="_cbHideIfReporterLastCommenter" pairedWith="_cbHideIfReporterNotLastCommenter">Yes </input>';
  948. iHTML += '<input type="checkbox" id="_cbHideIfReporterNotLastCommenter" pairedWith="_cbHideIfReporterLastCommenter">No</input><br>';
  949.  
  950. iHTML += '<input type="checkbox" id="_cbEnableMinCommentsFilter">With less than </input>';
  951. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMinComments"> comments<br>';
  952. iHTML += '<input type="checkbox" id="_cbEnableMaxCommentsFilter">With more than </input>';
  953. iHTML += '<input type="number" min="0" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMaxComments"> comments<br><br>';
  954.  
  955. iHTML += '<input type="checkbox" id="_cbEnableCommentAgeFilter2">Last comment less than </input>';
  956. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterCommentDays2"> days ago<br>';
  957. iHTML += '<input type="checkbox" id="_cbEnableCommentAgeFilter">Last comment more than </input>';
  958. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterCommentDays"> days ago<br>';
  959. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbIgnoreOtherEditorComments"><i>Ignore other editor comments?</i></input><br><br>';
  960.  
  961. iHTML += '<input type="checkbox" id="_cbURUserIDFilter">Without comments from user</input>';
  962. iHTML += '<select id="_selectURUserID" style="width:80%; height:22px;"></select><br>';
  963. iHTML += '<input type="checkbox" id="_cbURResolverIDFilter">Not resolved by user</input>';
  964. iHTML += '<select id="_selectURResolverID" style="width:80%; height:22px;"></select>';
  965.  
  966. iHTML += '<br><br><input type="checkbox" id="_cbInvertURStateFilter">Invert operation of state/age filters?</input><br>';
  967. iHTML += '<input type="checkbox" id="_cbNoFilterForTaggedURs">Don\'t apply state/age filters to tagged URs</input><br>';
  968.  
  969. return iHTML;
  970. },
  971. PopulateMC: function()
  972. {
  973. let iHTML = '';
  974. iHTML = '<br>';
  975.  
  976. iHTML += '&nbsp;&nbsp;<i>Specially tagged types</i><br>';
  977. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterRoadworks">[ROADWORKS]</input><br>';
  978. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterConstruction">[CONSTRUCTION]</input><br>';
  979. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterClosure">[CLOSURE]</input><br>';
  980. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterEvent">[EVENT]</input><br>';
  981. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterNote">[NOTE]</input><br>';
  982. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterBOG">[BOG]</input><br>';
  983. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterDifficult">[DIFFICULT]</input><br>';
  984. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterWSLM">[WSLM]</input><br><br>';
  985. iHTML += '<input type="checkbox" id="_cbInvertMCFilter">Invert operation of type filters?</input><br>';
  986.  
  987. iHTML += '<hr>';
  988.  
  989. iHTML += '<br><b>Filter by description/comments/following:</b><br>';
  990. iHTML += '<input type="checkbox" id="_cbMCHideMyFollowed" pairedWith="_cbMCHideMyUnfollowed">Ones I am or </input>';
  991. iHTML += '<input type="checkbox" id="_cbMCHideMyUnfollowed" pairedWith="_cbMCHideMyFollowed">am not following</input><br><br>';
  992.  
  993. iHTML += '<input type="checkbox" id="_cbMCDescriptionMustBePresent" pairedWith="_cbMCDescriptionMustBeAbsent">Hide</input> or ';
  994. iHTML += '<input type="checkbox" id="_cbMCDescriptionMustBeAbsent" pairedWith="_cbMCDescriptionMustBePresent">show</input> MCs with no description<br>';
  995. iHTML += '<input type="checkbox" id="_cbMCCommentsMustBePresent" pairedWith="_cbMCCommentsMustBeAbsent">Hide</input> or ';
  996. iHTML += '<input type="checkbox" id="_cbMCCommentsMustBeAbsent" pairedWith="_cbMCCommentsMustBePresent">show</input> MCs with no comments<br>';
  997. iHTML += '<input type="checkbox" id="_cbMCExpiryMustBePresent" pairedWith="_cbMCExpiryMustBeAbsent">Hide</input> or ';
  998. iHTML += '<input type="checkbox" id="_cbMCExpiryMustBeAbsent" pairedWith="_cbMCExpiryMustBePresent">show</input> MCs with no expiry date<br>';
  999. iHTML += '<input type="checkbox" id="_cbMCEnableKeywordMustBePresent">Hide MCs not including </input>';
  1000. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textMCKeywordPresent"><br>';
  1001. iHTML += '<input type="checkbox" id="_cbMCEnableKeywordMustBeAbsent">Hide MCs including </input>';
  1002. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textMCKeywordAbsent"><br>';
  1003. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCCaseInsensitive"><i>Case-insensitive matches?</i></input><br>';
  1004. iHTML += '<input type="checkbox" id="_cbMCCreatorIDFilter">Show MCs created by user</input>';
  1005. iHTML += '<select id="_selectMCCreatorID" style="width:80%; height:22px;"></select><br>';
  1006.  
  1007. iHTML += '<br><input type="checkbox" id="_cbHideWRCMCs"><b>Hide Waze_roadclosures MCs</b></input><br>';
  1008.  
  1009. iHTML += '<br><b>Hide MCs with lock level:</b><br>';
  1010. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank0">L1</input>';
  1011. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank1">L2</input>';
  1012. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank2">L3</input>';
  1013. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank3">L4</input>';
  1014. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank4">L5</input>';
  1015. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank5">L6</input>';
  1016. iHTML += '<hr>';
  1017. iHTML += '<input type="checkbox" id="_cbMCEnhancePointMCVisibility">Enhance visibility of point MCs</input>';
  1018.  
  1019. return iHTML;
  1020. },
  1021. PopulateCams: function()
  1022. {
  1023. let iHTML = '';
  1024. iHTML = '<br><b>Show Cameras created by:</b><br>';
  1025. iHTML += '<input type="checkbox" id="_cbShowWorldCams" checked>world_* users</input><br>';
  1026. iHTML += '<input type="checkbox" id="_cbShowUSACams" checked>usa_* users</input><br>';
  1027. iHTML += '<input type="checkbox" id="_cbShowNonWorldCams" checked>other users</input><br>';
  1028.  
  1029. iHTML += '<br><b>Show Cameras touched by a specific editor:</b><br>';
  1030. iHTML += '<input type="checkbox" id="_cbShowOnlyCamsCreatedBy">Created by</input>&nbsp;/&nbsp;';
  1031. iHTML += '<input type="checkbox" id="_cbShowOnlyCamsEditedBy">edited by</input><br>';
  1032. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textCameraEditor"><br>';
  1033. iHTML += '<select id="_selectCameraUserID" style="width:80%; height:22px;"></select><br>';
  1034. iHTML += '<br><input type="checkbox" id="_cbShowOnlyMyCams">Show ONLY cameras created/edited by me</input><br>';
  1035.  
  1036. iHTML += '<br><b>Show Cameras by type:</b><br>';
  1037. iHTML += '<input type="checkbox" id="_cbShowSpeedCams" checked>Speed</input><br>';
  1038. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowIfSpeedSet" checked> with speed data</input><br>';
  1039. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowIfNoSpeedSet" checked> with no speed data</input><br>';
  1040. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowIfInvalidSpeedSet" checked> with invalid speed data (zoom 16+)</input><br>';
  1041. iHTML += '&nbsp;&nbsp;&nbsp;<i>NOTE: slows down WME when deselected</i><br>';
  1042. iHTML += '<input type="checkbox" id="_cbShowRedLightCams" checked>Red Light</input><br>';
  1043. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowRLCIfZeroSpeedSet" checked> with speed limit = 0</input><br>';
  1044. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowRLCIfNonZeroSpeedSet" checked> with speed limit > 0</input><br>';
  1045. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowRLCIfNoSpeedSet" checked> with no speed data</input><br>';
  1046. iHTML += '<input type="checkbox" id="_cbShowDummyCams" checked>Dummy</input><br>';
  1047.  
  1048. iHTML += '<br><b>Hide Cameras by creator:</b><br>';
  1049. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByMe">me</input>';
  1050. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank0">L1</input>';
  1051. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank1">L2</input>';
  1052. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank2">L3</input>';
  1053. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank3">L4</input>';
  1054. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank4">L5</input>';
  1055. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank5">L6</input>';
  1056.  
  1057. iHTML += '<br><b>Hide Cameras by updater:</b><br>';
  1058. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByMe">me</input>';
  1059. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank0">L1</input>';
  1060. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank1">L2</input>';
  1061. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank2">L3</input>';
  1062. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank3">L4</input>';
  1063. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank4">L5</input>';
  1064. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank5">L6</input>';
  1065.  
  1066. iHTML += '<br><br><b><input type="checkbox" id="_cbHideManualLockedCams">Show only auto-locked cameras</input></b><br>';
  1067.  
  1068. iHTML += '<br><b><input type="checkbox" id="_cbHideCWLCams">Hide cameras on watchlist</input></b><br>';
  1069.  
  1070. iHTML += '<br><b><input type="checkbox" id="_cbInvertCamFilters">Invert operation of camera filters?</input></b><br>';
  1071.  
  1072. iHTML += '<b><input type="checkbox" id="_cbHighlightInsteadOfHideCams">Highlight instead of hide</input></b><br>';
  1073. return iHTML;
  1074. },
  1075. PopulateRTC: function()
  1076. {
  1077. let iHTML = '';
  1078. iHTML = '<br><b>Hide Road Closures:</b><br>';
  1079. // Hidden checkbox to avoid errors when applying settings from previous versions of the script where this was an active control...
  1080. iHTML += '<input type="checkbox" id="_cbHideUserRTCs" style="display: none;" />';
  1081.  
  1082. iHTML += '<table style="text-align:center;">';
  1083. 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>';
  1084. 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>';
  1085. 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>';
  1086. 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>';
  1087. 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>';
  1088. iHTML += '</table><br>';
  1089.  
  1090. iHTML += '<input type="checkbox" id="_cbShowMTERTCs" pairedWith="_cbHideMTERTCs">Show</input> or ';
  1091. iHTML += '<input type="checkbox" id="_cbHideMTERTCs" pairedWith="_cbShowMTERTCs">hide RTCs associated with MTE: </input>';
  1092. iHTML += '<select id="_selectRTCMTE" style="width:80%; height:22px;"></select><br>';
  1093. iHTML += '<br>';
  1094. iHTML += 'Hide if:<br>';
  1095. iHTML += '<input type="checkbox" id="_cbEnableRTCDurationFilterLessThan">Duration less than </input>';
  1096. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterRTCDurationLessThan"> days<br>';
  1097. iHTML += '<input type="checkbox" id="_cbEnableRTCDurationFilterMoreThan">Duration more than </input>';
  1098. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterRTCDurationMoreThan"> days<br>';
  1099. iHTML += '<br><b>Filter by date/time:</b><br>';
  1100. iHTML += '<input type="checkbox" id="_cbRTCFilterShowForTS" pairedWith="_cbRTCFilterHideForTS">Show</input> or ';
  1101. iHTML += '<input type="checkbox" id="_cbRTCFilterHideForTS" pairedWith="_cbRTCFilterShowForTS">hide</input> RTCs active at<br>';
  1102. iHTML += 'Date: <input type="number" min="1" max="31" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterDay"> / ';
  1103. iHTML += '<input type="number" min="1" max="12" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterMonth"> / ';
  1104. iHTML += '<input type="number" min="2010" max="2100" size="4" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterYear"><br>';
  1105. iHTML += 'Time: <input type="number" min="0" max="23" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterHour">:';
  1106. iHTML += '<input type="number" min="0" max="59" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterMin">';
  1107. return iHTML;
  1108. },
  1109. PopulateRA: function()
  1110. {
  1111. let iHTML = '';
  1112. iHTML = '<br><b>Filter Restricted Areas:</b><br>';
  1113. iHTML += '<input type="checkbox" id="_cbShowSpecificRA">Show a specific area: </input>';
  1114. iHTML += '<select id="_selectRA" style="width:80%; height:22px;"></select><br><br>';
  1115.  
  1116. iHTML += '<input type="checkbox" id="_cbRAEditorIDFilter">Show areas edited by user: </input>';
  1117. iHTML += '<select id="_selectRAEditorID" style="width:80%; height:22px;"></select><br><br>';
  1118.  
  1119. iHTML += 'Hide if:<br>';
  1120. iHTML += '<input type="checkbox" id="_cbEnableRAAgeFilterLessThan">Last modified less than </input>';
  1121. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterRAAgeLessThan"> days ago<br>';
  1122. iHTML += '<input type="checkbox" id="_cbEnableRAAgeFilterMoreThan">Last modified more than </input>';
  1123. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterRAAgeMoreThan"> days ago<br>';
  1124. return iHTML;
  1125. },
  1126. PopulateMisc: function()
  1127. {
  1128. let iHTML = '';
  1129. iHTML += '<br><b><input type="checkbox" id="_cbHideSegmentsWhenRoadsHidden" />Hide segment layer when road layer is hidden</b><br>';
  1130. iHTML += '<br><b><input type="checkbox" id="_cbKillInertialPanning" />Stop inertial panning when mouse moves out of map area</b><br>';
  1131.  
  1132. iHTML += '<br><br><b><input type="checkbox" id="_cbCommentCount" />Show comment count on UR markers</b><br>';
  1133.  
  1134. iHTML += '<br><br><b><input type="checkbox" id="_cbAutoApplyClonedClosure" />Auto-apply cloned closures</b><br>';
  1135. iHTML += '<b><input type="checkbox" id="_cbAutoScrollClosureList" />Auto-scroll to end of closures</b><br>';
  1136.  
  1137. iHTML += '<br><br><b>Disable filtering above zoom level </b>';
  1138. 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>';
  1139.  
  1140. iHTML += '<br><br><b>Marker Unstacking:</b><br>';
  1141. 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>';
  1142. 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>';
  1143.  
  1144. iHTML += '<br><br><b>Popup mouse behaviour:</b><br>';
  1145. 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>';
  1146. 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>';
  1147.  
  1148. iHTML += '<br><br><b>Disable popup for:</b><br>';
  1149. iHTML += '<input type="checkbox" id="_cbInhibitURPopup" />URs<br>';
  1150. iHTML += '<input type="checkbox" id="_cbInhibitMPPopup" />MPs<br>';
  1151. iHTML += '<input type="checkbox" id="_cbInhibitCamPopup" />Cameras<br>';
  1152. iHTML += '<input type="checkbox" id="_cbInhibitSegPopup" />Segments<br>';
  1153. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbInhibitSegGenericPopup" />Speed limit info<br>';
  1154. iHTML += '<input type="checkbox" id="_cbInhibitLandmarkPopup" />Places<br>';
  1155. iHTML += '<input type="checkbox" id="_cbInhibitPUPopup" />Place Updates<br>';
  1156. iHTML += '<input type="checkbox" id="_cbInhibitMapCommentPopup" />Map Comments<br>';
  1157. iHTML += '<input type="checkbox" id="_cbInhibitNodesPopup" />Junction Nodes<br>';
  1158.  
  1159. iHTML += '<br><br><b>Date/Time formatting for popups:</b><br>';
  1160. iHTML += '<input type="checkbox" id="_cbDateFmtDDMMYY" pairedWith="_cbDateFmtMMDDYY,_cbDateFmtYYMMDD" checked />day/month/year<br>';
  1161. iHTML += '<input type="checkbox" id="_cbDateFmtMMDDYY" pairedWith="_cbDateFmtDDMMYY,_cbDateFmtYYMMDD" />month/day/year<br>';
  1162. iHTML += '<input type="checkbox" id="_cbDateFmtYYMMDD" pairedWith="_cbDateFmtMMDDYY,_cbDateFmtDDMMYY" />year/month/day<br><br>';
  1163. iHTML += '<input type="checkbox" id="_cbTimeFmt24H" pairedWith="_cbTimeFmt12H" checked />24 hour<br>';
  1164. iHTML += '<input type="checkbox" id="_cbTimeFmt12H" pairedWith="_cbTimeFmt24H" />12 hour<br><br>';
  1165. iHTML += '<i>Unticked uses browser default setting</i>';
  1166.  
  1167. iHTML += '<br><br><b><input type="checkbox" id="_cbWhiteBackground" />Use custom background colour</b><br>';
  1168. 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" />';
  1169. 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" />';
  1170. 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>';
  1171.  
  1172. iHTML += '<br><br><b>Replace "Next ..." button with "Done" for:</b><br>';
  1173. iHTML += '<input type="checkbox" id="_cbInhibitNURButton" />URs<br>';
  1174. iHTML += '<input type="checkbox" id="_cbInhibitNMPButton" />MPs<br>';
  1175. iHTML += '<input type="checkbox" id="_cbInhibitNPURButton" />PURs<br>';
  1176.  
  1177. iHTML += '<br><br><b>Disable on-click recentering for:</b><br>';
  1178. iHTML += '<input type="checkbox" id="_cbInhibitURCentering" />URs<br>';
  1179. iHTML += '<input type="checkbox" id="_cbInhibitMPCentering" />MPs<br>';
  1180. iHTML += '<input type="checkbox" id="_cbInhibitPURCentering" />PURs<br>';
  1181. iHTML += '<input type="checkbox" id="_cbInhibitPPURCentering" />PPURs<br>';
  1182. iHTML += '<input type="checkbox" id="_cbInhibitRPURCentering" />RPURs<br>';
  1183.  
  1184. iHTML += '<br><br><b><input type="checkbox" id="_cbHideAMLayer" />Hide Area Manager polygons</b><br>';
  1185. iHTML += '<b><input type="checkbox" id="_cbMoveAMList" />Show AMs in topbar when AM layer is active</b><br>';
  1186. iHTML += '<br><b><input type="checkbox" id="_cbDisablePlacesFiltering" />Disable Places filtering</b><br>';
  1187.  
  1188. iHTML += '<br><br><b>Settings backup/restore/reset:</b><br>';
  1189. iHTML += '<input type="button" id="_btnSettingsToText" value="Backup" />&nbsp;&nbsp;&nbsp;';
  1190. iHTML += '<input type="button" id="_btnTextToSettings" value="Restore" />&nbsp;&nbsp;|&nbsp;&nbsp;';
  1191. iHTML += '<input type="button" id="_btnResetSettings" value="Reset" /><br><br>';
  1192. iHTML += '<textarea id="_txtSettings" value=""></textarea><br>';
  1193. iHTML += '<input type="button" id="_btnClearSettingsText" value="Clear" /><br>';
  1194.  
  1195. /*
  1196. iHTML += '<br><br><b>Debug:</b><br>';
  1197. iHTML += '<input type="button" id="_btnDebugToScreen" value="Show debug data" />';
  1198. */
  1199. return iHTML;
  1200. },
  1201. PopulateOWL()
  1202. {
  1203. let camTypes = new Array("","","Speed", "Dummy", "Red Light");
  1204. let iHTML = '';
  1205. if(document.getElementById('_uroCWLGroupSelect') !== null)
  1206. {
  1207. uroTabs.selectedOWLGroup = document.getElementById('_uroCWLGroupSelect').selectedIndex;
  1208. }
  1209. iHTML = '<br><b>Camera Watchlist:</b><br><br>';
  1210. iHTML += '<div id="_uroCWLCamList" style="height:65%;overflow:auto;">';
  1211. if(uroOWL.CWLGroups.length > 0)
  1212. {
  1213. let camidx;
  1214. for(let groupidx=0;groupidx<uroOWL.CWLGroups.length;groupidx++)
  1215. {
  1216. let groupObj = uroOWL.CWLGroups[groupidx];
  1217. iHTML += '<div id="_uroCWLGroup-'+groupidx+'">';
  1218. if(groupObj.groupCollapsed === true)
  1219. {
  1220. iHTML += '<i class="fa fa-plus-square-o" style="cursor:pointer;font-size:14px;" id="_uroCWLGroupState-'+groupidx+'"></i>';
  1221. }
  1222. else
  1223. {
  1224. iHTML += '<i class="fa fa-minus-square-o" style="cursor:pointer;font-size:14px;" id="_uroCWLGroupState-'+groupidx+'"></i>';
  1225. }
  1226. iHTML += '<b>'+groupObj.groupName+'</b><br>';
  1227. groupObj.groupCount = 0;
  1228. if(uroOWL.CamWatchObjects.length > 0)
  1229. {
  1230. for(camidx=0;camidx<uroOWL.CamWatchObjects.length;camidx++)
  1231. {
  1232. let camObj = uroOWL.CamWatchObjects[camidx];
  1233. if(camObj.groupID == groupObj.groupID)
  1234. {
  1235. groupObj.groupCount++;
  1236. let changed = uroOWL.CamDataChanged(camidx);
  1237. let deleted = (camObj.loaded === false);
  1238. iHTML += '<div id="_uroCWL-'+camidx+'" style="padding:3px;border-width:2px;border-style:solid;border-color:#FFFFFF;background-color:';
  1239. if(camObj.server != W.app.getAppRegionCode())
  1240. {
  1241. if(camObj.server == '??') iHTML += '#A0A0A0;';
  1242. else iHTML += '#AAFFAA;';
  1243. }
  1244. else if(changed) iHTML += '#AAAAFF;';
  1245. else if(deleted) iHTML += '#FFAAAA;';
  1246. else iHTML += '#FFFFFF;';
  1247. if(groupObj.groupCollapsed === true) iHTML += 'display:none;">';
  1248. else iHTML += 'display:block;">';
  1249. iHTML += 'ID: '+camObj.fid;
  1250. iHTML += ' ('+camObj.server+')';
  1251. iHTML += ' Type: '+camTypes[camObj.watch.type];
  1252. if(camObj.server != W.app.getAppRegionCode())
  1253. {
  1254. if(camObj.server == '??')
  1255. {
  1256. iHTML += '<br><i>Unknown server</i>';
  1257. }
  1258. else
  1259. {
  1260. iHTML += '<br><i>Not on this server</i>';
  1261. }
  1262. }
  1263. else if(deleted)
  1264. {
  1265. iHTML += '<br>DELETED';
  1266. }
  1267. else if(changed)
  1268. {
  1269. if(camObj.current.type != camObj.watch.type)
  1270. {
  1271. iHTML += '<br>&nbsp;&nbsp;Type changed';
  1272. iHTML += ' ('+camObj.watch.type+' to '+camObj.current.type+')';
  1273. }
  1274. if(camObj.current.azymuth != camObj.watch.azymuth)
  1275. {
  1276. iHTML += '<br>&nbsp;&nbsp;Azimuth changed';
  1277. iHTML += ' ('+camObj.watch.azymuth+' to '+camObj.current.azymuth+')';
  1278. }
  1279. if(camObj.current.speed != camObj.watch.speed)
  1280. {
  1281. iHTML += '<br>&nbsp;&nbsp;Speed changed';
  1282. iHTML += ' ('+camObj.watch.speed+' to '+camObj.current.speed+')';
  1283. }
  1284. if(camObj.current.lat != camObj.watch.lat)
  1285. {
  1286. iHTML += '<br>&nbsp;&nbsp;Latitude changed';
  1287. iHTML += ' ('+camObj.watch.lat+' to '+camObj.current.lat+')';
  1288. }
  1289. if(camObj.current.lon != camObj.watch.lon)
  1290. {
  1291. iHTML += '<br>&nbsp;&nbsp;Longitude changed';
  1292. iHTML += ' ('+camObj.watch.lon+' to '+camObj.current.lon+')';
  1293. }
  1294. }
  1295. if(camObj.server == W.app.getAppRegionCode())
  1296. {
  1297. if(deleted === false)
  1298. {
  1299. iHTML += '&nbsp;<i class="fa fa-group" style="cursor:pointer;font-size:14px;color:#ccccff;" id="_uroCWLIcon1-'+camidx+'"></i>';
  1300. }
  1301. iHTML += '&nbsp;<i class="fa fa-arrow-circle-right" style="cursor:pointer;font-size:14px;color:#ccccff;" id="_uroCWLIcon2-'+camidx+'"></i>';
  1302. }
  1303. iHTML += '</div>';
  1304. }
  1305. }
  1306. }
  1307. iHTML += '</div>';
  1308. }
  1309. }
  1310. iHTML += '</div><div id="_uroCWLControls">';
  1311. iHTML += '<hr>Group control:<br>';
  1312. iHTML += '<select id="_uroCWLGroupSelect" style="width:40%;height:22px;"></select>&nbsp;<input type="button" id="_btnCWLGroupDel" value="Delete group"><br>';
  1313. iHTML += '<input type="text" id="_uroCWLGroupEntry" style="width:40%;height:22px;">&nbsp;<input type="button" id="_btnCWLGroupAdd" value="Add group">';
  1314. iHTML += '<br><input type="button" id="_btnRescanCamWatchList" value="Refresh camera data"><br><br>';
  1315. iHTML += '<input type="button" id="_btnUpdateCamValues" value="Accept all changes"><br><br>';
  1316. iHTML += '<b>Remove cameras from OWL:</b><br>';
  1317. iHTML += '<input type="button" id="_btnRemoveDeletedCameras" value="Deleted">&nbsp;&nbsp;';
  1318. iHTML += '<input type="button" id="_btnRemoveUnknownServerCameras" value="Unknown Server">&nbsp;&nbsp;';
  1319. iHTML += '<input type="button" id="_btnClearCamWatchList" value="ALL Cameras">';
  1320. iHTML += '</div>';
  1321. uroTabs.CtrlTabs[uroTabs.IDS.OWL][uroTabs.FIELDS.TABBODY].innerHTML = uroUtils.ModifyHTML(iHTML);
  1322. uroTabs.FinaliseOWLTab();
  1323. },
  1324. FinaliseOWLTab: function()
  1325. {
  1326. if(uroOWL.CamWatchObjects.length > 0)
  1327. {
  1328. if(document.getElementById("_uroCWL-0") == null)
  1329. {
  1330. window.setTimeout(uroTabs.FinaliseOWLTab,100);
  1331. return;
  1332. }
  1333. for(let camidx=0;camidx<uroOWL.CamWatchObjects.length;camidx++)
  1334. {
  1335. document.getElementById("_uroCWL-"+camidx).onmouseover = uroOWL.HighlightCWLEntry;
  1336. document.getElementById("_uroCWL-"+camidx).onmouseleave = uroOWL.UnhighlightCWLEntry;
  1337. if(uroOWL.CamWatchObjects[camidx].server == W.app.getAppRegionCode())
  1338. {
  1339. let icon1 = document.getElementById("_uroCWLIcon1-"+camidx);
  1340. let icon2 = document.getElementById("_uroCWLIcon2-"+camidx);
  1341. if(icon1 !== null)
  1342. {
  1343. icon1.onmouseover = uroOWL.CWLIconHighlight;
  1344. icon1.onmouseleave = uroOWL.CWLIconLowlight;
  1345. icon1.onclick = uroOWL.AssignCameraToGroup;
  1346. }
  1347. if(icon2 !== null)
  1348. {
  1349. icon2.onmouseover = uroOWL.CWLIconHighlight;
  1350. icon2.onmouseleave = uroOWL.CWLIconLowlight;
  1351. icon2.onclick = uroOWL.GotoCam;
  1352. }
  1353. }
  1354. }
  1355. }
  1356. if(document.getElementById('_btnClearCamWatchList') == null)
  1357. {
  1358. window.setTimeout(uroTabs.FinaliseOWLTab, 100);
  1359. return;
  1360. }
  1361. uroUtils.AddEventListener('_btnClearCamWatchList', 'click', uroOWL.ClearCamWatchList, true);
  1362. uroUtils.AddEventListener('_btnRemoveDeletedCameras', 'click', uroOWL.ClearDeletedCameras, true);
  1363. uroUtils.AddEventListener('_btnRemoveUnknownServerCameras', 'click', uroOWL.ClearUnknownServerCameras, true);
  1364. uroUtils.AddEventListener('_btnRescanCamWatchList', 'click', uroOWL.RescanCamWatchList, true);
  1365. uroUtils.AddEventListener('_btnUpdateCamValues', 'click', uroOWL.AcceptCameraChanges, true);
  1366. uroUtils.AddEventListener('_btnCWLGroupDel', 'click', uroOWL.RemoveCWLGroup, true);
  1367. uroUtils.AddEventListener('_btnCWLGroupAdd', 'click', uroOWL.AddCWLGroup, true);
  1368. if(document.getElementById('_uroCWLGroupSelect') !== null)
  1369. {
  1370. uroDBG.AddLog('populating CWL group list');
  1371. uroOWL.PopulateCWLGroupSelect();
  1372. let selector = document.getElementById('_uroCWLGroupSelect');
  1373. if(uroTabs.selectedOWLGroup >= selector.length)
  1374. {
  1375. uroTabs.selectedOWLGroup = 0;
  1376. }
  1377. selector.selectedIndex = uroTabs.selectedOWLGroup;
  1378. }
  1379. if(uroOWL.CWLGroups.length > 0)
  1380. {
  1381. for(let groupidx=0;groupidx<uroOWL.CWLGroups.length;groupidx++)
  1382. {
  1383. if(uroOWL.CWLGroups[groupidx].groupCount === 0)
  1384. {
  1385. uroTabs.SetStyleDisplay('_uroCWLGroup-'+groupidx,'none');
  1386. }
  1387. else
  1388. {
  1389. uroUtils.SetOnClick('_uroCWLGroupState-'+groupidx,uroOWL.CWLGroupCollapseExpand);
  1390. }
  1391. }
  1392. }
  1393. },
  1394. ActiveTab: function(_id)
  1395. {
  1396. let e = document.getElementById(_id);
  1397. e.style.backgroundColor = "greenyellow";
  1398. e.style.borderTop = "1px solid";
  1399. e.style.borderLeft = "1px solid";
  1400. e.style.borderRight = "1px solid";
  1401. e.style.borderBottom = "0px solid";
  1402. },
  1403. InactiveTab: function(_id)
  1404. {
  1405. let e = document.getElementById(_id);
  1406. e.style.backgroundColor = "gainsboro";
  1407. e.style.borderTop = "0px solid";
  1408. e.style.borderLeft = "0px solid";
  1409. e.style.borderRight = "0px solid";
  1410. e.style.borderBottom = "1px solid";
  1411. },
  1412. InactiveAllTabs: function()
  1413. {
  1414. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  1415. {
  1416. uroTabs.InactiveTab(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABHEADER]);
  1417. uroTabs.SetStyleDisplay(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY], 'none');
  1418. }
  1419. },
  1420. ShowTab: function(tabID)
  1421. {
  1422. uroTabs.InactiveAllTabs();
  1423. uroTabs.ActiveTab(uroTabs.CtrlTabs[tabID][uroTabs.FIELDS.TABHEADER]);
  1424. uroTabs.SetStyleDisplay(uroTabs.CtrlTabs[tabID][uroTabs.FIELDS.TABBODY], 'block');
  1425. return false;
  1426. },
  1427. ShowURs: function()
  1428. {
  1429. uroTabs.ShowTab(uroTabs.IDS.URS);
  1430. return false;
  1431. },
  1432. ShowMPs: function()
  1433. {
  1434. uroTabs.ShowTab(uroTabs.IDS.MPS);
  1435. return false;
  1436. },
  1437. ShowMCs: function()
  1438. {
  1439. uroTabs.ShowTab(uroTabs.IDS.MCS);
  1440. return false;
  1441. },
  1442. ShowPlaces: function()
  1443. {
  1444. uroTabs.ShowTab(uroTabs.IDS.PLACES);
  1445. for(let idx=0;idx<uroPlacesGroupsCollapsed.length;idx++)
  1446. {
  1447. uroPlacesGroupCEHandler(idx);
  1448. }
  1449. return false;
  1450. },
  1451. ShowCams: function()
  1452. {
  1453. uroTabs.ShowTab(uroTabs.IDS.CAMS);
  1454. return false;
  1455. },
  1456. ShowOWL: function()
  1457. {
  1458. uroTabs.ShowTab(uroTabs.IDS.OWL);
  1459. uroTabs.PopulateOWL();
  1460. return false;
  1461. },
  1462. ShowMisc: function()
  1463. {
  1464. uroTabs.ShowTab(uroTabs.IDS.MISC);
  1465. return false;
  1466. },
  1467. ShowRTCs: function()
  1468. {
  1469. uroTabs.ShowTab(uroTabs.IDS.RTCS);
  1470. return false;
  1471. },
  1472. ShowRAs: function()
  1473. {
  1474. uroTabs.ShowTab(uroTabs.IDS.RAS);
  1475. return false;
  1476. },
  1477. ClickURs: function()
  1478. {
  1479. uroFilterURs();
  1480. },
  1481. ClickMPs: function()
  1482. {
  1483. uroFilterProblems();
  1484. },
  1485. ClickMCs: function()
  1486. {
  1487. uroFilterMapComments();
  1488. uroLayers.MCLayerChanged();
  1489. },
  1490. ClickPlaces: function()
  1491. {
  1492. uroFilterPlaces();
  1493. },
  1494. ClickCams: function()
  1495. {
  1496. uroFilterCameras();
  1497. },
  1498. ClickOWL: function()
  1499. {
  1500. // no action required
  1501. },
  1502. ClickMisc: function()
  1503. {
  1504. uroFilterItems();
  1505. uroUITweaks.ChangeMapBGColour();
  1506. uroUITweaks.HideAMLayer();
  1507. uroUITweaks.HideSegments();
  1508. },
  1509. ClickRTCs: function()
  1510. {
  1511. uroFilterRTCs();
  1512. uroClosureListHandler();
  1513. },
  1514. ClickRAs: function()
  1515. {
  1516. uroFilterRAs();
  1517. },
  1518. CreateTabHeaders: function()
  1519. {
  1520. uroTabs.CtrlTabs =
  1521. [
  1522. ['_tabURs', null, '_linkURs', 'URs', uroTabs.ShowURs, uroTabs.ClickURs, 'UROverviewUROptions', uroTabs.PopulateUR],
  1523. ['_tabMPs', null, '_linkMPs', 'MPs', uroTabs.ShowMPs, uroTabs.ClickMPs, 'UROverviewMPOptions', uroTabs.PopulateMP],
  1524. ['_tabMCs', null, '_linkMCs', 'MCs', uroTabs.ShowMCs, uroTabs.ClickMCs, 'UROverviewMCOptions', uroTabs.PopulateMC],
  1525. ['_tabRTCs', null, '_linkRTCs', 'RTCs', uroTabs.ShowRTCs, uroTabs.ClickRTCs, 'UROverviewRTCOptions', uroTabs.PopulateRTC],
  1526. ['_tabRAs', null, '_linkRAs', 'RAs', uroTabs.ShowRAs, uroTabs.ClickRAs, 'UROverviewRAOptions', uroTabs.PopulateRA],
  1527. ['_tabPlaces', null, '_linkPlaces', 'Places', uroTabs.ShowPlaces, uroTabs.ClickPlaces, 'UROverviewPlacesOptions', uroTabs.PopulatePlaces],
  1528. ['_tabCams', null, '_linkCams', 'Cams', uroTabs.ShowCams, uroTabs.ClickCams, 'UROverviewCameraOptions', uroTabs.PopulateCams],
  1529. ['_tabOWL', null, '_linkOWL', 'OWL', uroTabs.ShowOWL, uroTabs.ClickOWL, null, null],
  1530. ['_tabMisc', null, '_linkMisc', 'Misc', uroTabs.ShowMisc, uroTabs.ClickMisc, 'UROverviewMiscOptions', uroTabs.PopulateMisc]
  1531. ];
  1532.  
  1533. let i;
  1534. let tabsTotal = uroTabs.CtrlTabs.length;
  1535. let tabsPerRow = Math.ceil(tabsTotal / Math.ceil(tabsTotal / uroTabs.MAX_PER_ROW));
  1536. let tabCount = 0;
  1537. let tabbyHTML = '';
  1538. for(i = 0; i < tabsTotal; ++i)
  1539. {
  1540. if(tabCount == 0)
  1541. {
  1542. tabbyHTML += '<table border=0 width="100%"><tr>';
  1543. }
  1544. tabbyHTML += '<td valign="center" align="center" id="'+uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABHEADER]+'">';
  1545. 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>';
  1546. if(((++tabCount == tabsPerRow) && (i < (tabsTotal - 1))) || (i == (tabsTotal - 1)))
  1547. {
  1548. tabbyHTML += '</tr></table>';
  1549. tabCount = 0;
  1550. }
  1551. }
  1552. return tabbyHTML;
  1553. },
  1554. CreateTabBodies: function()
  1555. {
  1556. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  1557. {
  1558. uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY] = document.createElement('div');
  1559. }
  1560. },
  1561. AddToDOM: function()
  1562. {
  1563. let i;
  1564. for(i = 0; i < uroTabs.CtrlTabs.length; ++i)
  1565. {
  1566. if(uroTabs.CtrlTabs[i][uroTabs.FIELDS.POPULATEFN] != null)
  1567. {
  1568. uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY].innerHTML = uroTabs.CtrlTabs[i][uroTabs.FIELDS.POPULATEFN]();
  1569. }
  1570. document.getElementById('uroControlsContainer').appendChild(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY]);
  1571. uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY].onclick = uroTabs.CtrlTabs[i][uroTabs.FIELDS.CLICKFN];
  1572. }
  1573. }
  1574. };
  1575. const uroDBG = // debug output handling
  1576. {
  1577. // true enables debug output during script startup
  1578. showDebugOutput: true,
  1579. // true keeps debug output enabled after script startup
  1580. persistentDebugOutput: false,
  1581. // true enables performance monitoring debug output
  1582. performanceMonitoringOutput: false,
  1583.  
  1584. recentDebug: [],
  1585.  
  1586. Add: function(debugtext)
  1587. {
  1588. let ts = Math.round(performance.now());
  1589. if(uroDBG.recentDebug.length == 100)
  1590. {
  1591. uroDBG.recentDebug.shift();
  1592. }
  1593. uroDBG.recentDebug.push(ts+': '+debugtext);
  1594. console.debug('URO+DBG '+ts+':'+debugtext);
  1595. },
  1596. Dump: function()
  1597. {
  1598. if(uroDBG.recentDebug.length > 0)
  1599. {
  1600. document.getElementById('WazeMap').innerHTML = uroUtils.ModifyHTML('<textarea id="uroDbgOutput" style="width:100%;height:100%">');
  1601. let dbgOutput = '';
  1602. for(let i = 0; i < uroDBG.recentDebug.length; i++)
  1603. {
  1604. dbgOutput += uroDBG.recentDebug[i]+'\n';
  1605. }
  1606. document.getElementById('uroDbgOutput').textContent = dbgOutput;
  1607. }
  1608. },
  1609. Toggle: function()
  1610. {
  1611. uroDBG.showDebugOutput = !uroDBG.showDebugOutput;
  1612. let dbgMode = "none";
  1613. if(uroDBG.showDebugOutput)
  1614. {
  1615. dbgMode = "inline";
  1616. }
  1617. document.getElementById('_uroDebugMode').style.display = dbgMode;
  1618. },
  1619. PerfMon: function(source, ts)
  1620. {
  1621. if(uroDBG.performanceMonitoringOutput === true)
  1622. {
  1623. console.log(source+': '+(performance.now() - ts));
  1624. }
  1625. },
  1626. AddLog: function(logtext)
  1627. {
  1628. if(uroDBG.showDebugOutput) console.log('URO+: '+Date()+' '+logtext);
  1629. }
  1630. };
  1631. const uroAFN = // area friendly name functions
  1632. {
  1633. friendlyNames: [],
  1634. hoverTime: -1,
  1635. hoverObj: null,
  1636. overlayShown: false,
  1637. editHovered: false,
  1638. editBox: null,
  1639. friendlyAreaNames: null,
  1640. AFNObject: function(fName, area, server)
  1641. {
  1642. this.fName = fName;
  1643. this.area = area;
  1644. this.server = server;
  1645. },
  1646. UpdateName: function(name, server, area)
  1647. {
  1648. let foundExisting = false;
  1649. for(let i = 0; i < uroAFN.friendlyNames.length; i++)
  1650. {
  1651. if((uroAFN.friendlyNames[i].server == server) && (uroAFN.friendlyNames[i].area == area))
  1652. {
  1653. if(name === "")
  1654. {
  1655. this.friendlyNames.splice(i, 1);
  1656. foundExisting = true;
  1657. }
  1658. else
  1659. {
  1660. uroAFN.friendlyNames[i].fName = name;
  1661. foundExisting = true;
  1662. }
  1663. }
  1664. }
  1665. if((foundExisting === false) && (name !== ""))
  1666. {
  1667. uroAFN.friendlyNames.push(new uroAFN.AFNObject(name, area, server));
  1668. }
  1669. uroAFN.ReplaceAreaNames(true);
  1670. },
  1671. AreaNameHover: function()
  1672. {
  1673. if((uroAFN.hoverObj === null) || (uroAFN.hoverObj != this))
  1674. {
  1675. uroAFN.hoverTime = 0;
  1676. }
  1677. uroAFN.hoverObj = this;
  1678. },
  1679. AreaNameUnHover: function()
  1680. {
  1681. if(uroAFN.editHovered === true)
  1682. {
  1683. return false;
  1684. }
  1685. if(uroAFN.overlayShown)
  1686. {
  1687. uroAFN.hoverObj.removeChild(uroAFN.editBox);
  1688. }
  1689. uroAFN.hoverObj = null;
  1690. uroAFN.hoverTime = -1;
  1691. uroAFN.overlayShown = false;
  1692. },
  1693. EditHover: function()
  1694. {
  1695. uroAFN.editHovered = true;
  1696. uroUtils.AddEventListener('uroANEditBox', 'mouseout', uroAFN.EditUnHover, false);
  1697. uroUtils.AddEventListener('uroANEditBox', 'click', uroAFN.EditClick, false);
  1698. },
  1699. EditUnHover: function()
  1700. {
  1701. let newName = document.getElementById('_textAreaName').value;
  1702. // sanitise name to avoid conflicts with config storage delimiters...
  1703. newName = newName.replace(',','');
  1704. newName = newName.replace(':','');
  1705. let server = W.app.getAppRegionCode();
  1706. let area = uroAFN.GetAreaArea(uroAFN.hoverObj.parentNode.children[1].innerText);
  1707. uroAFN.hoverObj.removeChild(uroAFN.editBox);
  1708. uroAFN.overlayShown = false;
  1709. uroAFN.editHovered = false;
  1710. uroAFN.UpdateName(newName, server, area);
  1711. },
  1712. EditClick: function(e)
  1713. {
  1714. // this traps the click to prevent it falling through to the underlying area name element and
  1715. // potentially causing the map view to be relocated to that area...
  1716. e.stopPropagation();
  1717. },
  1718. GetAreaArea: function(area)
  1719. {
  1720. area = parseFloat(area.split(' ')[0]);
  1721. return area;
  1722. },
  1723. OverlaySetup: function()
  1724. {
  1725. uroAFN.overlayShown = true;
  1726. uroAFN.editBox = document.createElement('div');
  1727. uroAFN.editBox.id = "uroANEditBox";
  1728. uroAFN.editBox.style.position = "absolute";
  1729. uroAFN.editBox.style.top = '0px';
  1730. uroAFN.editBox.style.left = '0px';
  1731. uroAFN.editBox.style.width = "99%";
  1732. uroAFN.hoverObj.appendChild(uroAFN.editBox);
  1733. uroAFN.editBox.onmouseover = uroAFN.EditHover();
  1734. let existingName = uroAFN.hoverObj.innerHTML;
  1735. let italicTagPos = existingName.indexOf(' <i>');
  1736. if(italicTagPos == -1)
  1737. {
  1738. existingName = "";
  1739. }
  1740. else
  1741. {
  1742. existingName = existingName.substr(0,italicTagPos);
  1743. }
  1744. uroAFN.editBox.innerHTML = uroUtils.ModifyHTML('<input type="text" style="font-size:14px; line-height:16px; height:22px; width:100%" id="_textAreaName" value="'+existingName+'">');
  1745. },
  1746. ReplaceAreaNames: function(replaceAfterNameChange)
  1747. {
  1748. if(document.getElementById('sidepanel-areas') === undefined)
  1749. {
  1750. return;
  1751. }
  1752. if(document.getElementById('sidepanel-areas').getElementsByClassName('result-list').length === 0)
  1753. {
  1754. return;
  1755. }
  1756. if(replaceAfterNameChange === false)
  1757. {
  1758. if(document.getElementById('sidepanel-areas').getElementsByClassName('result-list')[0].id == "friendlyNamed")
  1759. {
  1760. return;
  1761. }
  1762. }
  1763. let panelRootObj = document.getElementById('sidepanel-areas').getElementsByClassName('result-list')[0];
  1764. if(panelRootObj === undefined)
  1765. {
  1766. // we get here if the user doesn't have any areas defined...
  1767. return;
  1768. }
  1769. let areaNameObjs = panelRootObj.getElementsByClassName('list-item-card-info');
  1770. if(areaNameObjs.length === 0)
  1771. {
  1772. return;
  1773. }
  1774. let localisedManagedArea = I18n.lookup("user.areas.managed_area");
  1775. for(let loop=0; loop < areaNameObjs.length; loop++)
  1776. {
  1777. if(areaNameObjs[loop].children.length === 2)
  1778. {
  1779. let title = areaNameObjs[loop].children[0].innerText;
  1780. if(title.indexOf(localisedManagedArea) > -1)
  1781. {
  1782. let area = uroAFN.GetAreaArea(areaNameObjs[loop].children[1].innerText);
  1783. areaNameObjs[loop].children[0].innerHTML = uroUtils.ModifyHTML(localisedManagedArea);
  1784. for(let fnIdx=0; fnIdx < uroAFN.friendlyNames.length; fnIdx++)
  1785. {
  1786. let fnObj = uroAFN.friendlyNames[fnIdx];
  1787. if((fnObj.area == area) && (fnObj.server == W.app.getAppRegionCode()))
  1788. {
  1789. areaNameObjs[loop].children[0].innerHTML = uroUtils.ModifyHTML(fnObj.fName +' <i>('+localisedManagedArea+')</i>');
  1790. break;
  1791. }
  1792. }
  1793. let titleObj = areaNameObjs[loop].getElementsByClassName('list-item-card-title')[0];
  1794. titleObj.addEventListener("mouseover", uroAFN.AreaNameHover, false);
  1795. titleObj.addEventListener("mouseout", uroAFN.AreaNameUnHover, false);
  1796. titleObj.style.cursor = "text";
  1797. }
  1798. }
  1799. }
  1800. document.getElementById('sidepanel-areas').getElementsByClassName('result-list')[0].id = "friendlyNamed";
  1801. },
  1802. ApplyNames: function()
  1803. {
  1804. let objects = localStorage.UROverviewFriendlyAreaNames.split(':');
  1805. uroAFN.friendlyNames = [];
  1806. for(let objIdx=0;objIdx<objects.length;objIdx++)
  1807. {
  1808. let fields = objects[objIdx].split(',');
  1809. uroAFN.friendlyNames.push(new uroAFN.AFNObject(fields[0],parseFloat(fields[1]),fields[2]));
  1810. }
  1811. uroAFN.ReplaceAreaNames(true);
  1812. }
  1813. };
  1814. const uroMarkers = // marker-related function
  1815. {
  1816. elm : null,
  1817. obj : null,
  1818. id : null,
  1819. type : null,
  1820. lastOver : null,
  1821.  
  1822. mouseX : null,
  1823. mouseY : null,
  1824. mouseButtons : null,
  1825. clientX : null,
  1826. clientY : null,
  1827. armHover : false,
  1828. entryTimeout : null,
  1829. inhibitSetCenter : false,
  1830. clickedOnCenter : null,
  1831. clickedOnID : null,
  1832.  
  1833. EntryTimeout: function()
  1834. {
  1835. uroMarkers.armHover = false;
  1836. if(uroMarkers.lastOver !== null)
  1837. {
  1838. if(uroMarkers.type === 'cam')
  1839. {
  1840. if(uroUtils.GetCBChecked('_cbHighlightInsteadOfHideCams') === true)
  1841. {
  1842. if(uroMarkers.lastOver !== uroMarkers.id)
  1843. {
  1844. window.setTimeout(uroFilterCameras, 50);
  1845. }
  1846. }
  1847. }
  1848. else if((uroMarkers.type == uroLayers.ID.UR) || (uroMarkers.type == uroLayers.ID.MP))
  1849. {
  1850. if(uroMarkers.type == uroLayers.ID.UR) uroHoveredURID = uroMarkers.id;
  1851. }
  1852.  
  1853. uroDBG.AddLog('hover over marker (Type ' + uroMarkers.type + ' / ID ' + uroMarkers.id + ')');
  1854. uroPopup.Generate();
  1855. }
  1856. },
  1857. MouseMove: function(e)
  1858. {
  1859. uroMarkers.buttons = e.buttons;
  1860. uroMarkers.mouseX = e.pageX - document.getElementById('map').getBoundingClientRect().left;
  1861. uroMarkers.mouseY = e.pageY - document.getElementById('map').getBoundingClientRect().top;
  1862. uroMarkers.clientX = e.clientX;
  1863. uroMarkers.clientY = e.clientY;
  1864.  
  1865. if(uroMarkers.armHover === true)
  1866. {
  1867. let eto = uroUtils.GetElmValue('_inputPopupEntryTimeout') * 100;
  1868. if(uroMarkers.entryTimeout !== null)
  1869. {
  1870. window.clearTimeout(uroMarkers.entryTimeout);
  1871. }
  1872. uroMarkers.entryTimeout = window.setTimeout(uroMarkers.EntryTimeout, eto);
  1873. }
  1874. },
  1875. TranslateType: function(ft)
  1876. {
  1877. const TLU =
  1878. [
  1879. ["mapProblem", uroLayers.ID.MP],
  1880. ["mapUpdateRequest", uroLayers.ID.UR],
  1881. ["placeUpdate", uroLayers.ID.PUR],
  1882. ["camera", "cam"],
  1883. ["node", "node"],
  1884. ["comment", "comment"],
  1885. ["venue", "venue"],
  1886. ["segment", "segment"]
  1887. ];
  1888.  
  1889. let retval = null;
  1890. for(let i = 0; i < TLU.length; ++i)
  1891. {
  1892. if(ft == TLU[i][0])
  1893. {
  1894. retval = TLU[i][1];
  1895. break;
  1896. }
  1897. }
  1898. return retval;
  1899. },
  1900. MouseOver: function(e)
  1901. {
  1902. let elm = null;
  1903. let obj = null;
  1904. let id = null;
  1905. let markerType = null;
  1906. let ft = e?.feature?.attributes?.wazeFeature?.featureType;
  1907. if(ft !== undefined)
  1908. {
  1909. obj = e.feature.attributes.wazeFeature._wmeObject;
  1910. elm = W.userscripts.getMapElementByDataModel(obj);
  1911. id = e.feature.attributes.wazeFeature.id;
  1912. markerType = uroMarkers.TranslateType(ft);
  1913.  
  1914. uroMarkers.elm = elm;
  1915. uroMarkers.obj = obj;
  1916. uroMarkers.id = id;
  1917. uroMarkers.type = markerType;
  1918. uroMarkers.lastOver = id;
  1919. uroMarkers.armHover = true;
  1920.  
  1921. uroMarkers.AddMarkerEventHandler();
  1922. }
  1923. },
  1924. MouseOut: function(e)
  1925. {
  1926. uroMarkers.lastOver = null;
  1927. if(uroMarkers.type !== null)
  1928. {
  1929. if(uroMarkers.type === 'cam')
  1930. {
  1931. if(uroUtils.GetCBChecked('_cbHighlightInsteadOfHideCams') === true)
  1932. {
  1933. window.setTimeout(uroFilterCameras, 50);
  1934. }
  1935. }
  1936. uroDBG.AddLog('hover off '+uroMarkers.type+' ID '+uroMarkers.id);
  1937. uroHoveredURID = null;
  1938.  
  1939. uroFID = -1;
  1940. if(uroStackType !== null)
  1941. {
  1942. let tStackType = uroStackType;
  1943. uroRestackMarkers();
  1944. if(tStackType == 1)
  1945. {
  1946. uroFilterURs();
  1947. }
  1948. else if(tStackType == 2)
  1949. {
  1950. uroFilterProblems();
  1951. }
  1952. else if(tStackType == 3)
  1953. {
  1954. uroFilterPlaces();
  1955. }
  1956. }
  1957.  
  1958. if(uroPopup.timer == -1)
  1959. {
  1960. uroPopup.timer = uroUtils.GetElmValue('_inputPopupEntryTimeout');
  1961. }
  1962. }
  1963. else
  1964. {
  1965. uroDBG.AddLog('hover off unknown object...');
  1966. }
  1967. },
  1968. MouseDown: function()
  1969. {
  1970. // Do this stuff in the mousedown event rather than the click event so we fire before any of the native
  1971. // click events - we need to ensure this happens for inhibiting marker centering, as we need to capture
  1972. // the markerType ahead of our interceptor function being called to deal with the centering...
  1973. if(uroMarkers.type !== null)
  1974. {
  1975. uroDBG.AddLog('clicked on '+uroMarkers.type+' marker '+uroMarkers.id);
  1976. uroMarkers.clickedOnID = uroMarkers.id;
  1977. uroMarkers.clickedOnCenter = W.map.getCenter();
  1978. uroInhibitURFiltering = true;
  1979. if(uroMarkers.inhibitSetCenter === false)
  1980. {
  1981. if(uroMarkers.Decentre() === true)
  1982. {
  1983. uroMarkers.inhibitSetCenter = true;
  1984. }
  1985. }
  1986. }
  1987. },
  1988. Decentre: function()
  1989. {
  1990. let inhibit = false;
  1991. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.UR) && (uroUtils.GetCBChecked("_cbInhibitURCentering")));
  1992. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.MP) && (uroUtils.GetCBChecked("_cbInhibitMPCentering")));
  1993. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.PUR) && (uroUtils.GetCBChecked("_cbInhibitPURCentering")));
  1994. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.PPUR) && (uroUtils.GetCBChecked("_cbInhibitPPURCentering")));
  1995. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.RPUR) && (uroUtils.GetCBChecked("_cbInhibitRPURCentering")));
  1996. return inhibit;
  1997. },
  1998. RegisterEvents: function()
  1999. {
  2000. for(let i = 0; i < uroLayers.layers.length; ++i)
  2001. {
  2002. if(uroLayers.layers[i].regEvt === true)
  2003. {
  2004. uroLayers.layers[i].l.events.register("fe-feature-in", null, uroMarkers.MouseOver);
  2005. uroLayers.layers[i].l.events.register("fe-feature-out", null, uroMarkers.MouseOut);
  2006. }
  2007. }
  2008. },
  2009. AddMarkerEventHandler: function()
  2010. {
  2011. if
  2012. (
  2013. (uroMarkers.type === uroLayers.ID.UR) ||
  2014. (uroMarkers.type === uroLayers.ID.MP) ||
  2015. (uroMarkers.type === uroLayers.ID.PUR) ||
  2016. (uroMarkers.type === uroLayers.ID.PPUR) ||
  2017. (uroMarkers.type === uroLayers.ID.RPUR)
  2018. )
  2019. {
  2020. let mMarker = uroGetMarker(uroMarkers.type, uroMarkers.id);
  2021. if(mMarker !== null)
  2022. {
  2023. let mIcon = null;
  2024. if(mMarker.element !== undefined)
  2025. {
  2026. mIcon = mMarker.element;
  2027. }
  2028. else if(mMarker.geometry !== undefined)
  2029. {
  2030. mIcon = document.querySelector('#'+mMarker.geometry.id);
  2031. }
  2032. else if(mMarker.tagName === "image")
  2033. {
  2034. mIcon = mMarker;
  2035. }
  2036. if((mIcon !== null) && (mIcon !== undefined))
  2037. {
  2038. mIcon.addEventListener("mousedown", uroMarkers.MouseDown, false);
  2039. }
  2040. }
  2041. }
  2042. }
  2043. };
  2044. const uroLayers = // layer functions
  2045. {
  2046. // -----------------------------------------------------------------
  2047. // NOTE CAREFULLY!
  2048. // The contents of layers and ID MUST, MUST, MUST, remain
  2049. // in sync at all times...
  2050. layers :
  2051. [
  2052. {name: "update_requests", l: null, mf: null, MO: null, regEvt: true, getMF: true},
  2053. {name: "mapProblems", l: null, mf: null, MO: null, regEvt: true, getMF: true},
  2054. {name: "place_updates", l: null, mf: null, MO: null, regEvt: true, getMF: true},
  2055. {name: "PARKING_PLACE_UPDATES", l: null, mf: null, MO: null, regEvt: true, getMF: true},
  2056. {name: "RESIDENTIAL_PLACE_UPDATES", l: null, mf: null, MO: null, regEvt: true, getMF: true},
  2057. {name: "closures", l: null, mf: null, MO: null, regEvt: false, getMF: true},
  2058. {name: "nodes", l: null, mf: null, MO: null, regEvt: true, getMF: false},
  2059. {name: "segments", l: null, mf: null, MO: null, regEvt: true, getMF: false},
  2060. {name: "venues", l: null, mf: null, MO: null, regEvt: true, getMF: false},
  2061. {name: "mapComments", l: null, mf: null, MO: null, regEvt: true, getMF: false},
  2062. {name: "speed_cameras", l: null, mf: null, MO: null, regEvt: true, getMF: false},
  2063. {name: "closure_nodes", l: null, mf: null, MO: null, regEvt: false, getMF: false}
  2064. ],
  2065. ID :
  2066. {
  2067. UR: 0,
  2068. MP: 1,
  2069. PUR: 2,
  2070. PPUR: 3,
  2071. RPUR: 4,
  2072. RTC: 5,
  2073. node: 6,
  2074. seg: 7,
  2075. venue: 8,
  2076. MC: 9,
  2077. cam: 10,
  2078. RTCnode: 11
  2079. },
  2080. // -----------------------------------------------------------------
  2081.  
  2082. BlobMouseOut: function(e)
  2083. {
  2084. let blobType = this.attributes.uroBlobType;
  2085. if(blobType !== undefined)
  2086. {
  2087. let blobID = this.attributes.uroBlobID;
  2088. uroDBG.AddLog('hover off '+blobType+' ID '+blobID);
  2089. if(blobType == 'map_comment')
  2090. {
  2091. if(W.model.mapComments.objects[blobID] != undefined)
  2092. {
  2093. let geoID = W.model.mapComments.objects[blobID].attributes.geometry.id;
  2094. if(geoID.indexOf('Point') != -1)
  2095. {
  2096. // reapply visibility mods
  2097. let svgElm = document.getElementById(uroMCLayer.div.id+'_vroot');
  2098. for(let svgIdx = 0; svgIdx < svgElm.children.length; svgIdx++)
  2099. {
  2100. if(svgElm.children[svgIdx].id === geoID)
  2101. {
  2102. window.setTimeout(uroLayers.ReapplyPointMCVisibilityMods,10);
  2103. }
  2104. }
  2105. }
  2106. }
  2107. }
  2108. }
  2109. else
  2110. {
  2111. uroDBG.AddLog('hover off unknown blob...');
  2112. }
  2113. },
  2114. MCLayerChanged_changed: function()
  2115. {
  2116. uroLayers.MCLayerChanged();
  2117. },
  2118. MCLayerChanged_added: function()
  2119. {
  2120. uroLayers.MCLayerChanged();
  2121. },
  2122. MCLayerChanged_removed: function()
  2123. {
  2124. uroLayers.MCLayerChanged();
  2125. },
  2126. ReapplyPointMCVisibilityMods: function()
  2127. {
  2128. if(uroLayers.ApplyPointMCVisibilityMods() === false)
  2129. {
  2130. window.setTimeout(uroLayers.ReapplyPointMCVisibilityMods,100);
  2131. }
  2132. },
  2133. ApplyPointMCVisibilityMods: function()
  2134. {
  2135. let retval = true;
  2136. if(uroLayers.HasSelectedMCs() === true)
  2137. {
  2138. retval = false;
  2139. }
  2140. else
  2141. {
  2142. let svgElm = document.getElementById(uroMCLayer.div.id+'_vroot');
  2143. for(let svgIdx = 0; svgIdx < svgElm.children.length; svgIdx++)
  2144. {
  2145. let svgChild = svgElm.children[svgIdx];
  2146. if(svgChild.id.indexOf('Point') != -1)
  2147. {
  2148. if(uroUtils.GetCBChecked('_cbMCEnhancePointMCVisibility') === true)
  2149. {
  2150. if(svgChild.getAttribute('r') == 6)
  2151. {
  2152. svgChild.setAttribute('fill','#ffff00');
  2153. svgChild.setAttribute('fill-opacity',0.75);
  2154. svgChild.setAttribute('r',12);
  2155. svgChild.setAttribute('touchedByURO',true);
  2156. }
  2157. else if((svgChild.getAttribute('touchedByURO') === "true")&&(svgChild.getAttribute('fill') === '#ffff00'))
  2158. {
  2159. // do nothing...
  2160. }
  2161. else
  2162. {
  2163. retval = false;
  2164. break;
  2165. }
  2166. }
  2167. else
  2168. {
  2169. if((svgChild.getAttribute('touchedByURO') === "true")&&(svgChild.getAttribute('fill') === '#ffff00'))
  2170. {
  2171. svgChild.setAttribute('fill','#ffffff');
  2172. svgChild.setAttribute('fill-opacity',1);
  2173. svgChild.setAttribute('r',6);
  2174. svgChild.setAttribute('touchedByURO',false);
  2175. }
  2176. }
  2177. }
  2178. }
  2179. }
  2180. return retval;
  2181. },
  2182. HasSelectedMCs: function()
  2183. {
  2184. let retval = false;
  2185. for(let mcObj in W.model.mapComments.objects)
  2186. {
  2187. if(W.model.mapComments.objects[mcObj].isSelected() === true)
  2188. {
  2189. retval = true;
  2190. break;
  2191. }
  2192. }
  2193. return retval;
  2194. },
  2195. MCLayerChanged: function()
  2196. {
  2197. uroInit.WazeBits();
  2198. if(uroMCLayer != null)
  2199. {
  2200. if(uroLayers.HasSelectedMCs() === false)
  2201. {
  2202. uroDBG.AddLog('adding MC blob event handlers');
  2203. let mcModel = null;
  2204. for(let mObj=0; mObj<uroMCLayer.features.length; mObj++)
  2205. {
  2206. if(uroMCLayer.features[mObj]?.attributes?.wazeFeature?._wmeObject !== undefined)
  2207. {
  2208. mcModel = uroMCLayer.features[mObj].attributes.wazeFeature._wmeObject;
  2209. {
  2210. if(mcModel.selected !== true)
  2211. {
  2212. let mcBlobID = mcModel.attributes.geometry.id;
  2213. let mcID = mcModel.attributes.id;
  2214. let mcBlob = document.getElementById(mcBlobID);
  2215. if(mcBlob !== null)
  2216. {
  2217. mcBlob.addEventListener("mouseout", uroLayers.blobMouseOut, false);
  2218. mcBlob.attributes.uroBlobID = mcID;
  2219. mcBlob.attributes.uroBlobType = "map_comment";
  2220. uroDBG.AddLog('added handlers to MC '+mcID);
  2221. }
  2222. }
  2223. }
  2224. }
  2225. }
  2226. uroLayers.ApplyPointMCVisibilityMods();
  2227. }
  2228. else
  2229. {
  2230. uroDBG.AddLog('MC selected, handlers not added yet...');
  2231. }
  2232. uroFilterMapComments();
  2233. }
  2234. },
  2235. VenueLayerChanged: function()
  2236. {
  2237. uroDBG.AddLog('adding place blob event handlers');
  2238. for(let mObj=0; mObj<uroVenueLayer.features.length; mObj++)
  2239. {
  2240. // clicking on an area place now adds the polygon drag handles into the features[] array, so we need to test that
  2241. // the current array entry isn't referring to one of these handles before trying to access the attributes...
  2242. if(uroVenueLayer.features[mObj]?.attributes?.wazeFeature?._wmeObject !== undefined)
  2243. {
  2244. let mcBlobID = uroVenueLayer.features[mObj].attributes.wazeFeature._wmeObject.attributes.geometry.id;
  2245. let mcID = uroVenueLayer.features[mObj].attributes.wazeFeature._wmeObject.attributes.id;
  2246. let mcBlob = document.getElementById(mcBlobID);
  2247. if(mcBlob !== null)
  2248. {
  2249. mcBlob.addEventListener("mouseout", uroLayers.blobMouseOut, false);
  2250. mcBlob.attributes.uroBlobID = mcID;
  2251. mcBlob.attributes.uroBlobType = "place";
  2252. }
  2253. }
  2254. }
  2255. },
  2256. Observe_VenueLayer: function()
  2257. {
  2258. uroLayers.layers[uroLayers.ID.venue].MO.observe(uroVenueLayer.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2259. },
  2260. Observe_URLayer: function()
  2261. {
  2262. // As URs are now displayed as SVG image elements rather than HTML elements, and as WME likes to re-render them seemingly
  2263. // at random after they've been initially displayed, we hang the mutation observer off of the vectorRoot element, as this
  2264. // is the parent SVG element for the markers, and the MO therefore seems to trigger reliably on each change to that level
  2265. // of the SVG, including these random re-renders. It's obvious if these re-renders aren't being captured correctly, as it
  2266. // causes the comment count markers to randomly show up behind UR markers instead of always being in front of them...
  2267. uroLayers.layers[uroLayers.ID.UR].MO.observe(uroLayers.layers[uroLayers.ID.UR].l.renderer.vectorRoot,{childList: true, attributes : true, characterData : true, subtree: true});
  2268. },
  2269. URLayerChanged: function()
  2270. {
  2271. uroDBG.AddLog('UR layer change detected');
  2272. uroLayers.layers[uroLayers.ID.UR].MO.disconnect();
  2273. uroFilterURs();
  2274. uroLayers.Observe_URLayer();
  2275. },
  2276. PURLayerChanged: function()
  2277. {
  2278. uroDBG.AddLog('PUR layer change detected');
  2279. uroLayers.layers[uroLayers.ID.PUR].MO.disconnect();
  2280. uroFilterProblems();
  2281. uroLayers.Observe_PURLayer();
  2282. },
  2283. Observe_PURLayer: function()
  2284. {
  2285. uroLayers.layers[uroLayers.ID.PUR].MO.observe(uroLayers.layers[uroLayers.ID.PUR].l.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2286. },
  2287. PPURLayerChanged: function()
  2288. {
  2289. uroDBG.AddLog('PPUR layer change detected');
  2290. uroLayers.layers[uroLayers.ID.PPUR].MO.disconnect();
  2291. uroFilterProblems();
  2292. uroLayers.Observe_PPURLayer();
  2293. },
  2294. Observe_PPURLayer: function()
  2295. {
  2296. uroLayers.layers[uroLayers.ID.PPUR].MO.observe(uroLayers.layers[uroLayers.ID.PPUR].l.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2297. },
  2298. RPURLayerChanged: function()
  2299. {
  2300. uroDBG.AddLog('RPUR layer change detected');
  2301. uroLayers.layers[uroLayers.ID.RPUR].MO.disconnect();
  2302. uroFilterProblems();
  2303. uroLayers.Observe_RPURLayer();
  2304. },
  2305. Observe_RPURLayer: function()
  2306. {
  2307. uroLayers.layers[uroLayers.ID.RPUR].MO.observe(uroLayers.layers[uroLayers.ID.RPUR].l.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2308. },
  2309.  
  2310. RTCLayerChanged: function()
  2311. {
  2312. uroDBG.AddLog('reapplying closures filter');
  2313. uroLayers.layers[uroLayers.ID.RTC].MO.disconnect();
  2314. uroFilterRTCs();
  2315. uroLayers.Observe_RTCLayer();
  2316. },
  2317. Observe_RTCLayer: function()
  2318. {
  2319. uroLayers.layers[uroLayers.ID.RTC].MO.observe(uroLayers.layers[uroLayers.ID.RTC].l.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2320. },
  2321. RunChangeHandlers: function()
  2322. {
  2323. uroLayers.URLayerChanged();
  2324. uroLayers.PURLayerChanged();
  2325. uroLayers.PPURLayerChanged();
  2326. uroLayers.RPURLayerChanged();
  2327. uroLayers.VenueLayerChanged();
  2328. uroLayers.RTCLayerChanged();
  2329.  
  2330. uroLayers.MCLayerChanged();
  2331. },
  2332. InitialiseMOs: function()
  2333. {
  2334. uroLayers.layers[uroLayers.ID.UR].MO = new MutationObserver(uroLayers.URLayerChanged);
  2335. uroLayers.layers[uroLayers.ID.PUR].MO = new MutationObserver(uroLayers.PURLayerChanged);
  2336. uroLayers.layers[uroLayers.ID.PPUR].MO = new MutationObserver(uroLayers.PPURLayerChanged);
  2337. uroLayers.layers[uroLayers.ID.RPUR].MO = new MutationObserver(uroLayers.RPURLayerChanged);
  2338. uroLayers.layers[uroLayers.ID.venue].MO = new MutationObserver(uroLayers.VenueLayerChanged);
  2339. uroLayers.layers[uroLayers.ID.RTC].MO = new MutationObserver(uroLayers.RTCLayerChanged);
  2340. uroLayers.Observe_URLayer();
  2341. uroLayers.Observe_PURLayer();
  2342. uroLayers.Observe_PPURLayer();
  2343. uroLayers.Observe_RPURLayer();
  2344. uroLayers.Observe_VenueLayer();
  2345. uroLayers.Observe_RTCLayer();
  2346. },
  2347. GetMarkersOrFeatures: function(layerID)
  2348. {
  2349. let retval = null;
  2350. let findit = uroLayers.layers[layerID].l.features;
  2351. if(findit !== undefined)
  2352. {
  2353. retval = findit;
  2354. uroDBG.AddLog(uroLayers.layers[layerID].name + ' = features');
  2355. }
  2356. else
  2357. {
  2358. findit = uroLayers.layers[layerID].l.markers;
  2359. if(findit !== undefined)
  2360. {
  2361. retval = findit;
  2362. uroDBG.AddLog(uroLayers.layers[layerID].name + ' = markers');
  2363. }
  2364. }
  2365. if(retval === null)
  2366. {
  2367. uroDBG.AddLog(uroLayers.layers[layerID].name + ' = unknown :-/');
  2368. }
  2369. return retval;
  2370. },
  2371. Init: function()
  2372. {
  2373. for(let i = 0; i < uroLayers.layers.length; ++i)
  2374. {
  2375. uroLayers.layers[i].l = W.map.getLayerByUniqueName(uroLayers.layers[i].name);
  2376. if(uroLayers.layers[i].getMF === true)
  2377. {
  2378. uroLayers.layers[i].mf = uroLayers.GetMarkersOrFeatures(i);
  2379. }
  2380. }
  2381. }
  2382. };
  2383. const uroAlertBox = // alert box handling
  2384. {
  2385. stack: [],
  2386. tickAction: null,
  2387. crossAction: null,
  2388. inUse: false,
  2389. ABObj: function(headericon, title, content, hasCross, tickText, crossText, tickAction, crossAction)
  2390. {
  2391. this.headericon = headericon;
  2392. this.title = title;
  2393. this.content = content;
  2394. this.hasCross = hasCross;
  2395. this.tickText = tickText;
  2396. this.crossText = crossText;
  2397. this.tickAction = tickAction;
  2398. this.crossAction = crossAction;
  2399. },
  2400. Close: function()
  2401. {
  2402. document.getElementById('uroAlerts').childNodes[0].innerHTML = uroUtils.ModifyHTML('');
  2403. document.getElementById('uroAlerts').childNodes[1].innerHTML = uroUtils.ModifyHTML('');
  2404. document.getElementById('uroAlertTickBtnCaption').innerHTML = uroUtils.ModifyHTML('');
  2405. document.getElementById('uroAlertCrossBtnCaption').innerHTML = uroUtils.ModifyHTML('');
  2406. uroAlertBox.tickAction = null;
  2407. uroAlertBox.crossAction = null;
  2408. document.getElementById('uroAlerts').style.visibility = "hidden";
  2409. document.getElementById('uroAlertCrossBtn').style.visibility = "hidden";
  2410. uroAlertBox.inUse = false;
  2411. if(uroAlertBox.stack.length > 0)
  2412. {
  2413. uroAlertBox.BuildFromStack();
  2414. }
  2415. },
  2416. CloseWithTick: function()
  2417. {
  2418. if(typeof uroAlertBox.tickAction === 'function')
  2419. {
  2420. uroAlertBox.tickAction();
  2421. }
  2422. uroAlertBox.Close();
  2423. },
  2424. CloseWithCross: function()
  2425. {
  2426. if(typeof uroAlertBox.crossAction === 'function')
  2427. {
  2428. uroAlertBox.crossAction();
  2429. }
  2430. uroAlertBox.Close();
  2431. },
  2432. Show: function(headericon, title, content, hasCross, tickText, crossText, tickAction, crossAction)
  2433. {
  2434. uroAlertBox.stack.push(new uroAlertBox.ABObj(headericon, title, content, hasCross, tickText, crossText, tickAction, crossAction));
  2435. if(uroAlertBox.inUse === false)
  2436. {
  2437. uroAlertBox.BuildFromStack();
  2438. }
  2439. },
  2440. BuildFromStack: function()
  2441. {
  2442. uroAlertBox.inUse = true;
  2443. uroAlertBox.tickAction = null;
  2444. uroAlertBox.crossAction = null;
  2445. let titleContent = '<span style="font-size:14px;padding:2px;">';
  2446. titleContent += '<i class="fa '+uroAlertBox.stack[0].headericon+'"> </i>&nbsp;';
  2447. titleContent += uroAlertBox.stack[0].title;
  2448. titleContent += '</span>';
  2449. document.getElementById('uroAlerts').childNodes[0].innerHTML = uroUtils.ModifyHTML(titleContent);
  2450. document.getElementById('uroAlerts').childNodes[1].innerHTML = uroUtils.ModifyHTML(uroAlertBox.stack[0].content);
  2451. document.getElementById('uroAlertTickBtnCaption').innerHTML = uroUtils.ModifyHTML(uroAlertBox.stack[0].tickText);
  2452. if(uroAlertBox.stack[0].hasCross)
  2453. {
  2454. document.getElementById('uroAlertCrossBtnCaption').innerHTML = uroUtils.ModifyHTML(uroAlertBox.stack[0].crossText);
  2455. document.getElementById('uroAlertCrossBtn').style.visibility = "visible";
  2456. if(typeof uroAlertBox.stack[0].crossAction === "function")
  2457. {
  2458. uroAlertBox.crossAction = uroAlertBox.stack[0].crossAction;
  2459. }
  2460. }
  2461. else
  2462. {
  2463. document.getElementById('uroAlertCrossBtn').style.visibility = "hidden";
  2464. }
  2465. if(typeof uroAlertBox.stack[0].tickAction === "function")
  2466. {
  2467. uroAlertBox.tickAction = uroAlertBox.stack[0].tickAction;
  2468. }
  2469. document.getElementById('uroAlerts').style.visibility = "";
  2470. uroAlertBox.stack.shift();
  2471. }
  2472. };
  2473. const uroStartup = // startup messaging to users
  2474. {
  2475. ShowUpgradeNotes: function()
  2476. {
  2477. uroDBG.AddLog('let users know what\'s new in this release');
  2478.  
  2479. let releaseNotes = '';
  2480. releaseNotes += '<p>Thanks for installing URO+ '+uroRelease.version+' ('+uroRelease.date+')</p>';
  2481.  
  2482. let loop;
  2483. if(uroRelease.changes.length > 0)
  2484. {
  2485. releaseNotes += '<br>Changes since the last release:<br>';
  2486. releaseNotes += '<ul>';
  2487. for(loop=0; loop < uroRelease.changes.length; loop++)
  2488. {
  2489. releaseNotes += '<li>'+uroRelease.changes[loop];
  2490. }
  2491. releaseNotes += '</ul>';
  2492. }
  2493.  
  2494. uroAlertBox.Show('fa-info-circle', 'URO+ Release Notes', releaseNotes, false, "OK", "", null, null);
  2495. }
  2496. };
  2497. const uroConfig = // configuration handling
  2498. {
  2499. GatherSettings: function(container)
  2500. {
  2501. let options = '';
  2502. if(typeof(container) == 'string')
  2503. {
  2504. container = document.getElementById(container);
  2505. }
  2506. let urOptions = container.getElementsByTagName('input');
  2507. for (let optIdx=0;optIdx<urOptions.length;optIdx++)
  2508. {
  2509. // Don't save settings for any of the legacy input elements we've now hidden...
  2510. if(urOptions[optIdx].style.display != "none")
  2511. {
  2512. let id = urOptions[optIdx].id;
  2513. if((id.indexOf('_cb') === 0)||(id.indexOf('_text') === 0)||(id.indexOf('_input') === 0))
  2514. {
  2515. options += ':' + id;
  2516. if(urOptions[optIdx].type == 'checkbox') options += ',' + urOptions[optIdx].checked.toString();
  2517. else if((urOptions[optIdx].type == 'text')||(urOptions[optIdx].type == 'number')) options += ',' + urOptions[optIdx].value.toString();
  2518. }
  2519. }
  2520. }
  2521. return options;
  2522. },
  2523. GatherCamWatchList: function()
  2524. {
  2525. let liststr = '';
  2526. for(let loop=0;loop<uroOWL.CamWatchObjects.length;loop++)
  2527. {
  2528. let camObj = uroOWL.CamWatchObjects[loop];
  2529. if((camObj.fid != null) && (camObj.persistent === true))
  2530. {
  2531. if(loop > 0) liststr += ':';
  2532.  
  2533. liststr += camObj.fid+',';
  2534. liststr += camObj.watch.lon+',';
  2535. liststr += camObj.watch.lat+',';
  2536. liststr += camObj.watch.type+',';
  2537. liststr += camObj.watch.azymuth+',';
  2538. liststr += camObj.watch.speed+',';
  2539. liststr += camObj.groupID+',';
  2540. liststr += camObj.server;
  2541. }
  2542. }
  2543. return liststr;
  2544. },
  2545. GatherCWLGroups: function()
  2546. {
  2547. let liststr = '';
  2548. for(let loop=0;loop<uroOWL.CWLGroups.length;loop++)
  2549. {
  2550. let groupObj = uroOWL.CWLGroups[loop];
  2551. if(groupObj.groupID != -1)
  2552. {
  2553. if(loop > 0) liststr += ':';
  2554.  
  2555. liststr += groupObj.groupID+',';
  2556. liststr += groupObj.groupName+',';
  2557. liststr += groupObj.groupCollapsed;
  2558. }
  2559. }
  2560. return liststr;
  2561. },
  2562. GatherPlacesGroups: function()
  2563. {
  2564. let liststr = '';
  2565. for(let loop=0;loop<uroPlacesGroupsCollapsed.length;loop++)
  2566. {
  2567. if(loop > 0) liststr += ':';
  2568. liststr += uroPlacesGroupsCollapsed[loop];
  2569. }
  2570. return liststr;
  2571. },
  2572. GatherAFNs: function()
  2573. {
  2574. let liststr = '';
  2575. for(let loop=0; loop < uroAFN.friendlyNames.length; loop++)
  2576. {
  2577. let fnObj = uroAFN.friendlyNames[loop];
  2578. if(loop > 0) liststr += ':';
  2579.  
  2580. liststr += fnObj.fName+',';
  2581. liststr += fnObj.area+',';
  2582. liststr += fnObj.server;
  2583. }
  2584. return liststr;
  2585. },
  2586. SaveSettings: function()
  2587. {
  2588. if((uroInhibitSave) || (uroMTEMode === true) || (uroSettingsApplied === false))
  2589. {
  2590. uroDBG.AddLog('save inhibited');
  2591. return;
  2592. }
  2593.  
  2594. if (localStorage)
  2595. {
  2596. try
  2597. {
  2598. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  2599. {
  2600. localStorage[uroTabs.CtrlTabs[i][uroTabs.FIELDS.STORAGE]] = uroConfig.GatherSettings(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY]);
  2601. }
  2602.  
  2603. localStorage.UROverviewCamWatchList = uroConfig.GatherCamWatchList();
  2604. localStorage.UROverviewCWLGroups = uroConfig.GatherCWLGroups();
  2605. localStorage.UROverviewFriendlyAreaNames = uroConfig.GatherAFNs();
  2606. localStorage.UROverviewPlacesGroups = uroConfig.GatherPlacesGroups();
  2607.  
  2608. localStorage.UROverviewMasterEnable = uroUtils.GetCBChecked('_cbMasterEnable');
  2609. localStorage.UROverviewCurrentVersion = uroRelease.version;
  2610.  
  2611. uroDBG.AddLog('save complete');
  2612. }
  2613. catch(err)
  2614. {
  2615. uroDBG.AddLog('exception thrown during save - probably script reload whilst in MTE mode...');
  2616. }
  2617. }
  2618. else
  2619. {
  2620. uroDBG.AddLog('no localStorage, save blocked');
  2621. }
  2622. },
  2623. ApplySettings: function(settings)
  2624. {
  2625. uroSettingsApplied = true;
  2626. if(settings != undefined)
  2627. {
  2628. if(document.querySelector('#_cbMasterEnable') === null)
  2629. {
  2630. uroSettingsApplied = false;
  2631. }
  2632. else
  2633. {
  2634. let options = settings.split(':');
  2635. for(let optIdx=0;optIdx<options.length;optIdx++)
  2636. {
  2637. let fields = options[optIdx].split(',');
  2638. if(fields[0].indexOf('_cb') === 0)
  2639. {
  2640. if(document.getElementById(fields[0]) !== null)
  2641. {
  2642. uroUtils.SetCBChecked(fields[0], (fields[1] == 'true'));
  2643. }
  2644. }
  2645. else if((fields[0].indexOf('_input') === 0)||(fields[0].indexOf('_text') === 0))
  2646. {
  2647. if(document.getElementById(fields[0]) !== null) document.getElementById(fields[0]).value = fields[1];
  2648. }
  2649. }
  2650. }
  2651. }
  2652. },
  2653. ApplyCamWatchList: function()
  2654. {
  2655. let objects = localStorage.UROverviewCamWatchList.split(':');
  2656. uroOWL.CamWatchObjects = [];
  2657. if(objects.length > 0)
  2658. {
  2659. for(let objIdx=0;objIdx<objects.length;objIdx++)
  2660. {
  2661. let fields = objects[objIdx].split(',');
  2662. if(fields.length == 9)
  2663. {
  2664. // CWL entries with 9 fields include the validated property which is now redundant, so we need to strip this property before adding
  2665. // the camera to the object collection. Whilst WME no longer displays unapproved cameras, it's preferable at this stage to leave
  2666. // any watched unapproved cameras in the object collection, just in case any of them were approved (and will therefore still be
  2667. // present in WME) inbetween the last time the user ran URO and now. For those unapproved cameras which were still unapproved when
  2668. // 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
  2669. // remove them there as well.
  2670. uroOWL.CamWatchObjects.push(new uroOWL.CamWatchObj(true,fields[0],fields[1],fields[2],fields[3],fields[4],fields[5],fields[7],fields[8]));
  2671. }
  2672. else if(fields.length == 8)
  2673. {
  2674. uroOWL.CamWatchObjects.push(new uroOWL.CamWatchObj(true,fields[0],fields[1],fields[2],fields[3],fields[4],fields[5],fields[6],fields[7]));
  2675. }
  2676. }
  2677. }
  2678. },
  2679. ApplyCWLGroups: function()
  2680. {
  2681. let objects = localStorage.UROverviewCWLGroups.split(':');
  2682. uroOWL.CWLGroups = [];
  2683.  
  2684. if(objects.length === 0)
  2685. {
  2686. uroOWL.CWLGroups.push(new uroOWL.GroupObj(0,'No group',false));
  2687. }
  2688. else
  2689. {
  2690. for(let objIdx=0;objIdx<objects.length;objIdx++)
  2691. {
  2692. let fields = objects[objIdx].split(',');
  2693. if(fields.length < 2)
  2694. {
  2695. fields.push(false);
  2696. }
  2697. uroOWL.CWLGroups.push(new uroOWL.GroupObj(fields[0],fields[1],(fields[2] == 'true')));
  2698. }
  2699. }
  2700. },
  2701. TranslateLegacyMPTab: function()
  2702. {
  2703. let options = localStorage.UROverviewMPOptions.split(':');
  2704. for(let optIdx=0;optIdx<options.length;optIdx++)
  2705. {
  2706. let fields = options[optIdx].split(',');
  2707. if(fields[0].indexOf('_cb') === 0)
  2708. {
  2709. if(fields[0] == '_cbMPFilterParkingLotInputAsPoint') uroUtils.SetCBChecked('_cbMPFilter_T50', (fields[1] == 'true'));
  2710. if(fields[0] == '_cbMPMissingPLP_T70') uroUtils.SetCBChecked('_cbMPFilter_T70', (fields[1] == 'true'));
  2711. if(fields[0] == '_cbMPMissingPLP_T71') uroUtils.SetCBChecked('_cbMPFilter_T71', (fields[1] == 'true'));
  2712. if(fields[0] == '_cbMPFilterDrivingDirectionMismatch') uroUtils.SetCBChecked('_cbMPFilter_T101', (fields[1] == 'true'));
  2713. if(fields[0] == '_cbMPFilterMissingJunction') uroUtils.SetCBChecked('_cbMPFilter_T102', (fields[1] == 'true'));
  2714. if(fields[0] == '_cbMPFilterMissingRoad') uroUtils.SetCBChecked('_cbMPFilter_T103', (fields[1] == 'true'));
  2715. if(fields[0] == '_cbMPFilterCrossroadsJunctionMissing') uroUtils.SetCBChecked('_cbMPFilter_T104', (fields[1] == 'true'));
  2716. if(fields[0] == '_cbMPFilterRoadTypeMismatch') uroUtils.SetCBChecked('_cbMPFilter_T105', (fields[1] == 'true'));
  2717. if(fields[0] == '_cbMPFilterRestrictedTurn') uroUtils.SetCBChecked('_cbMPFilter_T106', (fields[1] == 'true'));
  2718. if(fields[0] == '_cbMPFilterTurnProblem') uroUtils.SetCBChecked('_cbMPFilter_T200', (fields[1] == 'true'));
  2719. if(fields[0] == '_cbMPFilterRoadClosureProblem') uroUtils.SetCBChecked('_cbMPFilter_T300', (fields[1] == 'true'));
  2720. }
  2721. }
  2722. },
  2723. TranslateLegacyZoom: function()
  2724. {
  2725. let tZoom = parseInt(document.getElementById("_inputFilterMinZoomLevel").value);
  2726. if(tZoom < 12)
  2727. {
  2728. tZoom += 12;
  2729. document.getElementById("_inputFilterMinZoomLevel").value = tZoom;
  2730. }
  2731. tZoom = parseInt(document.getElementById("_inputUnstackZoomLevel").value);
  2732. if(tZoom < 12)
  2733. {
  2734. tZoom += 12;
  2735. document.getElementById("_inputUnstackZoomLevel").value = tZoom;
  2736. }
  2737. },
  2738. LoadSettings: function()
  2739. {
  2740. let isNewInstall = true;
  2741. let isUpgradeInstall = true;
  2742.  
  2743. uroDBG.AddLog('loadSettings()');
  2744. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  2745. {
  2746. if (uroTabs.CtrlTabs[i][uroTabs.FIELDS.STORAGE] != null)
  2747. {
  2748. uroDBG.AddLog('recover '+uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABTITLE]+' tab settings');
  2749. uroConfig.ApplySettings(localStorage[uroTabs.CtrlTabs[i][uroTabs.FIELDS.STORAGE]]);
  2750. isNewInstall = false;
  2751. }
  2752. }
  2753. if (localStorage.UROverviewMPOptions != null)
  2754. {
  2755. uroConfig.TranslateLegacyMPTab();
  2756. }
  2757. if (localStorage.UROverviewMiscOptions != null)
  2758. {
  2759. uroConfig.TranslateLegacyZoom();
  2760. }
  2761.  
  2762. if(localStorage.UROverviewCWLGroups != null)
  2763. {
  2764. uroDBG.AddLog('recover CWL groups');
  2765. uroConfig.ApplyCWLGroups();
  2766. isNewInstall = false;
  2767. }
  2768. else
  2769. {
  2770. uroDBG.AddLog('set default CWL group');
  2771. uroOWL.CWLGroups.push(new uroOWL.GroupObj(0,'No group',false));
  2772. }
  2773.  
  2774. if(localStorage.UROverviewCamWatchList != null)
  2775. {
  2776. uroDBG.AddLog('recover camera watchlist');
  2777. uroConfig.ApplyCamWatchList();
  2778. uroOWL.GetCurrentCamWatchListObjects();
  2779. isNewInstall = false;
  2780. }
  2781. /*
  2782. if(localStorage.UROverviewSegWatchList != null)
  2783. {
  2784. uroDBG.AddLog('recover segment watchlist');
  2785. uroApplySegWatchList();
  2786. uroGetCurrentSegWatchListObjects();
  2787. isNewInstall = false;
  2788. }
  2789.  
  2790. if(localStorage.UROverviewPlaceWatchList != null)
  2791. {
  2792. uroDBG.AddLog('recover places watchlist');
  2793. uroApplyPlaceWatchList();
  2794. //uroGetCurrentPlaceWatchListObjects();
  2795. isNewInstall = false;
  2796. }
  2797.  
  2798. if(localStorage.UROverviewPlacesGroups != null)
  2799. {
  2800. uroDBG.AddLog('recover places groups');
  2801. uroApplyPlacesGroups();
  2802. isNewInstall = false;
  2803. }
  2804. */
  2805. if(localStorage.UROverviewCurrentVersion != null)
  2806. {
  2807. uroDBG.AddLog('comparing install versions');
  2808. if(localStorage.UROverviewCurrentVersion == uroRelease.version)
  2809. {
  2810. isUpgradeInstall = false;
  2811. }
  2812. }
  2813.  
  2814. if(localStorage.UROverviewFriendlyAreaNames != null)
  2815. {
  2816. uroDBG.AddLog('recover friendly area names');
  2817. uroAFN.ApplyNames();
  2818. isNewInstall = false;
  2819. }
  2820.  
  2821. if(localStorage.UROverviewMasterEnable != null)
  2822. {
  2823. uroDBG.AddLog('recover master enable state');
  2824. document.getElementById('_cbMasterEnable').checked = (localStorage.UROverviewMasterEnable == "true");
  2825. uroDBG.AddLog('enable checkbox state set...');
  2826. }
  2827.  
  2828. if((isNewInstall)||(isUpgradeInstall))
  2829. {
  2830. uroStartup.ShowUpgradeNotes();
  2831. }
  2832.  
  2833. uroInhibitSave = false;
  2834. },
  2835. DefaultSettings: function()
  2836. {
  2837. 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);
  2838. },
  2839. DefaultSettingsAction: function()
  2840. {
  2841. let defaultSettings = '';
  2842.  
  2843. defaultSettings += '[UROverviewCWLGroups][len=16]0,No group,false[END]';
  2844. defaultSettings += '[UROverviewCamWatchList][len=0][END]';
  2845. 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]';
  2846. defaultSettings += '[UROverviewCurrentVersion][len=5]3.146[END]';
  2847. defaultSettings += '[UROverviewFriendlyAreaNames][len=0][END]';
  2848. 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]';
  2849. 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]';
  2850. defaultSettings += '[UROverviewMasterEnable][len=4]true[END]';
  2851. 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]';
  2852. defaultSettings += '[UROverviewPlaceWatchList][len=0][END]';
  2853. defaultSettings += '[UROverviewPlacesGroups][len=65]false:false:false:false:false:false:false:false:false:false:false[END]';
  2854. 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]';
  2855. defaultSettings += '[UROverviewSegWatchList][len=0][END]';
  2856. 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]';
  2857.  
  2858. document.getElementById('_txtSettings').value = defaultSettings;
  2859. uroConfig.TextToSettings();
  2860. document.getElementById('_txtSettings').value = '';
  2861. },
  2862. SettingsToText: function()
  2863. {
  2864. let txtSettings = '';
  2865.  
  2866. uroConfig.SaveSettings();
  2867.  
  2868. for(let lsEntry in localStorage)
  2869. {
  2870. if(lsEntry.indexOf('UROverview') === 0)
  2871. {
  2872. txtSettings += '['+lsEntry+'][len=' + localStorage[lsEntry].length + ']' + localStorage[lsEntry] + '[END]\n';
  2873. }
  2874. }
  2875.  
  2876. document.getElementById('_txtSettings').value = txtSettings;
  2877. document.getElementById('_txtSettings').focus();
  2878. document.getElementById('_txtSettings').select();
  2879. },
  2880. TextToSettings: function()
  2881. {
  2882. let txtSettings = '';
  2883. txtSettings = uroUtils.GetElmValue('_txtSettings');
  2884. if(txtSettings.indexOf('[END]') == -1) return;
  2885.  
  2886. let subText = txtSettings.split('[END]');
  2887. for(let i=0;i<subText.length;i++)
  2888. {
  2889. let aPos = subText[i].indexOf('[');
  2890. let bPos = subText[i].indexOf(']');
  2891. if((aPos != -1) && (bPos != -1))
  2892. {
  2893. let settingID = subText[i].substr(aPos+1,bPos-1-aPos);
  2894. subText[i] = subText[i].substr(bPos+1);
  2895. bPos = subText[i].indexOf(']');
  2896. if(bPos != -1)
  2897. {
  2898. let settingLength = subText[i].substr(5,bPos-5);
  2899. subText[i] = subText[i].substr(bPos+1);
  2900. if(subText[i].length == settingLength)
  2901. {
  2902. localStorage[settingID] = subText[i];
  2903. }
  2904. }
  2905. }
  2906. }
  2907. uroConfig.LoadSettings();
  2908. },
  2909. ClearSettingsText: function()
  2910. {
  2911. document.getElementById('_txtSettings').value = '';
  2912. }
  2913. };
  2914. const uroRTCClone = // RTC cloning
  2915. {
  2916. ConfirmDelete : true,
  2917. ToDelete : 0,
  2918. Reason : null,
  2919. Event : null,
  2920. Direction : null,
  2921. StartDate : null,
  2922. StartTime : null,
  2923. EndDate : null,
  2924. EndTime : null,
  2925. IgnoreTraffic : null,
  2926. ClosedNodes : null,
  2927. PendingClone : -1,
  2928. PendingCloneIncrement : 0,
  2929.  
  2930. Complete: function()
  2931. {
  2932. let loop;
  2933. if(document.getElementsByClassName('edit-closure').length === 0)
  2934. {
  2935. window.setTimeout(uroRTCClone.Complete,100);
  2936. return;
  2937. }
  2938.  
  2939. if(uroTempFixMTEDropDown() == false)
  2940. {
  2941. window.setTimeout(uroRTCClone.Complete,100);
  2942. return;
  2943. }
  2944.  
  2945. // need to generate a change event on each of the form fields, because WME appears to be silently populating some hidden
  2946. // closure object with the details as they're entered manually, and if we just set the form values without then forcing
  2947. // the change event as well then WME will end up using its default values instead of the ones we've so lovingly copied...
  2948. let form = $('#edit-panel .closures .edit-closure form');
  2949.  
  2950. if(uroRTCClone.Reason !== null)
  2951. {
  2952. let fObj = form.find('wz-text-input#closure_reason');
  2953. fObj.val(uroRTCClone.Reason);
  2954. fObj.change();
  2955. }
  2956. if(uroRTCClone.Direction !== null)
  2957. {
  2958. let fObj = form.find('wz-select#closure_direction');
  2959. fObj[0].value = uroRTCClone.Direction;
  2960. fObj.change();
  2961. }
  2962. if(uroRTCClone.StartDate !== null)
  2963. {
  2964. let fObj = form.find('input#closure_startDate');
  2965. fObj.val(uroRTCClone.StartDate);
  2966. fObj.change();
  2967. }
  2968. if(uroRTCClone.StartTime !== null)
  2969. {
  2970. let fObj = form.find('div.form-group.start-date-form-group input.time-picker-input');
  2971. fObj.focus();
  2972. fObj.val(uroRTCClone.StartTime);
  2973. fObj.change();
  2974. }
  2975.  
  2976. if(uroRTCClone.IgnoreTraffic !== null)
  2977. {
  2978. let fObj = form.find('wz-checkbox#closure_permanent');
  2979. fObj.val(uroRTCClone.IgnoreTraffic);
  2980. fObj.change();
  2981. }
  2982. if(uroRTCClone.EndTime !== null)
  2983. {
  2984. let fObj = form.find('div.form-group.end-date-form-group input.time-picker-input');
  2985. fObj.focus();
  2986. fObj.val(uroRTCClone.EndTime);
  2987. fObj.change();
  2988. }
  2989.  
  2990. // the current version of WME wipes any existing end date as soon as the end time is altered, so we now need
  2991. // to set the date after the time instead of before as in earlier versions of this function...
  2992. if(uroRTCClone.EndDate !== null)
  2993. {
  2994. let fObj = form.find('input#closure_endDate');
  2995. fObj.val(uroRTCClone.EndDate);
  2996. fObj.change();
  2997. }
  2998.  
  2999. // the old method of setting the MTE just by changing the value attribute on closure_eventId no longer
  3000. // seems to work as expected (it runs OK from the dev console, but not within the scope of the userscript),
  3001. // so just as we do for setting the event to None, we set the event to the desired value here by finding
  3002. // the appropriate menu entry and clicking on it...
  3003. let cEvents = document.getElementById('closure_eventId').getElementsByTagName('wz-option');
  3004. for(let i of cEvents)
  3005. {
  3006. if(i.value == uroRTCClone.Event)
  3007. {
  3008. i.click();
  3009. break;
  3010. }
  3011. }
  3012.  
  3013. let nNodes = uroRTCClone.ClosedNodes.length;
  3014. if(nNodes > 0)
  3015. {
  3016. let fObj = form.find('wz-toggle-switch');
  3017. for(loop = 0; loop < nNodes; ++loop)
  3018. {
  3019. if(uroRTCClone.ClosedNodes[loop] === true)
  3020. {
  3021. fObj[loop].click();
  3022. }
  3023. }
  3024. }
  3025. if(uroUtils.GetCBChecked('_cbAutoApplyClonedClosure') == true)
  3026. {
  3027. window.setTimeout(uroRTCClone.ClickSave,100);
  3028. }
  3029.  
  3030. uroRTCClone.PendingClone = -1;
  3031. },
  3032. ClickSave: function()
  3033. {
  3034. document.getElementsByClassName('closures')[0].getElementsByClassName('save-button')[0].click();
  3035. },
  3036. Copy: function(closureOffset)
  3037. {
  3038. // grab the current closure details from the UI...
  3039. uroRTCClone.Reason = uroGetShadowElementProperty('closure_reason', 'input', 'value');
  3040. uroRTCClone.Direction = uroGetElementProperty('closure_direction', 0, 'value');
  3041. uroRTCClone.StartDate = uroGetElementProperty('closure_startDate', 0, 'value');
  3042. uroRTCClone.StartTime = document.querySelector('.start-date-form-group').querySelector('.time-picker-input').value;
  3043. uroRTCClone.EndDate = uroGetElementProperty('closure_endDate', 0, 'value');
  3044. uroRTCClone.EndTime = document.querySelector('.end-date-form-group').querySelector('.time-picker-input').value;
  3045. uroRTCClone.Event = uroGetElementProperty('closure_eventId', 0, 'value');
  3046. uroRTCClone.IgnoreTraffic = uroGetElementProperty('closure_permanent', 0, 'checked');
  3047. uroRTCClone.ClosedNodes = [];
  3048. let nNodes = document.getElementsByClassName('fromNodeClosed').length;
  3049. if(nNodes > 0)
  3050. {
  3051. for(let loop = 0; loop < nNodes; ++loop)
  3052. {
  3053. uroRTCClone.ClosedNodes.push(document.getElementsByClassName('fromNodeClosed')[loop].checked);
  3054. }
  3055. }
  3056.  
  3057. document.getElementsByClassName('closures')[0].getElementsByClassName('cancel-button')[0].click();
  3058.  
  3059. // auto-increment the start and end dates
  3060. uroRTCClone.StartDate = uroIncrementClosureDate(uroRTCClone.StartDate,uroRTCClone.PendingCloneIncrement);
  3061. uroRTCClone.EndDate = uroIncrementClosureDate(uroRTCClone.EndDate,uroRTCClone.PendingCloneIncrement);
  3062.  
  3063. uroRTCClone.PendingClone = -2;
  3064. },
  3065. Clone: function()
  3066. {
  3067. uroRTCClone.PendingCloneIncrement = parseInt(this.id.split('-')[1]);
  3068. uroRTCClone.PendingClone = parseInt(this.id.split('-')[2]);
  3069. },
  3070. DeleteNextOnList: function()
  3071. {
  3072. let nClosures = document.querySelectorAll('.closure-item.is-editable').length;
  3073. if(nClosures > 0)
  3074. {
  3075. if (nClosures != uroRTCClone.ToDelete)
  3076. {
  3077. uroRTCClone.ToDelete = nClosures;
  3078. let ctObj = document.querySelector('.closure-item.is-editable');
  3079. let deleteMenuEntry = ctObj.querySelector('wz-menu-item.delete');
  3080. if(deleteMenuEntry !== null)
  3081. {
  3082. deleteMenuEntry.click();
  3083. }
  3084. }
  3085. window.setTimeout(uroRTCClone.DeleteNextOnList,100);
  3086. }
  3087. else
  3088. {
  3089. uroRTCClone.ConfirmDelete = true;
  3090. }
  3091. },
  3092. DeleteAll: function()
  3093. {
  3094. uroRTCClone.ConfirmDelete = true;
  3095. 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);
  3096. },
  3097. DeleteAllAction: function()
  3098. {
  3099. uroRTCClone.ConfirmDelete = false;
  3100. let nClosures = document.getElementsByClassName('closure-item').length;
  3101. if(nClosures > 0)
  3102. {
  3103. uroRTCClone.ToDelete = -1;
  3104. uroRTCClone.DeleteNextOnList();
  3105. }
  3106. else
  3107. {
  3108. uroRTCClone.ConfirmDelete = true;
  3109. }
  3110. }
  3111. };
  3112. const uroOWL = /// camera watchlist
  3113. {
  3114. CWLGroups : [],
  3115. CamWatchObjects : [],
  3116.  
  3117. GroupObj: function(groupID, groupName, groupCollapsed)
  3118. {
  3119. groupID = uroUtils.TypeCast(groupID);
  3120. this.groupID = groupID;
  3121. this.groupName = groupName;
  3122. this.groupCount = 0;
  3123. this.groupCollapsed = groupCollapsed;
  3124. },
  3125. CamWatchObjCheckProps: function(type, azymuth, speed, lat, lon)
  3126. {
  3127. if(type !== null) type = uroUtils.TypeCast(type);
  3128. if(azymuth !== null) azymuth = uroUtils.Truncate(uroUtils.TypeCast(azymuth)%360);
  3129. if(speed !== null) speed = uroUtils.Truncate(uroUtils.TypeCast(speed));
  3130. if(lat !== null) lat = uroUtils.Truncate(uroUtils.TypeCast(lat));
  3131. if(lon !== null) lon = uroUtils.Truncate(uroUtils.TypeCast(lon));
  3132.  
  3133. this.type = type;
  3134. this.azymuth = azymuth;
  3135. this.speed = speed;
  3136. this.lat = lat;
  3137. this.lon = lon;
  3138. },
  3139. CamWatchObj: function(persistent, fid, lon, lat, type, azymuth, speed, groupID, server)
  3140. {
  3141. fid = uroUtils.TypeCast(fid);
  3142. groupID = uroUtils.TypeCast(groupID);
  3143. if(typeof persistent == "string") persistent = (persistent == "true");
  3144. if(server === "undefined") server = "??";
  3145.  
  3146. this.fid = fid;
  3147. this.persistent = persistent;
  3148. this.loaded = false;
  3149. this.server = server;
  3150. this.groupID = groupID;
  3151. this.watch = new uroOWL.CamWatchObjCheckProps(type, azymuth, speed, lat, lon);
  3152. this.current = new uroOWL.CamWatchObjCheckProps(null, null, null, null, null);
  3153. },
  3154. CamDataChanged: function(idx)
  3155. {
  3156. let camObj = uroOWL.CamWatchObjects[idx];
  3157. if(camObj.loaded === false) return false;
  3158. if(camObj.current.type != camObj.watch.type) return true;
  3159. if(camObj.current.azymuth != camObj.watch.azymuth) return true;
  3160. if(camObj.current.speed != camObj.watch.speed) return true;
  3161. if(camObj.current.lat != camObj.watch.lat) return true;
  3162. if(camObj.current.lon != camObj.watch.lon) return true;
  3163. return false;
  3164. },
  3165. FindCWLGroupByIdx: function(groupIdx)
  3166. {
  3167. let groupName = '';
  3168. for(let loop=0;loop<uroOWL.CWLGroups.length;loop++)
  3169. {
  3170. if(uroOWL.CWLGroups[loop].groupID == groupIdx)
  3171. {
  3172. groupName = uroOWL.CWLGroups[loop].groupName;
  3173. break;
  3174. }
  3175. }
  3176. return groupName;
  3177. },
  3178. IsCamOnWatchList: function(fid)
  3179. {
  3180. for(let loop=0;loop<uroOWL.CamWatchObjects.length;loop++)
  3181. {
  3182. if(uroOWL.CamWatchObjects[loop].fid == fid) return loop;
  3183. }
  3184. return -1;
  3185. },
  3186. AddCurrentCamWatchData: function(idx, lat, lon, type, azymuth, speed, server)
  3187. {
  3188. let camObj = uroOWL.CamWatchObjects[idx];
  3189. camObj.loaded = true;
  3190. camObj.server = server;
  3191. camObj.current = new uroOWL.CamWatchObjCheckProps(type, azymuth, speed, lat, lon);
  3192. return(uroOWL.CamDataChanged(idx));
  3193. },
  3194. AddCamToWatchList: function()
  3195. {
  3196. if(uroOWL.IsCamOnWatchList(uroShownFID) == -1)
  3197. {
  3198. let camObj = W.model.cameras.objects[uroShownFID];
  3199. 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()));
  3200. uroOWL.AddCurrentCamWatchData(uroOWL.CamWatchObjects.length-1, camObj.geometry.y, camObj.geometry.x, camObj.attributes.type, camObj.attributes.azymuth, camObj.attributes.speed, W.app.getAppRegionCode());
  3201. uroDBG.AddLog('added camera '+uroShownFID+' to watchlist');
  3202. uroTabs.PopulateOWL();
  3203. }
  3204. },
  3205. RemoveCamFromWatchList: function()
  3206. {
  3207. let camidx = uroOWL.IsCamOnWatchList(uroShownFID);
  3208. if(camidx != -1)
  3209. {
  3210. uroOWL.CamWatchObjects.splice(camidx,1);
  3211. uroDBG.AddLog('removed camera '+uroShownFID+' from watchlist');
  3212. uroTabs.PopulateOWL();
  3213. }
  3214. },
  3215. UpdateCamWatchList: function()
  3216. {
  3217. let camIdx = uroOWL.IsCamOnWatchList(uroShownFID);
  3218. if(camIdx != -1)
  3219. {
  3220. let camObj = W.model.cameras.objects[uroShownFID];
  3221. uroOWL.CamWatchObjects[camIdx].watch = new uroOWL.CamWatchObjCheckProps(camObj.attributes.type, camObj.attributes.azymuth, camObj.attributes.speed, camObj.geometry.y, camObj.geometry.x);
  3222. }
  3223. },
  3224. ClearCamWatchList: function()
  3225. {
  3226. 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);
  3227. },
  3228. ClearCamWatchListAction: function()
  3229. {
  3230. uroOWL.CamWatchObjects = [];
  3231. uroTabs.PopulateOWL();
  3232. },
  3233. RetrieveCameras: function(lat, lon)
  3234. {
  3235. let camPos = new OpenLayers.LonLat();
  3236. let camChanged = false;
  3237.  
  3238. camPos.lon = lon;
  3239. camPos.lat = lat;
  3240. camPos = uroUtils.ConvertMercatorToWGS84(camPos);
  3241.  
  3242. let camURL = 'https://' + document.location.host;
  3243. camURL += W.Config.api_base;
  3244. camURL += '/Features?language=en&cameras=true&bbox=';
  3245. let latl = camPos.lat - 0.25;
  3246. let latu = camPos.lat + 0.25;
  3247. let lonl = camPos.lon - 0.25;
  3248. let lonr = camPos.lon + 0.25;
  3249. camURL += lonl+','+latl+','+lonr+','+latu;
  3250. uroDBG.AddLog('retrieving camera data around '+camPos.lon+','+camPos.lat);
  3251.  
  3252. let camReq = new XMLHttpRequest();
  3253. camReq.open('GET',camURL,false);
  3254. try
  3255. {
  3256. camReq.send();
  3257. uroDBG.AddLog('response '+camReq.status+' received for camera data request');
  3258. if (camReq.status === 200)
  3259. {
  3260. let camData = JSON.parse(camReq.responseText);
  3261. for(let camIdx = 0; camIdx < camData.cameras.objects.length; camIdx++)
  3262. {
  3263. let camObj = camData.cameras.objects[camIdx];
  3264. let listIdx = uroOWL.IsCamOnWatchList(camObj.id);
  3265. if(listIdx != -1)
  3266. {
  3267. camPos.lon = camObj.geometry.coordinates[0];
  3268. camPos.lat = camObj.geometry.coordinates[1];
  3269. camPos = uroUtils.ConvertWGS84ToMercator(camPos);
  3270. camPos.lon = uroUtils.Truncate(camPos.lon);
  3271. camPos.lat = uroUtils.Truncate(camPos.lat);
  3272. camChanged = (uroOWL.AddCurrentCamWatchData(listIdx, camPos.lat, camPos.lon, camObj.type, camObj.azymuth, camObj.speed, W.app.getAppRegionCode()) || camChanged);
  3273. }
  3274. }
  3275. }
  3276. else
  3277. {
  3278. uroDBG.AddLog('camera data request failed (status != 200)');
  3279. }
  3280. }
  3281. catch(err)
  3282. {
  3283. uroDBG.AddLog('camera data request failed (exception '+err+' caught)');
  3284. }
  3285. return camChanged;
  3286. },
  3287. GetCurrentCamWatchListObjects: function()
  3288. {
  3289. let camChanged = false;
  3290. let camsChanged = [];
  3291. let camsDeleted = [];
  3292. let camidx;
  3293. let camObj;
  3294. for(camidx=0;camidx<uroOWL.CamWatchObjects.length;camidx++)
  3295. {
  3296. camObj = uroOWL.CamWatchObjects[camidx];
  3297. if((camObj.loaded === false) && ((camObj.server == W.app.getAppRegionCode()) || (camObj.server == '??')))
  3298. {
  3299. if(typeof W.model.cameras.objects[camObj.fid] == 'object')
  3300. {
  3301. if(W.model.cameras.objects[camObj.fid].state != "Delete")
  3302. {
  3303. let wazeObj = W.model.cameras.objects[camObj.fid];
  3304. camChanged = (uroOWL.AddCurrentCamWatchData(camidx, wazeObj.geometry.y, wazeObj.geometry.x, wazeObj.attributes.type, wazeObj.attributes.azymuth, wazeObj.attributes.speed, W.app.getAppRegionCode()) || camChanged);
  3305. }
  3306. else
  3307. {
  3308. camChanged = (uroOWL.RetrieveCameras(camObj.watch.lat, camObj.watch.lon) || camChanged);
  3309. }
  3310. }
  3311. else
  3312. {
  3313. camChanged = (uroOWL.RetrieveCameras(camObj.watch.lat, camObj.watch.lon) || camChanged);
  3314. }
  3315. }
  3316. }
  3317.  
  3318. if(camChanged)
  3319. {
  3320. for(camidx=0;camidx<uroOWL.CamWatchObjects.length;camidx++)
  3321. {
  3322. if(uroOWL.CamDataChanged(camidx))
  3323. {
  3324. camsChanged.push(uroOWL.CamWatchObjects[camidx]);
  3325. }
  3326. }
  3327. }
  3328.  
  3329. for(camidx=0;camidx<uroOWL.CamWatchObjects.length;camidx++)
  3330. {
  3331. camObj = uroOWL.CamWatchObjects[camidx];
  3332. if((camObj.loaded === false) && (camObj.server == W.app.getAppRegionCode()))
  3333. {
  3334. camsDeleted.push(camObj);
  3335. }
  3336. }
  3337. if((camsChanged.length > 0) || (camsDeleted.length > 0))
  3338. {
  3339. let alertStr = '';
  3340. for(camidx=0;camidx<camsChanged.length;camidx++)
  3341. {
  3342. alertStr += 'Camera ID '+camsChanged[camidx].fid+' in group "'+uroOWL.FindCWLGroupByIdx(camsChanged[camidx].groupID)+'" has been changed<br>';
  3343. }
  3344. alertStr += '<br>';
  3345. for(camidx=0;camidx<camsDeleted.length;camidx++)
  3346. {
  3347. alertStr += 'Camera ID '+camsDeleted[camidx].fid+' in group "'+uroOWL.FindCWLGroupByIdx(camsDeleted[camidx].groupID)+'" has been deleted<br>';
  3348. }
  3349. uroAlertBox.Show("fa-info-circle", "URO+ Camera Watchlist Alert", alertStr, false, "OK", null, null, null);
  3350. }
  3351. },
  3352. ClearDeletedCameras: function()
  3353. {
  3354. for(let camidx=uroOWL.CamWatchObjects.length-1;camidx>=0;camidx--)
  3355. {
  3356. if(uroOWL.CamWatchObjects[camidx].loaded === false)
  3357. {
  3358. uroShownFID = uroOWL.CamWatchObjects[camidx].fid;
  3359. uroOWL.RemoveCamFromWatchList();
  3360. }
  3361. }
  3362. },
  3363. AcceptCameraChanges: function()
  3364. {
  3365. for(let camidx=0; camidx < uroOWL.CamWatchObjects.length; camidx++)
  3366. {
  3367. if(uroOWL.CamDataChanged(camidx))
  3368. {
  3369. uroOWL.CamWatchObjects[camidx].watch.type = uroOWL.CamWatchObjects[camidx].current.type;
  3370. uroOWL.CamWatchObjects[camidx].watch.azymuth = uroOWL.CamWatchObjects[camidx].current.azymuth;
  3371. uroOWL.CamWatchObjects[camidx].watch.speed = uroOWL.CamWatchObjects[camidx].current.speed;
  3372. uroOWL.CamWatchObjects[camidx].watch.lat = uroOWL.CamWatchObjects[camidx].current.lat;
  3373. uroOWL.CamWatchObjects[camidx].watch.lon = uroOWL.CamWatchObjects[camidx].current.lon;
  3374. }
  3375. }
  3376. uroTabs.PopulateOWL();
  3377. },
  3378. ClearUnknownServerCameras: function()
  3379. {
  3380. let confirmMsg = '<p>Cameras with an unknown server <i>cannot</i> be automatically verified by URO+</p>';
  3381. 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>';
  3382. confirmMsg += 'If the cameras then continue to show up as an unknown server, it is safe to delete them...<br><br>';
  3383. confirmMsg += 'Do you still wish to proceed with deleting all unknown server cameras?';
  3384.  
  3385. uroAlertBox.Show("fa-warning", "URO+ Warning", confirmMsg, true, "Delete unknown cameras", "Keep unknown cameras", uroOWL.ClearUnknownServerCamerasAction, null);
  3386. },
  3387. ClearUnknownServerCamerasAction: function()
  3388. {
  3389. for(let camidx=uroOWL.CamWatchObjects.length-1;camidx>=0;camidx--)
  3390. {
  3391. if(uroOWL.CamWatchObjects[camidx].server == '??')
  3392. {
  3393. uroShownFID = uroOWL.CamWatchObjects[camidx].fid;
  3394. uroOWL.RemoveCamFromWatchList();
  3395. }
  3396. }
  3397. },
  3398. RescanCamWatchList: function()
  3399. {
  3400. for(let camidx=0;camidx<uroOWL.CamWatchObjects.length;camidx++)
  3401. {
  3402. uroOWL.CamWatchObjects[camidx].loaded = false;
  3403. }
  3404. uroOWL.GetCurrentCamWatchListObjects();
  3405. uroTabs.PopulateOWL();
  3406. },
  3407. GotoCam: function()
  3408. {
  3409. let camidx = this.id.substr(13);
  3410. let camPos = new OpenLayers.LonLat();
  3411. camPos.lon = uroOWL.CamWatchObjects[camidx].watch.lon;
  3412. camPos.lat = uroOWL.CamWatchObjects[camidx].watch.lat;
  3413. W.map.setCenter(camPos,16);
  3414. W.map.camerasLayer.setVisibility(true);
  3415. return false;
  3416. },
  3417. HighlightCWLEntry: function()
  3418. {
  3419. this.style.backgroundColor = '#FFFFAA';
  3420. return false;
  3421. },
  3422. UnhighlightCWLEntry: function()
  3423. {
  3424. let camidx = this.id.substr(8);
  3425. let changed = uroOWL.CamDataChanged(camidx);
  3426. let deleted = (uroOWL.CamWatchObjects[camidx].loaded === false);
  3427.  
  3428. if(uroOWL.CamWatchObjects[camidx].server != W.app.getAppRegionCode())
  3429. {
  3430. if(uroOWL.CamWatchObjects[camidx].server == '??') this.style.backgroundColor = '#A0A0A0';
  3431. else this.style.backgroundColor = '#AAFFAA';
  3432. }
  3433. else if(changed) this.style.backgroundColor = '#AAAAFF';
  3434. else if(deleted) this.style.backgroundColor = '#FFAAAA';
  3435. else this.style.backgroundColor = '#FFFFFF';
  3436. return false;
  3437. },
  3438. CWLIconHighlight: function()
  3439. {
  3440. this.style.color="#0000ff";
  3441. return false;
  3442. },
  3443. CWLIconLowlight: function()
  3444. {
  3445. this.style.color="#ccccff";
  3446. return false;
  3447. },
  3448. PopulateCWLGroupSelect: function()
  3449. {
  3450. let selector = document.getElementById('_uroCWLGroupSelect');
  3451. while(selector.options.length > 0)
  3452. {
  3453. selector.options.remove(0);
  3454. }
  3455. for(let loop=0;loop<uroOWL.CWLGroups.length;loop++)
  3456. {
  3457. let groupObj = uroOWL.CWLGroups[loop];
  3458. if(groupObj.groupID != -1)
  3459. {
  3460. selector.options.add(new Option(groupObj.groupName,groupObj.groupID));
  3461. }
  3462. }
  3463. },
  3464. GetNextCWLGroupID: function()
  3465. {
  3466. let nextID = 1;
  3467. for(let loop=0;loop<uroOWL.CWLGroups.length;loop++)
  3468. {
  3469. if(uroOWL.CWLGroups[loop].groupID >= nextID)
  3470. {
  3471. nextID = uroOWL.CWLGroups[loop].groupID + 1;
  3472. }
  3473. }
  3474. return nextID;
  3475. },
  3476. FindCWLGroupByName: function(groupName)
  3477. {
  3478. let groupID = -1;
  3479. for(let loop=0;loop<uroOWL.CWLGroups.length;loop++)
  3480. {
  3481. if((uroOWL.CWLGroups[loop].groupName == groupName) && (uroOWL.CWLGroups[loop].groupID != -1))
  3482. {
  3483. groupID = uroOWL.CWLGroups[loop].groupID;
  3484. break;
  3485. }
  3486. }
  3487. return groupID;
  3488. },
  3489. AddCWLGroup: function()
  3490. {
  3491. let groupID = uroOWL.GetNextCWLGroupID();
  3492. let groupName = uroUtils.GetElmValue('_uroCWLGroupEntry');
  3493. if(uroOWL.FindCWLGroupByName(groupName) == -1)
  3494. {
  3495. uroOWL.CWLGroups.push(new uroOWL.GroupObj(groupID,groupName,false));
  3496. uroOWL.PopulateCWLGroupSelect();
  3497. }
  3498. },
  3499. RemoveCWLGroup: function()
  3500. {
  3501. let loop;
  3502. let selector = document.getElementById('_uroCWLGroupSelect');
  3503. let groupID = parseInt(selector.selectedOptions[0].value);
  3504. if(groupID === 0) return false; // prevent deletion of the default group
  3505.  
  3506. for(loop=0;loop<uroOWL.CamWatchObjects.length;loop++)
  3507. {
  3508. let cwObj = uroOWL.CamWatchObjects[loop];
  3509. if(cwObj.groupID == groupID)
  3510. {
  3511. cwObj.groupID = 0;
  3512. }
  3513. }
  3514. for(loop=0;loop<uroOWL.CWLGroups.length;loop++)
  3515. {
  3516. let groupObj = uroOWL.CWLGroups[loop];
  3517. if(groupObj.groupID == groupID)
  3518. {
  3519. groupObj.groupID = -1;
  3520. }
  3521. }
  3522. uroTabs.PopulateOWL();
  3523. },
  3524. AssignCameraToGroup: function()
  3525. {
  3526. let camidx = this.id.substr(13);
  3527. let selector = document.getElementById('_uroCWLGroupSelect');
  3528. uroOWL.CamWatchObjects[camidx].groupID = parseInt(selector.selectedOptions[0].value);
  3529. uroTabs.PopulateOWL();
  3530. return false;
  3531. },
  3532. CWLGroupCollapseExpand: function()
  3533. {
  3534. let groupidx = this.id.substr(18);
  3535. if(uroOWL.CWLGroups[groupidx].groupCollapsed === true) uroOWL.CWLGroups[groupidx].groupCollapsed = false;
  3536. else uroOWL.CWLGroups[groupidx].groupCollapsed = true;
  3537. uroTabs.PopulateOWL();
  3538. return false;
  3539. }
  3540. };
  3541. const uroIgnore = // ignore list
  3542. {
  3543. IsOnList: function(fid)
  3544. {
  3545. if(sessionStorage.UROverview_FID_IgnoreList.indexOf('fid:'+fid) == -1) return false;
  3546. else return true;
  3547. },
  3548. EnableControls: function()
  3549. {
  3550. let btnState = "visible";
  3551. if(sessionStorage.UROverview_FID_IgnoreList === '')
  3552. {
  3553. btnState = "hidden";
  3554. }
  3555. try
  3556. {
  3557. document.getElementById('_btnUndoLastHide').style.visibility = btnState;
  3558. document.getElementById('_btnClearSessionHides').style.visibility = btnState;
  3559. uroFilterItems();
  3560. }
  3561. catch(err)
  3562. {
  3563. uroDBG.AddLog('exception thrown in uroIgnore.EnableControls()');
  3564. }
  3565. },
  3566. Add: function()
  3567. {
  3568. if(!uroIgnore.IsOnList(uroShownFID))
  3569. {
  3570. sessionStorage.UROverview_FID_IgnoreList += 'fid:'+uroShownFID;
  3571. uroDBG.AddLog('added fid '+uroShownFID+' to ignore list');
  3572. uroDBG.AddLog(sessionStorage.UROverview_FID_IgnoreList);
  3573. uroDiv.style.visibility = 'hidden';
  3574. uroIgnore.EnableControls();
  3575.  
  3576. W.map.events.register("mousemove", null, uroFilterItemsOnMove);
  3577. }
  3578. return false;
  3579. },
  3580. RemoveLastAdded: function()
  3581. {
  3582. let ignorelist = sessionStorage.UROverview_FID_IgnoreList;
  3583. let fidpos = ignorelist.lastIndexOf('fid:');
  3584. if(fidpos != -1)
  3585. {
  3586. ignorelist = ignorelist.slice(0,fidpos);
  3587. sessionStorage.UROverview_FID_IgnoreList = ignorelist;
  3588. uroDBG.AddLog('removed last fid from ignore list');
  3589. uroDBG.AddLog(sessionStorage.UROverview_FID_IgnoreList);
  3590. uroIgnore.EnableControls();
  3591. }
  3592. },
  3593. RemoveAll: function()
  3594. {
  3595. sessionStorage.UROverview_FID_IgnoreList = '';
  3596. uroIgnore.EnableControls();
  3597. }
  3598. };
  3599. const uroPopup = // map object popup handling
  3600. {
  3601. hasIgnoreLink : null,
  3602. hasDeleteLink : null,
  3603. hasAddWatchLink : null,
  3604. hasRemoveWatchLink : null,
  3605. hasUpdateWatchLink : null,
  3606. hasRecentreSessionLink : null,
  3607. hasOpenInNewTabLink : null,
  3608.  
  3609. isVenue : null,
  3610. isMapComment : null,
  3611. isUR : null,
  3612. isProblem : null,
  3613. isTurnProb : null,
  3614. isPlaceUpdate : null,
  3615. timer : -2,
  3616. autoHideTimer : 0,
  3617. mouseIn : false,
  3618. shown : false,
  3619. shownType : null,
  3620. newType : null,
  3621. hovered : null,
  3622. unstackedX : null,
  3623. unstackedY : null,
  3624. renderIntent : null,
  3625. pX : null,
  3626. pY : null,
  3627. suppressed : false,
  3628.  
  3629. GetFormattedLocks: function(attrs)
  3630. {
  3631. let autoLock = attrs.rank;
  3632. let userLock = attrs.lockRank;
  3633. let retval = '<b>' + I18n.lookup("edit.segment.fields.lock") + ': </b>';
  3634. if(userLock !== null)
  3635. {
  3636. retval += 'M' + (userLock+1) + ' / ';
  3637. }
  3638. retval += 'A' + (autoLock+1);
  3639. return retval;
  3640. },
  3641. UR: function()
  3642. {
  3643. let result = '';
  3644.  
  3645. uroPopup.unstackedX = uroUtils.ParsePxString(uroMarkers.elm.style.left);
  3646. uroPopup.unstackedY = uroUtils.ParsePxString(uroMarkers.elm.style.top);
  3647. // check for stacking...
  3648. if(uroShownFID != uroMarkers.id)
  3649. {
  3650. uroCheckStacking(uroLayers.ID.UR,uroMarkers.id, uroPopup.unstackedX, uroPopup.unstackedY);
  3651. }
  3652.  
  3653. if(uroUtils.GetCBChecked('_cbInhibitURPopup') === false)
  3654. {
  3655. if(uroMousedOverMapComment !== null)
  3656. {
  3657. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for UR highlight');
  3658. uroMousedOverOtherObjectWithinMapComment = true;
  3659. }
  3660.  
  3661. uroPopup.isUR = true;
  3662. uroPopup.newPopupType = uroMarkers.type;
  3663. let ureq = W.model.mapUpdateRequests.objects[uroMarkers.id];
  3664.  
  3665. uroFID = uroMarkers.id;
  3666.  
  3667. uroDBG.AddLog('building popup for UR '+uroMarkers.id);
  3668. result = '<b>Update Request ('+uroMarkers.id+'): ' + I18n.lookup("update_requests.types." + ureq.attributes.type) + '</b><br>';
  3669.  
  3670. result += uroUtils.Clickify(ureq.attributes.description, '<br>');
  3671. let uroDaysOld = uroUtils.GetURAge(ureq,0,false);
  3672. let uroSubmittedTS = uroUtils.GetURAge(ureq,0,true);
  3673. if(uroSubmittedTS != -1)
  3674. {
  3675. uroSubmittedTS = uroUtils.GetDateTimeString(uroSubmittedTS);
  3676. }
  3677. if(uroDaysOld != -1)
  3678. {
  3679. result += '<i>Submitted ' + uroUtils.ParseDaysAgo(uroDaysOld) + ' ';
  3680. if(uroSubmittedTS != -1) result += '(' + uroSubmittedTS + ') ';
  3681. if(ureq.attributes.guestUserName != null)
  3682. {
  3683. result += 'via Livemap';
  3684. if(ureq.attributes.guestUserName !== '')
  3685. {
  3686. result += ' by '+ureq.attributes.guestUserName.replace(/<\/?[^>]+(>|$)/g, "");
  3687. }
  3688. }
  3689. result += '</i>';
  3690. }
  3691. if(ureq.attributes.resolvedOn !== null)
  3692. {
  3693. let daysResolved = uroUtils.GetURAge(ureq,1,false);
  3694. let uroResolvedTS = uroUtils.GetURAge(ureq,1,true);
  3695. if(uroResolvedTS != -1)
  3696. {
  3697. uroResolvedTS = uroUtils.GetDateTimeString(uroResolvedTS);
  3698. }
  3699.  
  3700. if(daysResolved != -1)
  3701. {
  3702. result += '<br><i>Closed ' + uroUtils.ParseDaysAgo(daysResolved) + ' ';
  3703. if(uroResolvedTS != -1) result += '(' + uroResolvedTS + ')</i>';
  3704.  
  3705. result += '<br><i>Marked as ';
  3706. if(ureq.attributes.resolution === 0) result += 'solved';
  3707. else if(ureq.attributes.resolution == 1) result += 'not identified';
  3708. else result += 'unknown';
  3709. if(ureq.attributes.resolvedBy !== null)
  3710. {
  3711. result += ' by '+uroUtils.GetUserNameAndRank(ureq.attributes.resolvedBy);
  3712. }
  3713. result += '</i>';
  3714. }
  3715. }
  3716. if(W.model.updateRequestSessions.objects[uroMarkers.id] != null)
  3717. {
  3718. let hasMyComments = uroURHasMyComments(uroMarkers.id);
  3719. let nComments = W.model.updateRequestSessions.objects[uroMarkers.id].attributes.comments.length;
  3720. result += '<br>' + nComments + ' comment';
  3721. if(nComments != 1) result += 's';
  3722. if((hasMyComments === false) && (nComments > 0)) result += ' (none by me)';
  3723. if(nComments > 0)
  3724. {
  3725. let commentDaysOld = uroUtils.GetCommentAge(W.model.updateRequestSessions.objects[uroMarkers.id].attributes.comments[nComments-1]);
  3726. if(commentDaysOld != -1)
  3727. {
  3728. result += ', last update '+uroUtils.ParseDaysAgo(commentDaysOld);
  3729. }
  3730. }
  3731. }
  3732. if(uroURDupes.length > 0)
  3733. {
  3734. let thisID = parseInt(uroMarkers.id);
  3735. for(let i = 0; i < uroURDupes.length; ++i)
  3736. {
  3737. if(uroURDupes[i][0] === thisID)
  3738. {
  3739. result += '<br><br>Duplicate of: ';
  3740. let dupes = 0;
  3741. for(let j = 0; j < uroURDupes[i][1].length; ++j)
  3742. {
  3743. if(uroURDupes[i][1][j] !== thisID)
  3744. {
  3745. if(dupes > 0)
  3746. {
  3747. result += ', ';
  3748. }
  3749. result += uroURDupes[i][1][j];
  3750. ++dupes;
  3751. }
  3752. }
  3753. }
  3754. }
  3755. }
  3756. uroPopup.result += result;
  3757. uroPopup.UMPExtras(ureq);
  3758. uroPopup.Show();
  3759. }
  3760. },
  3761. MP: function()
  3762. {
  3763. let result = '';
  3764.  
  3765. uroPopup.unstackedX = uroUtils.ParsePxString(uroMarkers.elm.style.left);
  3766. uroPopup.unstackedY = uroUtils.ParsePxString(uroMarkers.elm.style.top);
  3767. // check for stacking...
  3768. if(uroShownFID != uroMarkers.id)
  3769. {
  3770. ////uroCheckStacking(uroLayers.ID.MP,uroMarkers.id, uroPopup.unstackedX, uroPopup.unstackedY);
  3771. }
  3772.  
  3773. if(uroUtils.GetCBChecked('_cbInhibitMPPopup') === false)
  3774. {
  3775. if(uroMousedOverMapComment !== null)
  3776. {
  3777. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for MP highlight');
  3778. uroMousedOverOtherObjectWithinMapComment = true;
  3779. }
  3780.  
  3781. uroPopup.isProblem = true;
  3782. uroPopup.newPopupType = uroMarkers.type;
  3783. let ureq = W.model.mapProblems.objects[uroMarkers.id];
  3784.  
  3785. uroFID = uroMarkers.id;
  3786. uroDBG.AddLog('building popup for problem '+uroMarkers.id);
  3787. if(uroPopup.isTurnProb) result = '<b>Turn Problem ('+uroMarkers.id+'): ' + I18n.lookup("problems.types.turn.title");
  3788. else
  3789. {
  3790. result = '<b>Map Problem ('+uroMarkers.id+'): ';
  3791.  
  3792. let problemType = ureq.attributes.subType;
  3793. if(problemType == 300)
  3794. {
  3795. result += I18n.lookup("problems.panel.closure.title");
  3796. }
  3797. else
  3798. {
  3799. if(I18n.lookup("problems.types." + problemType) === undefined) result += 'Unknown problem type ('+problemType+')';
  3800. else result += I18n.lookup("problems.types." + problemType + ".title");
  3801. }
  3802. }
  3803. result += '</b><br>';
  3804.  
  3805. if(ureq.attributes.description != null)
  3806. {
  3807. result += 'Description: ' + ureq.attributes.description + '<br>';
  3808. }
  3809. if(ureq.attributes.extraInfo != null)
  3810. {
  3811. result += 'ExtraInfo: ' + uroUtils.Clickify(ureq.attributes.extraInfo, '<br>');
  3812. }
  3813. if(ureq.attributes.provider != null)
  3814. {
  3815. result += 'Provider: ' + ureq.attributes.provider + '<br>';
  3816. }
  3817. if(ureq.attributes.startTime != null)
  3818. {
  3819. result += 'From: ' + uroUtils.GetDateTimeString(ureq.attributes.startTime) + '<br>';
  3820. }
  3821. if(ureq.attributes.endTime != null)
  3822. {
  3823. result += 'To: ' + uroUtils.GetDateTimeString(ureq.attributes.endTime) + '<br>';
  3824. }
  3825. if(ureq.attributes.resolvedOn != null)
  3826. {
  3827. let daysResolved = uroUtils.GetURAge(ureq,1,false);
  3828. if(daysResolved != -1)
  3829. {
  3830. result += '<br><i>Closed ' + uroUtils.ParseDaysAgo(daysResolved) + ' ';
  3831. if(ureq.attributes.resolvedBy != null)
  3832. {
  3833. result += ' by '+uroUtils.GetUserNameAndRank(ureq.attributes.resolvedBy);
  3834. }
  3835.  
  3836. if((ureq.attributes.open === true) && (ureq.attributes.resolvedOn != null))
  3837. {
  3838. result += '<br>Reopened by Waze';
  3839. }
  3840. result += '</i>';
  3841. }
  3842. }
  3843. uroPopup.result += result;
  3844. uroPopup.UMPExtras(ureq);
  3845. }
  3846. },
  3847. PUR: function()
  3848. {
  3849. let result = '';
  3850.  
  3851. uroPopup.unstackedX = uroUtils.ParsePxString(uroMarkers.elm.style.left);
  3852. uroPopup.unstackedY = uroUtils.ParsePxString(uroMarkers.elm.style.top);
  3853.  
  3854. if(uroShownFID != uroMarkers.id)
  3855. {
  3856. // check for stacking...
  3857. uroCheckStacking(uroMarkers.type, uroMarkers.id, uroPopup.unstackedX, uroPopup.unstackedY);
  3858. }
  3859.  
  3860. if(uroUtils.GetCBChecked('_cbInhibitPUPopup') === false)
  3861. {
  3862. let ureq = W.model.venues.objects[uroMarkers.id];
  3863.  
  3864. uroPopup.newPopupType = uroMarkers.type;
  3865. if(uroMousedOverMapComment !== null)
  3866. {
  3867. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for PUR highlight');
  3868. uroMousedOverOtherObjectWithinMapComment = true;
  3869. }
  3870.  
  3871. uroPopup.isPlaceUpdate = true;
  3872.  
  3873. uroFID = uroMarkers.id;
  3874.  
  3875. if(uroMarkers.type == uroLayers.ID.PUR)
  3876. {
  3877. uroDBG.AddLog('building popup for placeUpdate '+uroMarkers.id);
  3878. }
  3879. else if(uroMarkers.type == uroLayers.ID.RPUR)
  3880. {
  3881. uroDBG.AddLog('building popup for residentialPlaceUpdate '+uroMarkers.id);
  3882. }
  3883. else
  3884. {
  3885. uroDBG.AddLog('building popup for parkingPlaceUpdate '+uroMarkers.id);
  3886. }
  3887.  
  3888. result = '<b>';
  3889. if(ureq.attributes.name === '') result += 'Unnamed landmark';
  3890. else result += ureq.attributes.name;
  3891. result += '</b><br>';
  3892.  
  3893. result += '<ul>';
  3894. for(let idx = 0; idx < ureq.attributes.categories.length; idx++)
  3895. {
  3896. result += '<li>' + I18n.lookup("venues.categories." + ureq.attributes.categories[idx]);
  3897. }
  3898. result += '</ul>';
  3899.  
  3900. if(ureq.attributes.residential === true)
  3901. {
  3902. result += '<i>Residential</i>';
  3903. }
  3904.  
  3905. let daysOld = uroUtils.GetPURAge(ureq);
  3906. if(daysOld != -1)
  3907. {
  3908. result += '<br><i>Submitted '+uroUtils.ParseDaysAgo(daysOld)+'</i>';
  3909. }
  3910.  
  3911. uroPopup.result += result;
  3912. uroPopup.UMPExtras(ureq);
  3913. }
  3914. },
  3915. Venue: function()
  3916. {
  3917. if(uroUtils.GetCBChecked('_cbInhibitLandmarkPopup') === false)
  3918. {
  3919. let result = '';
  3920. let navpointPos=new OpenLayers.LonLat();
  3921. {
  3922. if(uroPopup.renderIntent === 'highlight')
  3923. {
  3924. if(W.map.getExtent().intersectsBounds(uroMarkers.obj.attributes.geometry.getBounds()))
  3925. {
  3926. if(uroMousedOverMapComment !== null)
  3927. {
  3928. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for place highlight');
  3929. uroMousedOverOtherObjectWithinMapComment = true;
  3930. }
  3931.  
  3932. if(uroPopup.newPopupType === null)
  3933. {
  3934. uroFID = uroMarkers.obj.attributes.id;
  3935. uroDBG.AddLog('building popup for place '+uroFID);
  3936.  
  3937. navpointPos = uroGetVenueNavPoint(uroFID);
  3938. result += '<b>';
  3939. if(uroMarkers.obj.attributes.name === '')
  3940. {
  3941. if(uroMarkers.obj.attributes.residential === true) result += '<i>Residential</i>';
  3942. else result += '<i>Unnamed</i>';
  3943. }
  3944. else result += uroUtils.Clickify(uroMarkers.obj.attributes.name, '');
  3945. if(uroMarkers.obj.attributes.externalProviderIDs.length > 0)
  3946. {
  3947. result += ' <i>(linked)</i>';
  3948. }
  3949. if(uroMarkers.obj.attributes.adLocked)
  3950. {
  3951. result += ' <i>(AdLocked)</i>';
  3952. }
  3953. result += '</b><br>';
  3954. if(uroMarkers.obj.attributes.brand !== null)
  3955. {
  3956. result += '<i>Brand: ' + uroMarkers.obj.attributes.brand + '</i><br>';
  3957. }
  3958. let vDesc = uroMarkers.obj.attributes.description;
  3959. if(vDesc !== '')
  3960. {
  3961. result += '"<i>' + uroUtils.Clickify(vDesc, '') + '</i>"<br>';
  3962. }
  3963.  
  3964. let userLock = uroMarkers.obj.attributes.lockRank;
  3965. result += '<b>Lock: </b>' + (userLock+1);
  3966.  
  3967. result += '<hr>';
  3968. result += uroGetAddress(uroMarkers.obj.attributes.streetID, uroMarkers.obj.attributes.houseNumber, false, false, false);
  3969. result += '<ul>';
  3970. for(let idx = 0; idx < uroMarkers.obj.attributes.categories.length; idx++)
  3971. {
  3972. result += '<li>' + I18n.lookup("venues.categories." + uroMarkers.obj.attributes.categories[idx]);
  3973. }
  3974. result += '</ul>';
  3975.  
  3976. let npLink = document.location.href;
  3977. let npLayers = '';
  3978. npLink = npLink.substr(0,npLink.indexOf('?zoomLevel'));
  3979. npLink += '?zoomLevel=17&lat='+navpointPos.lat+'&lon='+navpointPos.lon+npLayers;
  3980.  
  3981. let targetTab = "_uroTab_" + Math.round(Math.random()*1000000);
  3982. result += '<hr>Jump to nav point: <a href="'+npLink+'" id="_openInNewTab" target="'+targetTab+'">in new tab</a> - ';
  3983. uroPopup.hasOpenInNewTabLink = true;
  3984. result += '<a href="#" id="_recentreSession">in this tab</a>';
  3985. uroPopup.hasRecentreSessionLink = true;
  3986.  
  3987. uroPopup.newPopupType = 'venue';
  3988. uroPopup.isVenue = true;
  3989.  
  3990. uroPopup.result += result;
  3991. uroPopup.Show();
  3992. }
  3993. else
  3994. {
  3995. let otherID = uroMarkers.obj.attributes.id;
  3996. uroDBG.AddLog('venue '+otherID+' is also highlighted');
  3997. }
  3998. }
  3999. else
  4000. {
  4001. uroDBG.AddLog('landmark '+uroFID+' has renderIntent==highlight but is offscreen... blocking popup');
  4002. }
  4003. }
  4004. }
  4005. }
  4006. },
  4007. Camera: function()
  4008. {
  4009. if(uroUtils.GetCBChecked('_cbInhibitCamPopup') === false)
  4010. {
  4011. let result = '';
  4012. let ureq = uroMarkers.obj;
  4013.  
  4014. if(uroPopup.renderIntent === "highlight")
  4015. {
  4016. if(uroMousedOverMapComment !== null)
  4017. {
  4018. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for camera highlight');
  4019. uroMousedOverOtherObjectWithinMapComment = true;
  4020. }
  4021. uroPopup.newPopupType = 'camera';
  4022. uroFID = uroMarkers.id;
  4023. uroDBG.AddLog('building popup for camera '+uroFID);
  4024. if(I18n.lookup("edit.camera.fields.type") === undefined)
  4025. {
  4026. result += '<b>Camera: ' + ureq.TYPES[ureq.attributes.type] + '</b>';
  4027. }
  4028. else
  4029. {
  4030. result += '<b>Camera: ' + I18n.lookup("edit.camera.fields.type." + ureq.attributes.type) + '</b>';
  4031. }
  4032. result += '<br>';
  4033. result += '<b>ID:</b> ' + uroFID + ' - ';
  4034. result += uroPopup.GetFormattedLocks(uroMarkers.obj.attributes);
  4035. result += '<br>';
  4036.  
  4037. result += '<b>Created by</b> ';
  4038. let userID;
  4039.  
  4040. if(W.model.users.getByIds([ureq.attributes.createdBy])[0] != null)
  4041. {
  4042. userID = ureq.attributes.createdBy;
  4043. result += uroUtils.GetUserNameAndRank(userID);
  4044. }
  4045. else result += 'unknown';
  4046. result += ', ';
  4047. let camAge = uroUtils.GetCameraAge(ureq,1);
  4048. if(camAge != -1)
  4049. {
  4050. result += uroUtils.ParseDaysAgo(camAge);
  4051. }
  4052. else result += 'unknown days ago';
  4053. result += '<br><b>Updated by</b> ';
  4054. if(W.model.users.getByIds([ureq.attributes.updatedBy])[0] != null)
  4055. {
  4056. userID = ureq.attributes.updatedBy;
  4057. result += uroUtils.GetUserNameAndRank(userID);
  4058. }
  4059. else result += 'unknown';
  4060. result += ', ';
  4061. camAge = uroUtils.GetCameraAge(ureq,0);
  4062. if(camAge != -1)
  4063. {
  4064. result += uroUtils.ParseDaysAgo(camAge);
  4065. }
  4066. else result += 'unknown days ago';
  4067.  
  4068. if(ureq.attributes.type !== 4)
  4069. {
  4070. result += '<br><b>Speed data:</b> ';
  4071. result += uroUtils.GetLocalisedSpeedString(ureq.attributes.speed);
  4072. if(uroIsCamSpeedValid(ureq) === false)
  4073. {
  4074. result += ' (differs to nearest segment)';
  4075. }
  4076. }
  4077. result += '<hr><ul>';
  4078. if(uroOWL.IsCamOnWatchList(uroFID) != -1)
  4079. {
  4080. result += '<li><a href="#" id="_updatewatchlist">Update watchlist entry</a>';
  4081. result += '<li><a href="#" id="_removefromwatchlist">Remove from watchlist</a>';
  4082. uroPopup.hasUpdateWatchLink = true;
  4083. uroPopup.hasRemoveWatchLink = true;
  4084. }
  4085. else
  4086. {
  4087. result += '<li><a href="#" id="_addtowatchlist">Add to watchlist</a>';
  4088. uroPopup.hasAddWatchLink = true;
  4089. }
  4090. if(ureq.attributes.permissions !== 0)
  4091. {
  4092. result += '<li><a href="#" id="_deleteobject">Delete Camera</a>';
  4093. uroPopup.hasDeleteLink = true;
  4094. }
  4095. result += '</ul>';
  4096. uroPopup.result += result;
  4097. uroPopup.Show();
  4098. }
  4099. }
  4100. },
  4101. Comment: function()
  4102. {
  4103. if(uroUtils.GetCBChecked('_cbInhibitMapCommentPopup') === false)
  4104. {
  4105. if(uroMCLayer.name !== 'mapComments')
  4106. {
  4107. uroInit.WazeBits();
  4108. }
  4109. if(uroMCLayer !== null)
  4110. {
  4111. let result = '';
  4112.  
  4113. if(uroPopup.renderIntent == 'highlight')
  4114. {
  4115. let moAttrs = uroMarkers.obj.attributes;
  4116. if(W.map.getExtent().intersectsBounds(moAttrs.geometry.getBounds()))
  4117. {
  4118. if(uroPopup.newPopupType === null)
  4119. {
  4120. if((uroMousedOverMapComment === moAttrs.id) && (uroMousedOverOtherObjectWithinMapComment === true))
  4121. {
  4122. uroDBG.AddLog('inhibit popup for map comment '+uroMousedOverMapComment);
  4123. }
  4124. else
  4125. {
  4126. uroMousedOverOtherObjectWithinMapComment = false;
  4127. if(moAttrs.geometry.id.indexOf('Polygon') !== -1)
  4128. {
  4129. // only capture ID for area comments...
  4130. uroMousedOverMapComment = moAttrs.id;
  4131. }
  4132. uroFID = moAttrs.id;
  4133. uroDBG.AddLog('building popup for map comment '+uroFID);
  4134.  
  4135. result += '<b>';
  4136. if(moAttrs.subject === '')
  4137. {
  4138. result += '<i>No subject</i>';
  4139. }
  4140. else result += uroUtils.Clickify(moAttrs.subject, '');
  4141. result += '</b><br>';
  4142. result += uroUtils.Clickify(moAttrs.body, '<br>');
  4143.  
  4144. let mcDaysOld = uroUtils.GetMCAge(moAttrs, 0, false);
  4145. let mcSubmittedTS = uroUtils.GetMCAge(moAttrs, 0, true);
  4146. if(mcSubmittedTS != -1)
  4147. {
  4148. mcSubmittedTS = uroUtils.GetDateTimeString(mcSubmittedTS);
  4149. }
  4150. if(mcDaysOld != -1)
  4151. {
  4152. result += '<i>Submitted ' + uroUtils.ParseDaysAgo(mcDaysOld) + ' ';
  4153. if(mcSubmittedTS != -1) result += '(' + mcSubmittedTS + ') ';
  4154. if(moAttrs.createdBy != null)
  4155. {
  4156. result += ' by '+uroUtils.GetUserNameAndRank(moAttrs.createdBy);
  4157. }
  4158. result += '</i><br>';
  4159. }
  4160. mcDaysOld = uroUtils.GetMCAge(moAttrs, 1, false);
  4161. mcSubmittedTS = uroUtils.GetMCAge(moAttrs, 1, true);
  4162. if(mcSubmittedTS != -1)
  4163. {
  4164. mcSubmittedTS = uroUtils.GetDateTimeString(mcSubmittedTS);
  4165. }
  4166. if(mcDaysOld != -1)
  4167. {
  4168. result += '<i>Updated ' + uroUtils.ParseDaysAgo(mcDaysOld) + ' ';
  4169. if(mcSubmittedTS != -1) result += '(' + mcSubmittedTS + ') ';
  4170. if(moAttrs.createdBy != null)
  4171. {
  4172. result += ' by '+uroUtils.GetUserNameAndRank(moAttrs.updatedBy);
  4173. }
  4174. result += '</i><br>';
  4175. }
  4176.  
  4177. mcDaysOld = uroUtils.GetMCAge(moAttrs,2,false);
  4178. mcSubmittedTS = uroUtils.GetMCAge(moAttrs,2,true);
  4179. if(mcDaysOld != -1)
  4180. {
  4181. result += '<i>Expires ' + uroUtils.ParseDaysToGo(mcDaysOld) + ' ';
  4182. result += '(' + uroUtils.GetDateTimeString(mcSubmittedTS) +')</i><br>';
  4183. }
  4184.  
  4185. let mcHasMyComments = false;
  4186. let mcNComments = moAttrs.conversation.length;
  4187. if(mcNComments > 0)
  4188. {
  4189. for(let j=0; j<mcNComments; j++)
  4190. {
  4191. if(moAttrs.conversation[j].userID == uroUserID)
  4192. {
  4193. mcHasMyComments = true;
  4194. break;
  4195. }
  4196. }
  4197. }
  4198. result += '<br>' + mcNComments +' comment';
  4199. if(mcNComments != 1) result += 's';
  4200. if((mcHasMyComments === false) && (mcNComments > 0)) result += ' (none by me)';
  4201.  
  4202. // add "ignore for this session" link
  4203. result += '<br><a href="#" id="_addtoignore">Hide for this session</a>';
  4204. uroPopup.hasIgnoreLink = true;
  4205.  
  4206. uroPopup.newPopupType = 'map_comment';
  4207. uroPopup.isMapComment = true;
  4208.  
  4209. uroPopup.result += result;
  4210. uroPopup.Show();
  4211. }
  4212. }
  4213. else
  4214. {
  4215. let mcOtherID = moAttrs.id;
  4216. uroDBG.AddLog('map comment '+mcOtherID+' is also highlighted');
  4217. }
  4218. }
  4219. else
  4220. {
  4221. uroDBG.AddLog('map comment '+uroFID+' has renderIntent==highlight but is offscreen... blocking popup');
  4222. }
  4223. }
  4224. }
  4225. }
  4226. },
  4227. AddClosureRow: function(rcObj)
  4228. {
  4229. let startDate = rcObj.attributes.startDate;
  4230. let endDate = "unknown";
  4231. if(rcObj.attributes.endDate !== null)
  4232. {
  4233. endDate = rcObj.attributes.endDate;
  4234. }
  4235. let provider = "---";
  4236. if(rcObj.attributes.provider !== null)
  4237. {
  4238. provider = rcObj.attributes.provider;
  4239. }
  4240. else if(rcObj.attributes.createdBy !== null)
  4241. {
  4242. provider = uroUtils.GetUserNameAndRank(rcObj.attributes.createdBy);
  4243. }
  4244. let reason = "---";
  4245. if(rcObj.attributes.reason !== null)
  4246. {
  4247. reason = rcObj.attributes.reason;
  4248. }
  4249. let mte = "---";
  4250. if(rcObj.attributes.eventId !== null)
  4251. {
  4252. try
  4253. {
  4254. mte = W.model.majorTrafficEvents.objects[rcObj.attributes.eventId].attributes.names[0].value;
  4255. }
  4256. catch(err)
  4257. {
  4258. }
  4259. }
  4260. let startOffset = uroGetRTCOffset(rcObj.attributes.startDate);
  4261. let duration = uroGetRTCDuration(rcObj);
  4262. if(duration === 0) duration = '<1 day';
  4263. else if(duration === 1) duration = '1 day';
  4264. else duration = duration + ' days';
  4265. let state = uroGetRTCState(rcObj);
  4266. let status = '';
  4267. let bgCol = '';
  4268. if(state === URO_SRTC.EXPIRED)
  4269. {
  4270. status = "Expired";
  4271. bgCol = '#A0A0A0';
  4272. }
  4273. else if(state === URO_SRTC.ACTIVE)
  4274. {
  4275. status = 'Active';
  4276. bgCol = '#FFFFFF';
  4277. }
  4278. else if(state === URO_SRTC.FUTURE)
  4279. {
  4280. if(startOffset == 0)
  4281. {
  4282. status = 'Today';
  4283. }
  4284. else if(startOffset == 1)
  4285. {
  4286. status = 'In 1 day';
  4287. }
  4288. else
  4289. {
  4290. status = 'In ' + startOffset + ' days';
  4291. }
  4292. bgCol = '#C0C0C0';
  4293. }
  4294. let result = '';
  4295. result += '<tr bgcolor="' + bgCol + '">';
  4296. result += '<td nowrap>' + status + '</td>';
  4297. result += '<td nowrap>' + startDate + ' to ' + endDate + ' (' + duration + ')</td>';
  4298. result += '<td nowrap>' + provider + '</td>';
  4299. result += '<td nowrap>' + reason + '</td>';
  4300. result += '<td nowrap>' + mte + '</td>';
  4301. result += '</td></tr>';
  4302. return result;
  4303. },
  4304. AddClosureDetails: function(cTypes, addType, addDesc)
  4305. {
  4306. let retval = '';
  4307. if((cTypes & addType) === addType)
  4308. {
  4309. retval += '<tr><td colspan=4><b>' + addDesc + ':</b></td></tr>';
  4310. for(let closure in uroRTCObjs)
  4311. {
  4312. if(uroRTCObjs.hasOwnProperty(closure))
  4313. {
  4314. let cObj = uroRTCObjs[closure];
  4315. if(cObj.direction === addType)
  4316. {
  4317. retval += uroPopup.AddClosureRow(cObj);
  4318. }
  4319. }
  4320. }
  4321. }
  4322. return retval;
  4323. },
  4324. Segment: function()
  4325. {
  4326. if(uroUtils.GetCBChecked('_cbInhibitSegPopup') === false)
  4327. {
  4328. {
  4329. if(W.map.getExtent().intersectsBounds(uroMarkers.obj.attributes.geometry.getBounds()))
  4330. {
  4331. let result = '';
  4332. let doPopUp = false;
  4333. let restObj;
  4334.  
  4335. if(uroMousedOverMapComment !== null)
  4336. {
  4337. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for segment highlight');
  4338. uroMousedOverOtherObjectWithinMapComment = true;
  4339. }
  4340.  
  4341. let streetID = uroMarkers.obj.attributes.primaryStreetID;
  4342. if(streetID !== null)
  4343. {
  4344. // generic segment data
  4345. if(uroUtils.GetCBChecked('_cbInhibitSegGenericPopup') === false)
  4346. {
  4347. doPopUp = true;
  4348. uroDBG.AddLog('building popup for segment '+streetID);
  4349.  
  4350. let isToll = ((uroMarkers.obj.attributes.fwdToll == true) || (uroMarkers.obj.attributes.revToll == true));
  4351. result += uroGetAddress(streetID, null, true, false, isToll);
  4352.  
  4353. if(uroMarkers.obj.attributes.streetIDs.length > 0)
  4354. {
  4355. // list any alternate names
  4356. result += '<br>Alternate names:<br>';
  4357. for(let i = 0; i < uroMarkers.obj.attributes.streetIDs.length; ++i)
  4358. {
  4359. result += '&nbsp;<i>' + W.model.streets.objects[uroMarkers.obj.attributes.streetIDs[i]].attributes.name + ', ';
  4360. let cityName = "";
  4361. if(W.model.cities.objects[W.model.streets.objects[uroMarkers.obj.attributes.streetIDs[i]].attributes.cityID] != undefined)
  4362. {
  4363. cityName = W.model.cities.objects[W.model.streets.objects[uroMarkers.obj.attributes.streetIDs[i]].attributes.cityID].attributes.name;
  4364. }
  4365. if(cityName != "")
  4366. {
  4367. result += cityName;
  4368. }
  4369. else
  4370. {
  4371. result += ' no city';
  4372. }
  4373. result += '</i><br>';
  4374. }
  4375. result += '<br>';
  4376. }
  4377.  
  4378. result += '<b>ID: </b>'+uroMarkers.obj.attributes.id+' - ';
  4379. result += uroPopup.GetFormattedLocks(uroMarkers.obj.attributes);
  4380. result += ' - ';
  4381.  
  4382. let level = uroMarkers.obj.attributes.level;
  4383. result += '<b>' + I18n.lookup("edit.segment.fields.level") +': </b>';
  4384. if(level == 0)
  4385. {
  4386. result += I18n.lookup("edit.segment.levels")[0];
  4387. }
  4388. else
  4389. {
  4390. result += level;
  4391. }
  4392. result += '<br>';
  4393.  
  4394. let leBy = uroMarkers.obj.attributes.updatedBy;
  4395. let leOn = uroMarkers.obj.attributes.updatedOn;
  4396. if(leOn == null)
  4397. {
  4398. leBy = uroMarkers.obj.attributes.createdBy;
  4399. leOn = uroMarkers.obj.attributes.createdOn;
  4400. }
  4401. result += "<b>Last edit by</b> " + uroUtils.GetUserNameAndRank(leBy) + " <b>on</b> " + uroUtils.GetDateTimeString(leOn) + "<br><br>";
  4402.  
  4403. let fwdSpeed = uroMarkers.obj.attributes.fwdMaxSpeed;
  4404. let revSpeed = uroMarkers.obj.attributes.revMaxSpeed;
  4405. let fwdLanes = uroMarkers.obj.attributes.fwdLaneCount;
  4406. let revLanes = uroMarkers.obj.attributes.revLaneCount;
  4407. let fwdWidth = 'Not set';
  4408. let revWidth = 'Not set';
  4409. if(uroMarkers.obj.attributes.fromLanesInfo != null)
  4410. {
  4411. fwdWidth = uroGetLengthString(uroMarkers.obj.attributes.fromLanesInfo.laneWidth);
  4412. }
  4413. if(uroMarkers.obj.attributes.toLanesInfo != null)
  4414. {
  4415. revWidth = uroGetLengthString(uroMarkers.obj.attributes.toLanesInfo.laneWidth);
  4416. }
  4417. let fwdUnverified = uroMarkers.obj.attributes.fwdMaxSpeedUnverified;
  4418. let revUnverified = uroMarkers.obj.attributes.revMaxSpeedUnverified;
  4419. let fwdASC = ((uroMarkers.obj.attributes.fwdFlags & 1) === 1);
  4420. let revASC = ((uroMarkers.obj.attributes.revFlags & 1) === 1);
  4421. let roadType = uroMarkers.obj.attributes.roadType;
  4422. let verifyLimits = true;
  4423. if((roadType === 17) || (roadType === 20))
  4424. {
  4425. verifyLimits = false;
  4426. }
  4427.  
  4428. result += '<table border=1><tr><th>Dir</th><th>Speed</th><th>ASC</th><th>Lanes</th><th>Width</th></tr>';
  4429. if(uroMarkers.obj.attributes.fwdDirection)
  4430. {
  4431. result += '<tr><td><b>A-B</b></td><td>'+uroUtils.GetLocalisedSpeedString(fwdSpeed)+'</td><td>';
  4432. if(fwdASC == true)
  4433. {
  4434. result += 'Yes';
  4435. }
  4436. else
  4437. {
  4438. result += 'No';
  4439. }
  4440. result += '</td><td>';
  4441. if(fwdLanes > 0)
  4442. {
  4443. result += fwdLanes;
  4444. }
  4445. else
  4446. {
  4447. result += 'Not set';
  4448. }
  4449. result += '</td><td>'+fwdWidth+'</td></tr>';
  4450. }
  4451. if(uroMarkers.obj.attributes.revDirection)
  4452. {
  4453. result += '<tr><td><b>B-A</b></td><td>'+uroUtils.GetLocalisedSpeedString(revSpeed)+'</td><td>';
  4454. if(revASC == true)
  4455. {
  4456. result += 'Yes';
  4457. }
  4458. else
  4459. {
  4460. result += 'No';
  4461. }
  4462. result += '</td><td>';
  4463. if(revLanes > 0)
  4464. {
  4465. result += revLanes;
  4466. }
  4467. else
  4468. {
  4469. result += 'Not set';
  4470. }
  4471. result += '</td><td>'+revWidth+'</td></tr>';
  4472. }
  4473. result += '</table>';
  4474.  
  4475. if((uroMarkers.obj.attributes.fwdDirection) && (uroMarkers.obj.attributes.revDirection) && (fwdSpeed != revSpeed) && (!fwdUnverified) && (!revUnverified))
  4476. {
  4477. result += '<br>Two-way segment has different verified speed limits...';
  4478. }
  4479. }
  4480.  
  4481. // segment restrictions
  4482. if(uroMarkers.obj.attributes.restrictions.length > 0)
  4483. {
  4484. result += '<br><table border=1>';
  4485. doPopUp = true;
  4486. let fwdResult = '<tr><td colspan=13><b>A-B restrictions:</b></td></tr>';
  4487. let revResult = '<tr><td colspan=13><b>B-A restrictions:</b></td></tr>';
  4488. let bothResult = '<tr><td colspan=13><b>Two-way restrictions:</b></td></tr>';
  4489.  
  4490. let nABRestrictions = 0;
  4491. let nBARestrictions = 0;
  4492. let nBothRestrictions = 0;
  4493. for(let idx = 0; idx < uroMarkers.obj.attributes.restrictions.length; idx++)
  4494. {
  4495. restObj = uroMarkers.obj.attributes.restrictions[idx];
  4496. if(restObj._direction === "FWD")
  4497. {
  4498. nABRestrictions++;
  4499. fwdResult += uroFormatRestriction(restObj);
  4500. }
  4501. else if(restObj._direction === "REV")
  4502. {
  4503. nBARestrictions++;
  4504. revResult += uroFormatRestriction(restObj);
  4505. }
  4506. else if(restObj._direction === "BOTH")
  4507. {
  4508. nBothRestrictions++;
  4509. bothResult += uroFormatRestriction(restObj);
  4510. }
  4511. else
  4512. {
  4513. uroDBG.AddLog("unknown restriction direction...");
  4514. }
  4515. }
  4516. if(nABRestrictions > 0)
  4517. {
  4518. result += fwdResult;
  4519. }
  4520. if(nBARestrictions > 0)
  4521. {
  4522. result += revResult;
  4523. }
  4524. if(nBothRestrictions > 0)
  4525. {
  4526. result += bothResult;
  4527. }
  4528. result += '</table>';
  4529. }
  4530. if(uroLayers.layers[uroLayers.ID.RTC].l.getVisibility() === true)
  4531. {
  4532. let closureTypes = uroGetSelectedSegmentRTCs(uroMarkers.obj.attributes.id);
  4533. if(closureTypes !== URO_DRTC.NONE)
  4534. {
  4535. result += '<br><table border=1 width="100%">';
  4536.  
  4537. result += uroPopup.AddClosureDetails(closureTypes, URO_DRTC.SEG_AB, "A-B closures");
  4538. result += uroPopup.AddClosureDetails(closureTypes, URO_DRTC.SEG_BA, "B-A closures");
  4539. result += uroPopup.AddClosureDetails(closureTypes, URO_DRTC.SEG_BI, "Two-way closures");
  4540. result += uroPopup.AddClosureDetails(closureTypes, URO_DRTC.TURN_OUT, "Outbound turn closures");
  4541. result += uroPopup.AddClosureDetails(closureTypes, URO_DRTC.TURN_IN, "Inbound turn closures");
  4542. doPopUp = true;
  4543. result += '</table>';
  4544. }
  4545. }
  4546.  
  4547. if(doPopUp === true)
  4548. {
  4549. uroFID = uroMarkers.obj.attributes.id;
  4550. uroPopup.newPopupType = 'segment_restriction';
  4551. }
  4552. }
  4553. uroPopup.result += result;
  4554. uroPopup.Show();
  4555. }
  4556. else
  4557. {
  4558. uroDBG.AddLog('segment '+uroFID+' has renderIntent==highlight but is offscreen... blocking popup');
  4559. }
  4560. }
  4561. }
  4562. },
  4563. Node: function()
  4564. {
  4565. if(uroUtils.GetCBChecked('_cbInhibitNodesPopup') === false)
  4566. {
  4567. let result = '';
  4568. let ureq = W.model.nodes.objects[uroMarkers.id];
  4569. if(ureq === undefined)
  4570. {
  4571. uroMarkers.id = null;
  4572. }
  4573. else
  4574. {
  4575. if(uroMousedOverMapComment !== null)
  4576. {
  4577. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for node highlight');
  4578. uroMousedOverOtherObjectWithinMapComment = true;
  4579. }
  4580. uroPopup.newPopupType = 'node';
  4581. uroFID = uroMarkers.id;
  4582. uroDBG.AddLog('building popup for node '+uroFID);
  4583. result += '<b>Node: ' + uroFID + '</b><br>';
  4584. for(let k=0; k<ureq.attributes.segIDs.length; k++)
  4585. {
  4586. let nodeSegID = ureq.attributes.segIDs[k];
  4587. let nodeSegObj = W.model.segments.objects[nodeSegID];
  4588. if(nodeSegObj !== undefined)
  4589. {
  4590. let nodeStreetID = nodeSegObj.attributes.primaryStreetID;
  4591. result += uroGetAddress(nodeStreetID, null, false, true, false);
  4592. }
  4593. }
  4594. }
  4595. uroPopup.result += result;
  4596. uroPopup.Show();
  4597. }
  4598. },
  4599. UMPExtras: function(ureq)
  4600. {
  4601. // add "open new WME tab" link
  4602. let urPos=new OpenLayers.LonLat();
  4603. if(uroPopup.isPlaceUpdate)
  4604. {
  4605. urPos.lon = ureq.getOLGeometry().getCentroid().x;
  4606. urPos.lat = ureq.getOLGeometry().getCentroid().y;
  4607. }
  4608. else
  4609. {
  4610. if(ureq.attributes.geometry.realX === undefined)
  4611. {
  4612. urPos.lon = ureq.attributes.geometry.x;
  4613. urPos.lat = ureq.attributes.geometry.y;
  4614. }
  4615. else
  4616. {
  4617. urPos.lon = ureq.attributes.geometry.realX;
  4618. urPos.lat = ureq.attributes.geometry.realY;
  4619. }
  4620. }
  4621. urPos = uroUtils.ConvertMercatorToWGS84(urPos);
  4622. let urLink = document.location.href;
  4623. let urLayers = '';
  4624. urLink = urLink.substr(0,urLink.indexOf('?zoomLevel'));
  4625. urLink += '?zoomLevel=17&lat='+urPos.lat+'&lon='+urPos.lon+urLayers;
  4626.  
  4627. if(uroPopup.isUR) urLink += '&mapUpdateRequest='+uroMarkers.id;
  4628. else if(uroPopup.isTurnProb) urLink += '&showturn='+uroMarkers.id+'&endshow';
  4629. else if(uroPopup.isProblem) urLink += '&mapProblem='+uroMarkers.id;
  4630. else if(uroPopup.isPlaceUpdate)
  4631. {
  4632. if(uroMarkers.type == uroLayers.ID.PUR)
  4633. {
  4634. urLink += '&showpur='+uroMarkers.id+'&endshow';
  4635. }
  4636. else
  4637. {
  4638. urLink += '&showppur='+uroMarkers.id+'&endshow';
  4639. }
  4640. }
  4641.  
  4642. let targetTab = "_uroTab_" + Math.round(Math.random()*1000000);
  4643. uroPopup.result += '<hr><ul><li><a href="'+urLink+'" id="_openInNewTab" target="'+targetTab+'">Open in new tab</a> - ';
  4644. uroPopup.hasOpenInNewTabLink = true;
  4645. uroPopup.result += '<a href="#" id="_recentreSession">centre in current tab</a>';
  4646. uroPopup.hasRecentreSessionLink = true;
  4647.  
  4648. // add "open new livemap tab" link
  4649. let lmLink = null;
  4650. if(document.getElementById("livemap-link") != null)
  4651. {
  4652. uroDBG.AddLog('Livemap link in livemap-link id element');
  4653. lmLink = document.getElementById("livemap-link").href;
  4654. }
  4655. else if(document.getElementsByClassName("livemap-link") != null)
  4656. {
  4657. uroDBG.AddLog('Livemap link in livemap-link class element');
  4658. lmLink = document.getElementsByClassName("livemap-link")[0].href;
  4659. }
  4660. else
  4661. {
  4662. uroDBG.AddLog('Livemap link not found...');
  4663. }
  4664. if(lmLink !== null)
  4665. {
  4666. let zpos = lmLink.indexOf('?');
  4667. if(zpos > -1) lmLink = lmLink.substr(0,zpos);
  4668. lmLink += '?zoom=17&lat='+urPos.lat+'&lon='+urPos.lon+'&layers=BTTTT';
  4669. uroPopup.result += '<li><a href="'+lmLink+'" target="_lmTab">Open in new livemap tab</a>';
  4670. }
  4671. if(!uroPopup.isPlaceUpdate)
  4672. {
  4673. // add "ignore for this session" link
  4674. uroPopup.result += '<li><a href="#" id="_addtoignore">Hide for this session</a></ul>';
  4675. uroPopup.hasIgnoreLink = true;
  4676. }
  4677.  
  4678. uroPopup.Show();
  4679. },
  4680. Preamble: function()
  4681. {
  4682. let retval = true;
  4683.  
  4684. if
  4685. (
  4686. (uroMarkers.type === null) &&
  4687. (uroPopup.timer === 0)
  4688. )
  4689. {
  4690. if(uroPopup.shown === true)
  4691. {
  4692. uroPopup.Hide();
  4693. }
  4694. uroMousedOverMapComment = null;
  4695. retval = false;
  4696. }
  4697. if(retval === true)
  4698. {
  4699. if(uroMTEMode)
  4700. {
  4701. retval = false;
  4702. }
  4703. }
  4704.  
  4705. if(retval === true)
  4706. {
  4707. if(!uroInit.initialised)
  4708. {
  4709. retval = false;
  4710. }
  4711. }
  4712.  
  4713. if(retval === true)
  4714. {
  4715. if((uroMouseIsDown) && (uroMarkers.mouseButtons === 0))
  4716. {
  4717. uroDBG.AddLog('trapped erroneous mousedown state');
  4718. uroMouseIsDown = false;
  4719. }
  4720. if(uroMouseIsDown)
  4721. {
  4722. retval = false;
  4723. }
  4724. }
  4725.  
  4726. if(retval === true)
  4727. {
  4728. if(OpenLayers === null)
  4729. {
  4730. if(uroNullOpenLayers === false)
  4731. {
  4732. uroDBG.AddLog('caught null OpenLayers');
  4733. uroNullOpenLayers = true;
  4734. }
  4735. retval = false;
  4736. }
  4737. else
  4738. {
  4739. uroNullOpenLayers = false;
  4740. }
  4741. }
  4742.  
  4743. if(retval === true)
  4744. {
  4745. if(uroLayers.layers[uroLayers.ID.UR].l === null)
  4746. {
  4747. if(uroNullURLayer === false)
  4748. {
  4749. uroDBG.AddLog('caught null UR layer');
  4750. uroNullURLayer = true;
  4751. }
  4752. retval = false;
  4753. }
  4754. else
  4755. {
  4756. uroNullURLayer = false;
  4757. }
  4758. }
  4759.  
  4760. if(retval === true)
  4761. {
  4762. if(uroLayers.layers[uroLayers.ID.MP].l === null)
  4763. {
  4764. if(uroNullProblemLayer === false)
  4765. {
  4766. uroDBG.AddLog('caught null problem layer');
  4767. uroNullProblemLayer = true;
  4768. }
  4769. retval = false;
  4770. }
  4771. else
  4772. {
  4773. uroNullProblemLayer = false;
  4774. }
  4775. }
  4776.  
  4777. if(retval === true)
  4778. {
  4779. if(uroUtils.GetCBChecked('_cbMasterEnable') === false)
  4780. {
  4781. retval = false;
  4782. }
  4783. }
  4784.  
  4785. if(retval === true)
  4786. {
  4787. if(uroTestPointerOutsideMap(uroMarkers.clientX, uroMarkers.clientY))
  4788. {
  4789. retval = false;
  4790. }
  4791. }
  4792.  
  4793.  
  4794. if(retval === true)
  4795. {
  4796. uroPopup.mouseX = uroMarkers.mouseX;
  4797. uroPopup.mouseY = uroMarkers.mouseY;
  4798. uroPopup.result = '';
  4799. uroPopup.hasIgnoreLink = false;
  4800. uroPopup.hasDeleteLink = false;
  4801. uroPopup.hasAddWatchLink = false;
  4802. uroPopup.hasRemoveWatchLink = false;
  4803. uroPopup.hasUpdateWatchLink = false;
  4804. uroPopup.hasRecentreSessionLink = false;
  4805. uroPopup.hasOpenInNewTabLink = false;
  4806. uroPopup.isVenue = false;
  4807. uroPopup.isMapComment = false;
  4808. uroPopup.newPopupType = null;
  4809. uroPopup.ureqID = null;
  4810. uroPopup.isUR = false;
  4811. uroPopup.isProblem = false;
  4812. uroPopup.isTurnProb = false;
  4813. uroPopup.isPlaceUpdate = false;
  4814. uroPopup.renderIntent = uroGetFeatureRenderIntent(uroMarkers.obj);
  4815.  
  4816. uroInit.WazeBits();
  4817.  
  4818. let mouseLonLat = W.map.getLonLatFromViewPortPx(new OpenLayers.Pixel(uroPopup.mouseX, uroPopup.mouseY));
  4819. let mousePoint = new OpenLayers.Geometry.Point(mouseLonLat.lon, mouseLonLat.lat);
  4820. if(uroMousedOverMapComment !== null)
  4821. {
  4822. if(W.model.mapComments.objects[uroMousedOverMapComment] === undefined)
  4823. {
  4824. uroDBG.AddLog('clearing uroMousedOverMapComment: object no longer exists in current map view');
  4825. uroMousedOverMapComment = null;
  4826. }
  4827. else if(W.model.mapComments.objects[uroMousedOverMapComment].attributes.geometry.containsPoint(mousePoint) === false)
  4828. {
  4829. uroDBG.AddLog('clearing uroMousedOverMapComment: pointer no longer within comment boundary');
  4830. uroMousedOverMapComment = null;
  4831. }
  4832. }
  4833. let popupXOffset = document.getElementById('editor-container').getBoundingClientRect().x;
  4834. let popupYOffset = $(document.getElementById("WazeMap")).offset().top;
  4835. uroPopup.pX = uroPopup.mouseX + popupXOffset + 10;
  4836. uroPopup.pY = uroPopup.mouseY + popupYOffset;
  4837. }
  4838.  
  4839. return retval;
  4840. },
  4841. Show: function()
  4842. {
  4843. if(uroPopup.suppressed === false)
  4844. {
  4845. if((uroFID != uroShownFID) || (uroPopup.newPopupType != uroPopup.shownType))
  4846. {
  4847. if(uroFID != uroShownFID) uroDBG.AddLog('FID mismatch, show popup: '+uroFID+'/'+uroShownFID);
  4848. else uroDBG.AddLog('Popup type mismatch: '+uroPopup.newPopupType+'/'+uroPopup.shownType);
  4849. uroShownFID = uroFID;
  4850. uroPopup.shownType = uroPopup.newPopupType;
  4851. uroPopup.shown = false;
  4852. }
  4853. if(uroPopup.shown === false)
  4854. {
  4855. uroPopup.shown = true;
  4856. uroDiv.style.height = "auto";
  4857. uroDiv.style.width = "auto";
  4858. uroDiv.style.overflow = "auto";
  4859. uroDiv.innerHTML = uroUtils.ModifyHTML(uroPopup.result);
  4860. if((uroFID != -1) && (uroPopup.hasIgnoreLink === true))
  4861. {
  4862. uroUtils.AddEventListener('_addtoignore','click', uroIgnore.Add, true);
  4863. }
  4864. if(uroPopup.hasDeleteLink === true)
  4865. {
  4866. uroUtils.AddEventListener('_deleteobject','click', uroDeleteObject, true);
  4867. }
  4868. if(uroPopup.hasRemoveWatchLink === true)
  4869. {
  4870. uroUtils.AddEventListener('_removefromwatchlist','click', uroOWL.RemoveCamFromWatchList, true);
  4871. }
  4872. if(uroPopup.hasAddWatchLink === true)
  4873. {
  4874. uroUtils.AddEventListener('_addtowatchlist','click', uroOWL.AddCamToWatchList, true);
  4875. }
  4876. if(uroPopup.hasUpdateWatchLink === true)
  4877. {
  4878. uroUtils.AddEventListener('_updatewatchlist','click', uroOWL.UpdateCamWatchList, true);
  4879. }
  4880. if(uroPopup.hasOpenInNewTabLink === true)
  4881. {
  4882. uroUtils.AddEventListener('_openInNewTab','mouseup', uroOpenNewTab, true);
  4883. }
  4884. if(uroPopup.hasRecentreSessionLink === true)
  4885. {
  4886. if(uroPopup.isUR) uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnUR, true);
  4887. else if((uroPopup.isProblem)||(uroPopup.isTurnProb)) uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnMP, true);
  4888. else if(uroPopup.isPlaceUpdate)
  4889. {
  4890. if(uroPopup.newPopupType == uroLayers.ID.PUR)
  4891. {
  4892. uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnPUR, true);
  4893. }
  4894. else
  4895. {
  4896. uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnPPUR, true);
  4897. }
  4898. }
  4899. else if(uroPopup.isVenue) uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnVenueNavPoint, true);
  4900. }
  4901. // restrict the popup width to be no wider than just under half the window width to avoid it
  4902. // completely overlapping the marker it's associated with - by keeping it to just below half
  4903. // the window width we guarantee that it'll fit either to the left or the right of the marker
  4904. // no matter how far across the screen the marker is located...
  4905. let rw = parseInt(uroDiv.clientWidth);
  4906. if(rw > (window.innerWidth * 0.45))
  4907. {
  4908. rw = (window.innerWidth * 0.45);
  4909. uroDiv.style.width = rw+'px';
  4910. }
  4911. // get the div height after any adjustment of the width above, to account for whatever content
  4912. // reflow may have occurred as a result of reducing the width...
  4913. let rh = parseInt(uroDiv.clientHeight);
  4914. // similarly restrict the popup height to avoid it dropping of the bottom of the screen if a
  4915. // segment has a bunch of closures/restrictions
  4916. rh = parseInt(uroDiv.clientHeight);
  4917. if(rh > (window.innerHeight * 0.80))
  4918. {
  4919. rh = (window.innerHeight * 0.80);
  4920. uroDiv.style.height = rh+'px';
  4921. uroDiv.style.overflow = 'scroll';
  4922. }
  4923. let origPopupX = uroPopup.pX;
  4924. let movedLeft = false;
  4925. if((uroPopup.pX + rw) > window.innerWidth)
  4926. {
  4927. // where the popup would be off the right hand side of the screen, move it completely over to the
  4928. // other side of the mouse pointer
  4929. uroPopup.pX -= (rw + 20);
  4930. if(uroPopup.pX < 0) uroPopup.pX = 0;
  4931. movedLeft = true;
  4932. }
  4933. if((uroPopup.pY + rh) > window.innerHeight)
  4934. {
  4935. // where the popup would be off the bottom of the screen, shift it up just far enough to be
  4936. // fully visible
  4937. uroPopup.pY -= (((uroPopup.pY + rh) - window.innerHeight) + 30);
  4938. }
  4939. if(uroPopup.pY < 0) uroPopup.pY = 0;
  4940. uroDiv.style.top = uroPopup.pY+'px';
  4941. uroDiv.style.left = uroPopup.pX+'px';
  4942. if(movedLeft === true)
  4943. {
  4944. // after relocating the popup to the left of the pointer, it may end up resizing itself
  4945. // which may then cause it to completely overlap the UR marker, so perform one more check
  4946. // of the div width and nudge to the left if required...
  4947. rw = parseInt(uroDiv.clientWidth);
  4948. if(rw > (window.innerWidth * 0.45))
  4949. {
  4950. rw = (window.innerWidth * 0.45);
  4951. uroDiv.style.width = rw+'px';
  4952. }
  4953. let nudgeDist = parseInt(20 + (uroPopup.pX + rw) - origPopupX);
  4954. if((uroPopup.pX + rw + 30) >= origPopupX)
  4955. {
  4956. uroDiv.style.left = parseInt(uroPopup.pX - nudgeDist)+'px';
  4957. }
  4958. }
  4959.  
  4960. uroDBG.AddLog('display popup at '+uroPopup.pX+','+uroPopup.pY);
  4961. uroDiv.style.visibility = 'visible';
  4962. uroPopup.autoHideTimer = (uroUtils.GetElmValue('_inputPopupAutoHideTimeout') * 10);
  4963. }
  4964. uroPopup.timer = -1;
  4965. }
  4966. },
  4967. Generate: function()
  4968. {
  4969. if(uroPopup.Preamble() === true)
  4970. {
  4971. if(uroMarkers.type === uroLayers.ID.UR) uroPopup.UR();
  4972. else if(uroMarkers.type === uroLayers.ID.MP) uroPopup.MP();
  4973. else if((uroMarkers.type === uroLayers.ID.PUR)||(uroMarkers.type === uroLayers.ID.PPUR)||(uroMarkers.type === uroLayers.ID.RPUR)) uroPopup.PUR();
  4974. else if(uroMarkers.type === "venue") uroPopup.Venue();
  4975. else if(uroMarkers.type === "cam") uroPopup.Camera();
  4976. else if(uroMarkers.type === "comment") uroPopup.Comment();
  4977. else if(uroMarkers.type === "segment") uroPopup.Segment();
  4978. else if(uroMarkers.type === "node") uroPopup.Node();
  4979. else
  4980. {
  4981. uroDBG.AddLog("request to generate popup for unknown type - " + uroMarkers.type);
  4982. }
  4983. }
  4984. },
  4985. Hide: function()
  4986. {
  4987. if(uroPopup.shown)
  4988. {
  4989. uroDiv.style.visibility = 'hidden';
  4990. uroPopup.shown = false;
  4991. uroPopup.timer = -2;
  4992. uroShownFID = -1;
  4993. }
  4994. uroPopup.suppressed = false;
  4995. },
  4996. Suppress: function()
  4997. {
  4998. uroDiv.style.visibility = 'hidden';
  4999. window.getSelection().removeAllRanges();
  5000. uroPopup.suppressed = true;
  5001. },
  5002. MouseOver: function()
  5003. {
  5004. uroPopup.mouseIn = true;
  5005. },
  5006. MouseOut: function()
  5007. {
  5008. uroPopup.mouseIn = false;
  5009. }
  5010. };
  5011. const uroURExtras = // UR marker enhancements
  5012. {
  5013. urList : [],
  5014. URListEntry: function(id, customType, hasMyComments, nComments, ageLastComment)
  5015. {
  5016. this.id = id;
  5017. this.customType = customType;
  5018. this.hasMyComments = hasMyComments;
  5019. this.nComments = nComments;
  5020. this.ageLastComment = ageLastComment;
  5021. },
  5022. AddToList: function(urID, customType, hasMyComments, nComments, ageLastComment)
  5023. {
  5024. let useCustomMarker = false;
  5025. if(uroUtils.GetCBChecked('_cbMasterEnable') === true)
  5026. {
  5027. if(customType === 0) useCustomMarker = (uroUtils.GetCBChecked('_cbCustomRoadworksMarkers'));
  5028. else if(customType === 1) useCustomMarker = (uroUtils.GetCBChecked('_cbCustomConstructionMarkers'));
  5029. else if(customType === 2) useCustomMarker = (uroUtils.GetCBChecked('_cbCustomClosuresMarkers'));
  5030. else if(customType === 3) useCustomMarker = (uroUtils.GetCBChecked('_cbCustomEventsMarkers'));
  5031. else if(customType === 4) useCustomMarker = (uroUtils.GetCBChecked('_cbCustomNotesMarkers'));
  5032. else if(customType === 5) useCustomMarker = (uroUtils.GetCBChecked('_cbCustomWSLMMarkers'));
  5033. else if(customType === 6) useCustomMarker = (uroUtils.GetCBChecked('_cbCustomBOGMarkers'));
  5034. else if(customType === 7) useCustomMarker = (uroUtils.GetCBChecked('_cbCustomDifficultMarkers'));
  5035. else if(customType === 98) useCustomMarker = (uroUtils.GetCBChecked('_cbCustomNativeSLMarkers'));
  5036. else if(customType === 99) useCustomMarker = (uroUtils.GetCBChecked('_cbCustomKeywordMarkers'));
  5037. }
  5038. if(!useCustomMarker) customType = -1;
  5039. uroURExtras.urList.push(new uroURExtras.URListEntry(urID, customType, hasMyComments, nComments, ageLastComment));
  5040. },
  5041. AddCommentCounts: function()
  5042. {
  5043. // Remove existing count elements before (re-)rendering, as WME doesn't automatically do this
  5044. // for us now that the way it handles the marker layers has changed...
  5045. let toRemove = document.querySelectorAll('#uroCommentCount');
  5046. let trCount = toRemove.length;
  5047. while(trCount > 0)
  5048. {
  5049. --trCount;
  5050. toRemove[trCount].remove();
  5051. }
  5052. let addCommentCount = false;
  5053. let nURs = uroURExtras.urList.length;
  5054.  
  5055. if(uroUtils.GetCBChecked('_cbMasterEnable') === true)
  5056. {
  5057. addCommentCount = ((nURs > 0) && (uroUtils.GetCBChecked('_cbCommentCount') === true));
  5058. }
  5059.  
  5060. if(addCommentCount === true)
  5061. {
  5062. for(let i = 0; i < nURs; ++i)
  5063. {
  5064. let uObj = uroURExtras.urList[i];
  5065. let nComments = uObj.nComments;
  5066. let marker = uroGetMarker(uroLayers.ID.UR, uObj.id);
  5067. if((marker !== null) && (nComments !== 0))
  5068. {
  5069. let mx = (marker.x.baseVal.value - 15);
  5070. let my = (marker.y.baseVal.value + 35);
  5071. let newSpan = '<foreignObject id="uroCommentCount" x="' + mx + '" y="' + my + '" width="100%" height="100%" style="pointer-events: none;">';
  5072.  
  5073. newSpan += '<div style="position:absolute;';
  5074. if(uObj.hasMyComments === true)
  5075. {
  5076. newSpan += 'background-color: yellow;';
  5077. }
  5078. else
  5079. {
  5080. newSpan += 'background-color: white;';
  5081. }
  5082. newSpan += 'font-size: 14px;font-weight: 800;';
  5083. newSpan += 'border-width: 1px;border-style: solid;border-radius: 12px;padding-left: 4px;padding-right: 4px;z-index: 1;';
  5084. newSpan += '">';
  5085. newSpan += nComments + 'c ';
  5086. newSpan += uObj.ageLastComment + 'd';
  5087. newSpan += '</div>';
  5088.  
  5089. newSpan += '</foreignObject>';
  5090. marker.insertAdjacentHTML("afterend", newSpan);
  5091. }
  5092. }
  5093. }
  5094. }
  5095. };
  5096. const uroInit = // script initialisation
  5097. {
  5098. initialised : false,
  5099. setupListeners : true,
  5100. finalisingListenerSetup : false,
  5101.  
  5102. WazeBitsAvailable: function()
  5103. {
  5104. uroDBG.AddLog('All WazeBits present and correct...');
  5105. W.prefs.on('change:isImperial', uroInit.Initialise);
  5106. uroLayers.Init();
  5107. // To avoid creating multiple URO tabs in the event that the initialise code
  5108. // gets called more than once, we now test for the presence of our tab and skip
  5109. // if it's already present
  5110. if(document.getElementById('uroTabHeader') === null)
  5111. {
  5112. uroInit.SetupUI();
  5113. }
  5114. },
  5115. WaitForW: function()
  5116. {
  5117. if(document.getElementsByClassName("sandbox").length > 0)
  5118. {
  5119. uroDBG.AddLog('WME practice mode detected, script is disabled...');
  5120. return;
  5121. }
  5122. if(window.W === undefined)
  5123. {
  5124. window.setTimeout(uroInit.WaitForW, 100);
  5125. return;
  5126. }
  5127. if (W.userscripts?.state?.isReady)
  5128. {
  5129. uroInit.WazeBitsAvailable();
  5130. }
  5131. else
  5132. {
  5133. document.addEventListener("wme-ready", uroInit.WazeBitsAvailable, {once: true});
  5134. }
  5135. },
  5136. AddInterceptor: function()
  5137. {
  5138. uroDBG.AddLog('Adding interceptor functions...');
  5139. // add interceptor function for window.confirm(), to inhibit the closure deletion confirmation that would
  5140. // pop up for each individual closure when we're using the delete all button - the user has already
  5141. // confirmed the delete action using our own requester
  5142. let _confirm = window.confirm;
  5143. window.confirm = function(msg)
  5144. {
  5145. let cm_delete_confirm = I18n.lookup("closures.delete_confirm").split('"')[0].trimRight(1);
  5146. if(msg.indexOf(cm_delete_confirm) != -1)
  5147. {
  5148. uroDBG.AddLog('intercepted closure delete confirmation...');
  5149. if(uroRTCClone.ConfirmDelete)
  5150. {
  5151. return _confirm(msg);
  5152. }
  5153. else
  5154. {
  5155. return true;
  5156. }
  5157. }
  5158. else if(typeof(msg) == 'undefined')
  5159. {
  5160. uroDBG.AddLog('Intercepted blank confirmation...');
  5161. return true;
  5162. }
  5163. else
  5164. {
  5165. return _confirm(msg);
  5166. }
  5167. };
  5168. uroConfirmIntercepted = true;
  5169. },
  5170. Initialise: function()
  5171. {
  5172. uroInit.initialised = false;
  5173. uroInit.setupListeners = true;
  5174. uroInit.finalisingListenerSetup = false;
  5175. uroInit.WaitForW();
  5176. },
  5177. WaitForControlsContainer: function()
  5178. {
  5179. if(document.getElementById('uroControlsContainer') === null)
  5180. {
  5181. window.setTimeout(uroInit.WaitForControlsContainer,500);
  5182. }
  5183. else
  5184. {
  5185. let updateURL = 'https://greasyfork.org/scripts/1952-uroverview-plus-uro';
  5186. uroDBG.AddLog('adding controls to sidebar container...');
  5187. let tabbyHTML = '<div id="uroTabHeader"><b><a href="'+updateURL+'" target="_blank">UROverview Plus</a></b> <label id="_uroVersion">'+uroRelease.version+'</label>';
  5188. tabbyHTML += '<label id="_uroDebugMode">(dbg)</label>';
  5189. tabbyHTML += '&nbsp;<input type="checkbox" id="_cbMasterEnable" checked>Enabled</input>';
  5190. tabbyHTML += uroTabs.CreateTabHeaders();
  5191. tabbyHTML += '</div>';
  5192. document.getElementById('uroControlsContainer').innerHTML = uroUtils.ModifyHTML(tabbyHTML);
  5193. uroTabs.CreateTabBodies();
  5194. // other sidebar elements
  5195. uroAMList = document.createElement('div');
  5196. uroAMList.style.color = "#ffff00";
  5197. uroCtrlHides = document.createElement('div');
  5198. // Object watchlist tab
  5199. {
  5200. uroOWL.CWLGroups = [];
  5201. uroTabs.PopulateOWL();
  5202. }
  5203. // footer for tabs container
  5204. uroCtrlHides.id = 'uroCtrlHides';
  5205. let tHTML = '<input type="button" id="_btnUndoLastHide" value="Undo last hide" />&nbsp;&nbsp;&nbsp;';
  5206. tHTML += '<input type="button" id="_btnClearSessionHides" value="Undo all hides" /><p>';
  5207. uroCtrlHides.innerHTML = uroUtils.ModifyHTML(tHTML);
  5208. // footer for AM list
  5209. uroAMList.id = 'uroAMList';
  5210. uroTabs.CtrlTabs[0][uroTabs.FIELDS.SHOWFN]();
  5211. window.addEventListener("beforeunload", uroConfig.SaveSettings, false);
  5212. }
  5213. },
  5214. AddTab_API: async function()
  5215. {
  5216. let {tabLabel, tabPane} = W.userscripts.registerSidebarTab("URO+");
  5217. tabLabel.innerText = "URO+";
  5218. tabPane.innerHTML = uroUtils.ModifyHTML(uroControls.innerHTML);
  5219. await W.userscripts.waitForElementConnected(tabPane);
  5220. uroInit.CompleteUISetup();
  5221. },
  5222. CompleteUISetup: function()
  5223. {
  5224. uroDBG.AddLog('waiting for controls container...');
  5225. uroInit.WaitForControlsContainer();
  5226. uroGetProblemTypes();
  5227. uroTabs.AddToDOM();
  5228. document.getElementById('uroControlsContainer').appendChild(uroCtrlHides);
  5229. uroInit.WazeBits();
  5230. uroDiv.addEventListener("mouseover", uroPopup.MouseOver, false);
  5231. uroDiv.addEventListener("mouseout", uroPopup.MouseOut, false);
  5232. if(sessionStorage.UROverview_FID_IgnoreList === undefined) sessionStorage.UROverview_FID_IgnoreList = '';
  5233. if(sessionStorage.UROverview_FID_WatchList === undefined) sessionStorage.UROverview_FID_WatchList = '';
  5234. if(uroConfirmIntercepted === false) uroInit.AddInterceptor();
  5235. uroUtils.AddStyle('urostyle_UnstackedMarkers', '.map-marker.marker-selected { transform: scale(1) !important; }');
  5236. uroMainTickHandlerID = window.setInterval(uroMainTick,1000);
  5237. },
  5238. SetupUI: function()
  5239. {
  5240. // create a new div to display the UR details floaty-box
  5241. uroDiv = document.createElement('div');
  5242. uroDiv.id = "uroDiv";
  5243. uroDiv.style.position = 'absolute';
  5244. uroDiv.style.visibility = 'hidden';
  5245. uroDiv.style.top = '0';
  5246. uroDiv.style.left = '0';
  5247. uroDiv.style.zIndex = 10000;
  5248. uroDiv.style.backgroundColor = 'aliceblue';
  5249. uroDiv.style.borderWidth = '3px';
  5250. uroDiv.style.borderStyle = 'solid';
  5251. uroDiv.style.borderRadius = '10px';
  5252. uroDiv.style.boxShadow = '5px 5px 10px Silver';
  5253. uroDiv.style.padding = '4px';
  5254. document.body.appendChild(uroDiv);
  5255. // create a new div to display script alerts
  5256. uroAlerts = document.createElement('div');
  5257. uroAlerts.id = "uroAlerts";
  5258. uroAlerts.style.position = 'fixed';
  5259. uroAlerts.style.visibility = 'hidden';
  5260. uroAlerts.style.top = '50%';
  5261. uroAlerts.style.left = '50%';
  5262. uroAlerts.style.zIndex = 10000;
  5263. uroAlerts.style.backgroundColor = 'aliceblue';
  5264. uroAlerts.style.borderWidth = '3px';
  5265. uroAlerts.style.borderStyle = 'solid';
  5266. uroAlerts.style.borderRadius = '10px';
  5267. uroAlerts.style.boxShadow = '5px 5px 10px Silver';
  5268. uroAlerts.style.padding = '4px';
  5269. uroAlerts.style.webkitTransform = "translate(-50%, -50%)";
  5270. uroAlerts.style.transform = "translate(-50%, -50%)";
  5271. let alertsHTML = '<div id="header" style="padding: 4px; background-color:LightGreen; font-weight: bold;">Alert title goes here...</div>';
  5272. alertsHTML += '<div id="content" style="padding: 4px; background-color:White; overflow:auto;max-height:500px">Alert content goes here...</div>';
  5273. alertsHTML += '<div id="controls" align="center" style="padding: 4px;">';
  5274. alertsHTML += '<span id="uroAlertTickBtn" style="cursor:pointer;font-size:14px;border:thin outset black;padding:2px 10px 2px 10px;">';
  5275. alertsHTML += '<i class="fa fa-check"> </i>';
  5276. alertsHTML += '<span id="uroAlertTickBtnCaption" style="font-weight: bold;"></span>';
  5277. alertsHTML += '</span>';
  5278. alertsHTML += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
  5279. alertsHTML += '<span id="uroAlertCrossBtn" style="cursor:pointer;font-size:14px;border:thin outset black;padding:2px 10px 2px 10px;">';
  5280. alertsHTML += '<i class="fa fa-times"> </i>';
  5281. alertsHTML += '<span id="uroAlertCrossBtnCaption" style="font-weight: bold;"></span>';
  5282. alertsHTML += '</span>';
  5283. alertsHTML += '</div>';
  5284. uroAlerts.innerHTML = uroUtils.ModifyHTML(alertsHTML);
  5285. document.body.appendChild(uroAlerts);
  5286. uroControls = document.createElement('section');
  5287. uroControls.style.fontSize = '12px';
  5288. uroControls.style.height = '100%';
  5289. uroControls.id = "sidepanel-uroverview";
  5290. uroControls.className = "tab-pane";
  5291. uroControls.innerHTML = uroUtils.ModifyHTML('<div id="uroControlsContainer" style="display:flex;flex-direction:column;height:80vh;"></div>');
  5292. uroInit.AddTab_API();
  5293. },
  5294. WazeBits: function()
  5295. {
  5296. uroMCLayer = null;
  5297.  
  5298. for(let i=0; i < W.map.layers.length; i++)
  5299. {
  5300. if(W.map.layers[i].name == 'mapComments') uroMCLayer = W.map.layers[i];
  5301. if(W.map.layers[i].name == 'venues') uroVenueLayer = W.map.layers[i];
  5302. }
  5303. },
  5304. FinalizeListenerSetup: function()
  5305. {
  5306. uroInit.finalisingListenerSetup = true;
  5307. // filter markers when the marker objects are modified (this happens whenever WME needs to load fresh marker data
  5308. // due to having panned/zoomed the map beyond the extents of the previously loaded data)
  5309. W.model.mapUpdateRequests.on("objectschanged", uroFilterURs_onObjectsChanged);
  5310. W.model.mapUpdateRequests.on("objectsadded", uroFilterURs_onObjectsAdded);
  5311. W.model.mapUpdateRequests.on("objectsremoved", uroFilterURs_onObjectsRemoved);
  5312. W.model.updateRequestSessions.on("objectsadded", uroUREvent_onObjectsAdded);
  5313. W.model.cameras.on("objectschanged", uroFilterCameras);
  5314. W.model.cameras.on("objectsadded", uroFilterCameras);
  5315. W.model.cameras.on("objectsremoved", uroFilterCameras);
  5316. W.model.mapProblems.on("objectschanged", uroFilterProblems);
  5317. W.model.mapProblems.on("objectsadded", uroFilterProblems);
  5318. W.model.mapProblems.on("objectsremoved", uroFilterProblems);
  5319. W.model.venues.on("objectschanged", uroFilterPlaces);
  5320. W.model.venues.on("objectsadded", uroFilterPlaces);
  5321. W.model.venues.on("objectsremoved", uroFilterPlaces);
  5322. W.model.mapComments.on("objectschanged", uroLayers.MCLayerChanged_changed);
  5323. W.model.mapComments.on("objectsadded", uroLayers.MCLayerChanged_added);
  5324. W.model.mapComments.on("objectsremoved", uroLayers.MCLayerChanged_removed);
  5325. uroMarkers.RegisterEvents();
  5326. uroLayers.InitialiseMOs();
  5327. uroUtils.AddEventListener('_btnUndoLastHide', "click", uroIgnore.RemoveLastAdded, true);
  5328. uroUtils.AddEventListener('_btnClearSessionHides', "click", uroIgnore.RemoveAll, true);
  5329. uroIgnore.EnableControls();
  5330. uroUtils.AddEventListener('_btnClearCamWatchList', "click", uroOWL.ClearCamWatchList, true);
  5331. uroUtils.AddEventListener('_btnSettingsToText', "click", uroConfig.SettingsToText, true);
  5332. uroUtils.AddEventListener('_btnTextToSettings', "click", uroConfig.TextToSettings, true);
  5333. uroUtils.AddEventListener('_btnResetSettings', "click", uroConfig.DefaultSettings, true);
  5334. uroUtils.AddEventListener('_btnClearSettingsText', "click", uroConfig.ClearSettingsText, true);
  5335. uroUtils.AddEventListener('_cbMasterEnable', "click", uroFilterItems_MasterEnableClick, true);
  5336. /*
  5337. uroUtils.AddEventListener('_btnDebugToScreen',"click", uroDBG.Dump, true);
  5338. */
  5339. uroUtils.AddEventListener('uroDiv', "dblclick", uroPopup.Suppress, true);
  5340. uroUtils.AddEventListener('_selectCameraUserID', "change", uroCamEditorSelected, true);
  5341. uroUtils.AddEventListener('_selectPlacesUserID', "change", uroPlacesEditorSelected, true);
  5342. uroUtils.AddEventListener('_selectHidePlacesUserID', "change", uroHidePlacesEditorSelected, true);
  5343. uroUtils.AddEventListener('uroAlertTickBtn', 'click', uroAlertBox.CloseWithTick, true);
  5344. uroUtils.AddEventListener('uroAlertCrossBtn', 'click', uroAlertBox.CloseWithCross, true);
  5345. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  5346. {
  5347. uroUtils.SetOnClick(uroTabs.CtrlTabs[i][uroTabs.FIELDS.LINKID], uroTabs.CtrlTabs[i][uroTabs.FIELDS.SHOWFN]);
  5348. }
  5349. for(let idx=0;idx<W.Config.venues.categories.length;idx++)
  5350. {
  5351. uroUtils.SetOnClick('_uroPlacesGroupState-'+idx,uroPlacesGroupCollapseExpand);
  5352. }
  5353. uroDBG.AddLog('finalise onload');
  5354. uroNewLookCheckDetailsRequest();
  5355. // filter markers as and when the map is moved
  5356. W.map.events.register("moveend", null, uroMapMoveEnd.Handler);
  5357. W.map.events.register("moveend", null, uroGetAMs); // uroGetAMs accesses e, so has to be called directly from the event handler
  5358. W.map.events.register("mousemove", null, uroGetAMs);
  5359. W.map.events.register("mousemove", null, uroMarkers.MouseMove);
  5360. W.map.events.registerPriority("mousedown", null, uroMouseDown);
  5361. // trap mousedown on Streetview marker drag
  5362. if(document.getElementsByClassName('street-view-control').length === 0) return;
  5363. document.getElementsByClassName('street-view-control')[0].onmousedown = uroMouseDown;
  5364. W.map.events.register("mouseup", null, uroMouseUp);
  5365. W.map.events.register("mouseout", null, uroMouseOut);
  5366. uroSetSectionTabStyles();
  5367. uroConfig.LoadSettings();
  5368. uroDBG.AddLog('getting user ID...');
  5369. uroUserID = W.loginManager.user.attributes.id;
  5370. uroDBG.AddLog('...ID is '+uroUserID);
  5371. uroDBG.AddLog('filtering...');
  5372. uroFilterItems();
  5373. uroDBG.AddLog('...done');
  5374. uroDBG.showDebugOutput = uroDBG.persistentDebugOutput;
  5375. let dbgMode = "none";
  5376. if(uroDBG.showDebugOutput)
  5377. {
  5378. dbgMode = "inline";
  5379. }
  5380. document.getElementById('_uroDebugMode').style.display = dbgMode;
  5381. uroUtils.AddEventListener('_uroVersion',"click", uroDBG.Toggle, true);
  5382. // add exclusiveCB click handlers to all checkboxes with a pairedWith attribute
  5383. uroDBG.AddLog('adding exclusiveCB handlers...');
  5384. let cbList = document.getElementsByTagName('input');
  5385. for (let optIdx=0;optIdx<cbList.length;optIdx++)
  5386. {
  5387. if((cbList[optIdx].id.indexOf('_cb') === 0) && (cbList[optIdx].attributes.pairedWith != null))
  5388. {
  5389. uroUtils.SetOnClick(cbList[optIdx].id,uroExclusiveCB);
  5390. }
  5391. }
  5392. uroDBG.AddLog('...done');
  5393. // manually call the layer-change handlers on startup, since there's a good chance WME will already have
  5394. // completed its own startup layer changes before our handlers get registered, preventing the marker handlers
  5395. // from being set up as expected on any markers which are visible in the startup map view before the user forces
  5396. // a layer update by panning/zooming/etc...
  5397. uroLayers.RunChangeHandlers();
  5398.  
  5399. uroUITweaks.Setup();
  5400. uroInit.setupListeners = false;
  5401. uroMainTickStage = 0;
  5402. window.clearInterval(uroMainTickHandlerID);
  5403. window.setInterval(uroMainTick, 10);
  5404. uroInit.initialised = true;
  5405. }
  5406. };
  5407. const uroUITweaks = // native UI enhancements
  5408. {
  5409. MO_SidePanel : null,
  5410. MO_ReportPanel : null,
  5411.  
  5412. ChangeMapBGColour: function()
  5413. {
  5414. let mapviewport = document.getElementById("WazeMap").getElementsByClassName("olMapViewport")[0];
  5415. if((uroUtils.GetCBChecked('_cbWhiteBackground') === true) && (uroUtils.GetCBChecked('_cbMasterEnable') === true))
  5416. {
  5417. let customColour = '#' + uroUtils.ToHex(uroUtils.GetElmValue('_inputCustomBackgroundRed'),2);
  5418. customColour += uroUtils.ToHex(uroUtils.GetElmValue('_inputCustomBackgroundGreen'),2);
  5419. customColour += uroUtils.ToHex(uroUtils.GetElmValue('_inputCustomBackgroundBlue'),2);
  5420. mapviewport.style.setProperty('background',customColour,'important');
  5421. }
  5422. else
  5423. {
  5424. mapviewport.style.setProperty('background',"#354148",'important');
  5425. }
  5426. },
  5427. HideAMLayer: function()
  5428. {
  5429. // If this sounds like a weird function - why not just switch off the layer from the layers menu? - then
  5430. // remember that in order for URO+ to be able to display in its own tab the list of AMs under the current
  5431. // mouse pointer location, which is somewhat more useful than the list given in the topbar, it needs the
  5432. // AM layer to be activated so that the AM areas data is loaded into WME. It doesn't however need the layer
  5433. // to then be visible, and since having a bunch of purple polygons covering the map can make for a rather
  5434. // difficult editing experience, being able to hide the polys whilst retaining the area information is
  5435. // of real benefit...
  5436. if((uroUtils.GetCBChecked('_cbHideAMLayer')) && (uroUtils.GetCBChecked('_cbMasterEnable')))
  5437. {
  5438. W.map.managedAreasLayer.setOpacity(0);
  5439. }
  5440. else
  5441. {
  5442. W.map.managedAreasLayer.setOpacity(1);
  5443. }
  5444. },
  5445. HideSegments: function()
  5446. {
  5447. // Hides the vector segments when the raster segment layer is hidden
  5448. if(uroUtils.GetCBChecked('_cbHideSegmentsWhenRoadsHidden'))
  5449. {
  5450. W.map.segmentLayer.drawn = W.map.roadLayer.visibility;
  5451. W.map.nodeLayer.drawn = W.map.roadLayer.visibility;
  5452. }
  5453. else
  5454. {
  5455. W.map.segmentLayer.drawn = true;
  5456. W.map.nodeLayer.drawn = true;
  5457. }
  5458. },
  5459. ReportPanelChange: function()
  5460. {
  5461. if(uroMarkers.inhibitSetCenter === true)
  5462. {
  5463. let bcr = document.querySelector('#panel-container').getBoundingClientRect();
  5464. if(bcr.width > 0)
  5465. {
  5466. uroMarkers.inhibitSetCenter = false;
  5467. W.map.setCenter(uroMarkers.clickedOnCenter);
  5468. }
  5469. }
  5470. },
  5471. CheckForClosurePanel: function()
  5472. {
  5473. if(uroUtils.IsClosureUIActive() === true)
  5474. {
  5475. // Closure panel active
  5476. let uroMO_ClosureUI = new MutationObserver(uroClosureEditUIChanged);
  5477. uroMO_ClosureUI.disconnect();
  5478. uroMO_ClosureUI.observe(document.querySelector('wz-tab.closures-tab'),{subtree: true, attributes: true});
  5479. uroClosureEditUIChanged();
  5480. }
  5481. },
  5482. SidePanelChange: function()
  5483. {
  5484. // The sidepanel MO only fires when the sidepanel changes in bulk - i.e. when first rendered, or
  5485. // when changing to show details for a different type of map object. Once this version of the
  5486. // panel is open, any internal changes, such as selecting a different tab within the panel, do
  5487. // NOT trigger the MO. Consequently, if a segment is selected and the sidepanel doesn't then
  5488. // open with the closures tab already selected, the MO will fire at this point rather than at the
  5489. // point where the closures tab is selected...
  5490. //
  5491. // To ensure the closures UI enhancements are applied consistently, we therefore need to set up an
  5492. // onclick handler to deal with the sidepanel opening into a different tab and the user then
  5493. // clicking through into the closures tab after this MO has already fired, but we ALSO still need
  5494. // to check for the availability of the closures UI here as well just in case the sidepanel opens
  5495. // into the closures tab directly.
  5496. //
  5497. // Easy really...
  5498.  
  5499. let elmToClick = document.querySelector('#edit-panel');
  5500. if(elmToClick !== null)
  5501. {
  5502. uroUtils.SetOnClick(elmToClick, uroUITweaks.CheckForClosurePanel);
  5503. }
  5504. uroUITweaks.CheckForClosurePanel();
  5505. },
  5506. Setup: function()
  5507. {
  5508. uroUITweaks.MO_SidePanel = new MutationObserver(uroUITweaks.SidePanelChange);
  5509. uroUITweaks.MO_SidePanel.observe(document.getElementById('edit-panel'), {childList: true, subtree: true});
  5510. uroUITweaks.MO_ReportPanel = new MutationObserver(uroUITweaks.ReportPanelChange);
  5511. uroUITweaks.MO_ReportPanel.observe(document.getElementById('panel-container'), {childList: true, subtree: true});
  5512.  
  5513. uroUITweaks.ChangeMapBGColour();
  5514. uroUITweaks.HideAMLayer();
  5515. uroUITweaks.HideSegments();
  5516. }
  5517. };
  5518. const uroMapMoveEnd = // things that happen after a move of the map view
  5519. {
  5520. lat : null,
  5521. lon: null,
  5522. zoom: null,
  5523. Handler: function()
  5524. {
  5525. let mc = W.map.getCenter();
  5526. let z = W.map.getZoom();
  5527. if((mc.lat != this.lat) || (mc.lon != this.lon) || (z != this.zoom))
  5528. {
  5529. // Apply any filters which need to be updated when the map view changes,
  5530. // and which won't be applied via an event handler or mutation observer
  5531. // attached to the relevant layer etc...
  5532. uroFilterProblems();
  5533. uroFilterPlaces();
  5534. uroFilterCameras();
  5535. uroFilterURs();
  5536. uroFilterRAs();
  5537. uroFilterMapComments();
  5538.  
  5539. uroMiscUITweaksHandler();
  5540. uroLayers.MCLayerChanged();
  5541. this.lat = mc.lat;
  5542. this.lon = mc.lon;
  5543. this.zoom = z;
  5544. }
  5545. }
  5546. };
  5547.  
  5548.  
  5549. // ================================================================================================
  5550. // Here be the unfactored wilderness...
  5551. // ================================================================================================
  5552.  
  5553.  
  5554. function uroTempFixMTEDropDown()
  5555. {
  5556. // Auto-selects the "None" event in the closures tab to avoid the user having to manually select it for almost
  5557. // every single closure they'll ever add - the only time you'd need to select anything other than None is when
  5558. // adding a closure related to a MTE...
  5559.  
  5560. let retval = false;
  5561.  
  5562. let tObj = document.getElementById('closure_eventId');
  5563. // Make sure the closure event list is available, and that we haven't already messed with it.
  5564. if((tObj !== null) && (tObj.tag != "touchedByURO"))
  5565. {
  5566. // The event dropdown is now some byzantine piece of DOM manipulation to generate something which looks like a
  5567. // regular select list, but which can't be manipulated like one... The first gotcha is that the selected item
  5568. // exists only within a shadow DOM section within the dropdown rather than simply being part of the list from
  5569. // which we'd be able to read off its selected index. So to check whether or not the user has selected an
  5570. // event already, we need to drill down into this shadow DOM to get its text contents, and compare those against
  5571. // the I18n translation for the choose event text. What a palaver...
  5572. let shadowElm = tObj.shadowRoot.querySelectorAll('.selected-value')[0];
  5573. if(shadowElm !== undefined)
  5574. {
  5575. let eventText = tObj.shadowRoot.querySelectorAll('.selected-value')[0].innerText;
  5576. // Sometimes we get here before WME has finished rendering, so if the event text hasn't been set yet then we
  5577. // need to return false and let the caller deal with it...
  5578. if(eventText !== '')
  5579. {
  5580. if(eventText == I18n.lookup('closures.choose_event'))
  5581. {
  5582. // Having now established that, yes, the closure hasn't yet been associated with any event, it's surprisingly
  5583. // easy to change it to "None" - we just generate a click event on the first child element in the main DOM (not
  5584. // the shadow DOM this time), which replicates what the user would do to select None manually.
  5585. tObj.children[0].click();
  5586. }
  5587. // Tag the event list to prevent further processing attempts whilst this closure remains open.
  5588. tObj.tag = "touchedByURO";
  5589. retval = true;
  5590. }
  5591. }
  5592. }
  5593.  
  5594. return retval;
  5595. }
  5596. let uroPendingURSessionsTotal;
  5597. let uroFinalizeTimeoutHandle = null;
  5598. function uroFinalizeURSessionsGet()
  5599. {
  5600. if(uroPendingURSessionsTotal != uroPendingURSessionIDs.length)
  5601. {
  5602. uroPendingURSessionsTotal = uroPendingURSessionIDs.length;
  5603. if(uroFinalizeTimeoutHandle !== null)
  5604. {
  5605. window.clearTimeout(uroFinalizeTimeoutHandle);
  5606. uroFinalizeTimeoutHandle = null;
  5607. }
  5608. uroFinalizeTimeoutHandle = window.setTimeout(uroFinalizeURSessionsGet, 500);
  5609. return;
  5610. }
  5611.  
  5612. let idList = [];
  5613.  
  5614. while((idList.length < 50) && (uroPendingURSessionIDs.length))
  5615. {
  5616. let id = uroPendingURSessionIDs.shift();
  5617. idList.push(id);
  5618. }
  5619.  
  5620. if(idList.length > 0)
  5621. {
  5622. uroDBG.AddLog('grabbing '+idList.length+' updateRequestSessions, IDs: '+idList);
  5623. W.model.updateRequestSessions.getAsync(idList);
  5624. }
  5625.  
  5626. if((uroPendingURSessionIDs.length) || (uroRequestedURSessionIDs.length))
  5627. {
  5628. window.setTimeout(uroGetUpdateRequestSessions,1000);
  5629. }
  5630. else
  5631. {
  5632. uroPopulatingRequestSessions = false;
  5633. }
  5634. }
  5635. function uroGetUpdateRequestSessions()
  5636. {
  5637. uroPendingURSessionsTotal = uroPendingURSessionIDs.length;
  5638. if(uroFinalizeTimeoutHandle !== null)
  5639. {
  5640. window.clearTimeout(uroFinalizeTimeoutHandle);
  5641. uroFinalizeTimeoutHandle = null;
  5642. }
  5643. uroFinalizeTimeoutHandle = window.setTimeout(uroFinalizeURSessionsGet,500);
  5644. }
  5645. function uroRefreshUpdateRequestSessions()
  5646. {
  5647. let urcount = 0;
  5648. uroPendingURSessionIDs = [];
  5649. uroRequestedURSessionIDs = [];
  5650. uroPopulatingRequestSessions = true;
  5651. for (let urID in W.model.mapUpdateRequests.objects)
  5652. {
  5653. if(W.model.mapUpdateRequests.objects.hasOwnProperty(urID))
  5654. {
  5655. if(W.model.updateRequestSessions.objects[urID] === undefined)
  5656. {
  5657. uroPendingURSessionIDs.push(urID);
  5658. }
  5659. urcount++;
  5660. }
  5661. }
  5662. uroGetUpdateRequestSessions();
  5663. }
  5664. function uroURHasMyComments(fid)
  5665. {
  5666. if(uroUserID === -1)
  5667. {
  5668. return false;
  5669. }
  5670. let nComments = W.model.updateRequestSessions.objects[fid].attributes.comments.length;
  5671. if(nComments === 0)
  5672. {
  5673. return false;
  5674. }
  5675.  
  5676. for(let cidx=0; cidx<nComments; cidx++)
  5677. {
  5678. if(W.model.updateRequestSessions.objects[fid].attributes.comments[cidx].userID == uroUserID)
  5679. {
  5680. return true;
  5681. }
  5682. }
  5683.  
  5684. return false;
  5685. }
  5686. function uroIsFilteringEnabled(ignoreZoom)
  5687. {
  5688. let retval = false;
  5689. if
  5690. (
  5691. (uroUtils.GetCBChecked('_cbMasterEnable') === true) &&
  5692. (
  5693. (ignoreZoom === true) ||
  5694. (W.map.getZoom() <= uroUtils.GetElmValue('_inputFilterMinZoomLevel'))
  5695. )
  5696. )
  5697. {
  5698. retval = true;
  5699. }
  5700. return retval;
  5701. }
  5702. function uroUpdateMTEList()
  5703. {
  5704. if(Object.keys(W.model.majorTrafficEvents.objects).length === 0) return;
  5705.  
  5706. let selectedIdx = null;
  5707. let idx;
  5708. let mteNames = [];
  5709. let mteIDs = [];
  5710. for(idx in W.model.majorTrafficEvents.objects)
  5711. {
  5712. if(W.model.majorTrafficEvents.objects.hasOwnProperty(idx))
  5713. {
  5714. let name = W.model.majorTrafficEvents.objects[idx].attributes.names[0]?.value;
  5715. if(mteNames.indexOf(name) == -1)
  5716. {
  5717. mteNames.push(name);
  5718. mteIDs.push(idx);
  5719. }
  5720. }
  5721. }
  5722. // check for any previously selected ID in the list, then clear it and repopulate
  5723. // using the newly gathered ID collection from above, and finally reselect the
  5724. // previously selected MTE if its still present in the new list...
  5725. let selector;
  5726. let selectedID;
  5727. let selectorEntry;
  5728.  
  5729. selector = document.getElementById('_selectRTCMTE');
  5730. selectedID = null;
  5731. if(selector.selectedOptions[0] != null)
  5732. {
  5733. selectedID = selector.selectedOptions[0].value;
  5734. }
  5735. while(selector.options.length > 0)
  5736. {
  5737. selector.options.remove(0);
  5738. }
  5739. selector.options.add(new Option('<select a MTE>', null));
  5740. if(mteNames.length > 0)
  5741. {
  5742. selectorEntry = '';
  5743. for(idx=0; idx<mteNames.length; idx++)
  5744. {
  5745. selectorEntry = mteNames[idx];
  5746. selector.options.add(new Option(selectorEntry, mteIDs[idx]));
  5747. if(mteIDs[idx] == selectedID)
  5748. {
  5749. selectedIdx = idx+1;
  5750. }
  5751. }
  5752. }
  5753.  
  5754. if(selectedIdx !== null)
  5755. {
  5756. selector.selectedIndex = selectedIdx;
  5757. }
  5758. }
  5759. function uroRTCMarkerInfo(mIdx, isVisible)
  5760. {
  5761. let pri = null;
  5762. let status = null;
  5763. let dir = null;
  5764. let pos = null;
  5765. let mID = null;
  5766.  
  5767. let mObj = uroLayers.layers[uroLayers.ID.RTC].l.markers[mIdx];
  5768. if(mObj !== undefined)
  5769. {
  5770. // Store the marker status - if we've already made a note of the original
  5771. // status by adding an _orig-suffixed classname, extract the status from
  5772. // that rather than from the class currently being used to display the
  5773. // marker, to preserve the original status regardless of what we may have
  5774. // done to it subsequently as a result of our RTC filtering setup...
  5775. let cList = mObj.element.classList;
  5776. for(let i = 0; i < cList.length; ++i)
  5777. {
  5778. if(cList[i].indexOf('_orig') != -1)
  5779. {
  5780. status = cList[i].replace('_orig', '');
  5781. }
  5782. }
  5783. if(status === null)
  5784. {
  5785. for(let i = 0; i < cList.length; ++i)
  5786. {
  5787. if(cList[i].indexOf('status-') != -1)
  5788. {
  5789. status = cList[i];
  5790. }
  5791. }
  5792. }
  5793.  
  5794. // Assign a priority level to the marker so we know whether to show or hide
  5795. // it if it's stacked up with others on the same segment - the level set here
  5796. // follows the priority used by WME to decide which closures to show normally.
  5797. if(status == "status-active")
  5798. {
  5799. pri = 2;
  5800. }
  5801. else if(status == "status-not-started")
  5802. {
  5803. pri = 1;
  5804. }
  5805. else
  5806. {
  5807. pri = 0;
  5808. }
  5809.  
  5810. // To avoid the need to cross-reference with the closure model object, use the
  5811. // classname of the arrow attached to this marker to determine if the closure is
  5812. // in the forward or reverse direction.
  5813. if(mObj.element.childNodes.length == 1)
  5814. {
  5815. if(mObj.element.childNodes[0].className.indexOf('forward') != -1)
  5816. {
  5817. dir = "fwd";
  5818. }
  5819. else if(mObj.element.childNodes[0].className.indexOf('backward') != -1)
  5820. {
  5821. dir = "rev";
  5822. }
  5823. }
  5824.  
  5825. pos = mObj.px;
  5826. mID = mObj.element.dataset.id;
  5827. }
  5828.  
  5829. this.isVisible = isVisible;
  5830. this.pos = pos;
  5831. this.pri = pri;
  5832. this.mID = mID;
  5833. this.status = status;
  5834. this.dir = dir;
  5835. }
  5836. function uroFilterRTCs()
  5837. {
  5838. let pmTStart = performance.now();
  5839. let pmFunction = "uroFilterRTCs";
  5840.  
  5841. if(uroFilterPreamble() === false) return;
  5842.  
  5843. let closureLayer = uroLayers.layers[uroLayers.ID.RTC].l;
  5844. if(closureLayer.markers.length === 0) return;
  5845.  
  5846. let uFR_filterActiveFromWME = uroUtils.GetCBChecked('_cbHideEditorRTCs');
  5847. let uFR_filterActiveFromWazeFeed = uroUtils.GetCBChecked('_cbHideWazeFeedRTCs');
  5848. let uFR_filterActiveFromWazeOther = uroUtils.GetCBChecked('_cbHideWazeRTCs');
  5849. let uFR_filterFutureFromWME = uroUtils.GetCBChecked('_cbHideFutureEditorRTCs');
  5850. let uFR_filterFutureFromWazeFeed = uroUtils.GetCBChecked('_cbHideFutureWazeFeedRTCs');
  5851. let uFR_filterFutureFromWazeOther = uroUtils.GetCBChecked('_cbHideFutureWazeRTCs');
  5852. let uFR_filterExpiredFromWME = uroUtils.GetCBChecked('_cbHideExpiredEditorRTCs');
  5853. let uFR_filterExpiredFromWazeFeed = uroUtils.GetCBChecked('_cbHideExpiredWazeFeedRTCs');
  5854. let uFR_filterExpiredFromWazeOther = uroUtils.GetCBChecked('_cbHideExpiredWazeRTCs');
  5855. let uFR_filterShowForMTE = uroUtils.GetCBChecked('_cbShowMTERTCs');
  5856. let uFR_filterHideForMTE = uroUtils.GetCBChecked('_cbHideMTERTCs');
  5857. let uFR_filterHideDurationLessThan = uroUtils.GetCBChecked('_cbEnableRTCDurationFilterLessThan');
  5858. let uFR_filterHideDurationMoreThan = uroUtils.GetCBChecked('_cbEnableRTCDurationFilterMoreThan');
  5859. let uFR_thresholdDurationLessThan = uroUtils.GetElmValue('_inputFilterRTCDurationLessThan');
  5860. let uFR_thresholdDurationMoreThan = uroUtils.GetElmValue('_inputFilterRTCDurationMoreThan');
  5861.  
  5862. let uFR_filterShowForTS = uroUtils.GetCBChecked('_cbRTCFilterShowForTS');
  5863. let uFR_filterHideForTS = uroUtils.GetCBChecked('_cbRTCFilterHideForTS');
  5864. let tsD = uroUtils.GetElmValue('_inputRTCFilterDay');
  5865. let tsMo = uroUtils.GetElmValue('_inputRTCFilterMonth');
  5866. let tsY = uroUtils.GetElmValue('_inputRTCFilterYear');
  5867. let tsH = uroUtils.GetElmValue('_inputRTCFilterHour');
  5868. let tsMi = uroUtils.GetElmValue('_inputRTCFilterMin');
  5869. let filterTS = uroUtils.GetTS(tsD, tsMo, tsY, tsH, tsMi);
  5870. uroUpdateMTEList();
  5871. let mteID = null;
  5872. let selectorMTE = document.getElementById('_selectRTCMTE');
  5873. if(selectorMTE?.selectedOptions[0] != null)
  5874. {
  5875. mteID = selectorMTE.selectedOptions[0].value;
  5876. }
  5877.  
  5878. let uFR_masterEnable = uroIsFilteringEnabled(false);
  5879.  
  5880. let markerInfo = [];
  5881.  
  5882. // Pass 1 - determine which filtering to apply to each of the RTC markers
  5883. let markerIdx = 0;
  5884. for (let rtcObj in W.model.roadClosures.objects)
  5885. {
  5886. let isVisible = true;
  5887.  
  5888. if(uFR_masterEnable === true)
  5889. {
  5890. let rtcModel = W.model.roadClosures.objects[rtcObj];
  5891.  
  5892. if(mteID !== null)
  5893. {
  5894. if((uFR_filterShowForMTE === true) && (rtcModel.attributes.eventId !== mteID))
  5895. {
  5896. isVisible = false;
  5897. }
  5898. if((uFR_filterHideForMTE === true) && (rtcModel.attributes.eventId === mteID))
  5899. {
  5900. isVisible = false;
  5901. }
  5902. }
  5903.  
  5904. let rtcType = uroGetRTCOrigin(rtcModel);
  5905. let rtcState = uroGetRTCState(rtcModel);
  5906.  
  5907. if(rtcType == URO_TRTC.WAZEFEED)
  5908. {
  5909. if
  5910. (
  5911. ((rtcState === URO_SRTC.ACTIVE) && (uFR_filterActiveFromWazeFeed === true)) ||
  5912. ((rtcState === URO_SRTC.FUTURE) && (uFR_filterFutureFromWazeFeed === true)) ||
  5913. ((rtcState === URO_SRTC.EXPIRED) && (uFR_filterExpiredFromWazeFeed === true))
  5914. )
  5915. {
  5916. isVisible = false;
  5917. }
  5918. }
  5919. else if(rtcType == URO_TRTC.WAZEOTHER)
  5920. {
  5921. if
  5922. (
  5923. ((rtcState === URO_SRTC.ACTIVE) && (uFR_filterActiveFromWazeOther === true)) ||
  5924. ((rtcState === URO_SRTC.FUTURE) && (uFR_filterFutureFromWazeOther === true)) ||
  5925. ((rtcState === URO_SRTC.EXPIRED) && (uFR_filterExpiredFromWazeOther === true))
  5926. )
  5927. {
  5928. isVisible = false;
  5929. }
  5930. }
  5931. else
  5932. {
  5933. if
  5934. (
  5935. ((rtcState === URO_SRTC.ACTIVE) && (uFR_filterActiveFromWME === true)) ||
  5936. ((rtcState === URO_SRTC.FUTURE) && (uFR_filterFutureFromWME === true)) ||
  5937. ((rtcState === URO_SRTC.EXPIRED) && (uFR_filterExpiredFromWME === true))
  5938. )
  5939. {
  5940. isVisible = false;
  5941. }
  5942. }
  5943. let rtcDuration = uroGetRTCDuration(rtcModel);
  5944. if(uFR_filterHideDurationLessThan === true)
  5945. {
  5946. if(rtcDuration < uFR_thresholdDurationLessThan)
  5947. {
  5948. isVisible = false;
  5949. }
  5950. }
  5951. if(uFR_filterHideDurationMoreThan === true)
  5952. {
  5953. if(rtcDuration > uFR_thresholdDurationMoreThan)
  5954. {
  5955. isVisible = false;
  5956. }
  5957. }
  5958. if((uFR_filterShowForTS === true) || (uFR_filterHideForTS === true))
  5959. {
  5960. let startTS = new Date(rtcModel.attributes.startDate).getTime();
  5961. let endTS = new Date(rtcModel.attributes.endDate).getTime();
  5962. if(uFR_filterShowForTS === true)
  5963. {
  5964. if((filterTS < startTS) || (filterTS > endTS))
  5965. {
  5966. isVisible = false;
  5967. }
  5968. }
  5969. if (uFR_filterHideForTS === true)
  5970. {
  5971. if((filterTS >= startTS) && (filterTS <= endTS))
  5972. {
  5973. isVisible = false;
  5974. }
  5975. }
  5976. }
  5977. }
  5978.  
  5979. markerInfo.push(new uroRTCMarkerInfo(markerIdx, isVisible));
  5980. ++markerIdx;
  5981. }
  5982.  
  5983. // Pass 2 - based on the initial filtering results, determine which markers *actually* should be
  5984. // made visible or hidden according both to our filtering settings AND any masking of this marker
  5985. // due to the presence of other higher priority markers at the same position which have also been
  5986. // marked as visible following the filtering pass...
  5987. //
  5988. // For added merriment, we also deal with the WME limitation that prevents it displaying two
  5989. // different types of closure arrow if a segment has a one-way closure which is a higher priority
  5990. // than a closure in the opposite direction.
  5991.  
  5992. let cNodesDiv = uroLayers.layers[uroLayers.ID.RTCnode].l.div;
  5993. for (let i = 0; i < markerIdx; ++i)
  5994. {
  5995. let status = markerInfo[i].status;
  5996.  
  5997. // Only apply this pass to closures which haven't already been hidden in pass 1, AND which
  5998. // have a valid marker position
  5999. if((markerInfo[i].isVisible === true) && (markerInfo[i].pos !== null))
  6000. {
  6001. // Iterate through all the other markers, looking for any which are also still visible
  6002. // and have the same marker position as the one we're currently processing
  6003. for (let j = 0; j < markerIdx; ++j)
  6004. {
  6005. if(j != i)
  6006. {
  6007. if((markerInfo[j].isVisible === true) && (markerInfo[j].pos !== null))
  6008. {
  6009. if((markerInfo[i].pos.x == markerInfo[j].pos.x) && (markerInfo[i].pos.y == markerInfo[j].pos.y))
  6010. {
  6011. if(markerInfo[j].pri > markerInfo[i].pri)
  6012. {
  6013. if(markerInfo[j].dir == markerInfo[i].dir)
  6014. {
  6015. // Mark the currently processed marker to be hidden only if this higher priority
  6016. // marker is for a closure in the same direction - if it's not, then we need to
  6017. // leave the current marker visible so that its arrow remains visible...
  6018. markerInfo[i].isVisible = false;
  6019. }
  6020. else
  6021. {
  6022. // Otherwise, if we're leaving the current marker visible then we'll need to
  6023. // alter its status class to match this higher-priority marker, so that the
  6024. // marker which is shown to the user remains correct regardless of what the
  6025. // relative stacking order of the markers is on this segment.
  6026. status = markerInfo[j].status;
  6027. }
  6028. break;
  6029. }
  6030. }
  6031. }
  6032. }
  6033. }
  6034. }
  6035.  
  6036. let marker = closureLayer.markers[i].element;
  6037. let markerClass = marker.className;
  6038.  
  6039. // Remove the hidden class if present - this allows markers natively hidden by WME due to being masked
  6040. // by higher priority markers to become visible again if our own filtering settings have hidden those
  6041. // higher priority marker...
  6042. markerClass = markerClass.replace(" road-closure-hidden", "");
  6043. if(markerInfo[i].isVisible == false)
  6044. {
  6045. // Apply the hidden class for any markers WE'VE decided need to be hidden
  6046. markerClass += " road-closure-hidden";
  6047. }
  6048. else
  6049. {
  6050. // For any markers which we're leaving visible, first check to see if it's a marker we haven't yet
  6051. // seen. If so, then we need to store its original status class for future reference.
  6052. if(markerClass.indexOf('_orig') == -1)
  6053. {
  6054. markerClass += (' '+markerInfo[i].status + '_orig');
  6055. }
  6056. // Now, to ensure this segment displays the appropriate marker for the highest priority closure
  6057. // still visible on it, we remove the existing status class and replace it with the one we
  6058. // chose above
  6059. markerClass = markerClass.replace(" status-finished "," ");
  6060. markerClass = markerClass.replace(" status-active "," ");
  6061. markerClass = markerClass.replace(" status-not-started "," ");
  6062. markerClass += ' '+status;
  6063. }
  6064. marker.className = markerClass;
  6065. let toHide = cNodesDiv.querySelectorAll("[data-id='"+markerInfo[i].mID+"']");
  6066. for(let j = 0; j < toHide.length; ++j)
  6067. {
  6068. if(markerInfo[i].isVisible === false)
  6069. {
  6070. toHide[j].style.visibility = "hidden";
  6071. }
  6072. else
  6073. {
  6074. toHide[j].style.visibility = "";
  6075. }
  6076. }
  6077. }
  6078.  
  6079. uroDBG.PerfMon(pmFunction, pmTStart);
  6080. }
  6081. function uroUpdateRAList()
  6082. {
  6083. if(Object.keys(W.model.restrictedDrivingAreas.objects).length === 0) return;
  6084.  
  6085. let selectedIdx = null;
  6086. let idx;
  6087. let raNames = [];
  6088. for(idx in W.model.restrictedDrivingAreas.objects)
  6089. {
  6090. if(W.model.restrictedDrivingAreas.objects.hasOwnProperty(idx))
  6091. {
  6092. let name = W.model.restrictedDrivingAreas.objects[idx].attributes.name;
  6093. if(raNames.indexOf(name) == -1)
  6094. {
  6095. raNames.push(name);
  6096. }
  6097. }
  6098. }
  6099. // check for any previously selected name in the list, then clear it and repopulate
  6100. // using the newly gathered collection from above, and finally reselect the
  6101. // previously selected MTE if its still present in the new list...
  6102. let selector;
  6103. let selectedName;
  6104. let selectorEntry;
  6105.  
  6106. selector = document.getElementById('_selectRA');
  6107. selectedName = null;
  6108. if(selector.selectedOptions[0] != null)
  6109. {
  6110. selectedName = selector.selectedOptions[0].value;
  6111. }
  6112. while(selector.options.length > 0)
  6113. {
  6114. selector.options.remove(0);
  6115. }
  6116. selector.options.add(new Option('<select a RA>', null));
  6117. if(raNames.length > 0)
  6118. {
  6119. selectorEntry = '';
  6120. for(idx=0; idx<raNames.length; idx++)
  6121. {
  6122. selectorEntry = raNames[idx];
  6123. selector.options.add(new Option(selectorEntry, selectorEntry));
  6124. if(selectorEntry == selectedName)
  6125. {
  6126. selectedIdx = idx+1;
  6127. }
  6128. }
  6129. }
  6130.  
  6131. if(selectedIdx !== null)
  6132. {
  6133. selector.selectedIndex = selectedIdx;
  6134. }
  6135. }
  6136. function uroUpdateEditorList(modelObj, listElement, useCreated, useUpdated, useResolved, useCommenter)
  6137. {
  6138. if(Object.keys(modelObj).length === 0) return;
  6139.  
  6140. let selector = document.getElementById(listElement);
  6141.  
  6142. let selectedUser = null;
  6143. if(selector.selectedOptions[0] != null)
  6144. {
  6145. selectedUser = parseInt(selector.selectedOptions[0].value);
  6146. }
  6147.  
  6148. while(selector.options.length > 0)
  6149. {
  6150. selector.options.remove(0);
  6151. }
  6152.  
  6153. let selectedIdx = null;
  6154. let listedIDs = [];
  6155. let idx;
  6156. for(idx in modelObj)
  6157. {
  6158. if(modelObj.hasOwnProperty(idx))
  6159. {
  6160. let obj;
  6161. if(useCommenter == true)
  6162. {
  6163. obj = modelObj[idx];
  6164. if(obj.attributes.comments.length > 0)
  6165. {
  6166. for(let cidx=0; cidx < obj.attributes.comments.length; cidx++)
  6167. {
  6168. let userID = obj.attributes.comments[cidx].userID;
  6169. if((listedIDs.indexOf(userID) == -1) && (userID != -1))
  6170. {
  6171. listedIDs.push(userID);
  6172. }
  6173. }
  6174. }
  6175. }
  6176. else
  6177. {
  6178. obj = modelObj[idx].attributes;
  6179. let cbID = null;
  6180. let ubID = null;
  6181. let rbID = null;
  6182. if(useCreated == true) cbID = obj.createdBy;
  6183. if(useUpdated == true) ubID = obj.updatedBy;
  6184. if(useResolved == true) ubID = obj.resolvedBy;
  6185. if((cbID !== null) && (listedIDs.indexOf(cbID) == -1))
  6186. {
  6187. listedIDs.push(cbID);
  6188. }
  6189. if((ubID !== null) && (listedIDs.indexOf(ubID) == -1))
  6190. {
  6191. listedIDs.push(ubID);
  6192. }
  6193. if((rbID !== null) && (listedIDs.indexOf(rbID) == -1))
  6194. {
  6195. listedIDs.push(rbID);
  6196. }
  6197. }
  6198. }
  6199. }
  6200.  
  6201. selector.options.add(new Option('<select a user>', null));
  6202. if(listedIDs.length > 0)
  6203. {
  6204. let users = W.model.users.getByIds(listedIDs);
  6205. let selectorEntry = '';
  6206. for(idx=0; idx<users.length; idx++)
  6207. {
  6208. if(listedIDs.indexOf(users[idx].id) != -1)
  6209. {
  6210. listedIDs.splice(listedIDs.indexOf(users[idx]), 1);
  6211. }
  6212. if(users[idx].attributes.userName === undefined)
  6213. {
  6214. selectorEntry = users[idx].attributes.id;
  6215. }
  6216. else
  6217. {
  6218. selectorEntry = users[idx].attributes.userName;
  6219. }
  6220. selector.options.add(new Option(selectorEntry, users[idx].id));
  6221. if(users[idx].attributes.id == selectedUser)
  6222. {
  6223. selectedIdx = idx+1;
  6224. }
  6225. }
  6226. }
  6227.  
  6228. if(selectedIdx !== null)
  6229. {
  6230. selector.selectedIndex = selectedIdx;
  6231. }
  6232. }
  6233. function uroGetUserID(filterNameID, tbUserName)
  6234. {
  6235. if(filterNameID === null)
  6236. {
  6237. for(let idx in W.model.users.objects)
  6238. {
  6239. if(W.model.users.objects.hasOwnProperty(idx))
  6240. {
  6241. if(W.model.users.objects[idx].attributes.userName == tbUserName)
  6242. {
  6243. filterNameID = W.model.users.objects[idx].attributes.id;
  6244. break;
  6245. }
  6246. }
  6247. }
  6248. }
  6249. return filterNameID;
  6250. }
  6251. function uroFilterRAs()
  6252. {
  6253. let pmTStart = performance.now();
  6254. let pmFunction = "uroFilterRAs";
  6255.  
  6256. if(uroFilterPreamble() === false) return;
  6257. let uFURs_masterEnable = uroIsFilteringEnabled(false);
  6258. let filterByArea = uroUtils.GetCBChecked('_cbShowSpecificRA');
  6259. let filterByLastEditor = uroUtils.GetCBChecked('_cbRAEditorIDFilter');
  6260. let filterByMinAge = uroUtils.GetCBChecked('_cbEnableRAAgeFilterLessThan');
  6261. let filterByMaxAge = uroUtils.GetCBChecked('_cbEnableRAAgeFilterMoreThan');
  6262. let thresholdMinAge = uroUtils.GetElmValue('_inputFilterRAAgeLessThan');
  6263. let thresholdMaxAge = uroUtils.GetElmValue('_inputFilterRAAgeMoreThan');
  6264. let selectorRA = document.getElementById('_selectRA');
  6265. if(filterByArea === false)
  6266. {
  6267. while(selectorRA.options.length > 0)
  6268. {
  6269. selectorRA.options.remove(0);
  6270. }
  6271. }
  6272. let shownRA = null;
  6273. if(filterByArea === true)
  6274. {
  6275. if(selectorRA.options.length === 0)
  6276. {
  6277. uroUpdateRAList();
  6278. }
  6279. if(selectorRA.selectedOptions[0] != null)
  6280. {
  6281. shownRA = selectorRA.selectedOptions[0].value;
  6282. }
  6283. }
  6284.  
  6285. let filterNameID = null;
  6286. if(filterByLastEditor == true)
  6287. {
  6288. uroUpdateEditorList(W.model.restrictedDrivingAreas.objects, '_selectRAEditorID', true, true, false, false);
  6289. let selector = document.getElementById('_selectRAEditorID');
  6290. if(selector.selectedIndex > 0)
  6291. {
  6292. filterNameID = document.getElementById('_selectRAEditorID').selectedOptions[0].value;
  6293. }
  6294. }
  6295. let nRANames = document.querySelectorAll('.restricted-driving-area-name-marker').length;
  6296. for (let raIdx = 0; raIdx < W.map.restrictedDrivingAreaLayer.features.length; raIdx++)
  6297. {
  6298. let raObj = W.map.restrictedDrivingAreaLayer.features[raIdx].attributes.wazeFeature;
  6299. if(raObj !== undefined)
  6300. {
  6301. let raStyle = 'visible';
  6302. if(uFURs_masterEnable === true)
  6303. {
  6304. if(shownRA !== null)
  6305. {
  6306. if(raObj._wmeObject.attributes.name != shownRA) raStyle = 'hidden';
  6307. }
  6308. if(filterNameID !== null)
  6309. {
  6310. if((raObj._wmeObject.attributes.createdBy != filterNameID) && (raObj._wmeObject.attributes.updatedBy != filterNameID))
  6311. {
  6312. raStyle = 'hidden';
  6313. }
  6314. }
  6315. let raAge = uroUtils.DateToDays(raObj._wmeObject.attributes.updatedOn);
  6316. if(filterByMinAge == true)
  6317. {
  6318. if(raAge < thresholdMinAge) raStyle = 'hidden';
  6319. }
  6320. if(filterByMaxAge == true)
  6321. {
  6322. if(raAge > thresholdMaxAge) raStyle = 'hidden';
  6323. }
  6324. }
  6325. let geoID = W.map.restrictedDrivingAreaLayer.features[raIdx].geometry.id;
  6326. if(document.getElementById(geoID) !== null)
  6327. {
  6328. document.getElementById(geoID).style.visibility = raStyle;
  6329. }
  6330.  
  6331. // This doesn't always work, as the order in which the markers are listed on their layer isn't guaranteed
  6332. // to match the order in which the corresponding RA polys are listed on theirs...
  6333. if(raIdx < nRANames)
  6334. {
  6335. document.querySelectorAll('.restricted-driving-area-name-marker')[raIdx].style.visibility = raStyle;
  6336. }
  6337. }
  6338. }
  6339. uroDBG.PerfMon(pmFunction, pmTStart);
  6340. }
  6341. function uroFilterPlaceMarker(mObj, vObj, uFP_masterEnable)
  6342. {
  6343. if((mObj === undefined) || (vObj === undefined))
  6344. {
  6345. return;
  6346. }
  6347.  
  6348. let purAge = null;
  6349. let placeStyle = 'visible';
  6350.  
  6351. if(uFP_masterEnable === true)
  6352. {
  6353. if(uro_uFP[URO_UFP_OPTS.filterInsideManagedAreas] === true)
  6354. {
  6355. let tPt = [];
  6356. tPt.push(mObj.lonlat.lon);
  6357. tPt.push(mObj.lonlat.lat);
  6358. if(uroCheckGeometryWithinManagedAreas(tPt) === true) placeStyle = 'hidden';
  6359. }
  6360.  
  6361. if((placeStyle == 'visible') && (uro_uFP[URO_UFP_OPTS.filterUneditable] === true))
  6362. {
  6363. if(vObj.attributes.permissions === 0)
  6364. {
  6365. placeStyle = 'hidden';
  6366. }
  6367. if((placeStyle == 'visible') && (uro_uFP[URO_UFP_OPTS.isLoggedIn]))
  6368. {
  6369. if(uro_uFP[URO_UFP_OPTS.userRank] < vObj.attributes.lockRank)
  6370. {
  6371. placeStyle = 'hidden';
  6372. }
  6373. }
  6374. if((placeStyle == 'visible') && (vObj.attributes.adLocked))
  6375. {
  6376. placeStyle = 'hidden';
  6377. }
  6378. }
  6379.  
  6380. if((placeStyle == 'visible') && (uro_uFP[URO_UFP_OPTS.filterLockRanked] === true))
  6381. {
  6382. if(vObj.attributes.lockRank !== 0)
  6383. {
  6384. placeStyle = 'hidden';
  6385. }
  6386. }
  6387.  
  6388. let urEntries = vObj.attributes.venueUpdateRequests;
  6389. if((placeStyle == 'visible') && (urEntries !== undefined))
  6390. {
  6391. for(let i = 0; i < urEntries.length; ++i)
  6392. {
  6393. let ut = urEntries[i].attributes.updateType;
  6394. if((uro_uFP[URO_UFP_OPTS.filterFlagged] === true) && (ut === "flag"))
  6395. {
  6396. placeStyle = 'hidden';
  6397. }
  6398. else if((uro_uFP[URO_UFP_OPTS.filterNewPlace] === true) && (ut === "ADD_VENUE"))
  6399. {
  6400. placeStyle = 'hidden';
  6401. }
  6402. else if((uro_uFP[URO_UFP_OPTS.filterUpdatedDetails] === true) && (ut === "UPDATE_VENUE"))
  6403. {
  6404. placeStyle = 'hidden';
  6405. }
  6406. else if((uro_uFP[URO_UFP_OPTS.filterNewPhoto] === true) && (ut === "ADD_IMAGE"))
  6407. {
  6408. placeStyle = 'hidden';
  6409. }
  6410. }
  6411.  
  6412. if((placeStyle == 'visible') && (uro_uFP[URO_UFP_OPTS.filterOnCFs] === true))
  6413. {
  6414. let nVUR = urEntries.length;
  6415. while(nVUR > 0)
  6416. {
  6417. nVUR--;
  6418. let tCF = urEntries[nVUR].attributes.changedFields;
  6419. if(tCF !== undefined)
  6420. {
  6421. if(tCF.length > 0)
  6422. {
  6423. let tFN = tCF[0].attributes.fieldName;
  6424. if((tFN == "phone") && (uro_uFP[URO_UFP_OPTS.filterCFPhone] === true))
  6425. {
  6426. placeStyle = 'hidden';
  6427. }
  6428. else if((tFN == "name") && (uro_uFP[URO_UFP_OPTS.filterCFName] === true))
  6429. {
  6430. placeStyle = 'hidden';
  6431. }
  6432. else if((tFN == "entryExitPoints") && (uro_uFP[URO_UFP_OPTS.filterCFEntryExitPoints] === true))
  6433. {
  6434. placeStyle = 'hidden';
  6435. }
  6436. else if((tFN == "openingHours") && (uro_uFP[URO_UFP_OPTS.filterCFOpeningHours] === true))
  6437. {
  6438. placeStyle = 'hidden';
  6439. }
  6440. else if((tFN == "aliases") && (uro_uFP[URO_UFP_OPTS.filterCFAliases] === true))
  6441. {
  6442. placeStyle = 'hidden';
  6443. }
  6444. else if((tFN == "services") && (uro_uFP[URO_UFP_OPTS.filterCFServices] === true))
  6445. {
  6446. placeStyle = 'hidden';
  6447. }
  6448. else if((tFN == "geometry") && (uro_uFP[URO_UFP_OPTS.filterCFGeometry] === true))
  6449. {
  6450. placeStyle = 'hidden';
  6451. }
  6452. else if((tFN == "houseNumber") && (uro_uFP[URO_UFP_OPTS.filterCFHouseNumber] === true))
  6453. {
  6454. placeStyle = 'hidden';
  6455. }
  6456. else if((tFN == "categories") && (uro_uFP[URO_UFP_OPTS.filterCFCategories] === true))
  6457. {
  6458. placeStyle = 'hidden';
  6459. }
  6460. else if((tFN == "description") && (uro_uFP[URO_UFP_OPTS.filterCFDescription] === true))
  6461. {
  6462. placeStyle = 'hidden';
  6463. }
  6464. }
  6465. }
  6466. }
  6467. }
  6468. }
  6469.  
  6470. if(uro_uFP[URO_UFP_OPTS.invertPURFilters] === true)
  6471. {
  6472. if(placeStyle == 'hidden') placeStyle = 'visible';
  6473. else placeStyle = 'hidden';
  6474. }
  6475.  
  6476. if(uro_uFP[URO_UFP_OPTS.filterMinPURAge] || uro_uFP[URO_UFP_OPTS.filterMaxPURAge])
  6477. {
  6478. purAge = uroUtils.GetPURAge(vObj);
  6479. if(uro_uFP[URO_UFP_OPTS.filterMinPURAge] === true)
  6480. {
  6481. if(purAge < uro_uFP[URO_UFP_OPTS.thresholdMinPURDays]) placeStyle = 'hidden';
  6482. }
  6483. if(uro_uFP[URO_UFP_OPTS.filterMaxPURAge] === true)
  6484. {
  6485. if(purAge > uro_uFP[URO_UFP_OPTS.thresholdMaxPURDays]) placeStyle = 'hidden';
  6486. }
  6487. }
  6488.  
  6489. if(uroPURsToHide.indexOf(vObj.attributes.id) !== -1)
  6490. {
  6491. placeStyle = 'hidden';
  6492. }
  6493. }
  6494.  
  6495. mObj.style.visibility = placeStyle;
  6496.  
  6497. if((uro_uFP[URO_UFP_OPTS.leavePURGeos] === false) && (placeStyle === 'hidden'))
  6498. {
  6499. if(vObj.model != null)
  6500. {
  6501. if(vObj.attributes.geometry != null)
  6502. {
  6503. let puGeo = document.getElementById(vObj.attributes.geometry.id);
  6504. if(puGeo !== null)
  6505. {
  6506. puGeo.style.visibility = 'hidden';
  6507. }
  6508. }
  6509. }
  6510. }
  6511. }
  6512. function uroFilterPlaces()
  6513. {
  6514. let pmTStart = performance.now();
  6515. let pmFunction = "uroFilterPlaces";
  6516.  
  6517. if(uroFilterPreamble() === false) return;
  6518.  
  6519. let moObj = uroGetHighlightedMapFeature();
  6520. let renderIntent = uroGetFeatureRenderIntent(moObj);
  6521. if(moObj != null)
  6522. {
  6523. if(moObj.featureType === 'venue')
  6524. {
  6525. if((renderIntent == 'select') || (renderIntent == 'highlightselected'))
  6526. {
  6527. return;
  6528. }
  6529. }
  6530. }
  6531.  
  6532. if(uroUtils.GetCBChecked('_cbDisablePlacesFiltering') === true) return;
  6533.  
  6534. uroUpdateVenueEditorLists();
  6535.  
  6536. let filterNameID = null;
  6537. let tbUserName = uroUtils.GetElmValue('_textPlacesEditor');
  6538. let selector = document.getElementById('_selectPlacesUserID');
  6539. if(selector.selectedIndex > 0)
  6540. {
  6541. let selUserName = document.getElementById('_selectPlacesUserID').selectedOptions[0].innerHTML;
  6542. if(selUserName == tbUserName)
  6543. {
  6544. filterNameID = document.getElementById('_selectPlacesUserID').selectedOptions[0].value;
  6545. }
  6546. }
  6547. filterNameID = uroGetUserID(filterNameID, tbUserName);
  6548.  
  6549. let filterHideNameID = null;
  6550. let tbHideUserName = uroUtils.GetElmValue('_textHidePlacesEditor');
  6551. let selectorHide = document.getElementById('_selectHidePlacesUserID');
  6552. if(selectorHide.selectedIndex > 0)
  6553. {
  6554. let selHideUserName = document.getElementById('_selectHidePlacesUserID').selectedOptions[0].innerHTML;
  6555. if(selHideUserName == tbHideUserName)
  6556. {
  6557. filterHideNameID = document.getElementById('_selectHidePlacesUserID').selectedOptions[0].value;
  6558. }
  6559. }
  6560. filterHideNameID = uroGetUserID(filterHideNameID, tbHideUserName);
  6561.  
  6562. let filterCats = [];
  6563. for(let i=0; i<W.Config.venues.categories.length; i++)
  6564. {
  6565. let parentCategory = W.Config.venues.categories[i];
  6566. let subCategory;
  6567.  
  6568. if(uroUtils.GetCBChecked('_cbPlacesFilter-'+parentCategory) === true)
  6569. {
  6570. filterCats.push(parentCategory);
  6571. for(let i1=0; i1<W.Config.venues.subcategories[parentCategory].length; i1++)
  6572. {
  6573. subCategory = W.Config.venues.subcategories[parentCategory][i1];
  6574. filterCats.push(subCategory);
  6575. }
  6576. }
  6577. else
  6578. {
  6579. for(let i2=0; i2<W.Config.venues.subcategories[parentCategory].length; i2++)
  6580. {
  6581. subCategory = W.Config.venues.subcategories[parentCategory][i2];
  6582. if(uroUtils.GetCBChecked('_cbPlacesFilter-'+subCategory) === true)
  6583. {
  6584. filterCats.push(subCategory);
  6585. }
  6586. }
  6587. }
  6588. }
  6589.  
  6590. let placeStyle;
  6591.  
  6592. let uFP_filterEditedLessThan = uroUtils.GetCBChecked('_cbPlaceFilterEditedLessThan');
  6593. let uFP_filterEditedMoreThan = uroUtils.GetCBChecked('_cbPlaceFilterEditedMoreThan');
  6594. let uFP_filterL0 = uroUtils.GetCBChecked('_cbHidePlacesL0');
  6595. let uFP_filterL1 = uroUtils.GetCBChecked('_cbHidePlacesL1');
  6596. let uFP_filterL2 = uroUtils.GetCBChecked('_cbHidePlacesL2');
  6597. let uFP_filterL3 = uroUtils.GetCBChecked('_cbHidePlacesL3');
  6598. let uFP_filterL4 = uroUtils.GetCBChecked('_cbHidePlacesL4');
  6599. let uFP_filterL5 = uroUtils.GetCBChecked('_cbHidePlacesL5');
  6600. let uFP_filterStaff = uroUtils.GetCBChecked('_cbHidePlacesStaff');
  6601. let uFP_filterAL = uroUtils.GetCBChecked('_cbHidePlacesAdLocked');
  6602. let uFP_filterOnLockLevel = (uFP_filterL0 || uFP_filterL1 || uFP_filterL2 || uFP_filterL3 || uFP_filterL4 || uFP_filterL5 || uFP_filterStaff);
  6603. let uFP_filterNoPhotos = uroUtils.GetCBChecked('_cbHideNoPhotoPlaces');
  6604. let uFP_filterWithPhotos = uroUtils.GetCBChecked('_cbHidePhotoPlaces');
  6605. let uFP_filterNoLinks = uroUtils.GetCBChecked('_cbHideNoLinkedPlaces');
  6606. let uFP_filterWithLinks = uroUtils.GetCBChecked('_cbHideLinkedPlaces');
  6607. let uFP_filterNoDescription = uroUtils.GetCBChecked('_cbHideNonDescribedPlaces');
  6608. let uFP_filterWithDescription = uroUtils.GetCBChecked('_cbHideDescribedPlaces');
  6609. let uFP_filterNoKeyword = uroUtils.GetCBChecked('_cbHideKeywordPlaces');
  6610. let uFP_filterKeyword = uroUtils.GetCBChecked('_cbHideNoKeywordPlaces');
  6611. let uFP_filterPrivate = uroUtils.GetCBChecked('_cbFilterPrivatePlaces');
  6612. let uFP_invertFilters = uroUtils.GetCBChecked('_cbInvertPlacesFilter');
  6613. let uFP_masterEnable = uroIsFilteringEnabled(false);
  6614. let uFP_filterAreaPlaces = uroUtils.GetCBChecked('_cbHideAreaPlaces');
  6615. let uFP_filterPointPlaces = uroUtils.GetCBChecked('_cbHidePointPlaces');
  6616. let uFP_filterCreatedBy = uroUtils.GetCBChecked('_cbShowOnlyPlacesCreatedBy');
  6617. let uFP_filterEditedBy = uroUtils.GetCBChecked('_cbShowOnlyPlacesEditedBy');
  6618. let uFP_filterHideCreatedBy = uroUtils.GetCBChecked('_cbHideOnlyPlacesCreatedBy');
  6619. let uFP_filterHideEditedBy = uroUtils.GetCBChecked('_cbHideOnlyPlacesEditedBy');
  6620.  
  6621. let uFP_hidePURsForFilteredPlaces = uroUtils.GetCBChecked('_cbHidePURsForFilteredPlaces');
  6622.  
  6623. let uFP_NameKeyword = document.getElementById('_textKeywordPlace').value.toLowerCase();
  6624. let uFP_thresholdMinDays = document.getElementById('_inputFilterPlaceEditMinDays').value;
  6625. let uFP_thresholdMaxDays = document.getElementById('_inputFilterPlaceEditMaxDays').value;
  6626.  
  6627. uroPURsToHide = [];
  6628.  
  6629. for(let v=0; v<uroVenueLayer.features.length; v++)
  6630. {
  6631. placeStyle = 'visible';
  6632. if(uFP_masterEnable === true)
  6633. {
  6634. let lmObj = uroVenueLayer.features[v];
  6635.  
  6636. // when an area place is selected, the drag points for editing the place outline now get added as objects into uroVenueLayer.features,
  6637. // however none of these objects had the .attributes.repositoryObject property - whilst the devs have now replaced this with the almost
  6638. // identical .wazeFeature._wmeObject property, it's unclear if drag points still need to be excluded from this scan, so the check
  6639. // remains in place as a "let's just make sure it has it before trying to use it"...
  6640. if(lmObj?.attributes?.wazeFeature?._wmeObject != null)
  6641. {
  6642. lmObj = lmObj.attributes.wazeFeature._wmeObject.attributes;
  6643. if(lmObj.id < 0)
  6644. {
  6645. // don't apply filtering to newly-created places - this allows the user to leave their filtering settings unchanged whilst
  6646. // adding a new place which, once saved, would then be hidden...
  6647. break;
  6648. }
  6649.  
  6650. if(uFP_filterAreaPlaces)
  6651. {
  6652. if(lmObj.geometry.id.indexOf('Polygon') !== -1)
  6653. {
  6654. placeStyle = 'hidden';
  6655. }
  6656. }
  6657. if(uFP_filterPointPlaces)
  6658. {
  6659. if(lmObj.geometry.id.indexOf('Point') !== -1)
  6660. {
  6661. placeStyle = 'hidden';
  6662. }
  6663. }
  6664.  
  6665.  
  6666. if(placeStyle == 'visible')
  6667. {
  6668. if((uFP_filterEditedLessThan) || (uFP_filterEditedMoreThan))
  6669. {
  6670. let editDate = lmObj.updatedOn;
  6671. if(editDate === undefined)
  6672. {
  6673. // where a place has never been edited since its creation, use the creation date instead...
  6674. editDate = lmObj.createdOn;
  6675. }
  6676. if(editDate != null)
  6677. {
  6678. let editDaysAgo = uroUtils.DateToDays(editDate);
  6679. if(uFP_filterEditedLessThan)
  6680. {
  6681. if(editDaysAgo < uFP_thresholdMinDays)
  6682. {
  6683. placeStyle = 'hidden';
  6684. }
  6685. }
  6686. if(uFP_filterEditedMoreThan)
  6687. {
  6688. if(editDaysAgo > uFP_thresholdMaxDays)
  6689. {
  6690. placeStyle = 'hidden';
  6691. }
  6692. }
  6693. }
  6694. }
  6695. }
  6696.  
  6697. if(placeStyle == 'visible')
  6698. {
  6699. if(uFP_filterOnLockLevel)
  6700. {
  6701. let lockLevel = lmObj.lockRank;
  6702. if ((uFP_filterL0) && (lockLevel === 0)) placeStyle = 'hidden';
  6703. if ((uFP_filterL1) && (lockLevel === 1)) placeStyle = 'hidden';
  6704. if ((uFP_filterL2) && (lockLevel === 2)) placeStyle = 'hidden';
  6705. if ((uFP_filterL3) && (lockLevel === 3)) placeStyle = 'hidden';
  6706. if ((uFP_filterL4) && (lockLevel === 4)) placeStyle = 'hidden';
  6707. if ((uFP_filterL5) && (lockLevel === 5)) placeStyle = 'hidden';
  6708. if ((uFP_filterStaff) && (lockLevel === 6)) placeStyle = 'hidden';
  6709. }
  6710. }
  6711.  
  6712. if(placeStyle == 'visible')
  6713. {
  6714. if(uFP_filterAL)
  6715. {
  6716. if(lmObj.adLocked) placeStyle = 'hidden';
  6717. }
  6718. }
  6719.  
  6720. if(placeStyle == 'visible')
  6721. {
  6722. if(uFP_filterNoPhotos || uFP_filterWithPhotos)
  6723. {
  6724. let nPhotos = 0;
  6725. for(let loop=0; loop<lmObj.images.length; loop++)
  6726. {
  6727. if(lmObj.images[loop].attributes.approved) nPhotos++;
  6728. }
  6729. if((uFP_filterNoPhotos) && (nPhotos === 0)) placeStyle = 'hidden';
  6730. if((uFP_filterWithPhotos) && (nPhotos !== 0)) placeStyle = 'hidden';
  6731. }
  6732. }
  6733.  
  6734. if(placeStyle == 'visible')
  6735. {
  6736. if(uFP_filterNoLinks || uFP_filterWithLinks)
  6737. {
  6738. let nLinks = lmObj.externalProviderIDs.length;
  6739. if((uFP_filterNoLinks) && (nLinks === 0)) placeStyle = 'hidden';
  6740. if((uFP_filterWithLinks) && (nLinks !== 0)) placeStyle = 'hidden';
  6741. }
  6742. }
  6743.  
  6744. if(placeStyle == 'visible')
  6745. {
  6746. if(uFP_filterNoDescription || uFP_filterWithDescription)
  6747. {
  6748. let lDesc = lmObj.description.length;
  6749. if((uFP_filterNoDescription) && (lDesc === 0)) placeStyle = 'hidden';
  6750. if((uFP_filterWithDescription) && (lDesc !== 0)) placeStyle = 'hidden';
  6751. }
  6752. }
  6753.  
  6754. if(placeStyle == 'visible')
  6755. {
  6756. if((uFP_filterPrivate === true) && (lmObj.residential === true))
  6757. {
  6758. placeStyle = 'hidden';
  6759. }
  6760. else
  6761. {
  6762. for(let cat=0; cat<filterCats.length; cat++)
  6763. {
  6764. if(_.includes(lmObj.categories, filterCats[cat]))
  6765. {
  6766. placeStyle = 'hidden';
  6767. break;
  6768. }
  6769. }
  6770. }
  6771. }
  6772.  
  6773. if(placeStyle == 'visible')
  6774. {
  6775. if(uFP_filterNoKeyword || uFP_filterKeyword)
  6776. {
  6777. let venueName = lmObj.name.toLowerCase();
  6778. let noKeywordMatch = true;
  6779. if(uFP_NameKeyword === '')
  6780. {
  6781. noKeywordMatch = (venueName !== '');
  6782. }
  6783. else
  6784. {
  6785. noKeywordMatch = (venueName.indexOf(uFP_NameKeyword) === -1);
  6786. }
  6787.  
  6788. if(!noKeywordMatch && uFP_filterNoKeyword) placeStyle = 'hidden';
  6789. if(noKeywordMatch && uFP_filterKeyword) placeStyle = 'hidden';
  6790. }
  6791. }
  6792.  
  6793. if(placeStyle == 'visible')
  6794. {
  6795. if(filterNameID != null)
  6796. {
  6797. if(uFP_filterCreatedBy === true)
  6798. {
  6799. if(filterNameID != lmObj.createdBy) placeStyle = 'hidden';
  6800. }
  6801. if(uFP_filterEditedBy === true)
  6802. {
  6803. if(filterNameID != lmObj.updatedBy) placeStyle = 'hidden';
  6804. }
  6805. }
  6806. }
  6807. if(placeStyle == 'visible')
  6808. {
  6809. if(filterHideNameID != null)
  6810. {
  6811. if(uFP_filterHideCreatedBy === true)
  6812. {
  6813. if(filterHideNameID == lmObj.createdBy) placeStyle = 'hidden';
  6814. }
  6815. if(uFP_filterHideEditedBy === true)
  6816. {
  6817. if(filterHideNameID == lmObj.updatedBy) placeStyle = 'hidden';
  6818. }
  6819. }
  6820. }
  6821.  
  6822. if(uFP_invertFilters === true)
  6823. {
  6824. if(placeStyle == 'hidden') placeStyle = 'visible';
  6825. else placeStyle = 'hidden';
  6826. }
  6827. }
  6828.  
  6829. if((placeStyle == 'hidden') && (uFP_hidePURsForFilteredPlaces === true))
  6830. {
  6831. uroPURsToHide.push(lmObj.id);
  6832. }
  6833. }
  6834.  
  6835. let geoID = uroVenueLayer.features[v].geometry.id;
  6836. if(document.getElementById(geoID) !== null)
  6837. {
  6838. document.getElementById(geoID).style.visibility = placeStyle;
  6839. }
  6840. }
  6841.  
  6842. uro_uFP[URO_UFP_OPTS.filterUneditable] = uroUtils.GetCBChecked('_cbFilterUneditablePlaceUpdates');
  6843. uro_uFP[URO_UFP_OPTS.filterInsideManagedAreas] = uroUtils.GetCBChecked('_cbPURFilterInsideManagedAreas');
  6844. uro_uFP[URO_UFP_OPTS.excludeMyAreas] = uroUtils.GetCBChecked('_cbPURExcludeUserArea');
  6845. uro_uFP[URO_UFP_OPTS.filterLockRanked] = uroUtils.GetCBChecked('_cbFilterLockRankedPlaceUpdates');
  6846. uro_uFP[URO_UFP_OPTS.filterFlagged] = uroUtils.GetCBChecked("_cbFilterFlaggedPUR");
  6847. uro_uFP[URO_UFP_OPTS.filterNewPlace] = uroUtils.GetCBChecked("_cbFilterNewPlacePUR");
  6848. uro_uFP[URO_UFP_OPTS.filterUpdatedDetails] = uroUtils.GetCBChecked("_cbFilterUpdatedDetailsPUR");
  6849. uro_uFP[URO_UFP_OPTS.filterNewPhoto] = uroUtils.GetCBChecked("_cbFilterNewPhotoPUR");
  6850. uro_uFP[URO_UFP_OPTS.filterMinPURAge] = uroUtils.GetCBChecked('_cbEnablePURMinAgeFilter');
  6851. uro_uFP[URO_UFP_OPTS.filterMaxPURAge] = uroUtils.GetCBChecked('_cbEnablePURMaxAgeFilter');
  6852. uro_uFP[URO_UFP_OPTS.invertPURFilters] = uroUtils.GetCBChecked('_cbInvertPURFilters');
  6853. uro_uFP[URO_UFP_OPTS.leavePURGeos] = uroUtils.GetCBChecked('_cbLeavePURGeos');
  6854. uro_uFP[URO_UFP_OPTS.filterCFPhone] = uroUtils.GetCBChecked('_cbPURFilterCFPhone');
  6855. uro_uFP[URO_UFP_OPTS.filterCFName] = uroUtils.GetCBChecked('_cbPURFilterCFName');
  6856. uro_uFP[URO_UFP_OPTS.filterCFEntryExitPoints] = uroUtils.GetCBChecked('_cbPURFilterCFEntryExitPoints');
  6857. uro_uFP[URO_UFP_OPTS.filterCFOpeningHours] = uroUtils.GetCBChecked('_cbPURFilterCFOpeningHours');
  6858. uro_uFP[URO_UFP_OPTS.filterCFAliases] = uroUtils.GetCBChecked('_cbPURFilterCFAliases');
  6859. uro_uFP[URO_UFP_OPTS.filterCFServices] = uroUtils.GetCBChecked('_cbPURFilterCFServices');
  6860. uro_uFP[URO_UFP_OPTS.filterCFGeometry] = uroUtils.GetCBChecked('_cbPURFilterCFGeometry');
  6861. uro_uFP[URO_UFP_OPTS.filterCFHouseNumber] = uroUtils.GetCBChecked('_cbPURFilterCFHouseNumber');
  6862. uro_uFP[URO_UFP_OPTS.filterCFCategories] = uroUtils.GetCBChecked('_cbPURFilterCFCategories');
  6863. uro_uFP[URO_UFP_OPTS.filterCFDescription] = uroUtils.GetCBChecked('_cbPURFilterCFDescription');
  6864.  
  6865. 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]);
  6866. 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]);
  6867. 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]);
  6868.  
  6869. uro_uFP[URO_UFP_OPTS.thresholdMinPURDays] = uroUtils.GetElmValue('_inputPURFilterMinDays');
  6870. uro_uFP[URO_UFP_OPTS.thresholdMaxPURDays] = uroUtils.GetElmValue('_inputPURFilterMaxDays');
  6871. uro_uFP[URO_UFP_OPTS.isLoggedIn] = W.loginManager.isLoggedIn();
  6872. uro_uFP[URO_UFP_OPTS.userRank] = W.loginManager.user.attributes.rank;
  6873.  
  6874. uro_uFP[URO_UFP_OPTS.filterInsideManagedAreas] = uro_uFP[URO_UFP_OPTS.filterInsideManagedAreas] && (uroGetManagedAreas() !== 0);
  6875. if(uroUtils.GetCBChecked('_cbPURExcludeUserArea') == true)
  6876. {
  6877. uroIgnoreAreasUserID = W.loginManager.user.attributes.id;
  6878. }
  6879.  
  6880. uroPrepForFilterPlaceMarker(uroLayers.ID.PUR, uFP_masterEnable);
  6881. uroPrepForFilterPlaceMarker(uroLayers.ID.PPUR, uFP_masterEnable);
  6882. uroPrepForFilterPlaceMarker(uroLayers.ID.RPUR, uFP_masterEnable);
  6883.  
  6884. uroDBG.PerfMon(pmFunction, pmTStart);
  6885. }
  6886. function uroPrepForFilterPlaceMarker(markerType, masterEnable)
  6887. {
  6888. if(uroLayers.layers[markerType].l?.getVisibility() === true)
  6889. {
  6890. let pu;
  6891. let mObj;
  6892. let vObj;
  6893. let idList = uroGetMarkerIDs(markerType);
  6894. for(pu of idList)
  6895. {
  6896. mObj = uroGetMarker(markerType, pu);
  6897. if(mObj !== null)
  6898. {
  6899. vObj = W.model.venues.objects[pu];
  6900. uroFilterPlaceMarker(mObj, vObj, masterEnable);
  6901. }
  6902. }
  6903. }
  6904. }
  6905. function uroGetClosestSegmentToPoint(p)
  6906. {
  6907. let retval = null;
  6908. if(W.map.getZoom() >= 16)
  6909. {
  6910. let minDist = 99999999;
  6911.  
  6912. for(let s in W.model.segments.objects)
  6913. {
  6914. if(W.model.segments.objects.hasOwnProperty(s))
  6915. {
  6916. let seg = W.model.segments.getObjectById(s);
  6917. let dist = seg.attributes.geometry.distanceTo(p);
  6918. if(dist < minDist)
  6919. {
  6920. minDist = dist;
  6921. retval = s;
  6922. }
  6923. }
  6924. }
  6925. }
  6926. return retval;
  6927. }
  6928. function uroIsCamSpeedValid(camObj)
  6929. {
  6930. let retval = true;
  6931.  
  6932. let cPoint = camObj.attributes.geometry.getCentroid();
  6933. let nSeg = uroGetClosestSegmentToPoint(cPoint);
  6934. if(nSeg !== null)
  6935. {
  6936. let fwdSpeed = W.model.segments.getObjectById(nSeg).attributes.fwdMaxSpeed;
  6937. let revSpeed = W.model.segments.getObjectById(nSeg).attributes.revMaxSpeed;
  6938. let camSpeed = camObj.attributes.speed;
  6939. if(W.model.isImperial == true)
  6940. {
  6941. fwdSpeed = Math.round(fwdSpeed / 1.609);
  6942. revSpeed = Math.round(revSpeed / 1.609);
  6943. camSpeed = Math.round(camSpeed / 1.609);
  6944. }
  6945. if((camSpeed !== fwdSpeed) && (camSpeed !== revSpeed))
  6946. {
  6947. retval = false;
  6948. }
  6949. }
  6950.  
  6951. return retval;
  6952. }
  6953. function uroFilterCameras()
  6954. {
  6955. let pmTStart = performance.now();
  6956. let pmFunction = "uroFilterCameras";
  6957.  
  6958. if(uroFilterPreamble() === false)
  6959. {
  6960. return;
  6961. }
  6962.  
  6963. if(uroMouseIsDown === false) W.map.camerasLayer.redraw();
  6964.  
  6965. if(uroIsFilteringEnabled(false) === true)
  6966. {
  6967. uroUpdateEditorList(W.model.cameras.objects, '_selectCameraUserID', true, true, false, false);
  6968. let tbUserName = uroUtils.GetElmValue('_textCameraEditor');
  6969. let selector = document.getElementById('_selectCameraUserID');
  6970. let filterNameID = null;
  6971. if(selector.selectedIndex > 0)
  6972. {
  6973. let selUserName = document.getElementById('_selectCameraUserID').selectedOptions[0].innerHTML;
  6974. if(selUserName == tbUserName)
  6975. {
  6976. filterNameID = document.getElementById('_selectCameraUserID').selectedOptions[0].value;
  6977. }
  6978. }
  6979. filterNameID = uroGetUserID(filterNameID, tbUserName);
  6980.  
  6981. let isChecked_cbShowOnlyCamsCreatedBy = uroUtils.GetCBChecked('_cbShowOnlyCamsCreatedBy');
  6982. let isChecked_cbShowOnlyCamsEditedBy = uroUtils.GetCBChecked('_cbShowOnlyCamsEditedBy');
  6983. let isChecked_cbShowOnlyMyCams = uroUtils.GetCBChecked('_cbShowOnlyMyCams');
  6984. let isChecked_cbShowWorldCams = uroUtils.GetCBChecked('_cbShowWorldCams');
  6985. let isChecked_cbShowUSACams = uroUtils.GetCBChecked('_cbShowUSACams');
  6986. let isChecked_cbShowNonWorldCams = uroUtils.GetCBChecked('_cbShowNonWorldCams');
  6987. let isChecked_cbShowSpeedCams = uroUtils.GetCBChecked('_cbShowSpeedCams');
  6988. let isChecked_cbShowRedLightCams = uroUtils.GetCBChecked('_cbShowRedLightCams');
  6989. let isChecked_cbShowDummyCams = uroUtils.GetCBChecked('_cbShowDummyCams');
  6990. let isChecked_cbShowIfNoSpeedSet = uroUtils.GetCBChecked('_cbShowIfNoSpeedSet');
  6991. let isChecked_cbShowIfSpeedSet = uroUtils.GetCBChecked('_cbShowIfSpeedSet');
  6992. let isChecked_cbShowIfInvalidSpeedSet = uroUtils.GetCBChecked('_cbShowIfInvalidSpeedSet');
  6993. let isChecked_cbShowRLCIfNoSpeedSet = uroUtils.GetCBChecked('_cbShowRLCIfNoSpeedSet');
  6994. let isChecked_cbShowRLCIfNonZeroSpeedSet = uroUtils.GetCBChecked('_cbShowRLCIfNonZeroSpeedSet');
  6995. let isChecked_cbShowRLCIfZeroSpeedSet = uroUtils.GetCBChecked('_cbShowRLCIfZeroSpeedSet');
  6996. let isChecked_cbHideCreatedByMe = uroUtils.GetCBChecked('_cbHideCreatedByMe');
  6997. let isChecked_cbHideCreatedByRank0 = uroUtils.GetCBChecked('_cbHideCreatedByRank0');
  6998. let isChecked_cbHideCreatedByRank1 = uroUtils.GetCBChecked('_cbHideCreatedByRank1');
  6999. let isChecked_cbHideCreatedByRank2 = uroUtils.GetCBChecked('_cbHideCreatedByRank2');
  7000. let isChecked_cbHideCreatedByRank3 = uroUtils.GetCBChecked('_cbHideCreatedByRank3');
  7001. let isChecked_cbHideCreatedByRank4 = uroUtils.GetCBChecked('_cbHideCreatedByRank4');
  7002. let isChecked_cbHideCreatedByRank5 = uroUtils.GetCBChecked('_cbHideCreatedByRank5');
  7003. let isChecked_cbHideUpdatedByMe = uroUtils.GetCBChecked('_cbHideUpdatedByMe');
  7004. let isChecked_cbHideUpdatedByRank0 = uroUtils.GetCBChecked('_cbHideUpdatedByRank0');
  7005. let isChecked_cbHideUpdatedByRank1 = uroUtils.GetCBChecked('_cbHideUpdatedByRank1');
  7006. let isChecked_cbHideUpdatedByRank2 = uroUtils.GetCBChecked('_cbHideUpdatedByRank2');
  7007. let isChecked_cbHideUpdatedByRank3 = uroUtils.GetCBChecked('_cbHideUpdatedByRank3');
  7008. let isChecked_cbHideUpdatedByRank4 = uroUtils.GetCBChecked('_cbHideUpdatedByRank4');
  7009. let isChecked_cbHideUpdatedByRank5 = uroUtils.GetCBChecked('_cbHideUpdatedByRank5');
  7010. let isChecked_HideManualLockedCams = uroUtils.GetCBChecked('_cbHideManualLockedCams');
  7011. let isChecked_cbHideCWLCams = uroUtils.GetCBChecked('_cbHideCWLCams');
  7012. let isChecked_cbHighlightInsteadOfHideCams = uroUtils.GetCBChecked('_cbHighlightInsteadOfHideCams');
  7013. let isChecked_InvertFiltere = uroUtils.GetCBChecked('_cbInvertCamFilters');
  7014.  
  7015. let nCameras = uroLayers.layers[uroLayers.ID.cam].l.features.length;
  7016. for (let i = 0; i < nCameras; ++i)
  7017. {
  7018. let uroCamUpdater = '';
  7019. let uroCamUpdaterRank = -1;
  7020. let uroCamCreator = '';
  7021. let uroCamCreatorRank = -1;
  7022. let wf = uroLayers.layers[uroLayers.ID.cam].l.features[i].attributes.wazeFeature;
  7023. // When a camera is selected, the alignment/positioning UI elements get added to features[].
  7024. // As these elements aren't camera markers and therefore have no attributes, we need to
  7025. // ignore them to prevent errors in the filtering code below...
  7026. if(wf !== undefined)
  7027. {
  7028. let uroCam = wf._wmeObject;
  7029. let uroCamStyle = 'visible';
  7030.  
  7031. if(uroCam.attributes.createdBy !== null)
  7032. {
  7033. if(W.model.users.objects[uroCam.attributes.createdBy] != null)
  7034. {
  7035. uroCamCreator = W.model.users.objects[uroCam.attributes.createdBy].attributes.userName;
  7036. uroCamCreatorRank = W.model.users.objects[uroCam.attributes.createdBy].attributes.rank;
  7037. }
  7038. }
  7039.  
  7040. if(uroCam.attributes.updatedBy !== null)
  7041. {
  7042. if(W.model.users.objects[uroCam.attributes.updatedBy] != null)
  7043. {
  7044. uroCamUpdater = W.model.users.objects[uroCam.attributes.updatedBy].attributes.userName;
  7045. uroCamUpdaterRank = W.model.users.objects[uroCam.attributes.updatedBy].attributes.rank;
  7046. }
  7047. }
  7048.  
  7049. let uroCamType = uroCam.attributes.type;
  7050. let camIsAutoLocked = (uroCam.attributes.lockRank === null);
  7051.  
  7052. if(isChecked_HideManualLockedCams === true)
  7053. {
  7054. if(camIsAutoLocked === false) uroCamStyle = 'hidden';
  7055. }
  7056.  
  7057. if(filterNameID != null)
  7058. {
  7059. if(isChecked_cbShowOnlyCamsCreatedBy === true)
  7060. {
  7061. if(filterNameID != uroCam.attributes.createdBy) uroCamStyle = 'hidden';
  7062. }
  7063. if(isChecked_cbShowOnlyCamsEditedBy === true)
  7064. {
  7065. if(filterNameID != uroCam.attributes.updatedBy) uroCamStyle = 'hidden';
  7066. }
  7067. }
  7068.  
  7069. if(isChecked_cbShowOnlyMyCams === true)
  7070. {
  7071. if((uroUserID != uroCam.attributes.createdBy)&&(uroUserID != uroCam.attributes.updatedBy)) uroCamStyle = 'hidden';
  7072. }
  7073.  
  7074. if((isChecked_cbShowWorldCams === false) || (isChecked_cbShowUSACams === false) || (isChecked_cbShowNonWorldCams === false))
  7075. {
  7076. let posWorld = uroCamCreator.indexOf('world_');
  7077. let posUSA = uroCamCreator.indexOf('usa_');
  7078.  
  7079. if((isChecked_cbShowWorldCams === false) && (posWorld === 0)) uroCamStyle = 'hidden';
  7080. if((isChecked_cbShowUSACams === false) && (posUSA === 0)) uroCamStyle = 'hidden';
  7081. if((isChecked_cbShowNonWorldCams === false) && (posWorld !== 0) && (posUSA !== 0)) uroCamStyle = 'hidden';
  7082. }
  7083.  
  7084. if((isChecked_cbShowSpeedCams === false) || (isChecked_cbShowRedLightCams === false) || (isChecked_cbShowDummyCams === false))
  7085. {
  7086. if((isChecked_cbShowSpeedCams === false) && (uroCamType == 2)) uroCamStyle = 'hidden';
  7087. if((isChecked_cbShowRedLightCams === false) && (uroCamType == 4)) uroCamStyle = 'hidden';
  7088. if((isChecked_cbShowDummyCams === false) && (uroCamType == 3)) uroCamStyle = 'hidden';
  7089. }
  7090.  
  7091. if((isChecked_cbShowSpeedCams === true) && (uroCamType == 2))
  7092. {
  7093. if((isChecked_cbShowIfNoSpeedSet === false) && (uroCam.attributes.speed === null)) uroCamStyle = 'hidden';
  7094. if((isChecked_cbShowIfSpeedSet === false) && (uroCam.attributes.speed !== null)) uroCamStyle = 'hidden';
  7095. if(isChecked_cbShowIfInvalidSpeedSet === false)
  7096. {
  7097. if(uroIsCamSpeedValid(uroCam) === false)
  7098. {
  7099. uroCamStyle = 'hidden';
  7100. }
  7101. }
  7102. }
  7103.  
  7104. if((isChecked_cbShowRedLightCams === true) && (uroCamType == 4))
  7105. {
  7106. if((isChecked_cbShowRLCIfNoSpeedSet === false) && (uroCam.attributes.speed === null)) uroCamStyle = 'hidden';
  7107. if((isChecked_cbShowRLCIfNonZeroSpeedSet === false) && (uroCam.attributes.speed > 0)) uroCamStyle = 'hidden';
  7108. if((isChecked_cbShowRLCIfZeroSpeedSet === false) && (uroCam.attributes.speed === 0)) uroCamStyle = 'hidden';
  7109. }
  7110.  
  7111. if(isChecked_cbHideCreatedByMe === true)
  7112. {
  7113. if(uroUserID == uroCam.attributes.createdBy) uroCamStyle = 'hidden';
  7114. }
  7115. if((isChecked_cbHideCreatedByRank0 === true) && (uroCamCreatorRank === 0)) uroCamStyle = 'hidden';
  7116. if((isChecked_cbHideCreatedByRank1 === true) && (uroCamCreatorRank == 1)) uroCamStyle = 'hidden';
  7117. if((isChecked_cbHideCreatedByRank2 === true) && (uroCamCreatorRank == 2)) uroCamStyle = 'hidden';
  7118. if((isChecked_cbHideCreatedByRank3 === true) && (uroCamCreatorRank == 3)) uroCamStyle = 'hidden';
  7119. if((isChecked_cbHideCreatedByRank4 === true) && (uroCamCreatorRank == 4)) uroCamStyle = 'hidden';
  7120. if((isChecked_cbHideCreatedByRank5 === true) && (uroCamCreatorRank == 5)) uroCamStyle = 'hidden';
  7121.  
  7122. if(isChecked_cbHideUpdatedByMe === true)
  7123. {
  7124. if(uroUserID == uroCam.attributes.updatedBy) uroCamStyle = 'hidden';
  7125. }
  7126. if((isChecked_cbHideUpdatedByRank0 === true) && (uroCamUpdaterRank === 0)) uroCamStyle = 'hidden';
  7127. if((isChecked_cbHideUpdatedByRank1 === true) && (uroCamUpdaterRank == 1)) uroCamStyle = 'hidden';
  7128. if((isChecked_cbHideUpdatedByRank2 === true) && (uroCamUpdaterRank == 2)) uroCamStyle = 'hidden';
  7129. if((isChecked_cbHideUpdatedByRank3 === true) && (uroCamUpdaterRank == 3)) uroCamStyle = 'hidden';
  7130. if((isChecked_cbHideUpdatedByRank4 === true) && (uroCamUpdaterRank == 4)) uroCamStyle = 'hidden';
  7131. if((isChecked_cbHideUpdatedByRank5 === true) && (uroCamUpdaterRank == 5)) uroCamStyle = 'hidden';
  7132.  
  7133. if((isChecked_cbHideCWLCams === true) && (uroOWL.IsCamOnWatchList(uroCam.attributes.id) != -1)) uroCamStyle = 'hidden';
  7134.  
  7135. if(isChecked_InvertFiltere === true)
  7136. {
  7137. if(uroCamStyle == "hidden")
  7138. {
  7139. uroCamStyle = "";
  7140. }
  7141. else
  7142. {
  7143. uroCamStyle = "hidden";
  7144. }
  7145. }
  7146.  
  7147. let uroCamGeometryID = uroLayers.layers[uroLayers.ID.cam].l.features[i].geometry.id;
  7148. let svgElm = document.getElementById(uroCamGeometryID);
  7149.  
  7150. if(svgElm !== null)
  7151. {
  7152. let origImage;
  7153. if(uroCamStyle == "hidden")
  7154. {
  7155. if(isChecked_cbHighlightInsteadOfHideCams === true)
  7156. {
  7157. // set the "highlight" camera image here...
  7158. let hrefImage = svgElm.getAttribute("xlink:href");
  7159. origImage = svgElm.getAttribute("origImage");
  7160. if((hrefImage === origImage) || (origImage === null))
  7161. {
  7162. svgElm.setAttribute("origImage", hrefImage);
  7163. svgElm.setAttribute("xlink:href", uroImages.HighlightedCameraImages[(uroCamType-2)]);
  7164.  
  7165. svgElm.addEventListener("mouseover", uroMarkers.MouseOver, false);
  7166. svgElm.addEventListener("mouseout", uroMarkers.MouseOut, false);
  7167. }
  7168. }
  7169. else
  7170. {
  7171. svgElm.remove();
  7172. }
  7173. }
  7174. else
  7175. {
  7176. // restore the original camera image here...
  7177. if(svgElm.getAttribute("origImage") !== null)
  7178. {
  7179. origImage = svgElm.getAttribute("origImage");
  7180. svgElm.setAttribute("xlink:href", origImage);
  7181. svgElm.removeAttribute("origImage");
  7182. }
  7183. }
  7184. }
  7185. }
  7186. }
  7187. }
  7188. uroDBG.PerfMon(pmFunction, pmTStart);
  7189. }
  7190. function uroFilterMapComments()
  7191. {
  7192. let pmTStart = performance.now();
  7193. let pmFunction = "uroFilterMapComments";
  7194.  
  7195. if(uroFilterPreamble() === false) return;
  7196.  
  7197. let uFURs_masterEnable = uroIsFilteringEnabled(false);
  7198. let filterDescMustBePresent = uroUtils.GetCBChecked('_cbMCDescriptionMustBePresent');
  7199. let filterDescMustBeAbsent = uroUtils.GetCBChecked('_cbMCDescriptionMustBeAbsent');
  7200. let filterKeywordMustBePresent = uroUtils.GetCBChecked('_cbMCEnableKeywordMustBePresent');
  7201. let filterKeywordMustBeAbsent = uroUtils.GetCBChecked('_cbMCEnableKeywordMustBeAbsent');
  7202. let filterMyFollowed = uroUtils.GetCBChecked('_cbMCHideMyFollowed');
  7203. let filterMyUnfollowed = uroUtils.GetCBChecked('_cbMCHideMyUnfollowed');
  7204. let filterRoadworks = uroUtils.GetCBChecked('_cbMCFilterRoadworks');
  7205. let filterConstruction = uroUtils.GetCBChecked('_cbMCFilterConstruction');
  7206. let filterClosure = uroUtils.GetCBChecked('_cbMCFilterClosure');
  7207. let filterEvent = uroUtils.GetCBChecked('_cbMCFilterEvent');
  7208. let filterNote = uroUtils.GetCBChecked('_cbMCFilterNote');
  7209. let filterWSLM = uroUtils.GetCBChecked('_cbMCFilterWSLM');
  7210. let filterBOG = uroUtils.GetCBChecked('_cbMCFilterBOG');
  7211. let filterDifficult = uroUtils.GetCBChecked('_cbMCFilterDifficult');
  7212. let invertFilters = uroUtils.GetCBChecked('_cbInvertMCFilter');
  7213. let keywordPresent = uroUtils.GetElmValue('_textMCKeywordPresent');
  7214. let keywordAbsent = uroUtils.GetElmValue('_textMCKeywordAbsent');
  7215. let caseInsensitive = uroUtils.GetCBChecked('_cbMCCaseInsensitive');
  7216. let filterCommentsMustBePresent = uroUtils.GetCBChecked('_cbMCCommentsMustBePresent');
  7217. let filterCommentsMustBeAbsent = uroUtils.GetCBChecked('_cbMCCommentsMustBeAbsent');
  7218.  
  7219. let filterExpiryMustBePresent = uroUtils.GetCBChecked('_cbMCExpiryMustBePresent');
  7220. let filterExpiryMustBeAbsent = uroUtils.GetCBChecked('_cbMCExpiryMustBeAbsent');
  7221. let filterByCreatorEnable = uroUtils.GetCBChecked('_cbMCCreatorIDFilter');
  7222. let filterL1 = uroUtils.GetCBChecked('_cbHideMCRank0');
  7223. let filterL2 = uroUtils.GetCBChecked('_cbHideMCRank1');
  7224. let filterL3 = uroUtils.GetCBChecked('_cbHideMCRank2');
  7225. let filterL4 = uroUtils.GetCBChecked('_cbHideMCRank3');
  7226. let filterL5 = uroUtils.GetCBChecked('_cbHideMCRank4');
  7227. let filterL6 = uroUtils.GetCBChecked('_cbHideMCRank5');
  7228. let filterWRCMC = uroUtils.GetCBChecked('_cbHideWRCMCs');
  7229. let selectorCreator = document.getElementById('_selectMCCreatorID');
  7230.  
  7231. if(filterByCreatorEnable === false)
  7232. {
  7233. while(selectorCreator.options.length > 0)
  7234. {
  7235. selectorCreator.options.remove(0);
  7236. }
  7237. }
  7238. let creatorUser = null;
  7239. if(filterByCreatorEnable === true)
  7240. {
  7241. if(selectorCreator.options.length === 0)
  7242. {
  7243. uroUpdateEditorList(W.model.mapComments.objects, '_selectMCCreatorID', true, false, false, false);
  7244. }
  7245. if(selectorCreator.selectedOptions[0] != null)
  7246. {
  7247. creatorUser = parseInt(selectorCreator.selectedOptions[0].value);
  7248. }
  7249. }
  7250.  
  7251. for (let mcIdx = 0; mcIdx < uroMCLayer.features.length; mcIdx++)
  7252. {
  7253. {
  7254. let mcObj = uroMCLayer?.features[mcIdx]?.attributes?.wazeFeature?._wmeObject;
  7255. if(mcObj !== undefined)
  7256. {
  7257. let desc = '';
  7258. if(mcObj.attributes.subject !== null) desc += mcObj.attributes.subject.replace(/<\/?[^>]+(>|$)/g, "");
  7259. if(mcObj.attributes.body !== null) desc += mcObj.attributes.body.replace(/<\/?[^>]+(>|$)/g, "");
  7260. let nComments = mcObj.attributes.conversation.length;
  7261. if(nComments > 0)
  7262. {
  7263. for(let cIdx=0; cIdx < nComments; cIdx++)
  7264. {
  7265. desc += mcObj.attributes.conversation[cIdx].text.replace(/<\/?[^>]+(>|$)/g, "");
  7266. }
  7267. }
  7268.  
  7269. let mcStyle = 'visible';
  7270. if(uroIgnore.IsOnList(mcObj.attributes.id)) mcStyle = 'hidden';
  7271. if(uFURs_masterEnable === true)
  7272. {
  7273. let ukroadworks_ur = false;
  7274. let construction_ur = false;
  7275. let closure_ur = false;
  7276. let event_ur = false;
  7277. let note_ur = false;
  7278. let wslm_ur = false;
  7279. let bog_ur = false;
  7280. let difficult_ur = false;
  7281.  
  7282. let filterByNotIncludedKeyword = false;
  7283. let filterByIncludedKeyword = true;
  7284.  
  7285. let customType = uroGetCustomType(null, "mc", desc);
  7286. if(customType === 0) ukroadworks_ur = true;
  7287. else if(customType === 1) construction_ur = true;
  7288. else if(customType === 2) closure_ur = true;
  7289. else if(customType === 3) event_ur = true;
  7290. else if(customType === 4) note_ur = true;
  7291. else if(customType === 5) wslm_ur = true;
  7292. else if(customType === 6) bog_ur = true;
  7293. else if(customType === 7) difficult_ur = true;
  7294.  
  7295. let rank = mcObj.attributes.lockRank;
  7296. let expiry = mcObj.attributes.endDate;
  7297.  
  7298. // keywords
  7299. if(mcStyle == 'visible')
  7300. {
  7301. if(filterDescMustBePresent === true)
  7302. {
  7303. if(desc === '') mcStyle = 'hidden';
  7304. }
  7305. if(filterDescMustBeAbsent === true)
  7306. {
  7307. if(desc !== '') mcStyle = 'hidden';
  7308. }
  7309.  
  7310. if(filterCommentsMustBePresent === true)
  7311. {
  7312. if(nComments === 0) mcStyle = 'hidden';
  7313. }
  7314. if(filterCommentsMustBeAbsent === true)
  7315. {
  7316. if(nComments > 0) mcStyle = 'hidden';
  7317. }
  7318.  
  7319. if(filterKeywordMustBePresent === true)
  7320. {
  7321. let keywordIsPresentInDesc = uroUtils.KeywordPresent(desc,keywordPresent,caseInsensitive);
  7322. filterByIncludedKeyword = (filterByIncludedKeyword && (!keywordIsPresentInDesc));
  7323. }
  7324. if(filterKeywordMustBeAbsent === true)
  7325. {
  7326. let keywordIsAbsentInDesc = uroUtils.KeywordPresent(desc,keywordAbsent,caseInsensitive);
  7327. filterByNotIncludedKeyword = (filterByNotIncludedKeyword || keywordIsAbsentInDesc);
  7328. }
  7329.  
  7330. filterByNotIncludedKeyword = (filterByNotIncludedKeyword && filterKeywordMustBeAbsent);
  7331. filterByIncludedKeyword = (filterByIncludedKeyword && filterKeywordMustBePresent);
  7332. if(filterByNotIncludedKeyword || filterByIncludedKeyword)
  7333. {
  7334. mcStyle = 'hidden';
  7335. }
  7336.  
  7337. }
  7338.  
  7339. //lock rank
  7340. if(mcStyle == 'visible')
  7341. {
  7342. if((filterL1 === true) && (rank == 0)) mcStyle = 'hidden';
  7343. if((filterL2 === true) && (rank == 1)) mcStyle = 'hidden';
  7344. if((filterL3 === true) && (rank == 2)) mcStyle = 'hidden';
  7345. if((filterL4 === true) && (rank == 3)) mcStyle = 'hidden';
  7346. if((filterL5 === true) && (rank == 4)) mcStyle = 'hidden';
  7347. if((filterL6 === true) && (rank == 5)) mcStyle = 'hidden';
  7348. }
  7349.  
  7350. // expiry
  7351. if(mcStyle == 'visible')
  7352. {
  7353. if((filterExpiryMustBePresent === true) && (expiry === null)) mcStyle = 'hidden';
  7354. if((filterExpiryMustBeAbsent === true) && (expiry != null)) mcStyle = 'hidden';
  7355. }
  7356.  
  7357. // is following?
  7358. if(mcStyle == 'visible')
  7359. {
  7360. if(mcObj.attributes.isFollowing === true)
  7361. {
  7362. if(filterMyFollowed === true) mcStyle = 'hidden';
  7363. }
  7364. else
  7365. {
  7366. if(filterMyUnfollowed === true) mcStyle = 'hidden';
  7367. }
  7368. }
  7369.  
  7370. if(mcStyle == 'visible')
  7371. {
  7372. if(creatorUser !== null)
  7373. {
  7374. if(mcObj.attributes.createdBy != creatorUser) mcStyle = 'hidden';
  7375. }
  7376. if(filterWRCMC === true)
  7377. {
  7378. if(mcObj.attributes.createdBy == 304740435) mcStyle = 'hidden';
  7379. }
  7380. }
  7381.  
  7382. // custom tags
  7383. if(mcStyle == 'visible')
  7384. {
  7385. if(ukroadworks_ur === true)
  7386. {
  7387. if(filterRoadworks === true) mcStyle = 'hidden';
  7388. }
  7389. else if(construction_ur === true)
  7390. {
  7391. if(filterConstruction === true) mcStyle = 'hidden';
  7392. }
  7393. else if(closure_ur === true)
  7394. {
  7395. if(filterClosure === true) mcStyle = 'hidden';
  7396. }
  7397. else if(event_ur === true)
  7398. {
  7399. if(filterEvent === true) mcStyle = 'hidden';
  7400. }
  7401. else if(note_ur === true)
  7402. {
  7403. if(filterNote === true) mcStyle = 'hidden';
  7404. }
  7405. else if(wslm_ur === true)
  7406. {
  7407. if(filterWSLM === true) mcStyle = 'hidden';
  7408. }
  7409. else if(bog_ur === true)
  7410. {
  7411. if(filterBOG === true) mcStyle = 'hidden';
  7412. }
  7413. else if(difficult_ur === true)
  7414. {
  7415. if(filterDifficult === true) mcStyle = 'hidden';
  7416. }
  7417.  
  7418. if(invertFilters === true)
  7419. {
  7420. if(mcStyle == 'hidden') mcStyle = 'visible';
  7421. else mcStyle = 'hidden';
  7422. }
  7423. }
  7424. }
  7425.  
  7426. let geoID = uroMCLayer.features[mcIdx].geometry.id;
  7427. if(document.getElementById(geoID) !== null)
  7428. {
  7429. document.getElementById(geoID).style.visibility = mcStyle;
  7430. }
  7431. }
  7432. }
  7433. }
  7434. uroDBG.PerfMon(pmFunction, pmTStart);
  7435. }
  7436. function uroFilterURs_onObjectsChanged()
  7437. {
  7438. if(uroFilterPreamble())
  7439. {
  7440. if(uroURDialogIsOpen === true)
  7441. {
  7442. uroFilterURs();
  7443. }
  7444. }
  7445. }
  7446. function uroFilterURs_onObjectsAdded()
  7447. {
  7448. if(uroFilterPreamble())
  7449. {
  7450. }
  7451. }
  7452. function uroFilterURs_onObjectsRemoved()
  7453. {
  7454. if(uroFilterPreamble())
  7455. {
  7456. }
  7457. }
  7458. function uroGetManagedAreas()
  7459. {
  7460. uroManagedAreas = [];
  7461. uroIgnoreAreasUserID = null;
  7462.  
  7463. for(let maObj in W.model.managedAreas.objects)
  7464. {
  7465. if(W.model.managedAreas.objects.hasOwnProperty(maObj))
  7466. {
  7467. uroManagedAreas.push(W.model.managedAreas.objects[maObj]);
  7468. }
  7469. }
  7470. return uroManagedAreas.length;
  7471. }
  7472. function uroCheckGeometryWithinManagedAreas(geo)
  7473. {
  7474. let retval = false;
  7475. let ignoreUserMA = false;
  7476.  
  7477. // If we're ignoring the user's managed area, then we first check to see if
  7478. // the geopoint lies within that - if so then we can skip checking all the
  7479. // other areas in the list...
  7480. if(uroIgnoreAreasUserID !== null)
  7481. {
  7482. for(let uma = 0; uma < uroManagedAreas.length; ++uma)
  7483. {
  7484. if(uroIgnoreAreasUserID == uroManagedAreas[uma].attributes.userID)
  7485. {
  7486. ignoreUserMA = uroContainsPoint(uroManagedAreas[uma].attributes.geoJSONGeometry.coordinates[0], geo);
  7487. break;
  7488. }
  7489. }
  7490. }
  7491.  
  7492. // Point either isn't within the user's area, or we're not ignoring it, so
  7493. // check the rest of the areas in the list
  7494. if(ignoreUserMA == false)
  7495. {
  7496. for(let ma = 0; ma < uroManagedAreas.length; ++ma)
  7497. {
  7498. if(uroIgnoreAreasUserID != uroManagedAreas[ma].attributes.userID)
  7499. {
  7500. retval = uroContainsPoint(uroManagedAreas[ma].attributes.geoJSONGeometry.coordinates[0], geo);
  7501. break;
  7502. }
  7503. }
  7504. }
  7505.  
  7506. return retval;
  7507. }
  7508. function uroGetURDriveGeoms()
  7509. {
  7510. let retval = [];
  7511.  
  7512. for (let urobj in W.model.mapUpdateRequests.objects)
  7513. {
  7514. if(W.model.mapUpdateRequests.objects.hasOwnProperty(urobj))
  7515. {
  7516. let ureq = W.model.mapUpdateRequests.objects[urobj];
  7517. let ureqID = ureq.attributes.id;
  7518.  
  7519. let hasGeo = false;
  7520. let thisRet = [];
  7521. thisRet.push(ureqID);
  7522. thisRet.push(null);
  7523. thisRet.push([]);
  7524.  
  7525. let latMin = 9999;
  7526. let latMax = -9999;
  7527. let lonMin = 9999;
  7528. let lonMax = -9999;
  7529.  
  7530. let urs = W.model.updateRequestSessions.objects[ureqID];
  7531. if((urs !== undefined) && (urs.attributes.driveGeometry !== undefined))
  7532. {
  7533. let cPairs = [];
  7534. for(let i = 0; i < urs.attributes.driveGeometry.coordinates.length; ++i)
  7535. {
  7536. for(let j = 0; j < urs.attributes.driveGeometry.coordinates[i].length; ++j)
  7537. {
  7538. if((i === 0) || (j > 0))
  7539. {
  7540. let coords = urs.attributes.driveGeometry.coordinates[i][j];
  7541. cPairs.push(coords);
  7542.  
  7543. if(coords[0] > lonMax)
  7544. {
  7545. lonMax = coords[0];
  7546. }
  7547. if(coords[0] < lonMin)
  7548. {
  7549. lonMin = coords[0];
  7550. }
  7551. if(coords[1] > latMax)
  7552. {
  7553. latMax = coords[1];
  7554. }
  7555. if(coords[1] < latMin)
  7556. {
  7557. latMin = coords[1];
  7558. }
  7559.  
  7560. hasGeo = true;
  7561. }
  7562. }
  7563. }
  7564. let bbox = [];
  7565. bbox.push(lonMin);
  7566. bbox.push(lonMax);
  7567. bbox.push(latMin);
  7568. bbox.push(latMax);
  7569. thisRet.push(bbox);
  7570. thisRet.push(cPairs);
  7571. }
  7572.  
  7573. if(hasGeo === true)
  7574. {
  7575. retval.push(thisRet);
  7576. }
  7577. }
  7578. }
  7579. return retval;
  7580. }
  7581. function uroCompareDriveGeos(geoA, geoB)
  7582. {
  7583. const matchLength = 5;
  7584. let retval = false;
  7585.  
  7586. if((geoA.length >= matchLength) && (geoB.length >= matchLength))
  7587. {
  7588. for(let i = 0; i < (geoA.length - matchLength); ++i)
  7589. {
  7590. for(let j = 0; j < (geoB.length - matchLength); ++j)
  7591. {
  7592. if((geoA[i][0] == geoB[j][0]) && (geoA[i][1] == geoB[j][1]))
  7593. {
  7594. retval = true;
  7595. for(let k = 1; k < matchLength; ++k)
  7596. {
  7597. if((geoA[i+k][0] != geoB[j+k][0]) || (geoA[i+k][1] != geoB[j+k][1]))
  7598. {
  7599. retval = false;
  7600. break;
  7601. }
  7602. }
  7603. }
  7604. if(retval === true)
  7605. {
  7606. break;
  7607. }
  7608. }
  7609.  
  7610. if(retval === true)
  7611. {
  7612. break;
  7613. }
  7614. }
  7615. }
  7616. return retval;
  7617. }
  7618. function uroCompareDriveBBoxes(bbA, bbB)
  7619. {
  7620. let retval = true;
  7621.  
  7622. if
  7623. (
  7624. (bbA[0] > bbB[1]) ||
  7625. (bbA[1] < bbB[0]) ||
  7626. (bbA[2] > bbB[3]) ||
  7627. (bbA[3] < bbB[2])
  7628. )
  7629. {
  7630. retval = false;
  7631. }
  7632.  
  7633. return retval;
  7634. }
  7635. function uroGetURDupes()
  7636. {
  7637. uroURDupes = [];
  7638.  
  7639. // To determine which URs are duplicates of one another (i.e. have been raised by the same user
  7640. // during the same section of a journey), we first compare the geometries of the drive tracks
  7641. // attached to any URs which have them - as this is based on the users GPS position rather than
  7642. // the WME map data, it makes it vanishingly unlikely that any two users would have identical
  7643. // GPS positions (especially given the level of accuracy to which the track points are stored)
  7644. // even if they were driving exactly the same route at the same speed, in the same lane etc.
  7645. //
  7646. // To accelerate this geometry comparison, we start by performing a simple bounding box overlap
  7647. // check for the two geometries under consideration - if there's no overlap then there can't be
  7648. // any geometry match, so no need to continue onto the more detailed comparision of the GPS
  7649. // tracks themselves...
  7650. let driveGeos = uroGetURDriveGeoms();
  7651. if(driveGeos.length > 1)
  7652. {
  7653. for(let i = 0; i < (driveGeos.length - 1); ++i)
  7654. {
  7655. if(driveGeos[i].length !== 5)
  7656. {
  7657. driveGeos[i][1] = false;
  7658. }
  7659. else
  7660. {
  7661. for(let j = (i + 1); j < driveGeos.length; ++j)
  7662. {
  7663. if(driveGeos[j].length === 5)
  7664. {
  7665. let geoMatch = uroCompareDriveBBoxes(driveGeos[i][3], driveGeos[j][3]);
  7666. if(geoMatch === true)
  7667. {
  7668. geoMatch = uroCompareDriveGeos(driveGeos[i][4], driveGeos[j][4]);
  7669. if(geoMatch === true)
  7670. {
  7671. driveGeos[i][2].push(driveGeos[j][0]);
  7672. driveGeos[j][2].push(driveGeos[i][0]);
  7673. }
  7674. }
  7675. }
  7676. }
  7677. }
  7678. }
  7679.  
  7680. for(let i = 0; i < driveGeos.length; ++i)
  7681. {
  7682. if(driveGeos[i][2].length > 0)
  7683. {
  7684. let res = [];
  7685. res.push(driveGeos[i][0]);
  7686. res.push(driveGeos[i][2]);
  7687. uroURDupes.push(res);
  7688. }
  7689. }
  7690. }
  7691.  
  7692. // Once we've done the initial drive track comparision, uroURDupes will contain a list of
  7693. // all the URs which were matched up based on that. However, as the track comparision is
  7694. // inherently limited by the amount of track data included with each UR, this initial
  7695. // comparison may mean some more widely spaced URs aren't flagged as duplicates simply
  7696. // because there's insufficient overlap between their tracks, even though there may have
  7697. // been further URs dropped inbetween to which they were matched.
  7698. //
  7699. // e.g. if a user drops 4 URs along a section of their journey, spaced such that each of
  7700. // the GPS tracks generates a comparison match with the UR either side of it, but no
  7701. // further than that, we would get:
  7702. //
  7703. // UR A......UR B.......UR C......UR D
  7704. //
  7705. // Matches: A to B, B to A & C, C to B & D, D to C
  7706. //
  7707. // Note how, although we know all of these URs are in fact duplicates, and can infer this
  7708. // from seeing that e.g. A is flagged only as a duplicate of B, however as B is flagged as
  7709. // a duplicate of A & C, and C is flagged as a duplicate of B & D, A MUST therefore be a
  7710. // duplicate of B, C & D...
  7711. //
  7712. // To fix this, we now run a merging pass over each of the entries in uroURDupes - for
  7713. // each entry we see if its ID appears in any of the other entries as a duplicate, and
  7714. // if so we merge the duplicates for both entries.
  7715.  
  7716. for(let i = 0; i < uroURDupes.length; ++i)
  7717. {
  7718. let urID = uroURDupes[i][0];
  7719. for(let j = 0; j < uroURDupes.length; ++j)
  7720. {
  7721. if(i != j)
  7722. {
  7723. if(uroURDupes[j][1].includes(urID) === true)
  7724. {
  7725. // https://stackoverflow.com/questions/1584370/how-to-merge-two-arrays-in-javascript-and-de-duplicate-items
  7726. let mergedDupes = [...new Set([...uroURDupes[i][1], ...uroURDupes[j][1]])];
  7727. uroURDupes[i][1] = mergedDupes;
  7728. uroURDupes[j][1] = mergedDupes;
  7729. }
  7730. }
  7731. }
  7732. }
  7733. }
  7734. function uroFilterURs()
  7735. {
  7736. let pmTStart = performance.now();
  7737. let pmFunction = "uroFilterURs";
  7738.  
  7739. if(uroUserID === -1)
  7740. {
  7741. return;
  7742. }
  7743.  
  7744. if(uroInhibitURFiltering === true)
  7745. {
  7746. return;
  7747. }
  7748.  
  7749.  
  7750. // compatibility fix for URComments - based on code supplied by RickZabel
  7751. let hasActiveURFilters = false;
  7752. if(uroIsFilteringEnabled(false) === true)
  7753. {
  7754. let urTabInputs = uroTabs.CtrlTabs[uroTabs.IDS.URS][uroTabs.FIELDS.TABBODY].getElementsByTagName('input');
  7755. for(let loop = 0; loop < urTabInputs.length; loop++)
  7756. {
  7757. if(urTabInputs[loop].type == 'checkbox')
  7758. {
  7759. let ignoreCB = false;
  7760. ignoreCB = ignoreCB || (urTabInputs[loop].id == '_cbCaseInsensitive');
  7761. ignoreCB = ignoreCB || (urTabInputs[loop].id == '_cbNoFilterForTaggedURs');
  7762. if((urTabInputs[loop].checked) && (ignoreCB === false))
  7763. {
  7764. hasActiveURFilters = true;
  7765. break;
  7766. }
  7767. }
  7768. }
  7769. }
  7770. sessionStorage.UROverview_hasActiveURFilters = hasActiveURFilters;
  7771. if(uroFilterPreamble() === false) return;
  7772. uroRefreshUpdateRequestSessions();
  7773. let selectorResolver = document.getElementById('_selectURResolverID');
  7774. let selectorCommentUser = document.getElementById('_selectURUserID');
  7775. if(uroUtils.GetCBChecked('_cbURResolverIDFilter') === false)
  7776. {
  7777. while(selectorResolver.options.length > 0)
  7778. {
  7779. selectorResolver.options.remove(0);
  7780. }
  7781. }
  7782. if(uroUtils.GetCBChecked('_cbURUserIDFilter') === false)
  7783. {
  7784. while(selectorCommentUser.options.length > 0)
  7785. {
  7786. selectorCommentUser.options.remove(0);
  7787. }
  7788. }
  7789. if(Object.keys(W.model.updateRequestSessions.objects).length === 0)
  7790. {
  7791. // This may be the case if the user has disabled the UR layer, so call
  7792. // AddCommentCounts to clear any existing ones from the map view...
  7793. uroURExtras.AddCommentCounts();
  7794. return;
  7795. }
  7796. let commenterUser = null;
  7797. if(uroUtils.GetCBChecked('_cbURUserIDFilter') === true)
  7798. {
  7799. if(selectorCommentUser.options.length === 0)
  7800. {
  7801. uroUpdateEditorList(W.model.updateRequestSessions.objects, '_selectURUserID', false, false, false, true);
  7802. }
  7803. if(selectorCommentUser.selectedOptions[0] != null)
  7804. {
  7805. commenterUser = parseInt(selectorCommentUser.selectedOptions[0].value);
  7806. }
  7807. }
  7808. let resolverUser = null;
  7809. if(uroUtils.GetCBChecked('_cbURResolverIDFilter') === true)
  7810. {
  7811. if(selectorResolver.options.length === 0)
  7812. {
  7813. uroUpdateEditorList(W.model.mapUpdateRequests.objects, '_selectURResolverID', false, false, true, false);
  7814. }
  7815. if(selectorResolver.selectedOptions[0] != null)
  7816. {
  7817. resolverUser = parseInt(selectorResolver.selectedOptions[0].value);
  7818. }
  7819. }
  7820. uroURExtras.urList = [];
  7821. uroGetURDupes();
  7822.  
  7823. let uFURs_masterEnable = uroIsFilteringEnabled(false);
  7824. let filterOutsideEditableArea = uroUtils.GetCBChecked('_cbURFilterOutsideArea');
  7825. let filterInsideManagedAreas = uroUtils.GetCBChecked('_cbURFilterInsideManagedAreas');
  7826. let filterSolved = uroUtils.GetCBChecked('_cbFilterSolved');
  7827. let filterUnidentified = uroUtils.GetCBChecked('_cbFilterUnidentified');
  7828. let filterClosed = uroUtils.GetCBChecked('_cbFilterClosedUR');
  7829. let filterOpen = uroUtils.GetCBChecked('_cbFilterOpenUR');
  7830. let filterDescMustBePresent = uroUtils.GetCBChecked('_cbURDescriptionMustBePresent');
  7831. let filterDescMustBeAbsent = uroUtils.GetCBChecked('_cbURDescriptionMustBeAbsent');
  7832. let filterKeywordMustBePresent = uroUtils.GetCBChecked('_cbEnableKeywordMustBePresent');
  7833. let filterKeywordMustBeAbsent = uroUtils.GetCBChecked('_cbEnableKeywordMustBeAbsent');
  7834. let filterMinURAge = uroUtils.GetCBChecked('_cbEnableMinAgeFilter');
  7835. let filterMaxURAge = uroUtils.GetCBChecked('_cbEnableMaxAgeFilter');
  7836. let filterMinComments = uroUtils.GetCBChecked('_cbEnableMinCommentsFilter');
  7837. let filterMaxComments = uroUtils.GetCBChecked('_cbEnableMaxCommentsFilter');
  7838. let filterReporterLastCommenter = uroUtils.GetCBChecked('_cbHideIfReporterLastCommenter');
  7839. let filterReporterNotLastCommenter = uroUtils.GetCBChecked('_cbHideIfReporterNotLastCommenter');
  7840. let filterHideAnyComments = uroUtils.GetCBChecked('_cbHideAnyComments');
  7841. let filterHideNotLastCommenter = uroUtils.GetCBChecked('_cbHideIfNotLastCommenter');
  7842. let filterHideMyComments = uroUtils.GetCBChecked('_cbHideMyComments');
  7843. let filterIfLastCommenter = uroUtils.GetCBChecked('_cbHideIfLastCommenter');
  7844. let filterIfNotLastCommenter = uroUtils.GetCBChecked('_cbHideIfNotLastCommenter');
  7845. let filterCommentMinAge = uroUtils.GetCBChecked('_cbEnableCommentAgeFilter2');
  7846. let filterCommentMaxAge = uroUtils.GetCBChecked('_cbEnableCommentAgeFilter');
  7847. let filterUserID = uroUtils.GetCBChecked('_cbURUserIDFilter');
  7848. let filterMyFollowed = uroUtils.GetCBChecked('_cbHideMyFollowed');
  7849. let filterMyUnfollowed = uroUtils.GetCBChecked('_cbHideMyUnfollowed');
  7850.  
  7851. let filterWazeAuto = uroUtils.GetCBChecked('_cbFilterWazeAuto');
  7852. let filterRoadworks = uroUtils.GetCBChecked('_cbFilterRoadworks');
  7853. let filterConstruction = uroUtils.GetCBChecked('_cbFilterConstruction');
  7854. let filterClosure = uroUtils.GetCBChecked('_cbFilterClosure');
  7855. let filterEvent = uroUtils.GetCBChecked('_cbFilterEvent');
  7856. let filterNote = uroUtils.GetCBChecked('_cbFilterNote');
  7857. let filterWSLM = uroUtils.GetCBChecked('_cbFilterWSLM');
  7858. let filterBOG = uroUtils.GetCBChecked('_cbFilterBOG');
  7859. let filterDifficult = uroUtils.GetCBChecked('_cbFilterDifficult');
  7860.  
  7861. let filterIncorrectTurn = uroUtils.GetCBChecked('_cbFilterIncorrectTurn');
  7862. let filterIncorrectAddress = uroUtils.GetCBChecked('_cbFilterIncorrectAddress');
  7863. let filterIncorrectRoute = uroUtils.GetCBChecked('_cbFilterIncorrectRoute');
  7864. let filterMissingRoundabout = uroUtils.GetCBChecked('_cbFilterMissingRoundabout');
  7865. let filterGeneralError = uroUtils.GetCBChecked('_cbFilterGeneralError');
  7866. let filterTurnNotAllowed = uroUtils.GetCBChecked('_cbFilterTurnNotAllowed');
  7867. let filterIncorrectJunction = uroUtils.GetCBChecked('_cbFilterIncorrectJunction');
  7868. let filterMissingBridgeOverpass = uroUtils.GetCBChecked('_cbFilterMissingBridgeOverpass');
  7869. let filterWrongDrivingDirection = uroUtils.GetCBChecked('_cbFilterWrongDrivingDirection');
  7870. let filterMissingExit = uroUtils.GetCBChecked('_cbFilterMissingExit');
  7871. let filterMissingRoad = uroUtils.GetCBChecked('_cbFilterMissingRoad');
  7872. let filterMissingLandmark = uroUtils.GetCBChecked('_cbFilterMissingLandmark');
  7873. let filterNativeSpeedLimit = uroUtils.GetCBChecked('_cbFilterSpeedLimits');
  7874. let filterBlockedRoad = uroUtils.GetCBChecked('_cbFilterBlockedRoad');
  7875. let filterUndefined = uroUtils.GetCBChecked('_cbFilterUndefined');
  7876.  
  7877. let invertURFilters = uroUtils.GetCBChecked('_cbInvertURFilter');
  7878. let invertURStateFilters = uroUtils.GetCBChecked('_cbInvertURStateFilter');
  7879. let noFilterTaggedURs = uroUtils.GetCBChecked('_cbNoFilterForTaggedURs');
  7880. let noFilterURInURL = uroUtils.GetCBChecked('_cbNoFilterForURInURL');
  7881. let showOnlyDupes = uroUtils.GetCBChecked('_cbURFilterDupes');
  7882.  
  7883. let keywordPresent = uroUtils.GetElmValue('_textKeywordPresent');
  7884. let keywordAbsent = uroUtils.GetElmValue('_textKeywordAbsent');
  7885. let caseInsensitive = uroUtils.GetCBChecked('_cbCaseInsensitive');
  7886. let thresholdMinAge = uroUtils.GetElmValue('_inputFilterMinDays');
  7887. let thresholdMaxAge = uroUtils.GetElmValue('_inputFilterMaxDays');
  7888. let thresholdMinComments = uroUtils.GetElmValue('_inputFilterMinComments');
  7889. let thresholdMaxComments = uroUtils.GetElmValue('_inputFilterMaxComments');
  7890. let thresholdMaxCommentAge = uroUtils.GetElmValue('_inputFilterCommentDays');
  7891. let thresholdMinCommentAge = uroUtils.GetElmValue('_inputFilterCommentDays2');
  7892. let ignoreOtherEditorComments = uroUtils.GetCBChecked('_cbIgnoreOtherEditorComments');
  7893. let urcFilteringIsActive = false;
  7894. let urcCB = document.getElementById('URCommentsFilterEnabled');
  7895. if(urcCB !== null)
  7896. {
  7897. if(urcCB.checked)
  7898. {
  7899. urcFilteringIsActive = true;
  7900. }
  7901. }
  7902. urcCB = document.getElementById('URCommentUROOnlyMyUR');
  7903. if(urcCB !== null)
  7904. {
  7905. if(urcCB.checked)
  7906. {
  7907. urcFilteringIsActive = true;
  7908. }
  7909. }
  7910. urcCB = document.getElementById('URCommentUROHideTagged');
  7911. if(urcCB !== null)
  7912. {
  7913. if(urcCB.checked)
  7914. {
  7915. urcFilteringIsActive = true;
  7916. }
  7917. }
  7918.  
  7919. filterInsideManagedAreas = filterInsideManagedAreas && (uroGetManagedAreas() !== 0);
  7920. if(uroUtils.GetCBChecked('_cbURExcludeUserArea') == true)
  7921. {
  7922. uroIgnoreAreasUserID = W.loginManager.user.attributes.id;
  7923. }
  7924.  
  7925. for (let urobj in W.model.mapUpdateRequests.objects)
  7926. {
  7927. if(W.model.mapUpdateRequests.objects.hasOwnProperty(urobj))
  7928. {
  7929. let ureq = W.model.mapUpdateRequests.objects[urobj];
  7930. let ureqID = ureq.attributes.id;
  7931.  
  7932. let urStyle = 'visible';
  7933. let inhibitFiltering = ((ureqID == uroSelectedURID) && (noFilterURInURL));
  7934.  
  7935. let hasMyComments = false;
  7936. let nComments = 0;
  7937. let desc = ureq.attributes.description;
  7938. let customType = uroGetCustomType(ureqID, uroLayers.ID.UR, desc);
  7939. let ageLastComment = null;
  7940. if(W.model.updateRequestSessions.objects[ureqID] != null)
  7941. {
  7942. nComments = W.model.updateRequestSessions.objects[ureqID].attributes.comments.length;
  7943. if(nComments != 0)
  7944. {
  7945. ageLastComment = uroUtils.GetCommentAge(W.model.updateRequestSessions.objects[ureqID].attributes.comments[nComments-1]);
  7946. }
  7947. if((uFURs_masterEnable === false) && (nComments === 0))
  7948. {
  7949. // when master enable is turned off, we want to make sure that all URs, including ones that were previously hidden, are correctly
  7950. // displayed in their native form - i.e. no comment count or custom conversation bubbles. The easiest way to achieve this is to
  7951. // force the AddCommentCounts code to test for the presence of these bubbles on each UR, which we do by setting a non-zero
  7952. // comment count for each UR... For URs which genuinely do have no comments we use -1 to indicate that we're not really setting
  7953. // a comment count, but that we still need to do something that wouldn't be achieved by using 0.
  7954. nComments = -1;
  7955. }
  7956. }
  7957.  
  7958. // check UR against current session ignore list...
  7959. if(uroIgnore.IsOnList(ureqID)) urStyle = 'hidden';
  7960.  
  7961. if((uFURs_masterEnable === true) && (inhibitFiltering === false))
  7962. {
  7963. let wazeauto_ur = false;
  7964. let ukroadworks_ur = false;
  7965. let construction_ur = false;
  7966. let closure_ur = false;
  7967. let event_ur = false;
  7968. let note_ur = false;
  7969. let wslm_ur = false;
  7970. let bog_ur = false;
  7971. let difficult_ur = false;
  7972.  
  7973. let filterByNotIncludedKeyword = false;
  7974. let filterByIncludedKeyword = true;
  7975.  
  7976. if(desc !== null) desc = desc.replace(/<\/?[^>]+(>|$)/g, "");
  7977. else desc = '';
  7978.  
  7979. if(customType === 0) ukroadworks_ur = true;
  7980. else if(customType === 1) construction_ur = true;
  7981. else if(customType === 2) closure_ur = true;
  7982. else if(customType === 3) event_ur = true;
  7983. else if(customType === 4) note_ur = true;
  7984. else if(customType === 5) wslm_ur = true;
  7985. else if(customType === 6) bog_ur = true;
  7986. else if(customType === 7) difficult_ur = true;
  7987.  
  7988. // check UR against editable area...
  7989.  
  7990. if(filterOutsideEditableArea === true)
  7991. {
  7992. if(ureq.canEdit() === false) urStyle = 'hidden';
  7993. }
  7994.  
  7995. if(filterInsideManagedAreas === true)
  7996. {
  7997. if(uroCheckGeometryWithinManagedAreas(ureq.attributes.geoJSONGeometry.coordinates) === true) urStyle = 'hidden';
  7998. }
  7999.  
  8000. if(showOnlyDupes === true)
  8001. {
  8002. let isDupe = false;
  8003. for(let i = 0; i < uroURDupes.length; ++i)
  8004. {
  8005. if(uroURDupes[i][0] === ureqID)
  8006. {
  8007. isDupe = true;
  8008. break;
  8009. }
  8010. }
  8011. if(isDupe === false) urStyle = 'hidden';
  8012. }
  8013.  
  8014. // state-age filtering
  8015. if(urStyle == 'visible')
  8016. {
  8017. // check against closed/not identified filtering if enabled...
  8018. if(filterSolved === true)
  8019. {
  8020. if(ureq.attributes.resolution === 0) urStyle = 'hidden';
  8021. }
  8022. if(filterUnidentified === true)
  8023. {
  8024. if(ureq.attributes.resolution == 1) urStyle = 'hidden';
  8025. }
  8026.  
  8027. if((ureq.attributes.resolvedOn !== null) && (filterClosed === true))
  8028. {
  8029. urStyle = 'hidden';
  8030. }
  8031.  
  8032. if((ureq.attributes.resolvedOn === null) && (filterOpen === true))
  8033. {
  8034. urStyle = 'hidden';
  8035. }
  8036.  
  8037. if(urStyle == 'visible')
  8038. {
  8039. // check UR against keyword filtering if enabled...
  8040. if(filterDescMustBePresent === true)
  8041. {
  8042. if(desc === '') urStyle = 'hidden';
  8043. }
  8044. if(filterDescMustBeAbsent === true)
  8045. {
  8046. if(desc !== '') urStyle = 'hidden';
  8047. }
  8048.  
  8049. if(filterKeywordMustBePresent === true)
  8050. {
  8051. let keywordIsPresentInDesc = uroUtils.KeywordPresent(desc,keywordPresent,caseInsensitive);
  8052. filterByIncludedKeyword = (filterByIncludedKeyword && (!keywordIsPresentInDesc));
  8053. }
  8054. if(filterKeywordMustBeAbsent === true)
  8055. {
  8056. let keywordIsAbsentInDesc = uroUtils.KeywordPresent(desc,keywordAbsent,caseInsensitive);
  8057. filterByNotIncludedKeyword = (filterByNotIncludedKeyword || keywordIsAbsentInDesc);
  8058. }
  8059. }
  8060.  
  8061. if(urStyle == 'visible')
  8062. {
  8063. // do age-based filtering if enabled
  8064. if(filterMinURAge === true)
  8065. {
  8066. if(uroUtils.GetURAge(ureq,0,false) < thresholdMinAge) urStyle = 'hidden';
  8067. }
  8068. if(filterMaxURAge === true)
  8069. {
  8070. if(uroUtils.GetURAge(ureq,0,false) > thresholdMaxAge) urStyle = 'hidden';
  8071. }
  8072. }
  8073.  
  8074. if(urStyle == 'visible')
  8075. {
  8076. if(resolverUser !== null)
  8077. {
  8078. if(ureq.attributes.resolvedBy != resolverUser) urStyle = 'hidden';
  8079. }
  8080. }
  8081.  
  8082. if(urStyle == 'visible')
  8083. {
  8084. // do comments/following filtering
  8085. if(W.model.updateRequestSessions.objects[ureqID] != null)
  8086. {
  8087. nComments = W.model.updateRequestSessions.objects[ureqID].attributes.comments.length;
  8088. let commentDaysOld = -1;
  8089.  
  8090.  
  8091. if(filterMinComments === true)
  8092. {
  8093. if(nComments < thresholdMinComments) urStyle = 'hidden';
  8094. }
  8095. if(filterMaxComments === true)
  8096. {
  8097. if(nComments > thresholdMaxComments) urStyle = 'hidden';
  8098. }
  8099.  
  8100.  
  8101. if(nComments > 0)
  8102. {
  8103. let reporterIsLastCommenter = false;
  8104. if(W.model.updateRequestSessions.objects[ureqID].attributes.comments[nComments-1].userID == -1) reporterIsLastCommenter = true;
  8105.  
  8106. if(filterReporterLastCommenter === true)
  8107. {
  8108. if(reporterIsLastCommenter === true) urStyle = 'hidden';
  8109. }
  8110. else if(filterReporterNotLastCommenter === true)
  8111. {
  8112. if(reporterIsLastCommenter === false) urStyle = 'hidden';
  8113. }
  8114.  
  8115. hasMyComments = uroURHasMyComments(ureqID);
  8116. if(hasMyComments === false)
  8117. {
  8118. if(filterHideAnyComments === true) urStyle = 'hidden';
  8119. if(filterHideNotLastCommenter === true) urStyle = 'hidden';
  8120. }
  8121. else
  8122. {
  8123. if(filterHideMyComments === true) urStyle = 'hidden';
  8124.  
  8125. let userIsLastCommenter = false;
  8126. if(W.model.updateRequestSessions.objects[ureqID].attributes.comments[nComments-1].userID == uroUserID) userIsLastCommenter = true;
  8127.  
  8128. if(filterIfLastCommenter === true)
  8129. {
  8130. if(userIsLastCommenter === true) urStyle = 'hidden';
  8131. }
  8132. else if(filterIfNotLastCommenter === true)
  8133. {
  8134. if(userIsLastCommenter === false) urStyle = 'hidden';
  8135. }
  8136. }
  8137.  
  8138. let cidx;
  8139. if(ignoreOtherEditorComments === false)
  8140. {
  8141. commentDaysOld = ageLastComment;
  8142. }
  8143. else
  8144. {
  8145. for(cidx=0; cidx<nComments; cidx++)
  8146. {
  8147. let cObj = W.model.updateRequestSessions.objects[ureqID].attributes.comments[cidx];
  8148. if((cObj.userID == uroUserID) || (cObj.userID == -1))
  8149. {
  8150. commentDaysOld = uroUtils.GetCommentAge(cObj);
  8151. }
  8152. }
  8153. }
  8154. if((filterCommentMinAge === true) && (commentDaysOld != -1))
  8155. {
  8156. if(thresholdMinCommentAge > commentDaysOld) urStyle = 'hidden';
  8157. }
  8158. if((filterCommentMaxAge === true) && (commentDaysOld != -1))
  8159. {
  8160. if(thresholdMaxCommentAge < commentDaysOld) urStyle = 'hidden';
  8161. }
  8162.  
  8163. if((commenterUser !== null) && (urStyle != 'hidden'))
  8164. {
  8165. urStyle = 'hidden';
  8166. for(cidx=0; cidx<nComments; cidx++)
  8167. {
  8168. if(W.model.updateRequestSessions.objects[ureqID].attributes.comments[cidx].userID == commenterUser)
  8169. {
  8170. urStyle = 'visible';
  8171. break;
  8172. }
  8173. }
  8174. }
  8175.  
  8176. let commentText = '';
  8177. for(cidx=0; cidx<nComments; cidx++)
  8178. {
  8179. commentText += W.model.updateRequestSessions.objects[ureqID].attributes.comments[cidx].text;
  8180. }
  8181.  
  8182. if(filterKeywordMustBePresent === true)
  8183. {
  8184. let keywordIsPresentInComments = uroUtils.KeywordPresent(commentText,keywordPresent,caseInsensitive);
  8185. filterByIncludedKeyword = (filterByIncludedKeyword && (!keywordIsPresentInComments));
  8186. }
  8187. if(filterKeywordMustBeAbsent === true)
  8188. {
  8189. let keywordIsAbsentInComments = uroUtils.KeywordPresent(commentText,keywordAbsent,caseInsensitive);
  8190. filterByNotIncludedKeyword = (filterByNotIncludedKeyword || keywordIsAbsentInComments);
  8191. }
  8192. }
  8193. else
  8194. {
  8195. if(filterUserID === true)
  8196. {
  8197. urStyle = 'hidden';
  8198. }
  8199. }
  8200.  
  8201. filterByNotIncludedKeyword = (filterByNotIncludedKeyword && filterKeywordMustBeAbsent);
  8202. filterByIncludedKeyword = (filterByIncludedKeyword && filterKeywordMustBePresent);
  8203. if(filterByNotIncludedKeyword || filterByIncludedKeyword)
  8204. {
  8205. urStyle = 'hidden';
  8206. }
  8207.  
  8208. if(W.model.updateRequestSessions.objects[ureqID].attributes.isFollowing === true)
  8209. {
  8210. if(filterMyFollowed === true) urStyle = 'hidden';
  8211. }
  8212. else
  8213. {
  8214. if(filterMyUnfollowed === true) urStyle = 'hidden';
  8215. }
  8216. }
  8217. }
  8218.  
  8219. if(invertURStateFilters === true)
  8220. {
  8221. if(urStyle == 'hidden') urStyle = 'visible';
  8222. else urStyle = 'hidden';
  8223. }
  8224. }
  8225.  
  8226. // type filtering
  8227. if(urStyle == 'visible')
  8228. {
  8229. // Test for Waze automatic URs before any others - these always (?) get inserted as General Error URs,
  8230. // so we can't filter them by type...
  8231. if(desc.indexOf('Waze Automatic:') != -1)
  8232. {
  8233. wazeauto_ur = true;
  8234. }
  8235.  
  8236. if(wazeauto_ur === true)
  8237. {
  8238. if(filterWazeAuto === true) urStyle = 'hidden';
  8239. }
  8240.  
  8241. else if(ukroadworks_ur === true)
  8242. {
  8243. if(filterRoadworks === true) urStyle = 'hidden';
  8244. }
  8245. else if(construction_ur === true)
  8246. {
  8247. if(filterConstruction === true) urStyle = 'hidden';
  8248. }
  8249. else if(closure_ur === true)
  8250. {
  8251. if(filterClosure === true) urStyle = 'hidden';
  8252. }
  8253. else if(event_ur === true)
  8254. {
  8255. if(filterEvent === true) urStyle = 'hidden';
  8256. }
  8257. else if(note_ur === true)
  8258. {
  8259. if(filterNote === true) urStyle = 'hidden';
  8260. }
  8261. else if(wslm_ur === true)
  8262. {
  8263. if(filterWSLM === true) urStyle = 'hidden';
  8264. }
  8265. else if(bog_ur === true)
  8266. {
  8267. if(filterBOG === true) urStyle = 'hidden';
  8268. }
  8269. else if(difficult_ur === true)
  8270. {
  8271. if(filterDifficult === true) urStyle = 'hidden';
  8272. }
  8273.  
  8274. else if(ureq.attributes.type == 6)
  8275. {
  8276. if(filterIncorrectTurn === true) urStyle = 'hidden';
  8277. }
  8278. else if(ureq.attributes.type == 7)
  8279. {
  8280. if (filterIncorrectAddress === true) urStyle = 'hidden';
  8281. }
  8282. else if(ureq.attributes.type == 8)
  8283. {
  8284. if(filterIncorrectRoute === true) urStyle = 'hidden';
  8285. }
  8286. else if(ureq.attributes.type == 9)
  8287. {
  8288. if(filterMissingRoundabout === true) urStyle = 'hidden';
  8289. }
  8290. else if(ureq.attributes.type == 10)
  8291. {
  8292. if(filterGeneralError === true) urStyle = 'hidden';
  8293. }
  8294. else if(ureq.attributes.type == 11)
  8295. {
  8296. if(filterTurnNotAllowed === true) urStyle = 'hidden';
  8297. }
  8298. else if(ureq.attributes.type == 12)
  8299. {
  8300. if(filterIncorrectJunction === true) urStyle = 'hidden';
  8301. }
  8302. else if(ureq.attributes.type == 13)
  8303. {
  8304. if(filterMissingBridgeOverpass === true) urStyle = 'hidden';
  8305. }
  8306. else if(ureq.attributes.type == 14)
  8307. {
  8308. if(filterWrongDrivingDirection === true) urStyle = 'hidden';
  8309. }
  8310. else if(ureq.attributes.type == 15)
  8311. {
  8312. if(filterMissingExit === true) urStyle = 'hidden';
  8313. }
  8314. else if(ureq.attributes.type == 16)
  8315. {
  8316. if(filterMissingRoad === true) urStyle = 'hidden';
  8317. }
  8318. else if(ureq.attributes.type == 18)
  8319. {
  8320. if(filterMissingLandmark === true) urStyle = 'hidden';
  8321. }
  8322. else if(ureq.attributes.type == 19)
  8323. {
  8324. if(filterBlockedRoad === true) urStyle = 'hidden';
  8325. }
  8326. else if(ureq.attributes.type == 23)
  8327. {
  8328. if(filterNativeSpeedLimit === true) urStyle = 'hidden';
  8329. }
  8330. else if(filterUndefined === true) urStyle = 'hidden';
  8331.  
  8332. if(invertURFilters === true)
  8333. {
  8334. if(urStyle == 'hidden') urStyle = 'visible';
  8335. else urStyle = 'hidden';
  8336. }
  8337. }
  8338.  
  8339. // stage-age filtering override for tagged URs
  8340. if(noFilterTaggedURs === true)
  8341. {
  8342. if(ukroadworks_ur === true)
  8343. {
  8344. if(filterRoadworks === false) urStyle = 'visible';
  8345. }
  8346. else if(construction_ur === true)
  8347. {
  8348. if(filterConstruction === false) urStyle = 'visible';
  8349. }
  8350. else if(closure_ur === true)
  8351. {
  8352. if(filterClosure === false) urStyle = 'visible';
  8353. }
  8354. else if(event_ur === true)
  8355. {
  8356. if(filterEvent === false) urStyle = 'visible';
  8357. }
  8358. else if(note_ur === true)
  8359. {
  8360. if(filterNote === false) urStyle = 'visible';
  8361. }
  8362. else if(wslm_ur === true)
  8363. {
  8364. if(filterWSLM === false) urStyle = 'visible';
  8365. }
  8366. }
  8367. }
  8368. // only touch marker visibility if we've got active filter settings, or if URComments is not
  8369. // doing any filtering of its own
  8370. if((hasActiveURFilters === true) || (urcFilteringIsActive === false) || (uFURs_masterEnable === false))
  8371. {
  8372. let urMarker = uroGetMarker(uroLayers.ID.UR,urobj);
  8373. if(urMarker !== null)
  8374. {
  8375. urMarker.style.visibility = urStyle;
  8376. }
  8377. }
  8378. if(urStyle != 'hidden')
  8379. {
  8380. uroURExtras.AddToList(ureqID, customType, hasMyComments, nComments, ageLastComment);
  8381. }
  8382. }
  8383. }
  8384. uroURExtras.AddCommentCounts();
  8385. uroDBG.PerfMon(pmFunction, pmTStart);
  8386. }
  8387. function uroGetProblemTypes()
  8388. {
  8389. uroKnownProblemTypeIDs = [];
  8390. uroKnownProblemTypeNames = [];
  8391. let tProblemList = I18n.lookup("problems.types");
  8392. for(let tObj in tProblemList)
  8393. {
  8394. if(tObj !== undefined)
  8395. {
  8396. uroKnownProblemTypeIDs.push(parseInt(tObj));
  8397. uroKnownProblemTypeNames.push(tProblemList[tObj].title);
  8398. }
  8399. }
  8400. }
  8401. function uroFilterProblems()
  8402. {
  8403. let pmTStart = performance.now();
  8404. let pmFunction = "uroFilterProblems";
  8405.  
  8406. if(uroFilterPreamble() === false) return;
  8407. let selector;
  8408.  
  8409. if((uroUtils.GetCBChecked('_cbMPNotClosedUserIDFilter') === false) && (uroUtils.GetCBChecked('_cbMPClosedUserIDFilter') === false))
  8410. {
  8411. selector = document.getElementById('_selectMPUserID');
  8412. while(selector.options.length > 0)
  8413. {
  8414. selector.options.remove(0);
  8415. }
  8416. }
  8417.  
  8418. let solverUser = null;
  8419. if((uroUtils.GetCBChecked('_cbMPNotClosedUserIDFilter') === true) || (uroUtils.GetCBChecked('_cbMPClosedUserIDFilter') === true))
  8420. {
  8421. selector = document.getElementById('_selectMPUserID');
  8422. if(selector.options.length === 0)
  8423. {
  8424. uroUpdateEditorList(W.model.mapProblems.objects, '_selectMPUserID', false, false, true, false);
  8425. }
  8426. if(selector.selectedOptions[0] != null)
  8427. {
  8428. solverUser = parseInt(selector.selectedOptions[0].value);
  8429. }
  8430. }
  8431.  
  8432. let uFP_masterEnable = uroIsFilteringEnabled(false);
  8433. let filter_OutsideEditableArea = uroUtils.GetCBChecked('_cbMPFilterOutsideArea');
  8434. let filter_Solved = uroUtils.GetCBChecked('_cbMPFilterSolved');
  8435. let filter_Unidentified = uroUtils.GetCBChecked('_cbMPFilterUnidentified');
  8436. let filter_Closed = uroUtils.GetCBChecked('_cbMPFilterClosed');
  8437. let filter_NotClosedUserID = uroUtils.GetCBChecked('_cbMPNotClosedUserIDFilter');
  8438. let filter_ClosedUserID = uroUtils.GetCBChecked('_cbMPClosedUserIDFilter');
  8439. let filter_Reopened = uroUtils.GetCBChecked('_cbMPFilterReopenedProblem');
  8440.  
  8441. let filter_LowSeverity = uroUtils.GetCBChecked('_cbMPFilterLowSeverity');
  8442. let filter_MediumSeverity = uroUtils.GetCBChecked('_cbMPFilterMediumSeverity');
  8443. let filter_HighSeverity = uroUtils.GetCBChecked('_cbMPFilterHighSeverity');
  8444.  
  8445. let filterTypes = [];
  8446. let i;
  8447. for(i=0; i<uroKnownProblemTypeIDs.length; i++)
  8448. {
  8449. if(uroUtils.GetCBChecked('_cbMPFilter_T'+uroKnownProblemTypeIDs[i])) filterTypes.push(uroKnownProblemTypeIDs[i]);
  8450. }
  8451. let filter_TypeUnknown = uroUtils.GetCBChecked('_cbMPFilterUnknownProblem');
  8452.  
  8453. let filter_TaggedElgin = uroUtils.GetCBChecked('_cbFilterElgin');
  8454. let filter_TaggedTrafficCast = uroUtils.GetCBChecked('_cbFilterTrafficCast');
  8455. let filter_TaggedTrafficMaster = uroUtils.GetCBChecked('_cbFilterTrafficMaster');
  8456. let filter_TaggedCaltrans = uroUtils.GetCBChecked('_cbFilterCaltrans');
  8457. let filter_TaggedTFL = uroUtils.GetCBChecked('_cbFilterTFL');
  8458.  
  8459. let filter_Invert = uroUtils.GetCBChecked('_cbInvertMPFilter');
  8460.  
  8461. let filter_StartDateEnabled = uroUtils.GetCBChecked('_cbMPFilterStartDate');
  8462. let filter_EndDateEnabled = uroUtils.GetCBChecked('_cbMPFilterEndDate');
  8463. let filter_EndDatePassed = uroUtils.GetCBChecked('_cbMPFilterEndDatePassed');
  8464.  
  8465. let tsD = uroUtils.GetElmValue('_inputMPFilterStartDay');
  8466. let tsM = uroUtils.GetElmValue('_inputMPFilterStartMonth');
  8467. let tsY = uroUtils.GetElmValue('_inputMPFilterStartYear');
  8468. let startDate = uroUtils.GetTS(tsD, tsM, tsY, 0, 0);
  8469.  
  8470. tsD = uroUtils.GetElmValue('_inputMPFilterEndDay');
  8471. tsM = uroUtils.GetElmValue('_inputMPFilterEndMonth');
  8472. tsY = uroUtils.GetElmValue('_inputMPFilterEndYear');
  8473. let endDate = uroUtils.GetTS(tsD, tsM, tsY, 0, 0);
  8474. let nowTime = (new Date()).getTime();
  8475.  
  8476. for (let urobj in W.model.mapProblems.objects)
  8477. {
  8478. if(W.model.mapProblems.objects.hasOwnProperty(urobj))
  8479. {
  8480. let problem = W.model.mapProblems.objects[urobj];
  8481.  
  8482. if(problem.attributes.origJSONGeo === undefined)
  8483. {
  8484. // Store a copy of the original marker position if we haven't already done so
  8485. problem.attributes.origJSONGeo = uroUtils.CloneObject(problem.attributes.geoJSONGeometry);
  8486. }
  8487. else
  8488. {
  8489. // Restore the original position if we do have a copy of it, to undo any adjustments
  8490. // that may have been made in the last filtering pass
  8491. problem.attributes.geoJSONGeometry = uroUtils.CloneObject(problem.attributes.origJSONGeo);
  8492. }
  8493.  
  8494.  
  8495. let ureqID = problem.attributes.id;
  8496.  
  8497. let problemStyle = 'visible';
  8498. // check problem against current session ignore list...
  8499. if(uroIgnore.IsOnList(ureqID)) problemStyle = 'hidden';
  8500.  
  8501. if(uFP_masterEnable === true)
  8502. {
  8503. if(filter_OutsideEditableArea === true)
  8504. {
  8505. if(problem.canEdit() === false)
  8506. {
  8507. problemStyle = 'hidden';
  8508. }
  8509. }
  8510.  
  8511. if(filter_EndDatePassed == true)
  8512. {
  8513. if(problem.attributes.endTime > nowTime)
  8514. {
  8515. problemStyle = 'hidden';
  8516. }
  8517. }
  8518. if(filter_StartDateEnabled == true)
  8519. {
  8520. let tStart = new Date(problem.attributes.startTime);
  8521. tStart.setHours(0);
  8522. tStart.setMinutes(0);
  8523. tStart.setSeconds(0);
  8524. tStart = tStart.getTime();
  8525. if(tStart != startDate)
  8526. {
  8527. problemStyle = 'hidden';
  8528. }
  8529. }
  8530. if(filter_EndDateEnabled == true)
  8531. {
  8532. let tEnd = new Date(problem.attributes.endTime);
  8533. tEnd.setHours(0);
  8534. tEnd.setMinutes(0);
  8535. tEnd.setSeconds(0);
  8536. tEnd = tEnd.getTime();
  8537. if(tEnd != endDate)
  8538. {
  8539. problemStyle = 'hidden';
  8540. }
  8541. }
  8542.  
  8543. // check against closed/not identified filtering if enabled...
  8544. if(problem.geometry.id !== null)
  8545. {
  8546. if(document.getElementById(problem.geometry.id) !== null)
  8547. {
  8548. let problem_marker_img = document.getElementById(problem.geometry.id).href.baseVal;
  8549. if(filter_Solved === true)
  8550. {
  8551. if(problem_marker_img.indexOf('_solved') != -1) problemStyle = 'hidden';
  8552. }
  8553. if(filter_Unidentified === true)
  8554. {
  8555. if(problem_marker_img.indexOf('_rejected') != -1) problemStyle = 'hidden';
  8556. }
  8557. }
  8558. }
  8559.  
  8560. if(filter_Closed === true)
  8561. {
  8562. if(problem.attributes.open === false)
  8563. {
  8564. problemStyle = 'hidden';
  8565. }
  8566. }
  8567.  
  8568. if(problemStyle == 'visible')
  8569. {
  8570. if(solverUser !== null)
  8571. {
  8572. if((filter_NotClosedUserID === true) && (problem.attributes.resolvedBy == solverUser)) problemStyle = 'hidden';
  8573. if((filter_ClosedUserID === true) && (problem.attributes.resolvedBy != solverUser)) problemStyle = 'hidden';
  8574. }
  8575. }
  8576.  
  8577. if(problemStyle == 'visible')
  8578. {
  8579. let problemType = problem.attributes.subType;
  8580. let desc = '';
  8581. if(problem.attributes.description != null)
  8582. {
  8583. desc = problem.attributes.description;
  8584. }
  8585. let customType = uroGetCustomType(ureqID, uroLayers.ID.MP, desc);
  8586.  
  8587. if(customType === 100)
  8588. {
  8589. if(filter_TaggedElgin === true) problemStyle = 'hidden';
  8590. }
  8591. else if(customType === 101)
  8592. {
  8593. if(filter_TaggedTrafficCast === true) problemStyle = 'hidden';
  8594. }
  8595. else if(customType === 102)
  8596. {
  8597. if(filter_TaggedTrafficMaster === true) problemStyle = 'hidden';
  8598. }
  8599. else if(customType === 103)
  8600. {
  8601. if(filter_TaggedCaltrans === true) problemStyle = 'hidden';
  8602. }
  8603. else if(customType === 104)
  8604. {
  8605. if(filter_TaggedTFL === true) problemStyle = 'hidden';
  8606. }
  8607. else if(uroKnownProblemTypeIDs.indexOf(problemType) !== -1)
  8608. {
  8609. if(filterTypes.indexOf(problemType) !== -1)
  8610. {
  8611. problemStyle = 'hidden';
  8612. }
  8613. }
  8614. else if(filter_TypeUnknown === true) problemStyle = 'hidden';
  8615.  
  8616. if(filter_Reopened === true)
  8617. {
  8618. if((problem.attributes.open === true) && (problem.attributes.resolvedOn !== null))
  8619. {
  8620. problemStyle = 'hidden';
  8621. }
  8622. }
  8623.  
  8624.  
  8625. if(filter_Invert === true)
  8626. {
  8627. if(problemStyle == 'hidden') problemStyle = 'visible';
  8628. else problemStyle = 'hidden';
  8629. }
  8630.  
  8631.  
  8632. if(problem.attributes.weight <= 3)
  8633. {
  8634. if(filter_LowSeverity === true) problemStyle = 'hidden';
  8635. }
  8636. else if(problem.attributes.weight <= 7)
  8637. {
  8638. if(filter_MediumSeverity === true) problemStyle = 'hidden';
  8639. }
  8640. else if(filter_HighSeverity === true) problemStyle = 'hidden';
  8641. }
  8642. }
  8643.  
  8644. let marker = uroGetMarker(uroLayers.ID.MP, urobj);
  8645. if(marker !== null)
  8646. {
  8647. marker.style.visibility = problemStyle;
  8648. if(problemStyle === 'hidden')
  8649. {
  8650. // To ensure WME displays the details for the topmost marker that's
  8651. // left visible in a stack, alter the coords for any hidden markers
  8652. // to place them in a location that isn't likely to be clicked on...
  8653. problem.attributes.geoJSONGeometry.coordinates[0] = 0;
  8654. problem.attributes.geoJSONGeometry.coordinates[1] = 90;
  8655. }
  8656. }
  8657. }
  8658. }
  8659.  
  8660. uroDBG.PerfMon(pmFunction, pmTStart);
  8661. }
  8662. function uroFilterPreamble()
  8663. {
  8664. let mapviewport = document.getElementsByClassName("olMapViewport")[0];
  8665. if(mapviewport === null)
  8666. {
  8667. if(uroNullMapViewport === false)
  8668. {
  8669. uroDBG.AddLog('caught null mapviewport');
  8670. uroNullMapViewport = true;
  8671. }
  8672. return false;
  8673. }
  8674.  
  8675. let uiElms = uroTabs.CtrlTabs[uroTabs.IDS.MISC][uroTabs.FIELDS.TABBODY];
  8676. if(uiElms == null)
  8677. {
  8678. uroDBG.AddLog('caught missing UI');
  8679. return false;
  8680. }
  8681. if(uiElms.innerHTML.length === 0)
  8682. {
  8683. uroDBG.AddLog('caught empty UI');
  8684. return false;
  8685. }
  8686.  
  8687. if(uroSettingsApplied === false)
  8688. {
  8689. return false;
  8690. }
  8691.  
  8692. uroNullMapViewport = false;
  8693.  
  8694. return true;
  8695. }
  8696. function uroFilterItems_MasterEnableClick()
  8697. {
  8698. if(uroUtils.GetCBChecked('_cbMasterEnable') === false)
  8699. {
  8700. uroPopup.Hide();
  8701. }
  8702. uroFilterItems();
  8703. }
  8704. function uroFilterItems()
  8705. {
  8706. uroFilterProblems();
  8707. uroFilterPlaces();
  8708. uroFilterCameras();
  8709. uroFilterURs();
  8710. uroFilterRTCs();
  8711. uroFilterRAs();
  8712. uroFilterMapComments();
  8713. }
  8714. function uroFilterItemsOnMove()
  8715. {
  8716. W.map.events.unregister('mousemove',null,uroFilterItemsOnMove);
  8717. uroFilterItems();
  8718. }
  8719. function uroDeleteObject()
  8720. {
  8721. uroDBG.AddLog('delete camera ID '+uroShownFID);
  8722. if(W.model.cameras.objects[uroShownFID] === null)
  8723. {
  8724. uroDBG.AddLog('camera object not found...');
  8725. return false;
  8726. }
  8727. uroOWL.RemoveCamFromWatchList();
  8728. let actionObj = require('Waze/Action/DeleteObject');
  8729. let deleteAction = new actionObj(W.model.cameras.objects[uroShownFID], null);
  8730. W.model.actionManager.add(deleteAction);
  8731. uroPopup.MouseOut();
  8732. uroPopup.Hide();
  8733. return false;
  8734. }
  8735. function uroCheckCommentsForTag(idSrc, customText)
  8736. {
  8737. let ursObj = W.model.updateRequestSessions.objects[idSrc];
  8738. if(typeof(ursObj) == 'undefined') return -1;
  8739. if(ursObj.attributes.comments.length === 0) return -1;
  8740.  
  8741. for(let idx=ursObj.attributes.comments.length-1; idx>=0; idx--)
  8742. {
  8743. for(let tag=0; tag<uroCustomURTags.length; tag++)
  8744. {
  8745. let keyword = uroCustomURTags[tag];
  8746. if(ursObj.attributes.comments[idx].text.indexOf(keyword) != -1)
  8747. {
  8748. return tag;
  8749. }
  8750. }
  8751.  
  8752. if(customText !== '')
  8753. {
  8754. if(ursObj.attributes.comments[idx].text.toLowerCase().indexOf(customText) != -1)
  8755. {
  8756. return 99;
  8757. }
  8758. }
  8759. }
  8760. return -1;
  8761. }
  8762. function uroGetCustomType(idSrc, markerType, desc)
  8763. {
  8764. let provider = '';
  8765. let customText = '';
  8766. if(uroUtils.GetCBChecked('_cbCustomKeywordMarkers')) customText = document.getElementById('_textCustomKeyword').value.toLowerCase();
  8767. if(desc === null) desc = '';
  8768. if(markerType == uroLayers.ID.UR)
  8769. {
  8770. let ureq = W.model.mapUpdateRequests.objects[idSrc];
  8771. // early test for native speed limit URs
  8772. if(ureq.attributes.type == 23) return 98;
  8773. }
  8774. else if(markerType == uroLayers.ID.MP)
  8775. {
  8776. let mp = W.model.mapProblems.objects[idSrc];
  8777. if(mp.attributes.provider != null)
  8778. {
  8779. provider = mp.attributes.provider;
  8780. }
  8781. }
  8782.  
  8783. if(desc !== '')
  8784. {
  8785. if((markerType == uroLayers.ID.UR) || (markerType == 'mc'))
  8786. {
  8787. for(let tag=0; tag<uroCustomURTags.length; tag++)
  8788. {
  8789. let keyword = uroCustomURTags[tag];
  8790. if(desc.indexOf(keyword) != -1)
  8791. {
  8792. return tag;
  8793. }
  8794. }
  8795. }
  8796.  
  8797. if(markerType == uroLayers.ID.UR)
  8798. {
  8799. if((uroUtils.GetCBChecked('_cbCustomKeywordMarkers')) && (customText !== ''))
  8800. {
  8801. if(desc.toLowerCase().indexOf(customText) != -1) return 99;
  8802. }
  8803. }
  8804.  
  8805. if(markerType == uroLayers.ID.MP)
  8806. {
  8807. if(desc.indexOf('[Elgin]') != -1) return 100;
  8808. if(desc.indexOf('[ELGIN]') != -1) return 100;
  8809. if(desc.indexOf('[elginroadworks]') != -1) return 100;
  8810. if(desc.indexOf('[one.network]') != -1) return 100;
  8811. if(desc.indexOf('[TrafficCast]') != -1) return 101;
  8812. if(desc.indexOf('[TM]') != -1) return 102;
  8813. if(desc.indexOf('[Caltrans]') != -1) return 103;
  8814. if(desc.indexOf('[TfL Open Data]') != -1) return 104;
  8815. if(provider.indexOf('London TFL Closures') != -1) return 104;
  8816. }
  8817. }
  8818. if(markerType == uroLayers.ID.UR)
  8819. {
  8820. return uroCheckCommentsForTag(idSrc, customText);
  8821. }
  8822.  
  8823. return -1;
  8824. }
  8825. function uroGetRestrictionLanes(disposition)
  8826. {
  8827. let retval = '';
  8828. if(disposition == 1) retval += 'All lanes';
  8829. else if(disposition == 2) retval += 'Left lane';
  8830. else if(disposition == 3) retval += 'Middle lane';
  8831. else if(disposition == 4) retval += 'Right lane';
  8832. else retval += ' - ';
  8833. return retval;
  8834. }
  8835. function uroGetRestrictionLaneType(laneType)
  8836. {
  8837. let retval = '';
  8838. if(laneType === null) retval += ' - ';
  8839. else
  8840. {
  8841. if(laneType == 1) retval += 'HOV';
  8842. else if(laneType == 2) retval += 'HOT';
  8843. else if(laneType == 3) retval += 'Express';
  8844. else if(laneType == 4) retval += 'Bus lane';
  8845. else if(laneType == 5) retval += 'Fast lane';
  8846. else retval += ' - ';
  8847. }
  8848. return retval;
  8849. }
  8850. let uroVehicleTypes =
  8851. [
  8852. [1280, 'fa-car'],
  8853. [1024, 'fa-motorcycle'],
  8854. [272, 'fa-taxi'],
  8855. [1808, 'fa-bolt']
  8856. ];
  8857. function uroGetRestrictionVehicleTypes(restObj, allowInit, profileKey)
  8858. {
  8859. let i;
  8860. let j;
  8861. let k;
  8862. let tVT;
  8863. let retval = [];
  8864. for(i = 0; i < uroVehicleTypes.length; ++i)
  8865. {
  8866. retval.push(allowInit);
  8867. }
  8868. let tRest = restObj._driveProfiles.get(profileKey);
  8869. if(tRest !== undefined)
  8870. {
  8871. for(i = 0; i < tRest._driveProfiles.length; ++i)
  8872. {
  8873. tVT = tRest._driveProfiles[i].getVehicleTypes();
  8874. {
  8875. if(tVT.length > 0)
  8876. {
  8877. for(j = 0; j < tVT.length; ++j)
  8878. {
  8879. for(k = 0; k < uroVehicleTypes.length; ++k)
  8880. {
  8881. if(tVT[j] == uroVehicleTypes[k][0])
  8882. {
  8883. retval[k] = !allowInit;
  8884. }
  8885. }
  8886. }
  8887. }
  8888. }
  8889. }
  8890. }
  8891. return retval;
  8892. }
  8893. function uroFormatRestriction(restObj)
  8894. {
  8895. let retval = '';
  8896.  
  8897. if(restObj._defaultType == "DIFFICULT")
  8898. {
  8899. retval = '<tr><td colspan=13>Difficult Turn';
  8900. }
  8901. else
  8902. {
  8903. let roDays = null;
  8904. let roFromDate = null;
  8905. let roToDate = null;
  8906. let roFromTime = null;
  8907. let roToTime = null;
  8908. let roRepeats = false;
  8909. let roAllDay = false;
  8910. if(restObj._days !== undefined)
  8911. {
  8912. roDays = restObj._days;
  8913. roFromDate = restObj._fromDate;
  8914. roToDate = restObj._toDate;
  8915. roFromTime = restObj._fromTime;
  8916. roToTime = restObj._toTime;
  8917. }
  8918. else if(restObj._timeFrames.length > 0)
  8919. {
  8920. if(restObj._timeFrames[0]._weekdays !== undefined)
  8921. {
  8922. roDays = restObj._timeFrames[0]._weekdays;
  8923. roFromDate = restObj._timeFrames[0]._startDate;
  8924. roToDate = restObj._timeFrames[0]._endDate;
  8925. roFromTime = restObj._timeFrames[0]._fromTime;
  8926. roToTime = restObj._timeFrames[0]._toTime;
  8927. roRepeats = restObj._timeFrames[0]._repeatYearly;
  8928. }
  8929. }
  8930.  
  8931. if((roFromTime === null) && (roToTime === null))
  8932. {
  8933. roFromTime = "0:00";
  8934. roToTime = "23:59";
  8935. roAllDay = true;
  8936. }
  8937.  
  8938. let hasExpired = false;
  8939. let isFuture = false;
  8940. let tNow = Date.now();
  8941. let tFrom = null;
  8942. let tTo = null;
  8943. if(roFromDate !== null)
  8944. {
  8945. tFrom = new Date(roFromDate + " " + roFromTime);
  8946. isFuture = (tFrom.getTime() > tNow);
  8947. }
  8948. if(roToDate !== null)
  8949. {
  8950. tTo = new Date(roToDate + " " + roToTime);
  8951. hasExpired = (tTo.getTime() < tNow);
  8952. }
  8953. if((hasExpired === true) && (roRepeats === true))
  8954. {
  8955. while(tTo.getTime() < tNow)
  8956. {
  8957. tFrom.setFullYear(tFrom.getFullYear() + 1);
  8958. tTo.setFullYear(tTo.getFullYear() + 1);
  8959. }
  8960. isFuture = (tFrom.getTime() > tNow);
  8961. hasExpired = false;
  8962. }
  8963.  
  8964.  
  8965. if(isFuture === true)
  8966. {
  8967. retval = '<tr bgcolor="#8080FF">';
  8968. }
  8969. else if(hasExpired === true)
  8970. {
  8971. retval = '<tr bgcolor="#FFFFC0">';
  8972. }
  8973. else
  8974. {
  8975. retval = '<tr>';
  8976. }
  8977.  
  8978. if(roDays === null)
  8979. {
  8980. roDays = 127;
  8981. }
  8982.  
  8983. retval += '<td style="text-align:center;">';
  8984. if((roDays & 1) == 1) retval += 'M';
  8985. else retval += '-';
  8986. retval += '</td><td style="text-align:center;">';
  8987. if((roDays & 2) == 2) retval += 'Tu';
  8988. else retval += '-';
  8989. retval += '</td><td style="text-align:center;">';
  8990. if((roDays & 4) == 4) retval += 'W';
  8991. else retval += '-';
  8992. retval += '</td><td style="text-align:center;">';
  8993. if((roDays & 8) == 8) retval += 'Th';
  8994. else retval += '-';
  8995. retval += '</td><td style="text-align:center;">';
  8996. if((roDays & 16) == 16) retval += 'F';
  8997. else retval += '-';
  8998. retval += '</td><td style="text-align:center;">';
  8999. if((roDays & 32) == 32) retval += 'Sa';
  9000. else retval += '-';
  9001. retval += '</td><td style="text-align:center;">';
  9002. if((roDays & 64) == 64) retval += 'Su';
  9003. else retval += '-';
  9004.  
  9005. retval += '</td><td nowrap style="text-align:center;">';
  9006.  
  9007. if(roFromDate === null) retval += 'All dates';
  9008. else retval += tFrom.toISOString().slice(0,10) + ' to ' + tTo.toISOString().slice(0,10);
  9009. if(roRepeats === true)
  9010. {
  9011. retval += '&nbsp;<i class="fa fa-repeat"> </i>';
  9012. }
  9013.  
  9014. retval += '</td><td nowrap style="text-align:center;">';
  9015.  
  9016. if((restObj._allDay === true) || (roAllDay === true)) retval += 'All day';
  9017. else retval += roFromTime + ' to ' + roToTime;
  9018.  
  9019. retval += '</td><td nowrap style="text-align:center;">';
  9020.  
  9021. retval += uroGetRestrictionLanes(restObj._disposition);
  9022.  
  9023. retval += '</td><td nowrap style="text-align:center;">';
  9024.  
  9025. retval += uroGetRestrictionLaneType(restObj._laneType);
  9026.  
  9027. retval += '</td><td nowrap style="text-align:center;">';
  9028.  
  9029. // for brevity, the popup only displays the allowed/prohibited restriction for the driveable vehicle types in the app...
  9030. let typesAllowed = [];
  9031. if((restObj._defaultType == "BLOCKED") || (restObj._defaultType == "TOLL"))
  9032. {
  9033. if(restObj._defaultType == "TOLL")
  9034. {
  9035. retval += I18n.lookup('restrictions.editing.segment.toll_road');
  9036. }
  9037. typesAllowed = uroGetRestrictionVehicleTypes(restObj, false, "FREE");
  9038. }
  9039. else
  9040. {
  9041. typesAllowed = uroGetRestrictionVehicleTypes(restObj, true, "BLOCKED");
  9042. }
  9043.  
  9044. let i;
  9045. for(i = 0; i < uroVehicleTypes.length; ++i)
  9046. {
  9047. if(typesAllowed[i] === true)
  9048. {
  9049. retval += '<i class="fa '+uroVehicleTypes[i][1]+'" style="color:#000000;"> </i>&nbsp;';
  9050. }
  9051. else
  9052. {
  9053. retval += '<i class="fa '+uroVehicleTypes[i][1]+'" style="color:#d0d0d0;"> </i>&nbsp;';
  9054. }
  9055. }
  9056.  
  9057. retval += '</td><td>';
  9058. retval += uroUtils.Clickify(restObj._description, '');
  9059. }
  9060.  
  9061. retval += '</td></tr>';
  9062.  
  9063. return retval;
  9064. }
  9065. function uroOpenURDialog(urID)
  9066. {
  9067. let t = {showNext: false, nextButtonString: I18n.lookup('problems.panel.done')};
  9068. let urObj = W.model.mapUpdateRequests.objects[urID];
  9069. W.reqres.request("problems:browse", _.extend(t, {problem: urObj}));
  9070. }
  9071. function uroRecentreSessionOnUR()
  9072. {
  9073. //uroGetMarker(uroLayers.ID.UR, uroShownFID).element.click();
  9074. uroOpenURDialog(uroShownFID);
  9075. W.map.moveTo(uroGetMarker(uroLayers.ID.UR, uroShownFID).lonlat, 17);
  9076. uroPopup.Hide();
  9077. return false;
  9078. }
  9079. function uroRecentreSessionOnMP()
  9080. {
  9081. uroGetMarker(uroLayers.ID.MP, uroShownFID).element.click();
  9082. W.map.moveTo(uroGetMarker(uroLayers.ID.MP, uroShownFID).lonlat, 17);
  9083. uroPopup.Hide();
  9084. return false;
  9085. }
  9086. function uroRecentreSessionOnPUR()
  9087. {
  9088. uroGetMarker(uroLayers.ID.PUR, uroShownFID).element.click();
  9089. W.map.moveTo(uroGetMarker(uroLayers.ID.PUR, uroShownFID).lonlat, 17);
  9090. uroPopup.Hide();
  9091. return false;
  9092. }
  9093. function uroRecentreSessionOnPPUR()
  9094. {
  9095. uroGetMarker(uroLayers.ID.PPUR, uroShownFID).element.click();
  9096. W.map.moveTo(uroGetMarker(uroLayers.ID.PPUR, uroShownFID).lonlat, 17);
  9097. uroPopup.Hide();
  9098. return false;
  9099. }
  9100. function uroRecentreSessionOnVenueNavPoint()
  9101. {
  9102. W.map.moveTo(uroGetVenueNavPoint(uroShownFID), 17);
  9103. uroPopup.Hide();
  9104. return false;
  9105. }
  9106. function uroStackListObj(fid,x,y)
  9107. {
  9108. this.fid = fid;
  9109. this.x = uroUtils.TypeCast(x);
  9110. this.y = uroUtils.TypeCast(y);
  9111. }
  9112. function uroRestackMarkers()
  9113. {
  9114. if(uroStackList.length === 0) return;
  9115.  
  9116. if(uroLayers.layers[uroStackType].mf !== null)
  9117. {
  9118. uroDBG.AddLog('restacking markers...');
  9119. // strip off the .realX/realY attributes from any UR object we've previously added it to, to allow
  9120. // the native recentering to work again...
  9121. let idList = uroGetMarkerIDs(uroStackType);
  9122. for(let marker of idList)
  9123. {
  9124. let testMarkerAttributes = uroGetAttributes(uroStackType, marker);
  9125. if(testMarkerAttributes.geometry.realX != null)
  9126. {
  9127. testMarkerAttributes.geometry.x = testMarkerAttributes.geometry.realX;
  9128. testMarkerAttributes.geometry.y = testMarkerAttributes.geometry.realY;
  9129. delete(testMarkerAttributes.geometry.realX);
  9130. delete(testMarkerAttributes.geometry.realY);
  9131. }
  9132. }
  9133. // now restack any markers that were repositioned...
  9134. for(let idx=0; idx<uroStackList.length; idx++)
  9135. {
  9136. let orig_x = uroStackList[idx].x + 'px';
  9137. let orig_y = uroStackList[idx].y + 'px';
  9138. let fid = uroStackList[idx].fid;
  9139.  
  9140. if(uroGetMarker(uroStackType, fid) != null)
  9141. {
  9142. uroGetMarker(uroStackType, fid).element.style.left = orig_x;
  9143. uroGetMarker(uroStackType, fid).element.style.top = orig_y;
  9144. }
  9145. }
  9146. uroStackList = [];
  9147. uroUnstackedMasterID = null;
  9148. uroStackType = null;
  9149. uroDBG.AddLog('...stacked!');
  9150. }
  9151. }
  9152. function uroIsIDAlreadyUnstacked(idSrc)
  9153. {
  9154. if(uroStackList.length === 0) return false;
  9155. for(let idx=0; idx<uroStackList.length; idx++)
  9156. {
  9157. if(uroStackList[idx].fid == idSrc) return true;
  9158. }
  9159. return false;
  9160. }
  9161. function uroCheckStacking(stackType, masterID, unstackedX, unstackedY)
  9162. {
  9163. //// WIP
  9164. return;
  9165. if(typeof(masterID) === 'number')
  9166. {
  9167. masterID = masterID.toString();
  9168. }
  9169.  
  9170. if(uroIsIDAlreadyUnstacked(masterID) === true) return;
  9171. if(uroStackType !== null) return;
  9172.  
  9173. uroDBG.AddLog('checking for marker stack, masterID: '+masterID+', stackType: '+stackType);
  9174. let stackList = [];
  9175. stackList.push(masterID);
  9176. let threshSquared = uroUtils.GetElmValue('_inputUnstackSensitivity');
  9177. threshSquared *= threshSquared;
  9178.  
  9179. let marker;
  9180.  
  9181. let offset = 0.000000001;
  9182. if(uroLayers.layers[stackType].mf !== null)
  9183. {
  9184. let idList = uroGetMarkerIDs(stackType);
  9185. let showOpen = true;
  9186. let showClosed = false;
  9187. let showTypes = null;
  9188. if(stackType === uroLayers.ID.UR)
  9189. {
  9190. showTypes = W?.issueTrackerController?.app?.attributes?.issueTrackerFilter?.attributes?.mapUpdateRequestsFilter?.attributes?.status;
  9191. }
  9192. else if(stackType === uroLayers.ID.MP)
  9193. {
  9194. showTypes = W?.issueTrackerController?.app?.attributes?.issueTrackerFilter?.attributes?.mapProblemsFilter?.attributes?.status;
  9195. }
  9196. if(showTypes !== null)
  9197. {
  9198. showOpen = ((showTypes == 'OPEN') || (showTypes == 'BOTH'));
  9199. showClosed = ((showTypes == 'CLOSED') || (showTypes == 'BOTH'));
  9200. }
  9201.  
  9202. for(marker of idList)
  9203. {
  9204. let testMarkerObj = uroGetMarker(stackType, marker);
  9205. let testMarkerAttributes = uroGetAttributes(stackType, marker);
  9206. if((testMarkerAttributes !== null) && (testMarkerObj !== null))
  9207. {
  9208. // 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
  9209. // top of the stack in the absence of any URO+ filtering, regardless of which UR pin actually receives the click event. To prevent
  9210. // this, we give each pin in the stack a unique set of false coordinates, storing the original coordinates in newly created
  9211. // properties so they can be restored later on.
  9212. //
  9213. // 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
  9214. // 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
  9215. // is being viewed. By using a small fractional offset added to each stacked marker, the risk of accidentally setting the offset coords to
  9216. // those of another marker is low
  9217. if(testMarkerAttributes.geometry.realX === undefined)
  9218. {
  9219. testMarkerAttributes.geometry.realX = testMarkerAttributes.geometry.x;
  9220. testMarkerAttributes.geometry.x += offset;
  9221. testMarkerAttributes.geometry.realY = testMarkerAttributes.geometry.y;
  9222. testMarkerAttributes.geometry.y += offset;
  9223. offset += 0.000000001;
  9224. }
  9225.  
  9226. let includeInStack = (testMarkerObj.element.style.visibility != 'hidden');
  9227. let isClosed = testMarkerObj.element.classList.contains("recently-closed");
  9228. includeInStack = includeInStack && ((isClosed && showClosed) || (!isClosed && showOpen));
  9229. if(includeInStack)
  9230. {
  9231. if(testMarkerAttributes.id != masterID)
  9232. {
  9233. let bcr = testMarkerObj.element.getBoundingClientRect();
  9234. let xdiff = unstackedX - bcr.x;
  9235. let ydiff = unstackedY - bcr.y;
  9236. let distSquared = ((xdiff * xdiff) + (ydiff * ydiff));
  9237. if(distSquared < threshSquared)
  9238. {
  9239. stackList.push(testMarkerAttributes.id);
  9240. }
  9241. }
  9242. }
  9243. }
  9244. }
  9245. }
  9246.  
  9247. let inhibitUnstacking = (W.map.getZoom() < uroUtils.GetElmValue('_inputUnstackZoomLevel'));
  9248. inhibitUnstacking = inhibitUnstacking || (stackList.length < 2);
  9249.  
  9250. if(inhibitUnstacking == false)
  9251. {
  9252. uroStackType = stackType;
  9253. if(uroUnstackedMasterID != masterID)
  9254. {
  9255. uroDBG.AddLog('unstacked ID mismatch, relocating markers...');
  9256. uroRestackMarkers();
  9257. uroUnstackedMasterID = masterID;
  9258. uroStackList = [];
  9259.  
  9260. // push the highlighted marker onto the stacklist so uroIsIDAlreadyUnstacked() will return true
  9261. uroStackList.push(new uroStackListObj(masterID,unstackedX,unstackedY));
  9262.  
  9263. for(let shoveIdx=0; shoveIdx < stackList.length; shoveIdx++)
  9264. {
  9265. let fid = stackList[shoveIdx];
  9266. let stackMarker = uroGetMarker(stackType, fid);
  9267. if(stackMarker !== null)
  9268. {
  9269. let x = uroUtils.ParsePxString(stackMarker.element.style.left);
  9270. let y = uroUtils.ParsePxString(stackMarker.element.style.top);
  9271. // store the unstacked marker positions so they can be reinstated later
  9272. uroStackList.push(new uroStackListObj(fid,x,y));
  9273. stackMarker.element.style.left = unstackedX + 'px';
  9274. stackMarker.element.style.top = unstackedY + 'px';
  9275. unstackedX += 5;
  9276. unstackedY -= 20;
  9277. }
  9278. }
  9279.  
  9280.  
  9281. // hide other markers to prevent confusion with the unstacked markers
  9282. let listIDs = uroGetMarkerIDs(stackType);
  9283. for(marker in listIDs)
  9284. {
  9285. if(listIDs.hasOwnProperty(marker))
  9286. {
  9287. let toHideMarker = uroGetMarker(stackType, marker);
  9288. if(toHideMarker !== null)
  9289. {
  9290. let toHideID = toHideMarker.id;
  9291. if(uroIsIDAlreadyUnstacked(toHideID) === false)
  9292. {
  9293. toHideMarker = uroGetMarker(stackType, toHideID);
  9294. if(toHideMarker !== null)
  9295. {
  9296. toHideMarker.element.style.visibility = 'hidden';
  9297. }
  9298. }
  9299. }
  9300. }
  9301. }
  9302. }
  9303. }
  9304. else
  9305. {
  9306. uroRestackMarkers();
  9307. }
  9308. }
  9309. function uroGetVenueNavPoint(uroFID)
  9310. {
  9311. let retval = W.map.getUnprojectedCenter(); // allow the function to return a safe value in case we can't find the requested venue object...
  9312.  
  9313. let vObj = W.model.venues.objects[uroFID];
  9314. if(vObj !== undefined)
  9315. {
  9316. if(vObj.attributes.entryExitPoints.length > 0)
  9317. {
  9318. // if the venue has any navpoints defined, use the position of the first one
  9319. let tPoint = vObj.attributes.entryExitPoints[0].getPoint();
  9320. retval.lon = tPoint.coordinates[0];
  9321. retval.lat = tPoint.coordinates[1];
  9322. }
  9323. else
  9324. {
  9325. // otherwise use the centrepoint of the venue point or polygon
  9326. let tPoint = vObj.attributes.geometry.getCentroid();
  9327. let tLL = new OpenLayers.LonLat();
  9328. tLL.lon = tPoint.x;
  9329. tLL.lat = tPoint.y;
  9330. tLL = uroUtils.ConvertMercatorToWGS84(tLL);
  9331. retval.lon = tLL.lon;
  9332. retval.lat = tLL.lat;
  9333. }
  9334. }
  9335. return retval;
  9336. }
  9337. function uroOpenNewTab()
  9338. {
  9339. // flush the current settings into localStorage before the new tab opens, so that when its instance of
  9340. // URO+ fires up it'll have the same settings as this one
  9341. uroConfig.SaveSettings();
  9342. return true;
  9343. }
  9344. function uroGetRTCDuration(rcObj)
  9345. {
  9346. let duration = new Date(rcObj.attributes.endDate) - new Date(rcObj.attributes.startDate);
  9347. return Math.floor(duration / 86400000);
  9348. }
  9349. function uroGetRTCOffset(rcDate)
  9350. {
  9351. let dateObj = new Date(rcDate);
  9352. return (0 - uroUtils.DateToDays(dateObj));
  9353. }
  9354. function uroGetRTCOrigin(rcObj)
  9355. {
  9356. let retval = URO_TRTC.UNKNOWN;
  9357.  
  9358. if(rcObj !== undefined)
  9359. {
  9360. if(rcObj.attributes.createdBy == -5)
  9361. {
  9362. retval = URO_TRTC.WAZEFEED;
  9363. }
  9364. else if((W.model.users.objects[rcObj.attributes.createdBy] !== undefined) && (W.model.users.objects[rcObj.attributes.createdBy].attributes.rank == 6))
  9365. {
  9366. retval = URO_TRTC.WAZEOTHER;
  9367. }
  9368. else
  9369. {
  9370. retval = URO_TRTC.WME;
  9371. }
  9372. }
  9373.  
  9374. return retval;
  9375. }
  9376. function uroGetRTCState(rcObj)
  9377. {
  9378. let retval = URO_SRTC.UNKNOWN;
  9379.  
  9380. let nowDate = new Date();
  9381. let startInPast = ((new Date(rcObj.attributes.startDate) - nowDate) < 0);
  9382. let endInPast = ((new Date(rcObj.attributes.endDate) - nowDate) < 0);
  9383.  
  9384. if(endInPast === true)
  9385. {
  9386. retval = URO_SRTC.EXPIRED;
  9387. }
  9388. else if(startInPast === true)
  9389. {
  9390. retval = URO_SRTC.ACTIVE;
  9391. }
  9392. else
  9393. {
  9394. retval = URO_SRTC.FUTURE;
  9395. }
  9396.  
  9397. return retval;
  9398. }
  9399. function uroGetAddress(streetID, houseNumber, formatForSegmentPopup, formatForNodePopup, showAsToll)
  9400. {
  9401. let result = '';
  9402. if((houseNumber !== undefined) && (houseNumber !== null))
  9403. {
  9404. result += houseNumber + ' ';
  9405. }
  9406.  
  9407. if(streetID != null)
  9408. {
  9409. let streetName = I18n.lookup('edit.address.no_street');
  9410. let doesStreetIDExist = true;
  9411. if(W.model.streets.objects[streetID] === undefined)
  9412. {
  9413. streetName = 'non-existent streetID';
  9414. doesStreetIDExist = false;
  9415. }
  9416. else
  9417. {
  9418. if((streetName !== null) && (W.model.streets.objects[streetID].attributes.isEmpty === false))
  9419. {
  9420. streetName = W.model.streets.objects[streetID].attributes.name;
  9421. }
  9422. }
  9423. if(formatForSegmentPopup === true)
  9424. {
  9425. if(showAsToll == true)
  9426. {
  9427. result += '<i class="fa fa-credit-card"></i> ';
  9428. }
  9429. result += '<b>'+streetName+'</b><br>';
  9430. }
  9431. else
  9432. {
  9433. result += streetName + ', ';
  9434. }
  9435.  
  9436. if(doesStreetIDExist === true)
  9437. {
  9438. let cityName = I18n.lookup('edit.address.no_city');
  9439. let doesCityIDExist = true;
  9440. let cityID = W.model.streets.objects[streetID].attributes.cityID;
  9441. if(W.model.cities.objects[cityID] === undefined)
  9442. {
  9443. cityName = 'non-existent cityID';
  9444. doesCityIDExist = false;
  9445. }
  9446. else
  9447. {
  9448. if(W.model.cities.objects[cityID].attributes.name !== "")
  9449. {
  9450. cityName = W.model.cities.objects[cityID].attributes.name;
  9451. }
  9452. }
  9453. result += cityName + ', ';
  9454.  
  9455. if(doesCityIDExist === true)
  9456. {
  9457. let stateID = W.model.cities.objects[cityID].attributes.stateID;
  9458. if(W.model.states.objects[stateID] === undefined)
  9459. {
  9460. result += 'non-existent stateID';
  9461. }
  9462. else
  9463. {
  9464. result += W.model.states.objects[stateID].attributes.name;
  9465. }
  9466. }
  9467. }
  9468. }
  9469. result += '<br>';
  9470.  
  9471. return result;
  9472. }
  9473. function uroGetSelectedSegmentRTCs(segID)
  9474. {
  9475. let closureTypes = URO_DRTC.NONE;
  9476. let RTCObjs = [];
  9477. let selectedSegs = [];
  9478.  
  9479. if(segID === null)
  9480. {
  9481. // segID should always be set to a valid segment ID if we're being called from the segment mouseover
  9482. // handler, so if it's null it implies we've instead been called from the closure panel handler where
  9483. // we might therefore be dealing with a multi-segment selection...
  9484. selectedSegs = W.selectionManager.getSegmentSelection().segments;
  9485. }
  9486.  
  9487. if((selectedSegs.length > 0) || (segID !== null))
  9488. {
  9489. for(let roadClosure in W.model.roadClosures.objects)
  9490. {
  9491. if(W.model.roadClosures.objects.hasOwnProperty(roadClosure))
  9492. {
  9493. let rcObj = W.model.roadClosures.objects[roadClosure];
  9494. rcObj.segIDs = [rcObj.attributes.segID]; // copy the segID property into an array so we can push extra segIDs into it later...
  9495.  
  9496. // 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
  9497. // into a two-way closure, we can then change the direction value to indicate this as well
  9498. if(rcObj.attributes.forward === true)
  9499. {
  9500. rcObj.direction = URO_DRTC.SEG_AB;
  9501. }
  9502. else
  9503. {
  9504. rcObj.direction = URO_DRTC.SEG_BA;
  9505. }
  9506.  
  9507. // for each of the selected or moused-over segments, find all the closures which have matching segIDs
  9508. if(segID !== null)
  9509. {
  9510. if(rcObj.attributes.segID == segID)
  9511. {
  9512. RTCObjs.push(rcObj);
  9513. }
  9514. }
  9515. else
  9516. {
  9517. for(let i = 0; i < selectedSegs.length; ++i)
  9518. {
  9519. if(rcObj.attributes.segID == selectedSegs[i].attributes.id)
  9520. {
  9521. RTCObjs.push(rcObj);
  9522. break;
  9523. }
  9524. }
  9525. }
  9526. }
  9527. }
  9528.  
  9529. // RTCObjs now contains all of the segment closures relating to all of the segments of interest, so
  9530. // we can begin to organise them such that by the time we exit this function, the array will then contain
  9531. // an optimised list of closures that matches up to the list shown in the closure sidepanel, taking into
  9532. // account closures applying to all segments vs some, closures that can be merged into two-ways etc.
  9533.  
  9534. // first sort the closure by their start date, with a secondary sort by direction for those closures
  9535. // that have the same start date
  9536. RTCObjs = RTCObjs.sort(function(a,b)
  9537. {
  9538. if(a.attributes.startDate === b.attributes.startDate)
  9539. {
  9540. if(a.direction == URO_DRTC.SEG_AB) return -1;
  9541. return 1;
  9542. }
  9543. if(a.attributes.startDate > b.attributes.startDate) return 1;
  9544. return -1;
  9545. });
  9546.  
  9547. // if we've got at least two closures in the sorted list, we then test adjacent list entries
  9548. // to see if they contain closure details which are identical except for their segment IDs, and
  9549. // combine them if so
  9550. if(RTCObjs.length > 1)
  9551. {
  9552. let i = 0;
  9553. while(i < (RTCObjs.length - 1))
  9554. {
  9555. if(
  9556. (RTCObjs[i].attributes.createdBy == RTCObjs[i+1].attributes.createdBy) &&
  9557. (RTCObjs[i].attributes.endDate == RTCObjs[i+1].attributes.endDate) &&
  9558. (RTCObjs[i].attributes.eventId == RTCObjs[i+1].attributes.eventId) &&
  9559. (RTCObjs[i].attributes.location == RTCObjs[i+1].attributes.location) &&
  9560. (RTCObjs[i].attributes.reason == RTCObjs[i+1].attributes.reason) &&
  9561. (RTCObjs[i].attributes.startDate == RTCObjs[i+1].attributes.startDate) &&
  9562. (RTCObjs[i].direction == RTCObjs[i+1].direction)
  9563. )
  9564. {
  9565. RTCObjs[i].segIDs.push(RTCObjs[i+1].attributes.segID);
  9566. RTCObjs.splice(i+1, 1);
  9567. }
  9568. else
  9569. {
  9570. ++i;
  9571. }
  9572. }
  9573. }
  9574.  
  9575. // after that first trimming of the list, if there are still two or more entries then
  9576. // we perform a second pass, this time merging any adjacent entries which have the same
  9577. // segment IDs in their segIDs arrays - these are two-way closures applying to all those
  9578. // segments, and so we also change the direction value to indicate two-way vs A-B or B-A
  9579. if(RTCObjs.length > 1)
  9580. {
  9581. let i = 0;
  9582. while(i < (RTCObjs.length - 1))
  9583. {
  9584. if
  9585. (
  9586. (RTCObjs[i].segIDs.sort().join(',') == RTCObjs[i+1].segIDs.sort().join(',')) &&
  9587. (RTCObjs[i].attributes.createdBy == RTCObjs[i+1].attributes.createdBy) &&
  9588. (RTCObjs[i].attributes.endDate == RTCObjs[i+1].attributes.endDate) &&
  9589. (RTCObjs[i].attributes.eventId == RTCObjs[i+1].attributes.eventId) &&
  9590. (RTCObjs[i].attributes.location == RTCObjs[i+1].attributes.location) &&
  9591. (RTCObjs[i].attributes.reason == RTCObjs[i+1].attributes.reason) &&
  9592. (RTCObjs[i].attributes.startDate == RTCObjs[i+1].attributes.startDate)
  9593. )
  9594. {
  9595. RTCObjs[i].direction = URO_DRTC.SEG_BI;
  9596. RTCObjs.splice(i+1, 1);
  9597. }
  9598. ++i;
  9599. }
  9600. }
  9601. }
  9602.  
  9603. let RTTCObjs = [];
  9604. if(segID !== null)
  9605. {
  9606. // If we've been called from the segment popup handler, we now also check for any turn closures
  9607. // associated with this segment, so that their details can also be shown in the popup...
  9608. for(let turnClosure in W.model.turnClosures.objects)
  9609. {
  9610. if(W.model.turnClosures.objects.hasOwnProperty(turnClosure))
  9611. {
  9612. let tcObj = W.model.turnClosures.objects[turnClosure];
  9613. if(tcObj.attributes.fromSegID === segID)
  9614. {
  9615. tcObj.direction = URO_DRTC.TURN_OUT;
  9616. RTTCObjs.push(tcObj);
  9617. }
  9618. else if(tcObj.attributes.toSegID === segID)
  9619. {
  9620. tcObj.direction = URO_DRTC.TURN_IN;
  9621. RTTCObjs.push(tcObj);
  9622. }
  9623. }
  9624. }
  9625.  
  9626. if(RTTCObjs.length > 1)
  9627. {
  9628. RTTCObjs = RTTCObjs.sort(function(a,b)
  9629. {
  9630. if(a.attributes.startDate === b.attributes.startDate)
  9631. {
  9632. if(a.direction == URO_DRTC.TURN_OUT) return -1;
  9633. return 1;
  9634. }
  9635. if(a.attributes.startDate > b.attributes.startDate) return 1;
  9636. return -1;
  9637. });
  9638. }
  9639. }
  9640.  
  9641. uroRTCObjs = RTCObjs.concat(RTTCObjs);
  9642. for(let i = 0; i < uroRTCObjs.length; ++i)
  9643. {
  9644. closureTypes |= uroRTCObjs[i].direction;
  9645. }
  9646.  
  9647. // the closure list ordering at this point doesn't always match up to the order used by the closures panel when
  9648. // a mixture of "all segment" and "some segment" closures are present - need to work out what ordering rules
  9649. // WME is using here...
  9650. return closureTypes;
  9651. }
  9652. function uroGetLengthString(length)
  9653. {
  9654. let retval = '';
  9655. if(length == null)
  9656. {
  9657. retval = "Default";
  9658. }
  9659. else if(W.model.isImperial == true)
  9660. {
  9661. retval = (length / (12 * 2.54)).toFixed(1) + "ft";
  9662. }
  9663. else
  9664. {
  9665. retval = (length / 100).toFixed(1) + "m";
  9666. }
  9667.  
  9668. return retval;
  9669. }
  9670. function uroGetHighlightedMapFeature()
  9671. {
  9672. let featureID = W.selectionManager.getWebMapSelectionManager().mouseInFeature;
  9673. let retval = null;
  9674.  
  9675. if(featureID !== null)
  9676. {
  9677. let isSelected = W.selectionManager.isSelected(featureID);
  9678. if(isSelected === false)
  9679. {
  9680. retval = W.selectionManager.getWebMapSelectionManager().getFeature(featureID);
  9681. }
  9682. }
  9683. return retval;
  9684. }
  9685. function uroGetFeatureRenderIntent(moObj)
  9686. {
  9687. let retval = "unknown";
  9688.  
  9689. if(moObj !== null)
  9690. {
  9691. let isSelected = moObj.selected;
  9692.  
  9693. if(isSelected === true)
  9694. {
  9695. retval = "highlightselected";
  9696. }
  9697. else
  9698. {
  9699. retval = "highlight";
  9700. }
  9701. }
  9702.  
  9703. return retval;
  9704. }
  9705. function uroExclusiveCB()
  9706. {
  9707. let cbChecked = uroUtils.GetCBChecked(this.id);
  9708.  
  9709. if(cbChecked === true)
  9710. {
  9711. let pairedList = this.attributes.pairedWith.value.split(',');
  9712. for(let i=0; i<pairedList.length; i++)
  9713. {
  9714. uroUtils.SetCBChecked(pairedList[i], false);
  9715. }
  9716. }
  9717. }
  9718. function uroContainsPoint(geo, point)
  9719. {
  9720. let retval = false;
  9721. try
  9722. {
  9723. let j = 1;
  9724. for(let i = 0; i < geo.length; ++i)
  9725. {
  9726. if
  9727. (
  9728. ((point[1] >= geo[i][1]) && (point[1] <= geo[j][1])) ||
  9729. ((point[1] >= geo[j][1]) && (point[1] <= geo[i][1]))
  9730. )
  9731. {
  9732. let lx = geo[i][0];
  9733. if(geo[i][1] != geo[j][1])
  9734. {
  9735. let g = ((point[1] - geo[i][1]) / (geo[j][1] - geo[i][1]));
  9736. lx += (g * (geo[j][0] - geo[i][0]));
  9737. }
  9738.  
  9739. if(point[0] <= lx)
  9740. {
  9741. retval = !retval;
  9742. }
  9743. }
  9744. if(++j == geo.length)
  9745. {
  9746. j = 0;
  9747. }
  9748. }
  9749. }
  9750. catch
  9751. {
  9752. }
  9753. return retval;
  9754. }
  9755. function uroGetAMs(e)
  9756. {
  9757. if(uroMTEMode) return;
  9758. if(!uroFilterPreamble) return;
  9759. if(!uroInit.initialised) return;
  9760. if(document.getElementById("uroAMList") == null) return;
  9761. if(document.getElementsByClassName('topbar') == null) return;
  9762.  
  9763. if(uroUtils.GetCBChecked("_cbMoveAMList") === false)
  9764. {
  9765. document.getElementsByClassName('area-managers-region')[0].style.display = "block";
  9766. uroAMList.innerHTML = uroUtils.ModifyHTML("");
  9767. document.getElementsByClassName('topbar')[0].style.backgroundColor=null;
  9768. return;
  9769. }
  9770.  
  9771. document.getElementsByClassName('topbar')[0].style.backgroundColor="#000000";
  9772. document.getElementsByClassName('area-managers-region')[0].style.display = "none";
  9773.  
  9774. let amList = '';
  9775. let tName = '';
  9776. if(W.map.managedAreasLayer.getVisibility() === true)
  9777. {
  9778. let mouseX = e.pageX - document.getElementById('map').getBoundingClientRect().left;
  9779. let mouseY = e.pageY - document.getElementById('map').getBoundingClientRect().top;
  9780. let mousePixel = W.map.getLonLatFromPixel(new OpenLayers.Pixel(mouseX, mouseY));
  9781. let mousePoint = [];
  9782. mousePoint.push(mousePixel.lon);
  9783. mousePoint.push(mousePixel.lat);
  9784.  
  9785. for(let amObj in W.model.managedAreas.objects)
  9786. {
  9787. let nc = W.model.managedAreas.objects[amObj].attributes.geoJSONGeometry.coordinates.length;
  9788. for(let i = 0; i < nc; ++i)
  9789. {
  9790. let geo = W.model.managedAreas.objects[amObj].attributes.geoJSONGeometry.coordinates[i];
  9791. if(nc > 1)
  9792. {
  9793. geo = geo[0];
  9794. }
  9795.  
  9796. if(uroContainsPoint(geo, mousePoint) === true)
  9797. {
  9798. let amName = uroUtils.GetUserNameFromID(W.model.managedAreas.objects[amObj].attributes.userID);
  9799. if(amList.indexOf(amName) === -1)
  9800. {
  9801. if(amList !== '') amList += ', ';
  9802. tName = uroUtils.GetUserNameAndRank(W.model.managedAreas.objects[amObj].attributes.userID);
  9803. if(tName.indexOf('a href') !== -1)
  9804. {
  9805. tName = tName.replace('a href', 'a style="color:#c0c0ff;" href');
  9806. }
  9807. amList += tName;
  9808. }
  9809. }
  9810. }
  9811. }
  9812. if(amList === '')
  9813. {
  9814. amList = 'none';
  9815. }
  9816. amList = "&nbsp;-&nbsp;<b>Area Managers:</b> "+amList;
  9817. }
  9818. document.getElementById("uroAMList").innerHTML = uroUtils.ModifyHTML(amList);
  9819. }
  9820. function uroNewTabAtMouseLoc(x, y)
  9821. {
  9822. let tPix = new OpenLayers.Pixel(x,y);
  9823. let mPos = uroUtils.ConvertMercatorToWGS84(W.map.getLonLatFromPixel(tPix));
  9824. let nZoom = W.map.getZoom();
  9825. if(nZoom < 17) nZoom = 17;
  9826. let nHref = window.location.origin + window.location.pathname;
  9827. nHref += '?lon=' + mPos.lon;
  9828. nHref += '&lat=' + mPos.lat;
  9829. nHref += '&zoomLevel=' + nZoom;
  9830. window.open(nHref);
  9831. }
  9832. function uroMouseDown(e)
  9833. {
  9834. uroMouseIsDown = true;
  9835. if((e.altKey === true) && (e.ctrlKey === true))
  9836. {
  9837. uroNewTabAtMouseLoc(e.offsetX, e.offsetY);
  9838. }
  9839. }
  9840. function uroMouseUp()
  9841. {
  9842. uroMouseIsDown = false;
  9843. }
  9844. function uroTestPointerOutsideMap(mX, mY)
  9845. {
  9846. let mapElm = document.getElementById("map");
  9847. if(mapElm === undefined) return;
  9848. let mapBCR = mapElm.getBoundingClientRect();
  9849.  
  9850. if
  9851. (
  9852. (mX < mapBCR.left) ||
  9853. (mX > mapBCR.right) ||
  9854. (mY < mapBCR.top) ||
  9855. (mY > mapBCR.bottom)
  9856. )
  9857. {
  9858. if(uroUtils.GetCBChecked('_cbKillInertialPanning') === true)
  9859. {
  9860. let controller = null;
  9861. if (W.map.navigationControl)
  9862. {
  9863. controller = W.map.navigationControl;
  9864. }
  9865. else if(W.map.controls.find(control => control.CLASS_NAME == 'OpenLayers.Control.Navigation'))
  9866. {
  9867. controller = W.map.controls.find(control => control.CLASS_NAME == 'OpenLayers.Control.Navigation');
  9868. }
  9869. if (controller !== null)
  9870. {
  9871. controller.dragPan.panMapStart();
  9872. }
  9873. }
  9874. return true;
  9875. }
  9876. else
  9877. {
  9878. return false;
  9879. }
  9880. }
  9881. function uroMouseOut(e)
  9882. {
  9883. if(uroTestPointerOutsideMap(e.clientX, e.clientY))
  9884. {
  9885. uroPopup.Hide();
  9886. }
  9887. }
  9888. function uroUREvent_onObjectsAdded()
  9889. {
  9890. if(uroUtils.GetCBChecked('_cbURResolverIDFilter') === true)
  9891. {
  9892. uroUpdateEditorList(W.model.mapUpdateRequests.objects, '_selectURResolverID', false, false, true, false);
  9893. }
  9894. if(uroPopulatingRequestSessions === false)
  9895. {
  9896. uroFilterURs();
  9897. }
  9898. }
  9899. function uroGetSelectedURCommentCount()
  9900. {
  9901. if(W.model.updateRequestSessions.objects[uroSelectedURID] != null)
  9902. {
  9903. let cachedCommentCount = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments.length;
  9904. uroDBG.AddLog(uroSelectedURID+':'+cachedCommentCount+' '+uroExpectedCommentCount);
  9905.  
  9906. // if there aren't the same number of cached comments as there are comments in the UR dialog list, initiate
  9907. // a refresh of the comment data...
  9908. if(cachedCommentCount != uroExpectedCommentCount)
  9909. {
  9910. if(uroPendingCommentDataRefresh === true)
  9911. {
  9912. if(cachedCommentCount > 0)
  9913. {
  9914. uroCachedLastCommentID = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments[cachedCommentCount-1].id;
  9915. }
  9916. else
  9917. {
  9918. uroCachedLastCommentID = null;
  9919. }
  9920. uroDBG.AddLog('updateRequestSessions refresh required for UR '+uroSelectedURID);
  9921. if(uroCachedLastCommentID !== null)
  9922. {
  9923. uroDBG.AddLog('last comment ID for this UR is '+uroCachedLastCommentID);
  9924. }
  9925. else
  9926. {
  9927. uroDBG.AddLog('first comment for this UR, no previous comment to ID');
  9928. }
  9929. let idList = [];
  9930. idList.push(uroSelectedURID);
  9931. // need to delete the existing cache object first, as .get() is only capable of creating new objects,
  9932. // it doesn't seem able to update an existing object with new data
  9933. W.model.updateRequestSessions.remove(W.model.updateRequestSessions.objects[uroSelectedURID]);
  9934. W.model.updateRequestSessions.getAsync(idList);
  9935.  
  9936. // the call to .get() initiates a XMLHttpRequest for the data, so we now need to switch modes - the
  9937. // refresh process has started so we're no longer pending, but we are now waiting for the XMLHttpRequest
  9938. // to return something...
  9939. uroPendingCommentDataRefresh = false;
  9940. uroWaitingCommentDataRefresh = true;
  9941. }
  9942. else
  9943. {
  9944. if(cachedCommentCount > 0)
  9945. {
  9946. let currentLastCommentID = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments[cachedCommentCount-1].id;
  9947. if(currentLastCommentID == uroCachedLastCommentID)
  9948. {
  9949. // most recent comment loaded for this UR is the same one that was present at the start of this
  9950. // refresh process, so kick back into pending mode so we can retry the .get()...
  9951. uroDBG.AddLog('latest comment ID still the same, reverting to pending mode...');
  9952. uroPendingCommentDataRefresh = true;
  9953. }
  9954. else
  9955. {
  9956. // something may have gone awry here - the most recent comment loaded for this UR doesn't have the
  9957. // same ID as the one present at the start of the refresh process, yet the comment counts still don't
  9958. // match up, which suggests either a comment got lost along the way or someone else has commented on
  9959. // the same UR at almost the same time. To get out of the loop this would create, assume that a
  9960. // mismatch in the IDs means the .get() has completed successfully no matter what the new comment
  9961. // count is, and take this new count to be the count we were expecting all along...
  9962. uroDBG.AddLog('latest comment ID different, but expected count not correct...');
  9963. uroExpectedCommentCount = cachedCommentCount;
  9964. }
  9965. }
  9966. else
  9967. {
  9968. uroDBG.AddLog('first comment on this UR not received yet, reverting to pending mode...');
  9969. uroPendingCommentDataRefresh = true;
  9970. }
  9971. }
  9972.  
  9973. }
  9974. else
  9975. {
  9976. // if the WME session is loaded with a UR already selected, such that WME has opened the UR dialog as part
  9977. // of the session startup process, adding new comments to the UR cause the cached data to be updated immediately.
  9978. // This prevents URO+ from switching into waiting mode in the above block of code, so we have to instead do
  9979. // it here by comparing the cached count against the expected count following the Send click event.
  9980. if(cachedCommentCount >= uroExpectedCommentCount)
  9981. {
  9982. uroPendingCommentDataRefresh = false;
  9983. uroWaitingCommentDataRefresh = true;
  9984. uroExpectedCommentCount = null;
  9985. }
  9986.  
  9987. // once the cached data has been updated, refilter the URs so that the new comment count is taken into account
  9988. // immediately for filtering and display purposes
  9989. if(uroWaitingCommentDataRefresh === true)
  9990. {
  9991. uroWaitingCommentDataRefresh = false;
  9992. uroFilterURs();
  9993. uroDBG.AddLog('refresh complete');
  9994. }
  9995. }
  9996. }
  9997. }
  9998. function uroAddedComment()
  9999. {
  10000. // when the user clicks the Send button to submit a new UR comment, this event handler fires before the new comment is
  10001. // posted to the server and thus also before the comment list gets updated in the UR dialog. So we take the current
  10002. // comment count and, if the new comment edit box isn't empty, increment it by 1 to get the expected count. Then we
  10003. // set the pending flag true to initiate a session refresh on the next 100ms tick
  10004. uroExpectedCommentCount = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments.length;
  10005. if(document.getElementsByClassName('new-comment-text')[0].value !== '')
  10006. {
  10007. uroExpectedCommentCount++;
  10008. uroDBG.AddLog('new comment added to UR '+uroSelectedURID+', cache refresh required...');
  10009. uroPendingCommentDataRefresh = true;
  10010. }
  10011. else
  10012. {
  10013. uroPendingCommentDataRefresh = false;
  10014. }
  10015. }
  10016. function uroInhibitNextUpdateRequestButton(e)
  10017. {
  10018. e.stopPropagation();
  10019.  
  10020. let doClick = true;
  10021. if(document.getElementsByClassName('form-control new-comment-text').length > 0)
  10022. {
  10023. if(document.getElementsByClassName('form-control new-comment-text')[0].textLength > 0)
  10024. {
  10025. uroAlertBox.Show("fa-warning", "URO+ Warning", "Comment not sent, close report panel anyway?", true, "Yes", "No", uroCloseReportPanel, null);
  10026. // set doClick to false here, as uroCloseReportPanel will be called by the alert box handler if required...
  10027. doClick = false;
  10028. }
  10029. }
  10030. // no alert box has been generated, so close the panel
  10031. if(doClick)
  10032. {
  10033. uroCloseReportPanel();
  10034. }
  10035. }
  10036. function uroCloseReportPanel()
  10037. {
  10038. document.getElementsByClassName('close-panel')[0].click();
  10039. }
  10040. function uroIncrementClosureDate(oldDate, incByDays)
  10041. {
  10042. // Thanks to WME no longer using consistent ISO8601 date formatting when displaying
  10043. // closure details, parsing the date string is now somewhat more involved. Thanks devs...
  10044.  
  10045. // Default to returning the existing date, just in case we can't increment it
  10046. let retval = oldDate;
  10047. let sepChar = null;
  10048.  
  10049. // Search through oldDate for a non-digit character, so we know what's
  10050. // being used to seperate the year, month and date values by this locale...
  10051. for(let i = 0; i < oldDate.length; ++i)
  10052. {
  10053. if((oldDate[i] < '0') || (oldDate[i] > '9'))
  10054. {
  10055. sepChar = oldDate[i];
  10056. break;
  10057. }
  10058. }
  10059.  
  10060. if(sepChar != null)
  10061. {
  10062. // First build a "probe" date object we can use to determine what the user's WME locale
  10063. // does with dates.
  10064. let incDate = new Date();
  10065. incDate.setFullYear(3000);
  10066. incDate.setMonth(10);
  10067. incDate.setDate(22);
  10068.  
  10069. // With these three carefully chosen date elements set, we now generate a localised datestring
  10070. // using the WME locale setting - the first character of which then tells us the date
  10071. // format - 1 = MDY (ack ptui), 2 = DMY (good), 3 = YMD (sweet!)
  10072. let localeDate = incDate.toLocaleDateString(I18n.locale);
  10073. let dateFormat = localeDate[0];
  10074.  
  10075. // Now we know the seperator character and the date format, so we can finally start to parse
  10076. // the existing date string...
  10077. let oldDateBits = oldDate.split(sepChar);
  10078. let datePos;
  10079. let monthPos;
  10080. let yearPos;
  10081. if(dateFormat == '1')
  10082. {
  10083. datePos = 1;
  10084. monthPos = 0;
  10085. yearPos = 2;
  10086. }
  10087. else if(dateFormat == '2')
  10088. {
  10089. datePos = 0;
  10090. monthPos = 1;
  10091. yearPos = 2;
  10092. }
  10093. else
  10094. {
  10095. datePos = 2;
  10096. monthPos = 1;
  10097. yearPos = 0;
  10098. }
  10099. incDate.setFullYear(parseInt(oldDateBits[yearPos]));
  10100. incDate.setMonth(parseInt(oldDateBits[monthPos]) - 1);
  10101. incDate.setDate(parseInt(oldDateBits[datePos]));
  10102. let tDate = new Date(incDate.getTime());
  10103. incDate.setDate(tDate.getDate() + incByDays);
  10104.  
  10105. retval = incDate.toLocaleDateString(I18n.locale);
  10106.  
  10107. // Except for those pesky locales where toLocaleDateString() doesn't *quite*
  10108. // return what WME is expecting. Because, you know, why make it easy for
  10109. // scripters when you can chuck in a few subtle curveballs like this, eh...
  10110.  
  10111. if(I18n.locale == 'bg')
  10112. {
  10113. // Remove the "r." suffix
  10114. retval = retval.split(" ")[0] + " ";
  10115. }
  10116. }
  10117. return retval;
  10118. }
  10119. function uroGetElementProperty(elmName, elmOffset, elmProperty)
  10120. {
  10121. let retval = null;
  10122. if(document.getElementsByName(elmName).length > elmOffset)
  10123. {
  10124. retval = document.getElementsByName(elmName)[elmOffset][elmProperty];
  10125. }
  10126. else if(document.getElementById(elmName) !== null)
  10127. {
  10128. retval = document.getElementById(elmName)[elmProperty];
  10129. }
  10130. return retval;
  10131. }
  10132. function uroGetShadowElementProperty(elmName, shadowElmType, property)
  10133. {
  10134. let retval = null;
  10135. let tObj = document.getElementById(elmName);
  10136. if(tObj !== null)
  10137. {
  10138. let sObj = tObj.shadowRoot.querySelector(shadowElmType);
  10139. if(sObj !== null)
  10140. {
  10141. retval = sObj[property];
  10142. }
  10143. }
  10144. return retval;
  10145. }
  10146. function uroClosureEditUIChanged()
  10147. {
  10148. if(document.getElementsByClassName('edit-closure').length === 1)
  10149. {
  10150. // note: this also fires when the UI is closed, due to the change events triggered as its elements are removed
  10151. // prior to the tab itself closing...
  10152.  
  10153. let notReady = 0;
  10154. if(document.getElementById('closure_reason').shadowRoot.querySelector('input') === null) notReady += 1;
  10155. if(document.getElementById('closure_direction').shadowRoot.querySelector('.selected-value') === null) notReady += 2;
  10156. else if(document.getElementById('closure_direction').shadowRoot.querySelector('.selected-value').innerText === "") notReady += 4;
  10157. if(document.getElementById('closure_startDate') === null) notReady += 8;
  10158. if(document.getElementById('closure_endDate') === null) notReady += 16;
  10159. if(document.getElementById('closure_eventId').shadowRoot.querySelector('.selected-value') === null) notReady += 32;
  10160. else if(document.getElementById('closure_eventId').shadowRoot.querySelector('.selected-value').innerText === "") notReady += 64;
  10161. if(document.getElementById('closure_permanent').shadowRoot.querySelector('.wz-checkbox') === null) notReady += 128;
  10162. if(notReady === 0)
  10163. {
  10164. if(uroRTCClone.PendingClone === -3)
  10165. {
  10166. uroRTCClone.Complete();
  10167. }
  10168. else if(uroRTCClone.PendingClone !== -1)
  10169. {
  10170. uroRTCClone.Copy(uroRTCClone.PendingClone);
  10171. }
  10172. else
  10173. {
  10174. uroTempFixMTEDropDown();
  10175. }
  10176. }
  10177. }
  10178. else
  10179. {
  10180. if(uroRTCClone.PendingClone === -2)
  10181. {
  10182. // generate a click event on the Add a closure button to open up the closure editing UI, then
  10183. // wait for the UI to finish opening...
  10184. document.getElementsByClassName('add-closure-button')[0].click();
  10185. uroRTCClone.PendingClone = -3;
  10186. }
  10187. uroClosureListHandler();
  10188. }
  10189. }
  10190. function uroTSTPopupHandler()
  10191. {
  10192. if(document.getElementsByClassName('panel')[0] === undefined)
  10193. {
  10194. uroHidePopupOnPanelOpen = true;
  10195. }
  10196.  
  10197. if(uroPopup.shown === true)
  10198. {
  10199. let hidePopup = false;
  10200.  
  10201. if(document.getElementsByClassName('panel')[0] != null)
  10202. {
  10203. if(uroHidePopupOnPanelOpen === true)
  10204. {
  10205. hidePopup = true;
  10206. uroHidePopupOnPanelOpen = false;
  10207. }
  10208. }
  10209.  
  10210. if(hidePopup === true)
  10211. {
  10212. uroPopup.Hide();
  10213. }
  10214. }
  10215.  
  10216. if((uroAFN.hoverObj !== null) && (uroAFN.hoverTime != -1) && (uroAFN.overlayShown === false))
  10217. {
  10218. if(++uroAFN.hoverTime > 5)
  10219. {
  10220. uroAFN.OverlaySetup();
  10221. }
  10222. }
  10223. uroAFN.ReplaceAreaNames(false);
  10224.  
  10225. if(uroPopup.autoHideTimer > 0)
  10226. {
  10227. if(--uroPopup.autoHideTimer === 0)
  10228. {
  10229. uroPopup.Hide();
  10230. }
  10231. }
  10232.  
  10233. if(uroPopup.timer > 0)
  10234. {
  10235. if(uroPopup.mouseIn === false)
  10236. {
  10237. uroPopup.timer--;
  10238. }
  10239. }
  10240. if(uroPopup.timer === 0)
  10241. {
  10242. uroPopup.Hide();
  10243. }
  10244. }
  10245. function uroTSTNextBtnHandler()
  10246. {
  10247. // replaces the "next xxx" button on UR, MP and PUR editing UIs
  10248.  
  10249. // Correctly determining what WME is displaying for the "next" button in the UR/MP/(P)PUR panel is not trivial due to
  10250. // inconsistencies in the panel behaviour depending on whether it was opened by clicking directly on the relevant
  10251. // marker, or by clicking on the associated feed entry... For PURs, there's also the added complication of multi-part
  10252. // update requests, where the same marker/panel are used to access more than one request and where, therefore, we need
  10253. // to enable access to all requests contained within the PUR, but still inhibit the "next" button once the last
  10254. // request in the multi-part sequence has been viewed.
  10255. //
  10256. // For directly-accesed markers, the "next" button caption is:
  10257. //
  10258. // URs = "Next update request" (update_requests.panel.next)
  10259. // MPs = "Next map problem" (problems.panel.next)
  10260. // PURs = "Next place" for single-part PURs or for the last part of a multi-part PUR (venues.update_requests.panel.next_venue)
  10261. // = "Next" for all but the last part of a multi-part PUR (venues.update_requests.panel.next)
  10262. // PPURs = "Next place" (venues.update_requests.panel.next_venue)
  10263. //
  10264. // For markers accessed via the feed, the "next" button caption always appears to be "Next issue" (feed.issues.next)
  10265.  
  10266.  
  10267.  
  10268. if(W.map.panelRegion.hasView() === true)
  10269. {
  10270. let nurButton = W.map.panelRegion.$el[0].getElementsByClassName('next')[0];
  10271. if(nurButton === undefined)
  10272. {
  10273. nurButton = W.map.panelRegion.$el[0].getElementsByClassName('next-venue')[0];
  10274. }
  10275. if(nurButton !== undefined)
  10276. {
  10277. let doneString = I18n.lookup('problems.panel.done');
  10278. let btnCaptionIsNextPlace = (nurButton.innerHTML.indexOf(I18n.lookup('venues.update_requests.panel.next_venue')) !== -1);
  10279. let btnCaptionIsDefaultUR = (nurButton.innerHTML.indexOf(I18n.lookup('update_requests.panel.next')) !== -1);
  10280. let btnCaptionIsDefaultMP = (nurButton.innerHTML.indexOf(I18n.lookup('problems.panel.next')) !== -1);
  10281. let btnCaptionIsNextIssue = (nurButton.innerHTML.indexOf(I18n.lookup('feed.issues.next')) !== -1);
  10282.  
  10283. let updateButton = false;
  10284.  
  10285. let panelClass = W.map.panelRegion.$el[0].childNodes[0].childNodes[0].className;
  10286. let isURorMPPanel = (panelClass.indexOf('problem-edit') !== -1);
  10287. let isPURPanel = (panelClass.indexOf('place-update') !== -1);
  10288.  
  10289. if(isURorMPPanel === true)
  10290. {
  10291. // user has enabled UR button mod?
  10292. if(uroUtils.GetCBChecked('_cbInhibitNURButton') === true)
  10293. {
  10294. // the native UR panel button will always either be "Next update request" or "Next issue"
  10295. updateButton = ((btnCaptionIsDefaultUR) || (btnCaptionIsNextIssue));
  10296. }
  10297.  
  10298. // user has enabled MP button mod?
  10299. if(uroUtils.GetCBChecked('_cbInhibitNMPButton') === true)
  10300. {
  10301. // there's no way to determine if the edit panel has been opened for a UR or a MP, however as MPs
  10302. // don't currently appear in the feed, the native button only uses "Next map problem" as its caption
  10303. updateButton = (updateButton || btnCaptionIsDefaultMP);
  10304. }
  10305. }
  10306. else if(isPURPanel === true)
  10307. {
  10308. if(uroUtils.GetCBChecked('_cbInhibitNPURButton') === true)
  10309. {
  10310. // for a (P)PUR, only modify the button if it's showing the "Next place" or "Next issue" caption, to
  10311. // avoid messing up the "Next" button used to move to the next part of a multi-part PUR...
  10312. updateButton = ((btnCaptionIsNextPlace === true) || (btnCaptionIsNextIssue));
  10313. }
  10314. }
  10315.  
  10316. if(updateButton === true)
  10317. {
  10318. uroDBG.AddLog('inhibit Next UR/MP/PUR button');
  10319.  
  10320. // alter the button caption
  10321. nurButton.innerHTML = uroUtils.ModifyHTML(doneString);
  10322. // 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
  10323. // moving to the next UR/MP/PUR, and also allows us to warn about closing the UR panel if there's an unsent comment...
  10324. nurButton.addEventListener("click", uroInhibitNextUpdateRequestButton, false);
  10325. }
  10326. }
  10327. uroInhibitURFiltering = false;
  10328. }
  10329. }
  10330. function uroTSTCommentAddedHandler()
  10331. {
  10332. // test for the opening or closing of the UR editing dialog so we can detect when a new comment is added
  10333. let URDialogIsOpen = false;
  10334. let panelOpen = (document.getElementById('panel-container').firstChild !== null);
  10335.  
  10336. if(panelOpen)
  10337. {
  10338. URDialogIsOpen = (document.getElementById('panel-container').getElementsByClassName('conversation').length > 0);
  10339. }
  10340.  
  10341. if(URDialogIsOpen)
  10342. {
  10343. let thisSelectedURID = document.getElementsByClassName('permalink')[0].href.split('&mapUpdateRequest=');
  10344. if(thisSelectedURID.length > 1)
  10345. {
  10346. thisSelectedURID = thisSelectedURID[1].split('&')[0];
  10347. }
  10348. else
  10349. {
  10350. thisSelectedURID = null;
  10351. }
  10352.  
  10353. if((thisSelectedURID != uroSelectedURID) || ((thisSelectedURID != uroMarkers.clickedOnID) && (uroMarkers.clickedOnID != null)))
  10354. {
  10355. // if the user selects a new UR whilst the editing dialog is still open, treat it in the
  10356. // same way as if the user had selected that UR with the dialog closed
  10357. uroURDialogIsOpen = false;
  10358. uroSelectedURID = null;
  10359. }
  10360.  
  10361. if(((uroURDialogIsOpen === false) && (uroSelectedURID === null)) || (uroURReclickAttempts > 0))
  10362. {
  10363. // user is editing a new UR
  10364.  
  10365. // add our own click event handler to the Send button, so we can do stuff whenever a new comment is added
  10366. if(document.getElementsByClassName('new-comment-form').length > 0)
  10367. {
  10368. if(document.getElementsByClassName('new-comment-form')[0].getElementsByClassName('send-button').length > 0)
  10369. {
  10370. document.getElementsByClassName('new-comment-form')[0].getElementsByClassName('send-button')[0].addEventListener("click", uroAddedComment, false);
  10371.  
  10372. uroSelectedURID = thisSelectedURID;
  10373. uroDBG.AddLog('user is editing UR '+uroSelectedURID);
  10374. uroExpectedCommentCount = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments.length;
  10375.  
  10376. if((uroHoveredURID !== null) && (uroSelectedURID !== null) && (parseInt(uroHoveredURID) !== parseInt(uroSelectedURID)))
  10377. {
  10378. if(uroURReclickAttempts === 0)
  10379. {
  10380. 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...');
  10381. }
  10382. if(++uroURReclickAttempts < 3)
  10383. {
  10384. //uroRestackMarkers();
  10385. let urMarker = uroGetMarker(uroLayers.ID.UR,uroHoveredURID);
  10386. if(urMarker !== null)
  10387. {
  10388. let urMarkerAttributes = uroGetAttributes(uroLayers.ID.UR, uroHoveredURID);
  10389. if(urMarkerAttributes !== null)
  10390. {
  10391. urMarkerAttributes.geometry.x = urMarkerAttributes.geometry.realX;
  10392. urMarkerAttributes.geometry.y = urMarkerAttributes.geometry.realY;
  10393. uroOpenURDialog(uroHoveredURID);
  10394. }
  10395. }
  10396. return;
  10397. }
  10398. else
  10399. {
  10400. uroDBG.AddLog('Woe is me, attempting to open UR ID '+uroHoveredURID+' has failed...');
  10401. 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);
  10402. }
  10403. }
  10404. uroURReclickAttempts = 0;
  10405. uroFilterURs();
  10406. }
  10407. }
  10408. }
  10409. }
  10410. else if(uroURDialogIsOpen === true)
  10411. {
  10412. // dialog was open and has now been closed
  10413. uroSelectedURID = null;
  10414. uroMarkers.clickedOnID = null;
  10415. uroFilterURs();
  10416. }
  10417. uroURDialogIsOpen = URDialogIsOpen;
  10418.  
  10419. if(((uroPendingCommentDataRefresh === true) || (uroWaitingCommentDataRefresh === true)) && (uroSelectedURID !== null))
  10420. {
  10421. uroDBG.AddLog('check completion of comment data refresh for UR '+uroSelectedURID+' ('+uroPendingCommentDataRefresh+','+uroWaitingCommentDataRefresh+')');
  10422. uroGetSelectedURCommentCount();
  10423. }
  10424.  
  10425. }
  10426. function uroClosureListHandler()
  10427. {
  10428. // Handles adjustments to the closure list in the sidepanel...
  10429. //
  10430. if(uroUtils.GetCBChecked('_cbMasterEnable') === false)
  10431. {
  10432. return;
  10433. }
  10434.  
  10435. // List entry filtering
  10436. let nEntries = document.querySelectorAll('.closure-item').length;
  10437. if(nEntries > 0)
  10438. {
  10439. let filterExpired = uroUtils.GetCBChecked('_cbHideExpiredSidepanelRTCs');
  10440. let filterCurrent = uroUtils.GetCBChecked('_cbHideSidepanelRTCs');
  10441. let filterFuture = uroUtils.GetCBChecked('_cbHideFutureSidepanelRTCs');
  10442. for(let i = 0; i < nEntries; ++i)
  10443. {
  10444. let hide = false;
  10445. let cElm = document.querySelectorAll('.closure-item')[i];
  10446. let ciSrc = cElm.querySelector('img')?.src;
  10447. if(ciSrc != undefined)
  10448. {
  10449. hide |= ((ciSrc.indexOf('finished') != -1) && (filterExpired == true));
  10450. hide |= ((ciSrc.indexOf('active') != -1) && (filterCurrent == true));
  10451. hide |= ((ciSrc.indexOf('not-started') != -1) && (filterFuture == true));
  10452. }
  10453.  
  10454. if(hide == true)
  10455. {
  10456. cElm.style.display = "none";
  10457. }
  10458. else
  10459. {
  10460. cElm.style.display = "block";
  10461. }
  10462. }
  10463. }
  10464.  
  10465. // Closure cloning controls
  10466. if((document.querySelectorAll('.closures-list').length > 0) && (document.querySelector('.closures-list').getAttribute('touchedbyuro') === null))
  10467. {
  10468. let nClosures;
  10469. let cLoop;
  10470. let btnElm;
  10471.  
  10472. // Cloning doesn't work with certain locales due to the way the date strings are formatted...
  10473. if
  10474. (
  10475. (I18n.locale == "fa-IR") ||
  10476. (I18n.locale == 'ar') ||
  10477. (I18n.locale == 'zh') ||
  10478. (I18n.locale == 'ko')
  10479. )
  10480. {
  10481. // Sorry :-(
  10482. }
  10483. else
  10484. {
  10485. // for the others, are there any closures defined for all of the selected segment(s)...
  10486. if(document.getElementsByClassName('full-closures').length > 0)
  10487. {
  10488. nClosures = document.getElementsByClassName('full-closures')[0].querySelectorAll('.closure-item.is-editable').length;
  10489. if(nClosures > 0)
  10490. {
  10491. // Force a refresh of uroRTCObjs for the selected segment, as this is no longer guaranteed to have already occurred...
  10492. let segID = W.selectionManager.getSelectedFeatureIds()[0];
  10493. uroGetSelectedSegmentRTCs(segID);
  10494.  
  10495. // and if so, have we already added the clone icon?
  10496. for(cLoop = 0; cLoop < nClosures; cLoop++)
  10497. {
  10498. btnElm = document.getElementsByClassName('full-closures')[0].querySelectorAll('.closure-item.is-editable')[cLoop].getElementsByClassName('closure-title')[0];
  10499. if((btnElm.innerHTML.indexOf('_uroCloneClosure-') == -1) && (uroGetRTCOrigin(uroRTCObjs[cLoop]) !== URO_TRTC.UNKNOWN))
  10500. {
  10501. let newNode = document.createElement("div");
  10502. let anchorID1 = '_uroCloneClosure-1-'+cLoop;
  10503. let anchorID2 = '_uroCloneClosure-7-'+cLoop;
  10504. let newAnchor = '<a id="'+anchorID1+'" href="#">';
  10505. newAnchor += "<i style='font-size: 150%; cursor: copy' class='fa fa-copy'></i>";
  10506. newAnchor += "</a><sup>+1</sup>&nbsp;";
  10507. newAnchor += '<a id="'+anchorID2+'" href="#">';
  10508. newAnchor += "<i style='font-size: 150%; cursor: copy' class='fa fa-copy'></i>";
  10509. newAnchor += "</a><sup>+7</sup>";
  10510. newNode.innerHTML = uroUtils.ModifyHTML(newAnchor);
  10511. btnElm.prepend(newNode);
  10512. uroUtils.AddEventListener(anchorID1,"click",uroRTCClone.Clone,false);
  10513. uroUtils.AddEventListener(anchorID2,"click",uroRTCClone.Clone,false);
  10514.  
  10515. let chipElm = btnElm.querySelector("wz-image-chip");
  10516. chipElm.innerHTML = chipElm.innerHTML.split('>')[0] + '>';
  10517. }
  10518. }
  10519. }
  10520. }
  10521. }
  10522.  
  10523. // if there's more than one closure (full or partial) listed, also add the delete all button if not already present
  10524. nClosures = document.querySelectorAll('.closure-item.is-editable').length;
  10525. if(nClosures > 0)
  10526. {
  10527. if(document.getElementById('_btnDeleteAllClosures') === null)
  10528. {
  10529. let daDiv = document.createElement('wz-button');
  10530. daDiv.className = 'delete-all-button btn is-expanded'; //btn-primary';
  10531. daDiv.id = '_btnDeleteAllClosures';
  10532.  
  10533. let tHTML = '<i class="fa fa-trash"></i> '+I18n.lookup("closures.delete_confirm_no_reason");
  10534. if(nClosures > 1)
  10535. {
  10536. tHTML += ' ('+I18n.lookup("closures.apply_to_all")+')';
  10537. }
  10538. daDiv.innerHTML = uroUtils.ModifyHTML(tHTML);
  10539. daDiv.style.width = '100%';
  10540. daDiv.style.marginBottom = '10px';
  10541.  
  10542. let acBtn = document.getElementsByClassName('add-closure-button')[0];
  10543. if(acBtn !== undefined)
  10544. {
  10545. acBtn.parentNode.insertBefore(daDiv, acBtn.nextSibling);
  10546. uroUtils.AddEventListener('_btnDeleteAllClosures',"click", uroRTCClone.DeleteAll, false);
  10547. }
  10548. }
  10549. }
  10550.  
  10551. let deferTouching = false;
  10552. if(uroUtils.GetCBChecked('_cbAutoScrollClosureList') == true)
  10553. {
  10554. // Scroll to the end of the closure tab, as that's where the closure you're most likely to be cloning
  10555. // is located...
  10556. let cItems = document.getElementsByClassName('closure-item');
  10557. if(cItems.length > 0)
  10558. {
  10559. let lastOne = cItems[cItems.length - 1];
  10560. if(lastOne.getBoundingClientRect().height === 0)
  10561. {
  10562. deferTouching = true;
  10563. }
  10564. else
  10565. {
  10566. lastOne.scrollIntoView();
  10567. }
  10568. }
  10569. }
  10570.  
  10571. if(deferTouching === false)
  10572. {
  10573. document.getElementsByClassName('closures-list')[0].setAttribute('touchedbyuro','true');
  10574. }
  10575. }
  10576. }
  10577. function uroMiscUITweaksHandler()
  10578. {
  10579. if(uroFilterPreamble())
  10580. {
  10581. // clickifies the ExtraInfo URL present in some MPs
  10582. {
  10583. if(document.getElementById('panel-container').getElementsByClassName('extraInfo').length > 0)
  10584. {
  10585. if(document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].touchedByURO === undefined)
  10586. {
  10587. let tDesc = document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].innerHTML;
  10588. tDesc = uroUtils.Clickify(tDesc, '');
  10589. document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].innerHTML = uroUtils.ModifyHTML(tDesc);
  10590. document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].touchedByURO = true;
  10591. }
  10592. }
  10593. }
  10594. }
  10595. }
  10596. function uroMainTick()
  10597. {
  10598. if(uroMTEMode) return;
  10599. if(uroInit.setupListeners)
  10600. {
  10601. if(uroInit.finalisingListenerSetup === false)
  10602. {
  10603. if(W.loginManager.isLoggedIn())
  10604. {
  10605. if(document.getElementsByClassName('topbar').length === 0) return;
  10606. uroInit.FinalizeListenerSetup();
  10607. document.getElementsByClassName('topbar')[0].appendChild(uroAMList);
  10608. }
  10609. }
  10610. }
  10611. else
  10612. {
  10613. if(uroUtils.GetCBChecked('_cbMasterEnable') === true)
  10614. {
  10615. // do one maintick handler call in each 10ms cycle to minimise the time stuck within the maintick handler without
  10616. // unduly affecting the overall response time for each individual handler
  10617.  
  10618. if(uroMainTickStage === 0) uroTSTPopupHandler();
  10619. if(uroMainTickStage == 1) uroTSTNextBtnHandler();
  10620. if(uroMainTickStage == 2) uroTSTCommentAddedHandler();
  10621. if(uroMainTickStage == 4) uroMiscUITweaksHandler();
  10622.  
  10623. if(++uroMainTickStage == 6) uroMainTickStage = 0;
  10624. }
  10625. }
  10626. }
  10627. function uroNewLookCheckDetailsRequest()
  10628. {
  10629. let thisurl = document.location.href;
  10630. let doRetry = true;
  10631. let urID;
  10632. let endmarkerpos = thisurl.indexOf('&endshow');
  10633. let showmarkerpos = thisurl.indexOf('&showturn=');
  10634.  
  10635. if((endmarkerpos != -1) && (showmarkerpos != -1))
  10636. {
  10637. showmarkerpos += 10;
  10638. uroDBG.AddLog('showturn tab opened');
  10639. urID = thisurl.substr(showmarkerpos,endmarkerpos-showmarkerpos);
  10640. uroDBG.AddLog(' turn problem ID = '+urID);
  10641.  
  10642. try
  10643. {
  10644. uroGetMarker(uroLayers.ID.MP,urID).element.click();
  10645. doRetry = false;
  10646. }
  10647. catch(err)
  10648. {
  10649. uroDBG.AddLog('problems not fully loaded, retrying...');
  10650. }
  10651.  
  10652. if(doRetry) window.setTimeout(uroNewLookCheckDetailsRequest,500);
  10653. }
  10654. else
  10655. {
  10656. showmarkerpos = thisurl.indexOf('&showpur=');
  10657. if((endmarkerpos != -1) && (showmarkerpos != -1))
  10658. {
  10659. showmarkerpos += 9;
  10660. uroDBG.AddLog('showPUR tab opened');
  10661. urID = thisurl.substr(showmarkerpos,endmarkerpos-showmarkerpos);
  10662. uroDBG.AddLog(' PUR ID = '+urID);
  10663.  
  10664. try
  10665. {
  10666. uroGetMarker(uroLayers.ID.PUR, urID).element.click();
  10667. doRetry = false;
  10668. }
  10669. catch(err)
  10670. {
  10671. uroDBG.AddLog('PURs not fully loaded, retrying...');
  10672. }
  10673.  
  10674. if(doRetry) window.setTimeout(uroNewLookCheckDetailsRequest,500);
  10675. }
  10676.  
  10677. else
  10678. {
  10679. showmarkerpos = thisurl.indexOf('&showppur=');
  10680. if((endmarkerpos != -1) && (showmarkerpos != -1))
  10681. {
  10682. showmarkerpos += 10;
  10683. uroDBG.AddLog('showPPUR tab opened');
  10684. urID = thisurl.substr(showmarkerpos,endmarkerpos-showmarkerpos);
  10685. uroDBG.AddLog(' PPUR ID = '+urID);
  10686.  
  10687. try
  10688. {
  10689. uroGetMarker(uroLayers.ID.PPUR, urID).element.click();
  10690. doRetry = false;
  10691. }
  10692. catch(err)
  10693. {
  10694. uroDBG.AddLog('PPURs not fully loaded, retrying...');
  10695. }
  10696.  
  10697. if(doRetry) window.setTimeout(uroNewLookCheckDetailsRequest,500);
  10698. }
  10699. }
  10700. }
  10701.  
  10702. }
  10703. function uroUpdateVenueEditorLists()
  10704. {
  10705. if(Object.keys(W.model.venues.objects).length === 0) return;
  10706.  
  10707. // build the list of all userIDs contained in the currently loaded venue objects
  10708. let selectedIdx = null;
  10709. let listedIDs = [];
  10710. let idx;
  10711. for(idx in W.model.venues.objects)
  10712. {
  10713. if(W.model.venues.objects.hasOwnProperty(idx))
  10714. {
  10715. let obj = W.model.venues.objects[idx].attributes;
  10716. let cbID = obj.createdBy;
  10717. let ubID = obj.updatedBy;
  10718.  
  10719. if((cbID !== null) && (listedIDs.indexOf(cbID) == -1))
  10720. {
  10721. listedIDs.push(cbID);
  10722. }
  10723. if((ubID !== null) && (ubID !== cbID) && (listedIDs.indexOf(ubID) == -1))
  10724. {
  10725. listedIDs.push(ubID);
  10726. }
  10727. }
  10728. }
  10729.  
  10730. // check for any previously selected userIDs in the two selector lists, then clear both lists
  10731. // and repopulate using the newly gathered ID collection from above, and finally reselect the
  10732. // previously selected user if they're still present in the new list...
  10733. let selector;
  10734. let selectedUser;
  10735. let users = W.model.users.getByIds(listedIDs);
  10736. let selectorEntry;
  10737.  
  10738. for(let i=0; i<2; i++)
  10739. {
  10740. if(i === 0) selector = document.getElementById('_selectPlacesUserID');
  10741. else selector = document.getElementById('_selectHidePlacesUserID');
  10742.  
  10743. selectedUser = null;
  10744. if(selector.selectedOptions[0] != null)
  10745. {
  10746. selectedUser = parseInt(selector.selectedOptions[0].value);
  10747. }
  10748. while(selector.options.length > 0)
  10749. {
  10750. selector.options.remove(0);
  10751. }
  10752. selector.options.add(new Option('<select a user>', null));
  10753. if(listedIDs.length > 0)
  10754. {
  10755. selectorEntry = '';
  10756. for(idx=0; idx<users.length; idx++)
  10757. {
  10758. if(users[idx].attributes.userName === undefined)
  10759. {
  10760. selectorEntry = users[idx].attributes.id;
  10761. }
  10762. else
  10763. {
  10764. selectorEntry = users[idx].attributes.userName;
  10765. }
  10766. selector.options.add(new Option(selectorEntry, users[idx].id));
  10767. if(users[idx].attributes.id == selectedUser)
  10768. {
  10769. selectedIdx = idx+1;
  10770. }
  10771. }
  10772. }
  10773.  
  10774. if(selectedIdx !== null)
  10775. {
  10776. selector.selectedIndex = selectedIdx;
  10777. }
  10778. }
  10779. }
  10780. function uroPlacesEditorSelected()
  10781. {
  10782. let selector = document.getElementById('_selectPlacesUserID');
  10783. if(selector.selectedIndex > 0)
  10784. {
  10785. document.getElementById('_textPlacesEditor').value = document.getElementById('_selectPlacesUserID').selectedOptions[0].innerHTML;
  10786. }
  10787. }
  10788. function uroHidePlacesEditorSelected()
  10789. {
  10790. let selector = document.getElementById('_selectHidePlacesUserID');
  10791. if(selector.selectedIndex > 0)
  10792. {
  10793. document.getElementById('_textHidePlacesEditor').value = document.getElementById('_selectHidePlacesUserID').selectedOptions[0].innerHTML;
  10794. }
  10795. }
  10796. function uroCamEditorSelected()
  10797. {
  10798. let selector = document.getElementById('_selectCameraUserID');
  10799. if(selector.selectedIndex > 0)
  10800. {
  10801. document.getElementById('_textCameraEditor').value = document.getElementById('_selectCameraUserID').selectedOptions[0].innerHTML;
  10802. }
  10803. }
  10804. function uroSetStyles(obj)
  10805. {
  10806. obj.style.fontSize = '12px';
  10807. obj.style.lineHeight = '100%';
  10808. obj.style.flex = '1';
  10809. obj.style.overflowY = 'auto';
  10810. }
  10811. function uroSetSectionTabStyles()
  10812. {
  10813. for(let i =0; i < uroTabs.CtrlTabs.length; ++i)
  10814. {
  10815. uroSetStyles(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY]);
  10816. }
  10817. }
  10818. function uroPlacesGroupCEHandler(groupidx)
  10819. {
  10820. if(uroPlacesGroupsCollapsed[groupidx] === false)
  10821. {
  10822. document.getElementById('_uroPlacesGroup-'+groupidx).style.display = "block";
  10823. document.getElementById('_uroPlacesGroupState-'+groupidx).className = "fa fa-minus-square-o";
  10824. }
  10825. else
  10826. {
  10827. document.getElementById('_uroPlacesGroup-'+groupidx).style.display = "none";
  10828. document.getElementById('_uroPlacesGroupState-'+groupidx).className = "fa fa-plus-square-o";
  10829. }
  10830. }
  10831. function uroPlacesGroupCollapseExpand()
  10832. {
  10833. let groupidx = this.id.substr(21);
  10834. if(uroPlacesGroupsCollapsed[groupidx] === true) uroPlacesGroupsCollapsed[groupidx] = false;
  10835. else uroPlacesGroupsCollapsed[groupidx] = true;
  10836. uroPlacesGroupCEHandler(groupidx);
  10837. return false;
  10838. }
  10839. function uroGetMarkerIDs(markerType)
  10840. {
  10841. let idList = [];
  10842.  
  10843. if(uroLayers.layers[markerType].mf !== null)
  10844. {
  10845. for(let i = 0; i < uroLayers.layers[markerType].mf.length; ++i)
  10846. {
  10847. let dID = uroLayers.layers[markerType].mf[i]?.element?.attributes['data-id']?.value;
  10848. if(dID === undefined)
  10849. {
  10850. dID = uroLayers.layers[markerType].mf[i]?.attributes?.wazeFeature?.id;
  10851. }
  10852. if(dID !== undefined)
  10853. {
  10854. idList.push(dID);
  10855. }
  10856. }
  10857. }
  10858. return idList;
  10859. }
  10860. function uroGetAttributes(markerType, markerID)
  10861. {
  10862. if(markerType == uroLayers.ID.UR) return W.model.mapUpdateRequests.objects[markerID].attributes;
  10863. if(markerType == uroLayers.ID.MP) return W.model.mapProblems.objects[markerID].attributes;
  10864. return null;
  10865. }
  10866. function uroGetMarker(markerType, markerID)
  10867. {
  10868. if(typeof(markerID) === 'number')
  10869. {
  10870. markerID = markerID.toString();
  10871. }
  10872.  
  10873. let retval = null;
  10874.  
  10875. if(markerID !== null)
  10876. {
  10877. let mObj = null;
  10878. if(markerType === uroLayers.ID.UR)
  10879. {
  10880. mObj = W.model.mapUpdateRequests.getObjectById(markerID);
  10881. }
  10882. else if(markerType === uroLayers.ID.MP)
  10883. {
  10884. mObj = W.model.mapProblems.getObjectById(markerID);
  10885. }
  10886. else if(markerType === uroLayers.ID.RTC)
  10887. {
  10888. mObj = W.model.roadClosures.getObjectById(markerID);
  10889. }
  10890.  
  10891. if(mObj !== null)
  10892. {
  10893. retval = W.userscripts.getMapElementByDataModel(mObj);
  10894. }
  10895. else
  10896. {
  10897. for(let i = 0; i < uroLayers.layers[markerType].mf.length; ++i)
  10898. {
  10899. if(uroLayers.layers[markerType].mf[i]?.attributes?.wazeFeature?.id === markerID)
  10900. {
  10901. let geoID = uroLayers.layers[markerType].mf[i].geometry.id;
  10902. retval = document.getElementById(geoID);
  10903. break;
  10904. }
  10905. }
  10906. }
  10907. }
  10908. return retval;
  10909. }
  10910.  
  10911. uroInit.Initialise();