WME Fix UI

Allows alterations to the WME UI to fix things screwed up or ignored by Waze

当前为 2018-05-28 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name WME Fix UI
  3. // @namespace https://greasyfork.org/en/users/46070
  4. // @description Allows alterations to the WME UI to fix things screwed up or ignored by Waze
  5. // @include https://www.waze.com/editor*
  6. // @include https://www.waze.com/*/editor*
  7. // @include https://beta.waze.com/editor*
  8. // @include https://beta.waze.com/*/editor*
  9. // @exclude https://www.waze.com/*user/editor/*
  10. // @supportURL https://www.waze.com/forum/viewtopic.php?f=819&t=191178
  11. // @version 2.22
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15. // Thanks to (in no particular order)
  16. // Bellhouse, Twister-UK, Timbones, Dave2084, Rickzabel, Glodenox,
  17. // JJohnston84, SAR85, Cardyin, JustinS83, berestovskyy
  18.  
  19. (function()
  20. {
  21. // global variables
  22. var wmefu_version = "2.22";
  23. var oldVersion;
  24. var prefix = "WMEFU";
  25. var tabAttempts = 0;
  26. var wmeFUAddon;
  27. var debug = false;
  28. var wmeFUinitialising = true;
  29. var URLSegments, SMSegments, PLCheckTimer;
  30. var newZoom;
  31. var kineticDragParams;
  32. var yslider;
  33. //Mutation Observer to re-hack buttons
  34. var buttonObserver = new MutationObserver(function(mutations) {
  35. mutations.forEach(function(mutation) {
  36. if ($(mutation.target).hasClass('waze-icon-reload')){
  37. $('.waze-icon-reload').removeClass('reload');
  38. $('.waze-icon-reload span').addClass('fa fa-refresh fa-lg');
  39. if ($('.waze-icon-reload span')[0]) {
  40. $('.waze-icon-reload span')[0].innerHTML = "";
  41. }
  42. }
  43. else if ($(mutation.target).hasClass('waze-icon-undo')){
  44. $('.waze-icon-undo').removeClass('undo');
  45. $('.waze-icon-undo span').addClass('fa fa-undo fa-lg');
  46. $('.waze-icon-undo span')[0].innerHTML = "";
  47. }
  48. else if ($(mutation.target).hasClass('waze-icon-redo')){
  49. $('.waze-icon-redo').removeClass('redo');
  50. $('.waze-icon-redo span').addClass('fa fa-repeat fa-lg');
  51. $('.waze-icon-redo span')[0].innerHTML = "";
  52. }
  53. else if ($(mutation.target).is('#wecm-count')){
  54. $('#wecm-count')[0].parentElement.style.marginTop = ['11px','5px','-1px'][_inpUICompression.value];
  55. }
  56. });
  57. });
  58. //for daterangepicker in Restrictions
  59. var RestrictionObserver = new MutationObserver(function(mutations) {
  60. if (_cbMondayFirst.checked || _cbISODates.checked) {
  61. mutations.forEach(function(mutation) {
  62. if ($(mutation.target).hasClass('modal-content')) {
  63. if (mutation.addedNodes.length > 0) {
  64. if ($(".datepicker").length > 0) {
  65. var DRP = $(".datepicker")[0];
  66. if (_cbMondayFirst.checked && _cbISODates.checked) {
  67. $(DRP).data("daterangepicker").locale.firstDay = 1;
  68. $(DRP).data("daterangepicker").locale.daysOfWeek = ['Mo','Tu','We','Th','Fr','Sa','Su'];
  69. $(DRP).data("daterangepicker").locale.format = "YYYY-MM-DD";
  70. DRP.value = $(DRP).data("daterangepicker").startDate._i + " - " + $(DRP).data("daterangepicker").endDate._i;
  71. } else if (_cbMondayFirst.checked) {
  72. $(DRP).data("daterangepicker").locale.firstDay = 1;
  73. $(DRP).data("daterangepicker").locale.daysOfWeek = ['Mo','Tu','We','Th','Fr','Sa','Su'];
  74. } else if (_cbISODates.checked) {
  75. $(DRP).data("daterangepicker").locale.format = "YYYY-MM-DD";
  76. DRP.value = $(DRP).data("daterangepicker").startDate._i + " - " + $(DRP).data("daterangepicker").endDate._i;
  77. }
  78. }
  79. }
  80. }
  81. });
  82. }
  83. });
  84. //for daterangepicker in Closures
  85. var ClosureObserver = new MutationObserver(function(mutations) {
  86. if (_cbMondayFirst.checked) {
  87. mutations.forEach(function(mutation) {
  88. if (mutation.target.className == "main") {
  89. if (mutation.addedNodes.length > 0) {
  90. if (mutation.addedNodes[0].firstChild.classList.contains("edit-closure")) {
  91. $(".end-date").data("daterangepicker").locale.firstDay = 1;
  92. $(".end-date").data("daterangepicker").locale.daysOfWeek = ['Mo','Tu','We','Th','Fr','Sa','Su'];
  93. $(".start-date").data("daterangepicker").locale.firstDay = 1;
  94. $(".start-date").data("daterangepicker").locale.daysOfWeek = ['Mo','Tu','We','Th','Fr','Sa','Su'];
  95. }
  96. }
  97. }
  98. });
  99. }
  100. });
  101. //Fix for date/time formats in WME released Oct/Nov 2016 - provided by Glodenox
  102. I18n.translations[I18n.currentLocale()].time = {};
  103. I18n.translations[I18n.currentLocale()].time.formats = {};
  104. I18n.translations[I18n.currentLocale()].time.formats.long = "%a %b %d %Y, %H:%M";
  105. I18n.translations[I18n.currentLocale()].date.formats = {};
  106. I18n.translations[I18n.currentLocale()].date.formats.long = "%a %b %d %Y, %H:%M";
  107. I18n.translations[I18n.currentLocale()].date.formats.default = "%a %b %d %Y";
  108. if (I18n.currentLocale() == 'en-GB') {
  109. I18n.translations['en-GB'].update_requests.panel.reported = 'Reported on: %{date}';
  110. }
  111. // Set the "Chat is here!" message to be hidden
  112. if (localStorage.hiddenMessages) {
  113. var hm = JSON.parse(localStorage.hiddenMessages);
  114. if (hm.chat_intro_tip === false) {
  115. logit("Hiding Chat is Here! message","info");
  116. hm.chat_intro_tip = true;
  117. localStorage.setItem('hiddenMessages', JSON.stringify(hm));
  118. }
  119. }
  120.  
  121. function init1() {
  122. console.group(prefix + ": initialising...");
  123. console.time(prefix + ": initialisation time");
  124. logit("Starting init1","debug");
  125. // go round again if map container isn't there yet
  126. if(!window.W.map) {
  127. logit("waiting for WME...","warning");
  128. setTimeout(init1, 200);
  129. return;
  130. }
  131. // Set flags for changing items in WME by checking the existence of elements
  132. newZoom = ((document.getElementById("overlay-buttons") === null) ? false : true);
  133. // create tab content and store it
  134. wmeFUAddon = createAddon();
  135. // insert the content as a tab
  136. addMyTab(null,0);
  137. //pass control to init2
  138. init2();
  139. }
  140.  
  141. function init2() {
  142. logit("Starting init2","debug");
  143. //go round again if my tab isn't there yet
  144. if (!getId('sidepanel-FixUI')) {
  145. logit("Waiting for my tab to appear...","warning");
  146. setTimeout(init2, 200);
  147. return;
  148. }
  149. // setup event handlers for my controls:
  150. getId('_cbMoveZoomBar').onclick = createZoomBar;
  151. getId('_cbHideUserInfo').onclick = hideUserInfo;
  152. getId('_cbFixExternalProviders').onclick = fixExternalProviders;
  153. getId('_cbMoveChatIcon').onclick = moveChatIcon;
  154. getId('_cbHighlightInvisible').onclick = highlightInvisible;
  155. getId('_cbDarkenSaveLayer').onclick = darkenSaveLayer;
  156. getId('_cbSwapRoadsGPS').onclick = swapRoadsGPS;
  157. getId('_cbUndarkenAerials').onclick = undarkenAerials;
  158. getId('_cbShowMapBlockers').onclick = showMapBlockers;
  159. getId('_cbHideLinks').onclick = hideLinks;
  160. getId('_cbShrinkTopBars').onclick = shrinkTopBars;
  161. getId('_cbCompressSegmentTab').onclick = compressSegmentTab;
  162. getId('_cbCompressLayersMenu').onclick = compressLayersMenu;
  163. getId('_cbLayersColumns').onclick = compressLayersMenu;
  164. getId('_cbRestyleReports').onclick = restyleReports;
  165. getId('_cbEnhanceChat').onclick = enhanceChat;
  166. getId('_cbNarrowSidePanel').onclick = narrowSidePanel;
  167. getId("_inpUICompression").onchange = applyEnhancements;
  168. getId("_inpUIContrast").onchange = applyEnhancements;
  169. getId("_inpASX").onchange = shiftAerials;
  170. getId("_inpASX").onwheel = shiftAerials;
  171. getId("_inpASY").onchange = shiftAerials;
  172. getId("_inpASY").onwheel = shiftAerials;
  173. getId("_inpASO").onchange = shiftAerials;
  174. getId("_inpASO").onwheel = shiftAerials;
  175. getId("_resetAS").onclick = function() {
  176. getId("_inpASX").value = 0;
  177. getId("_inpASY").value = 0;
  178. shiftAerials();
  179. };
  180. getId("_inpGSVContrast").onchange = adjustGSV;
  181. getId("_inpGSVBrightness").onchange = adjustGSV;
  182. getId("_cbGSVInvert").onchange = adjustGSV;
  183. getId("_cbFixBridgeButton").onchange = fixBridgeButton;
  184. getId("_cbDisableBridgeButton").onchange = disableBridgeButton;
  185. getId("_btnKillNode").onclick = killNode;
  186. getId("_cbDisableKinetic").onclick = disableKinetic;
  187. getId("_cbDisableScrollZoom").onclick = disableScrollZoom;
  188.  
  189. //REGISTER WAZE EVENT HOOKS
  190. // event to recreate my tab when MTE mode is exited
  191. W.app.modeController.model.bind('change:mode', addMyTab);
  192. // event to recreate my tab after changing WME units
  193. W.prefs.on('change:isImperial', function() {
  194. tabAttempts = 0;
  195. tabsLooper();
  196. });
  197. // events for Aerial Shifter
  198. W.map.events.register("zoomend", null, shiftAerials);
  199. W.map.events.register("moveend", null, shiftAerials);
  200. W.map.baseLayer.events.register("loadend", null, shiftAerials);
  201. // events to change menu bar color based on map comments checkbox
  202. W.map.events.register("zoomend", null, warnCommentsOff);
  203. W.map.events.register("moveend", null, warnCommentsOff);
  204. // event to re-hack my zoom bar if it's there
  205. W.map.baseLayer.events.register("loadend", null, ZLI);
  206. //window resize event to resize chat
  207. window.addEventListener('resize', enhanceChat, true);
  208. //window resize event to resize layers menu
  209. window.addEventListener('resize', compressLayersMenu, true);
  210. //event to re-hack toolbar buttons when exitine HN mode
  211. W.editingMediator.on('change:editingHouseNumbers', function() {
  212. if (W.editingMediator.attributes.editingHouseNumbers === false) {
  213. setTimeout(hackToolbarButtons,5000);
  214. }
  215. });
  216. //create Aerial Shifter warning div
  217. ASwarning = document.createElement('div');
  218. ASwarning.id = "WMEFU_AS";
  219. ASwarning.style.top = "20px";
  220. ASwarning.style.left = "0px";
  221. ASwarning.style.width = "100%";
  222. ASwarning.style.position = "absolute";
  223. ASwarning.style.zIndex = "10000";
  224. ASwarning.style.fontSize = "100px";
  225. ASwarning.style.fontWeight = "900";
  226. ASwarning.style.color = "rgba(255,255,0,0.4)";
  227. ASwarning.style.textAlign = "center";
  228. ASwarning.style.pointerEvents = "none";
  229. ASwarning.style.display = "none";
  230. ASwarning.innerHTML = "Aerials Shifted";
  231. getId("WazeMap").appendChild(ASwarning);
  232.  
  233. loadSettings();
  234. // Add an extra checkbox so I can test segment panel changes easily
  235. if (W.loginManager.user.userName == 'iainhouse') {
  236. logit("creating segment detail debug checkbox","info");
  237. var extraCBSection = document.createElement('p');
  238. extraCBSection.innerHTML = '<input type="checkbox" id="_cbextraCBSection" />';
  239. getId('brand').appendChild(extraCBSection);
  240. getId('_cbextraCBSection').onclick = FALSEcompressSegmentTab;
  241. getId('_cbextraCBSection').checked = getId('_cbCompressSegmentTab').checked;
  242. //completely disable save overlay: experimental feature
  243. addGlobalStyle('#popup-overlay { display: none !important; }');
  244. }
  245. //create Panel Swap div
  246. var WMEPS_div = document.createElement('div');
  247. WMEPS_div.id = "WMEFUPS";
  248. WMEPS_div.style.margin = "0 10px";
  249. WMEPS_div.style.fontSize = "20px";
  250. WMEPS_div.style.color = "lightgrey";
  251. WMEPS_div.title = "Panel Swap: when map elements are selected, this lets you\n" +
  252. "swap between the edit panel and the other tabs.";
  253. WMEPS_div.classList.add("fa");
  254. WMEPS_div.classList.add("fa-sticky-note");
  255. getId('brand').appendChild(WMEPS_div);
  256. // overload the window unload function to save my settings
  257. window.addEventListener("beforeunload", saveSettings, false);
  258. if (!W.selectionManager.getSelectedFeatures) {
  259. W.selectionManager.getSelectedFeatures = W.selectionManager.getSelectedItems;
  260. }
  261. getId("WMEFUPS").onclick = PSclicked;
  262. W.selectionManager.events.register("selectionchanged", null, PSicon);
  263. // warn of permalink segments not all selected
  264. if (getId("_cbPermalinkChecker").checked) {
  265. URLSegments = window.location.search.match(new RegExp("[?&]segments?=([^&]*)"));
  266. if (URLSegments) {
  267. //Call the check if nothing gets selected after 10 seconds
  268. PLCheckTimer = setTimeout(permalinkCheck, 10000);
  269. //Call the check when something is selected. This will either be triggerd by WME loading or
  270. //if nothing gets selected on load, by the user selecting something
  271. W.selectionManager.events.register("selectionchanged", null, permalinkCheck);
  272. URLSegments = URLSegments[1].split(',');
  273. }
  274. }
  275. // Alert to new version
  276. if (oldVersion != wmefu_version) {
  277. alert("WME Fix UI has been updated to version " + wmefu_version + "\n" +
  278. ChromeWarning() +
  279. "\n" +
  280. "Version 2.22 - 2018-05-28\n" +
  281. "* New Feature: Integration of WME Panel Swap\n" +
  282. "* Improved Permalink Checker\n" +
  283. "\n" +
  284. "Previous V2 highlights:\n" +
  285. "* 2.20 New Feature: Warning for shifted aerials\n" +
  286. "* 2.20 New Feature: Disable scroll-to-zoom\n" +
  287. "* 2.18 New Feature: Create Zoom bar from scratch\n" +
  288. "* 2.18 New Feature: Disable Kinetic Panning\n" +
  289. "* 2.16 New Feature: Temporarily hide junction nodes\n" +
  290. "* 2.14 New Feature: Fix/disable Bridge button\n" +
  291. "* 2.14 New Feature: Start calendars on Monday\n" +
  292. "* 2.14 New Feature: ISO dates in Restrictions dialogue\n" +
  293. "* 2.13 New feature: Highlight Invisible mode\n" +
  294. "* 2.11 New feature: Show map-blocking WME bugs\n" +
  295. "* 2.10 New features: Enhanced Feed refresh\n" +
  296. "* 2.9 New feature: Fix GSV marker position\n" +
  297. "* 2.8 New feature: Un-darken map layer\n" +
  298. "* 2.7 New feature: Move GPS layer below segments\n" +
  299. "* 2.6 New feature: Enhance Chat panel\n" +
  300. "* 2.4 Recovery from unit change & house number mode implemented\n" +
  301. "* 2.3 The zoom bar is back, with permanent level indicator\n" +
  302. "* 2.2 New feature: Darken screen overlay when saving\n" +
  303. "* 2.0 New operation with variable & independent compression/contrast control\n" +
  304. "ALL FUNCTIONS NOW RE-WRITTEN FOR WME v2\n" +
  305. "");
  306. saveSettings();
  307. }
  308.  
  309. // fix for sidebar display problem in Safari, requested by edsonajj
  310. var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
  311. if (isSafari) {
  312. addGlobalStyle('.flex-parent { height: 99% !important; }');
  313. }
  314. // apply the settings
  315. shiftAerials();
  316. setTimeout(applyAllSettings, 1000);
  317. logit("Initialisation complete");
  318. console.timeEnd(prefix + ": initialisation time");
  319. console.groupEnd();
  320. }
  321.  
  322. function createAddon() {
  323. //create the contents of my side-panel tab
  324. var addon = document.createElement('section');
  325. var section = document.createElement('p');
  326. addon.id = "sidepanel-FixUI";
  327. section.style.paddingTop = "4px";
  328. section.style.lineHeight = "11px";
  329. section.style.fontSize = "11px";
  330. section.id = "fuContent";
  331. section.innerHTML = "";
  332. section.innerHTML += '<b title="Shift aerial images layer to match GPS tracks and reduce image opacity">Aerial Shifter</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
  333. section.innerHTML += '<span class="fa fa-power-off" id="_resetAS" title="Clear X/Y offsets"></span><br>';
  334. section.innerHTML += '<div style="display:inline-block"><input type="number" id="_inpASX" title="horizontal shift" max=100 min=-100 step=5 style="height:20px; width:47px;text-align:right;"/><b>m</b><span class="fa fa-arrow-right"></span></div>';
  335. section.innerHTML += '<div id="as2" style="display:inline-block;padding:0 5px;"><input type="number" id="_inpASY" title="vertical shift" max=100 min=-100 step=5 style="height:20px; width:47px;text-align:right;"/><b>m</b><span class="fa fa-arrow-up"></span></div>';
  336. section.innerHTML += '<div id="as3" style="display:inline-block"><input type="number" id="_inpASO" title="opacity" max=100 min=0 step=10 style="height:20px; width:44px;text-align:right;"/><b>%</b><span class="fa fa-adjust"></span></div>';
  337. section.innerHTML += '<br>';
  338. section.innerHTML += '<br>';
  339.  
  340. section.innerHTML += '<b title="Adjust contrast & brightness for Google Street View images">GSV image adjust</b><br>';
  341. section.innerHTML += '<span title="Contrast"><input type="number" id="_inpGSVContrast" max=200 min=0 step=25 style="height:20px; width:47px;text-align:right;"/><b>%</b><span class="fa fa-adjust"></span></span>&nbsp;&nbsp;';
  342. section.innerHTML += '<span title="Brightness"><input type="number" id="_inpGSVBrightness" max=200 min=0 step=25 style="height:20px; width:47px;text-align:right;"/><b>%</b><span class="fa fa-sun-o"></span></span>&nbsp;&nbsp;&nbsp;';
  343. section.innerHTML += '<span title="Invert colours"><input type="checkbox" id="_cbGSVInvert"/><span class="fa fa-tint"></span></span>';
  344. section.innerHTML += '<br>';
  345. section.innerHTML += '<br>';
  346. section.innerHTML += '<b>UI Enhancements</b><br>';
  347. section.innerHTML += '<input type="checkbox" id="_cbShrinkTopBars" /> ' +
  348. '<span title="Because we can\'t afford to waste screen space, particularly on\nstuff we didn\'t ask for and don\'t want, like the black bar.\nAnd why does the reload button have a re-do icon?!">Compress/enhance bars above the map</span><br>';
  349. section.innerHTML += '<input type="checkbox" id="_cbCompressSegmentTab" /> ' +
  350. '<span title="Because I\'m sick of having to scroll the side panel because of oversized fonts and wasted space">Compress/enhance side panel contents</span><br>';
  351. section.innerHTML += '<input type="checkbox" id="_cbCompressLayersMenu" /> ' +
  352. '<span title="Because it\'s already too big for small screens and Waze only plan to make it bigger">Compress/enhance layers menu</span><br>';
  353. section.innerHTML += '<span id="layersColControls"><input type="checkbox" id="_cbLayersColumns" /> ' +
  354. '<span title="Widen the layers menu to 2 columns - particulary for netbook users\nWon\'t work without some compression turned on">Two-column layers menu</span><br></span>';
  355. section.innerHTML += '<input type="checkbox" id="_cbRestyleReports" /> ' +
  356. '<span title="Another UI element configured for developers with massive screens instead of normal users">Compress/enhance report panels (UR/MP)</span><br>';
  357. section.innerHTML += '<input type="checkbox" id="_cbEnhanceChat" /> ' +
  358. '<span title="A perfect example of the new WME UI. Looks very stylish,\nbut destroys usability and utterly ignores small-screen users.">Compress/enhance Chat panel</span><br>';
  359. section.innerHTML += '<input type="checkbox" id="_cbNarrowSidePanel" /> ' +
  360. '<span title="If you have a netbook, Waze isn\'t interested in your experience.\nYou need every bit of map space you can get - so have a present from me!">Reduce width of the side panel</span><span title="This will definitely interfere with scripts that rely on a fixed width for their tab contents." style="font-size: 16px; color: red;">&#9888</span><br>';
  361. section.innerHTML += '<br>';
  362. section.innerHTML += '<b title="Control the amount of compression/enhancment">UI Enhancement controls<br>';
  363. section.innerHTML += '<div style="display:inline-block"><select id="_inpUICompression" title="Compression enhancement" style="height:20px; padding:0px; border-radius=0px;"><option value="2">High</option><option value="1">Low</option><option value="0">None</option></select><span class="fa fa-compress"></span></div>&nbsp;&nbsp;&nbsp;&nbsp;';
  364. section.innerHTML += '<div style="display:inline-block"><select id="_inpUIContrast" title="Contrast enhancement" style="height:20px; padding:0px; border-radius=0px;"><option value="2">High</option><option value="1">Low</option><option value="0">None</option></select><span class="fa fa-adjust"></span></div>';
  365. section.innerHTML += '<br>';
  366. section.innerHTML += '<button id="_btnKillNode" style = "height: 18px; margin-top: 5px;" title="Hide the junction nodes layer to allow access to Map Comments hidden under nodes.\nThis stays in effect until the page is zoomed/panned/refreshed.">Hide junction nodes</button> <span style = "color: red; font-weight: bold;">--- NEW</span></br>';
  367. section.innerHTML += '<br>';
  368. section.innerHTML += '<b>UI Fixes/changes</b><br>';
  369. section.innerHTML += '<input type="checkbox" id="_cbMoveZoomBar" /> ' +
  370. '<span title="Because nobody likes a pointless UI change that breaks your workflow,\nimposed by idiots who rarely use the editor and don\'t listen to feedback.\nNO MATTER HOW HARD THEY TRY, I WILL BRING IT BACK!">Create zoom bar & move map controls <span style = "color: red; font-weight: bold;">--- NEW (& old!)</span></span><br>';
  371. section.innerHTML += '<input type="checkbox" id="_cbHideUserInfo" /> ' +
  372. '<span title="Because we can earn points quicker without a massive chunk of space\nwasted on telling us how many we earnt up to yesterday">Hide user info in the side panel</span><br>';
  373. section.innerHTML += '<input type="checkbox" id="_cbFixExternalProviders" /> ' +
  374. '<span title="The External Providers interface has a dexcription box that will only show one live of text.\nThis fixes that.">Expand External Provider details for places</span><br>';
  375. section.innerHTML += '<input type="checkbox" id="_cbPermalinkChecker" /> ' +
  376. '<span title="If a permalink is created with off-screen segments or segment IDs have been changed,\nWME may open with fewer segments selected than are included in the permalink.\nThis causes a pop-up warning when that happens.">Warn on invalid permalinks</span><br>';
  377. section.innerHTML += '<input type="checkbox" id="_cbMoveChatIcon" /> ' +
  378. '<span title="Here\'s a truly outstanding example of making a stupid change to the UI in order to\ndeal with another stupid change to the UI!\nBecause HQ couldn\'t make the new layers menu auto-hide, they moved the chat icon.\nTick this box to put it back where it belongs.">Move Chat icon back to right</span><br>';
  379. section.innerHTML += '<input type="checkbox" id="_cbHighlightInvisible" /> ' +
  380. '<span title="Typical WME design - the chat icon changes when you\'re invisible,\nbut the change is practically invisible!\nThis option provides a more obvious highlight.">Highlight invisible mode</span></span><br>';
  381. section.innerHTML += '<input type="checkbox" id="_cbLayersMenuMoreOptions" /> ' +
  382. '<span title="As requested by users, this option turns on the More Options in the Layers menu.\nNote that this option only has an effect when the page is loaded. You can still toggle as normal.">Turn on More Options in Layers menu</span><br>';
  383. section.innerHTML += '<input type="checkbox" id="_cbDarkenSaveLayer" /> ' +
  384. '<span title="It\'s not bad enough they\'ve removed all the contrast to give you eyestrain,\nbut then they blind you every time you save. ">Darken screen overlay when saving</span><br>';
  385. section.innerHTML += '<input type="checkbox" id="_cbSwapRoadsGPS" /> ' +
  386. '<span title="Guess what? Waze thinks the GPS layer should now be over the segments layer.\nWhy should you have any choice about that?">Move GPS layer below segments layer</span><br>';
  387. section.innerHTML += '<input type="checkbox" id="_cbUndarkenAerials" /> ' +
  388. '<span title="A new contribution from WME V2 to your eyestrain. Sometimes the aerial images\nare too dark - so WME makes them darker! This kills that behaviour.">Un-darken aerial images</span><br>';
  389. section.innerHTML += '<input type="checkbox" id="_cbShowMapBlockers" /> ' +
  390. '<span title="Some WME elements block access to the map layers. These problems have been reported as bugs.\nUntil they\'re fixed, this functions makes them visible.">Show map-blocking WME bugs</span></span><br>';
  391. section.innerHTML += '<input type="checkbox" id="_cbHideLinks" /> ' +
  392. '<span title="Hide the small Links bar at the bottom of the side panel,\nto give more usable space there.">Hide Links panel</span><br>';
  393. section.innerHTML += '<input type="checkbox" id="_cbFixBridgeButton" />Fix ' +
  394. '<input type="checkbox" id="_cbDisableBridgeButton" />' +
  395. '<span title="The Bridge button is rarely useful, but often used incorrectly. It also ovelaps\nthe junction node, so it\'s often clicked by accident.\nFixing it moves it off the junction node. Disabling it makes even more sense.">Disable Bridge button</span><br>';
  396. section.innerHTML += '<input type="checkbox" id="_cbMondayFirst" /> ' +
  397. '<span title="Requests to have calendar items localised with Monday as the first day of the week\ngo back a while. Now you don\'t have to wait for Waze.">Start calendars on Monday</span><br>';
  398. section.innerHTML += '<input type="checkbox" id="_cbISODates" /> ' +
  399. '<span title="Dates in the Restrictions dialogues are all in American format - MM/DD/YY\nFine if you\' American, confusing as hell for the rest of us!\nThis changes the dates to ISO format, matching the Closures dialogue">ISO dates in Restrictions</span><br>';
  400. section.innerHTML += '<input type="checkbox" id="_cbDisableKinetic" /> ' +
  401. '<span title="Kinetic panning is a new WME feature: if you release the mouse whilst dragging the map,\nthe map will keep moving. It can be very useful for panning large distances.\nIt can also be very annoying. Now YOU have control.">Disable Kinetic Panning <span style = "color: red; font-weight: bold;">--- NEW</span></span><br>';
  402. section.innerHTML += '<input type="checkbox" id="_cbDisableScrollZoom" /> ' +
  403. '<span title="Zooming with the scroll wheel can be problematic when using an Apple Magic Mouse, which\nscrolls on touch. This will disable scroll-to-zoom.">Disable scroll-to-zoom <span style = "color: red; font-weight: bold;">--- NEW</span></span><br>';
  404. section.innerHTML += '<br>';
  405. section.innerHTML += '<b><a href="https://www.waze.com/forum/viewtopic.php?f=819&t=191178" title="Forum topic" target="_blank"><u>' +
  406. 'WME Fix UI</u></a></b> &nbsp; v' + wmefu_version;
  407. addon.appendChild(section);
  408. addon.className = "tab-pane";
  409. return addon;
  410. }
  411.  
  412. function addMyTab(model,modeID) {
  413. if (modeID === 0) {
  414. logit("entering default mode, so creating tab");
  415. tabAttempts = 0;
  416. tabsLooper();
  417. } else {
  418. logit("entering event mode, so not initialising");
  419. return;
  420. }
  421. }
  422.  
  423. function tabsLooper() {
  424. tabAttempts += 1;
  425. if (tabAttempts > 20) {
  426. // tried 20 times to create tab without luck
  427. logit("unable to create my tab after 20 attempts","error");
  428. return;
  429. }
  430. var userTabs = getId('user-info');
  431. var navTabs = getElementsByClassName('nav-tabs', userTabs)[0];
  432. if (typeof navTabs === "undefined") {
  433. //the basic tabs aren't there yet, so I can't add mine
  434. logit("waiting for NavTabs","warning");
  435. setTimeout(tabsLooper, 200);
  436. } else{
  437. var tabContent = getElementsByClassName('tab-content', userTabs)[0];
  438. newtab = document.createElement('li');
  439. newtab.innerHTML = '<a href="#sidepanel-FixUI" data-toggle="tab" title="Fix UI">FU</a>';
  440. navTabs.appendChild(newtab);
  441. tabContent.appendChild(wmeFUAddon);
  442. if (_cbShrinkTopBars.checked === true) {
  443. hackToolbarButtons();
  444. }
  445. }
  446. }
  447.  
  448. function loadSettings() {
  449. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  450. logit("function " + fname + " called", "debug");
  451. // Convert old version of settings to new version
  452. var options;
  453. if (localStorage.WMEFixUI) {
  454. var oldSettings = JSON.parse(localStorage.WMEFixUI);
  455. var newSettings = {};
  456. newSettings.oldVersion = (oldSettings[0] ? oldSettings[0] : "1.0" );
  457. newSettings.moveZoomBar = (oldSettings[1] ? oldSettings[1] : true );
  458. newSettings.shrinkTopBars = (oldSettings[2] ? oldSettings[2] : true );
  459. newSettings.hideUserInfo = (oldSettings[3] ? oldSettings[3] : true );
  460. newSettings.restyleSidePanel = (oldSettings[4] ? oldSettings[4] : true );
  461. newSettings.restyleReports = (oldSettings[5] ? oldSettings[5] : true );
  462. newSettings.narrowSidePanel = (oldSettings[7] ? oldSettings[7] : false );
  463. newSettings.aerialShiftX = (oldSettings[10] ? oldSettings[10] : 0 );
  464. newSettings.aerialShiftY = (oldSettings[11] ? oldSettings[11] : 0 );
  465. newSettings.aerialOpacity = (oldSettings[12] ? oldSettings[12] : 100 );
  466. newSettings.fixExternalProviders = (oldSettings[13] ? oldSettings[13] : true );
  467. newSettings.GSVContrast = (oldSettings[14] ? oldSettings[14] : 100 );
  468. newSettings.GSVBrightness = (oldSettings[15] ? oldSettings[15] : 100 );
  469. newSettings.GSVInvert = (oldSettings[16] ? oldSettings[16] : false );
  470. newSettings.permalinkChecker = (oldSettings[18] ? oldSettings[18] : true );
  471. newSettings.restyleLayersMenu = (oldSettings[19] ? oldSettings[19] : true );
  472. newSettings.moveChatIcon = (oldSettings[20] ? oldSettings[20] : true );
  473. // setting[21] was Menu Autohide - no longer needed
  474. newSettings.layersMenuMore = (oldSettings[22] ? oldSettings[22] : true );
  475. localStorage.WMEFUSettings = JSON.stringify(newSettings);
  476. localStorage.removeItem("WMEFixUI");
  477. }
  478.  
  479. if (localStorage.WMEFUSettings) {
  480. options = JSON.parse(localStorage.WMEFUSettings);
  481. } else {
  482. options = {};
  483. }
  484. oldVersion = (options.oldVersion !== undefined ? options.oldVersion : "0.0");
  485. getId('_cbMoveZoomBar').checked = (options.moveZoomBar !== undefined ? options.moveZoomBar : true);
  486. getId('_cbShrinkTopBars').checked = (options.shrinkTopBars !== undefined ? options.shrinkTopBars : true);
  487. getId('_cbHideUserInfo').checked = ( options.hideUserInfo !== undefined ? options.hideUserInfo : true);
  488. getId('_cbCompressSegmentTab').checked = ( options.restyleSidePanel !== undefined ? options.restyleSidePanel : true);
  489. getId('_cbRestyleReports').checked = ( options.restyleReports !== undefined ? options.restyleReports : true);
  490. getId('_cbEnhanceChat').checked = ( options.enhanceChat !== undefined ? options.enhanceChat : true);
  491. getId('_cbNarrowSidePanel').checked = ( options.narrowSidePanel !== undefined ? options.narrowSidePanel : false);
  492. getId('_inpASX').value = ( options.aerialShiftX !== undefined ? options.aerialShiftX : 0);
  493. getId('_inpASY').value = ( options.aerialShiftY !== undefined ? options.aerialShiftY : 0);
  494. getId('_inpASO').value = ( options.aerialOpacity !== undefined ? options.aerialOpacity : 100);
  495. getId('_cbFixExternalProviders').checked = ( options.fixExternalProviders !== undefined ? options.fixExternalProviders : true);
  496. getId('_inpGSVContrast').value = ( options.GSVContrast !== undefined ? options.GSVContrast : 100);
  497. getId('_inpGSVBrightness').value = ( options.GSVBrightness !== undefined ? options.GSVBrightness : 100);
  498. getId('_cbGSVInvert').checked = ( options.GSVInvert !== undefined ? options.GSVInvert : false);
  499. getId('_cbPermalinkChecker').checked = ( options.permalinkChecker !== undefined ? options.permalinkChecker : true);
  500. getId('_cbCompressLayersMenu').checked = ( options.restyleLayersMenu !== undefined ? options.restyleLayersMenu : true);
  501. getId('_cbLayersColumns').checked = ( options.layers2Cols !== undefined ? options.layers2Cols : false);
  502. getId('_cbMoveChatIcon').checked = ( options.moveChatIcon !== undefined ? options.moveChatIcon : true);
  503. getId('_cbHighlightInvisible').checked = ( options.highlightInvisible !== undefined ? options.highlightInvisible : true);
  504. getId('_cbDarkenSaveLayer').checked = ( options.darkenSaveLayer !== undefined ? options.darkenSaveLayer : true);
  505. getId('_cbLayersMenuMoreOptions').checked = ( options.layersMenuMore !== undefined ? options.layersMenuMore : true);
  506. getId('_inpUIContrast').value = ( options.UIContrast !== undefined ? options.UIContrast : 1);
  507. getId('_inpUICompression').value = ( options.UICompression !== undefined ? options.UICompression : 1);
  508. getId('_cbSwapRoadsGPS').checked = ( options.swapRoadsGPS !== undefined ? options.swapRoadsGPS : true);
  509. getId('_cbUndarkenAerials').checked = ( options.undarkenAerials !== undefined ? options.undarkenAerials : true);
  510. getId('_cbShowMapBlockers').checked = ( options.showMapBlockers !== undefined ? options.showMapBlockers : true);
  511. getId('_cbHideLinks').checked = ( options.hideLinks !== undefined ? options.hideLinks : false);
  512. getId('_cbFixBridgeButton').checked = ( options.fixBridgeButton !== undefined ? options.fixBridgeButton : true);
  513. getId('_cbDisableBridgeButton').checked = ( options.disableBridgeButton !== undefined ? options.disableBridgeButton : true);
  514. getId('_cbISODates').checked = ( options.ISODates !== undefined ? options.ISODates : true);
  515. getId('_cbMondayFirst').checked = ( options.mondayFirst !== undefined ? options.mondayFirst : false);
  516. getId('_cbDisableKinetic').checked = ( options.disableKinetic !== undefined ? options.disableKinetic : false);
  517. getId('_cbDisableScrollZoom').checked = ( options.disableScrollZoom !== undefined ? options.disableScrollZoom : false);
  518. }
  519.  
  520. function saveSettings() {
  521. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  522. logit("function " + fname + " called", "debug");
  523. if (localStorage) {
  524. logit("saving options to local storage");
  525. var options = {};
  526. options.oldVersion = wmefu_version;
  527. options.moveZoomBar = getId('_cbMoveZoomBar').checked;
  528. options.shrinkTopBars = getId('_cbShrinkTopBars').checked;
  529. options.hideUserInfo = getId('_cbHideUserInfo').checked;
  530. options.restyleSidePanel = getId('_cbCompressSegmentTab').checked;
  531. options.restyleReports = getId('_cbRestyleReports').checked;
  532. options.enhanceChat = getId('_cbEnhanceChat').checked;
  533. options.narrowSidePanel = getId('_cbNarrowSidePanel').checked;
  534. options.aerialShiftX = getId('_inpASX').value;
  535. options.aerialShiftY = getId('_inpASY').value;
  536. options.aerialOpacity = getId('_inpASO').value;
  537. options.fixExternalProviders = getId('_cbFixExternalProviders').checked;
  538. options.GSVContrast = getId('_inpGSVContrast').value;
  539. options.GSVBrightness = getId('_inpGSVBrightness').value;
  540. options.GSVInvert = getId('_cbGSVInvert').checked;
  541. options.permalinkChecker = getId('_cbPermalinkChecker').checked;
  542. options.restyleLayersMenu = getId('_cbCompressLayersMenu').checked;
  543. options.layers2Cols = getId('_cbLayersColumns').checked;
  544. options.moveChatIcon = getId('_cbMoveChatIcon').checked;
  545. options.highlightInvisible = getId('_cbHighlightInvisible').checked;
  546. options.darkenSaveLayer = getId('_cbDarkenSaveLayer').checked;
  547. options.layersMenuMore = getId('_cbLayersMenuMoreOptions').checked;
  548. options.UIContrast = getId('_inpUIContrast').value;
  549. options.UICompression = getId('_inpUICompression').value;
  550. options.swapRoadsGPS = getId('_cbSwapRoadsGPS').checked;
  551. options.undarkenAerials = getId('_cbUndarkenAerials').checked;
  552. options.showMapBlockers = getId('_cbShowMapBlockers').checked;
  553. options.hideLinks = getId('_cbHideLinks').checked;
  554. options.fixBridgeButton = getId('_cbFixBridgeButton').checked;
  555. options.disableBridgeButton = getId('_cbDisableBridgeButton').checked;
  556. options.ISODates = getId('_cbISODates').checked;
  557. options.mondayFirst = getId('_cbMondayFirst').checked;
  558. options.disableKinetic = getId('_cbDisableKinetic').checked;
  559. options.disableScrollZoom = getId('_cbDisableScrollZoom').checked;
  560. localStorage.WMEFUSettings = JSON.stringify(options);
  561. }
  562. }
  563.  
  564. function applyAllSettings() {
  565. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  566. logit("function " + fname + " called", "debug");
  567. console.group(prefix + ": applying all settings");
  568. kineticDragParams = W.map.controls.find(control => control.dragPan).dragPan.kinetic;
  569. shrinkTopBars();
  570. hideUserInfo();
  571. compressSegmentTab();
  572. restyleReports();
  573. enhanceChat();
  574. narrowSidePanel();
  575. fixExternalProviders();
  576. warnCommentsOff();
  577. adjustGSV();
  578. compressLayersMenu();
  579. moveChatIcon();
  580. highlightInvisible();
  581. darkenSaveLayer();
  582. swapRoadsGPS();
  583. undarkenAerials();
  584. showMapBlockers();
  585. hideLinks();
  586. fixBridgeButton();
  587. disableBridgeButton();
  588. disableKinetic();
  589. disableScrollZoom();
  590. createZoomBar();
  591. console.groupEnd();
  592. RestrictionObserver.observe(getId('dialog-container'), { childList: true, subtree: true });
  593. ClosureObserver.observe(getId('edit-panel'), { childList: true, subtree: true });
  594. if (getId('_cbLayersMenuMoreOptions').checked === true) {
  595. $("#toolbar > div > div.layer-switcher-container > div > div > div > div > div.menu > div.more-options-toggle > label > div").click();
  596. }
  597. wmeFUinitialising = false;
  598. saveSettings();
  599. }
  600.  
  601. function applyEnhancements() {
  602. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  603. logit("function " + fname + " called", "debug");
  604. shrinkTopBars();
  605. compressSegmentTab();
  606. restyleReports();
  607. enhanceChat();
  608. compressLayersMenu();
  609. }
  610.  
  611. function createZoomBar() {
  612. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  613. logit("function " + fname + " called", "debug");
  614. if (_cbMoveZoomBar.checked) {
  615. yslider = new OL.Control.PanZoomBar({zoomStopHeight:9 , panIcons:false});
  616. yslider.position.x = 10;
  617. yslider.position.y = 35;
  618. W.map.addControl(yslider);
  619. var styles = "";
  620. //Overall bar
  621. styles += '.olControlPanZoomBar { left: 10px; top: 35px; height: 158px; border: 1px solid #f0f2f2; background-color: #f0f2f2; border-radius: 30px; width: 24px; box-sizing: initial; }';
  622. //zoom in/out buttons
  623. styles += '.olButton { background-color: white; border-radius: 30px; width: 24px; height: 24px; cursor: pointer; }';
  624. styles += '.olControlZoomButton { padding: 3px 5px; font-size: 18px; }';
  625. //slider stops
  626. styles += '.yslider-stops { width: 24px; height: 110px; background-color: #f3f3f3; background-image: linear-gradient(90deg, transparent 45%, #dedede 45%, #dedede 55%, transparent 55%), linear-gradient(#dedede 1px, transparent 1px); background-size: 50% 8px; background-repeat: repeat-y; background-position: 6px; }';
  627. //slider
  628. styles += '.slider { position: absolute; font-size: 15px; font-weight: 900; line-height: 1; text-align: center; width: 24px; height: 18px; margin-top: -29px; padding-top: 1px; border: 1px solid lightgrey; border-radius: 10px; background-color: white; cursor: ns-resize; }';
  629. //Move other WME controls and kill new zoom buttons
  630. styles += '#overlay-buttons { right: inherit !important; bottom: inherit; top: 204px; left: 9px; }';
  631. styles += '.zoom-bar-region { display: none; }';
  632. styles += '.street-view-mode #overlay-buttons { right: inherit; margin-right: inherit; }';
  633. // keep a space for the GSV control whilst GSV is active
  634. styles += '.street-view-region { height: 29px; }';
  635. // fix for WME BeenHere - old but I still use it :)
  636. styles += '#BeenHere { top: 310px !important; }';
  637. // shift UR/MP panel to the right
  638. styles += '#panel-container > div { left: 40px; }';
  639. // fix for WME Map Tiles Update
  640. styles += '#Info_div { margin-bottom: 0px !important; }';
  641. addStyle(prefix + fname,styles);
  642. W.map.events.register("zoomend", null, ZLI);
  643. ZLI();
  644. } else {
  645. if (yslider) {
  646. yslider.destroy();
  647. }
  648. W.map.events.unregister("zoomend", null, ZLI);
  649. removeStyle(prefix + fname);
  650. removeStyle('WMEMTU');
  651. }
  652. }
  653.  
  654. function ZLI() {
  655. if (yslider) {
  656. //Need to reset the OpenLayers-created settings from the zoom bar when it's redrawn
  657. //Overall bar
  658. yslider.div.style.left = "";
  659. yslider.div.style.top = "";
  660. //zoom in/out buttons
  661. yslider.buttons[0].style = "";
  662. yslider.buttons[0].innerHTML = "<div class='olControlZoomButton fa fa-plus' ></div>";
  663. yslider.buttons[1].style = "";
  664. yslider.buttons[1].innerHTML = "<div class='olControlZoomButton fa fa-minus' ></div>";
  665. //slider stops
  666. yslider.zoombarDiv.classList.add("yslider-stops");
  667. yslider.zoombarDiv.classList.remove("olButton");
  668. yslider.zoombarDiv.style="";
  669. //slider
  670. yslider.slider.innerHTML = "";
  671. yslider.slider.style = "";
  672. yslider.slider.classList.add("slider");
  673. yslider.moveZoomBar();
  674. //Actually set the ZLI
  675. yslider.slider.innerText = W.map.zoom;
  676. yslider.slider.title = "Zoom level indicator by WMEFU";
  677. switch (W.map.zoom) {
  678. case 0:
  679. case 1:
  680. yslider.slider.style.background = '#ef9a9a';
  681. yslider.slider.title += "\nCannot permalink any segments at this zoom level";
  682. break;
  683. case 2:
  684. case 3:
  685. yslider.slider.style.background = '#ffe082';
  686. yslider.slider.title += "\nCan only permalink primary or higher at this zoom level";
  687. break;
  688. default:
  689. yslider.slider.style.background = '#ffffff';
  690. yslider.slider.title += "\nCan permalink any segments at this zoom level";
  691. break;
  692. }
  693. // change document location of WME Map Update Info_div
  694. if (getId("Info_div")) {
  695. getId("overlay-buttons").appendChild(getId("Info_div"));
  696. getId("Info_div").style.marginTop = "10px";
  697. getId("Info_div").style.marginLeft = "4px";
  698. }
  699. }
  700. }
  701.  
  702. function hideUserInfo() {
  703. // Now functioning correctly for prod & beta
  704. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  705. logit("function " + fname + " called", "debug");
  706. var styles = "";
  707. // WME Panel Swap buttons - move them up if user info is hidden
  708. var PSButton1 = getId('WMEPS_UIButton');
  709. var PSButton2 = getId('WMEPS_EditButton');
  710. if (_cbHideUserInfo.checked) {
  711. styles += '#user-box { display: none; }';
  712. // extra fix for WME Panel Swap control (not working with new WME UI)
  713. if (PSButton1) { PSButton1.style.top = '-27px'; }
  714. if (PSButton2) { PSButton2.style.top = '-27px'; }
  715. addStyle(prefix + fname,styles);
  716. //Fix to move control button of Invalidated Camera Mass Eraser
  717. if (getId("_UCME_btn")) {
  718. var but = getId("_UCME_btn");
  719. var dest = getId("advanced-tools");
  720. getId("advanced-tools").appendChild(getId("_UCME_btn"));
  721. document.getElementById('UCME_btn').parentNode.removeChild(document.getElementById('UCME_btn'));
  722. }
  723. } else {
  724. if (PSButton1) { PSButton1.style.top = '-27px'; }
  725. if (PSButton2) { PSButton2.style.top = '-27px'; }
  726. removeStyle(prefix + fname);
  727. }
  728. }
  729.  
  730. function shrinkTopBars() {
  731. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  732. logit("function " + fname + " called", "debug");
  733. var styles = "";
  734. if (_cbShrinkTopBars.checked) {
  735. //always do this stuff
  736. //event mode button
  737. styles += '#mode-switcher .title-button .icon { font-size: 13px; font-weight: bold; color: black; }';
  738. //black bar
  739. styles += '#topbar-container { pointer-events: none; }';
  740. styles += '#map #topbar-container .topbar > div { pointer-events: initial; }';
  741. //change toolbar buttons - from JustinS83
  742. $('#mode-switcher .title-button .icon').removeClass('fa fa-angle-down');
  743. $('#mode-switcher .title-button .icon').addClass('fa fa-calendar');
  744. hackToolbarButtons();
  745. // HN editing tweaks
  746. styles += '#map-lightbox .content { pointer-events: none; }';
  747. styles += '#map-lightbox .content > div { pointer-events: initial; }';
  748. styles += '#map-lightbox .content .header { pointer-events: none !important; }';
  749. styles += '.toolbar .toolbar-button.add-house-number { background-color: #61cbff; float: right; font-weight: bold; }';
  750. styles += '.waze-icon-exit { background-color: #61cbff; font-weight: bold; }';
  751. // event mode button
  752. styles += '.toolbar.toolbar-mte .add-button { background-color: orange; font-weight: bold; }';
  753. var contrast = _inpUIContrast.value;
  754. var compress = _inpUICompression.value;
  755. if (compress > 0) {
  756. styles += '#app-head { height: ' + ['','35px','24px'][compress] + '; }';
  757. styles += '#app-head aside #brand { height: ' + ['','34px','22px'][compress] + '; padding-left: ' + ['','10px','5px'][compress] + '; }';
  758. styles += '.toolbar { height: ' + ['','35px','24px'][compress] + '; }';
  759. styles += '#mode-switcher .title-button .icon { line-height: ' + ['','34px','22px'][compress] + '; }';
  760. //search box
  761. styles += '#search { padding-top: ' + ['','3px','0px'][compress] + '; }';
  762. styles += '.form-search { height: ' + ['','27px','20px'][compress] + '; }';
  763. styles += '.form-search .search-query { height: ' + ['','26px','19px'][compress] + '; font-size: ' + ['','13px','12px'][compress] + '; }';
  764. styles += '.form-search .input-wrapper::after { top: ' + ['','6px','2px'][compress] + '; }';
  765. //toolbar dropdown menus
  766. //Toolbox switcher
  767. styles += '#toolbox-switcher .toolbar-button { margin-top: 0px; line-height: ' + ['','34px','22px'][compress] + '; }';
  768. styles += '#toolbox-switcher .fa { margin-right: ' + ['','5px','0px'][compress] + ' !important; }';
  769. //Toolbox menu
  770. styles += '.toolbox-dropdown-menu { top: ' + ['','17px','12px'][compress] + ' !important; }';
  771. //toolbar dropdowns
  772. styles += '.toolbar .toolbar-group { margin-right: ' + ['','14px','8px'][compress] + '; }';
  773. styles += '.toolbar .toolbar-icon { width: ' + ['','31px','22px'][compress] + '; height: ' + ['','34px','22px'][compress] + '; line-height: ' + ['','34px','22px'][compress] + '; }';
  774. styles += '.toolbar .group-title { height: ' + ['','34px','22px'][compress] + '; line-height: ' + ['','34px','22px'][compress] + '; margin-left: ' + ['','31px','22px'][compress] + '; }';
  775. styles += '.toolbar .dropdown-menu { top: ' + ['','34px','22px'][compress] + ' !important; left: ' + ['','7px','4px'][compress] + ' !important; }';
  776. //toolbar buttons
  777. styles += '#edit-buttons > div > .toolbar-button { margin-top: ' + ['','3px','1px'][compress] + '; margin-left: 3px; padding-left: ' + ['','10px','5px'][compress] + '; padding-right: ' + ['','10px','5px'][compress] + '; height: ' + ['','27px','22px'][compress] + '; line-height: ' + ['','27px','22px'][compress] + '; }';
  778. //keep save button wide enough for counter
  779. styles += '.toolbar .toolbar-button.waze-icon-save { padding-right: 15px !important; }';
  780. styles += '.toolbar .toolbar-button.waze-icon-save .counter { top: ' + ['','-3px','-1px'][compress] + '; }';
  781. styles += '#edit-buttons > div > .toolbar-button > .item-icon { top: ' + ['','5px','2px'][compress] + '; }';
  782. styles += '.toolbar .toolbar-separator { height: ' + ['','34px','22px'][compress] + '; }';
  783. //layers menu
  784. styles += '.waze-icon-layers { height: ' + ['','27px','22px'][compress] + ' !important; margin-top: ' + ['','3px','0px'][compress] + ' !important; }';
  785. styles += '.layer-switcher .menu { top: ' + ['','31px','24px'][compress] + '; }';
  786. // fix for WME Edit Count Monitor
  787. styles += '#edit-buttons > div > div:nth-child(10) { margin-top: ' + ['','5px','-1px'][compress] + ' !important; }';
  788. //black bar
  789. styles += '.topbar { height: ' + ['','24px','18px'][compress] + '; line-height: ' + ['','24px','18px'][compress] + '; }';
  790. }
  791. if (contrast > 0) {
  792. //toolbar dropdown menus
  793. styles += '.toolbar .group-title { color: black; }';
  794. styles += '#edit-buttons > div > .toolbar-button { border-radius: 8px; border: 1px solid ' + ['','lightgrey','grey'][contrast] + '; color: black; }';
  795. //layers icon - until Waze fix it
  796. styles += '.layer-switcher .waze-icon-layers.toolbar-button{ background-color: white; }';
  797. }
  798. // //fix for buttons of WME GIS script
  799. // styles += '.btn-group-sm { text-shadow: initial; background: white; }';
  800. addStyle(prefix + fname,styles);
  801. } else {
  802. removeStyle(prefix + fname);
  803. //change toolbar buttons - from JustinS83
  804. $('#mode-switcher .title-button .icon').removeClass('fa fa-calendar');
  805. $('#mode-switcher .title-button .icon').addClass('fa fa-angle-down');
  806. //un-hack Toolbar buttons
  807. if (document.getElementsByClassName("waze-icon-reload").length > 0) {
  808. $('.waze-icon-reload span').removeClass('fa fa-refresh fa-lg');
  809. $('.waze-icon-reload').addClass('reload');
  810. $('.waze-icon-reload span')[0].innerHTML = "Reload";
  811. }
  812. if (document.getElementsByClassName("waze-icon-undo").length > 0) {
  813. $('.waze-icon-undo span').removeClass('fa fa-undo fa-lg');
  814. $('.waze-icon-undo').addClass('undo');
  815. $('.waze-icon-undo span')[0].innerHTML = "Undo";
  816. }
  817. if (document.getElementsByClassName("waze-icon-redo").length > 0) {
  818. $('.waze-icon-redo span').removeClass('fa fa-repeat fa-lg');
  819. $('.waze-icon-redo').addClass('redo');
  820. $('.waze-icon-redo span')[0].innerHTML = "Redo";
  821. }
  822. buttonObserver.disconnect();
  823. }
  824. window.dispatchEvent(new Event('resize'));
  825. }
  826.  
  827. function hackToolbarButtons() {
  828. if (document.getElementsByClassName("waze-icon-reload").length > 0) {
  829. $('.waze-icon-reload').removeClass('reload');
  830. $('.waze-icon-reload span').addClass('fa fa-refresh fa-lg');
  831. $('.waze-icon-reload span')[0].innerHTML = "";
  832. }
  833. if (document.getElementsByClassName("waze-icon-undo").length > 0) {
  834. $('.waze-icon-undo').removeClass('undo');
  835. $('.waze-icon-undo span').addClass('fa fa-undo fa-lg');
  836. $('.waze-icon-undo span')[0].innerHTML = "";
  837. }
  838. if (document.getElementsByClassName("waze-icon-redo").length > 0) {
  839. $('.waze-icon-redo').removeClass('redo');
  840. $('.waze-icon-redo span').addClass('fa fa-repeat fa-lg');
  841. $('.waze-icon-redo span')[0].innerHTML = "";
  842. }
  843. buttonObserver.observe(getId('edit-buttons'), { childList: true, subtree: true });
  844. }
  845.  
  846. function FALSEcompressSegmentTab() {
  847. _cbCompressSegmentTab.checked = _cbextraCBSection.checked;
  848. compressSegmentTab();
  849. }
  850.  
  851. function compressSegmentTab() {
  852. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  853. logit("function " + fname + " called", "debug");
  854. var styles = "";
  855. if (_cbCompressSegmentTab.checked) {
  856. var contrast = _inpUIContrast.value;
  857. var compress = _inpUICompression.value;
  858. //Neuter the top gradient
  859. styles += '#sidebar .tab-scroll-gradient { pointer-events: none; }';
  860. //Nuke the bottom gradient
  861. styles += '#sidebar #links:before { display: none; }';
  862. // Make map comment text always visible
  863. styles += '.map-comment-name-editor .edit-button { display: block !important; }';
  864. if (compress > 0) {
  865. //general compression enhancements
  866. styles += '#sidebar #advanced-tools { padding: ' + ['','0 9px','0 4px'][compress] + '; }';
  867. styles += '#sidebar .waze-staff-tools { margin-bottom: ' + ['','9px','4px'][compress] + '; height: ' + ['','25px','20px'][compress] + '; }';
  868. styles += '#sidebar .tab-content { padding: ' + ['','9px','4px'][compress] + '; padding-top: ' + ['','4px','0px'][compress] + '; }';
  869. //Tabs
  870. styles += '#sidebar .nav-tabs { padding-bottom: ' + ['','3px','2px'][compress] + '; }';
  871. styles += '#sidebar #user-info #user-tabs { padding: ' + ['','0 9px','0 4px'][compress] + '; }';
  872. styles += '#sidebar .nav-tabs li a { margin-top: ' + ['','2px','1px'][compress] + '; margin-left: ' + ['','3px','1px'][compress] + '; padding-top: 0px !important; line-height: ' + ['','24px','21px'][compress] + '; height: ' + ['','24px','21px'][compress] + '; }';
  873. styles += '#sidebar .nav-tabs li { flex-grow: 0; }';
  874. //Feed
  875. styles += '.feed-item { margin-bottom: ' + ['','3px','1px'][compress] + '; }';
  876. styles += '.feed-item .inner { padding: ' + ['','5px','0px'][compress] + '; }';
  877. styles += '.feed-item .content .title { margin-bottom: ' + ['','1px','0px'][compress] + '; }';
  878. styles += '.feed-item .motivation { margin-bottom: ' + ['','2px','0px'][compress] + '; }';
  879. //Drives & Areas
  880. styles += '#sidebar .message { margin-bottom: ' + ['','6px','2px'][compress] + '; }';
  881. styles += '#sidebar .result-list .result { padding: ' + ['','6px 17px','2px 9px'][compress] + '; margin-bottom: ' + ['','3px','1px'][compress] + '; }';
  882. styles += '#sidebar .result-list .session { background-color: lightgrey; }';
  883. styles += '#sidebar .result-list .session-available { background-color: white; }';
  884. styles += '#sidebar .result-list .result.selected { background-color: lightgreen; }';
  885. styles += 'div#sidepanel-drives { height: auto !important; }';
  886. //SEGMENT EDIT PANEL
  887. //general changes
  888. //checkbox groups
  889. styles += '#sidebar .controls-container { padding-top: ' + ['','4px','1px'][compress] + '; display: inline-block; font-size: ' + ['','12px','11px'][compress] + '; }';
  890. styles += '.controls-container input[type="checkbox"] + label { padding-left: ' + ['','21px','17px'][compress] + ' !important; } }';
  891. //form groups
  892. styles += '#sidebar .form-group { margin-bottom: ' + ['','5px','0px'][compress] + '; }';
  893. //dropdown inputs
  894. styles += '#sidebar .form-control { height: ' + ['','27px','19px'][compress] + '; padding-top: ' + ['','4px','0px'][compress] + '; padding-bottom: ' + ['','4px','0px'][compress] + '; font-size: ' + ['','13px','12px'][compress] + '; color: black; }';
  895. //buttons
  896. styles += '#edit-panel .waze-btn { padding-top: 0px !important; padding-bottom: ' + ['','3px','1px'][compress] + '; height: ' + ['','20px','18px'][compress] + ' !important; line-height: ' + ['','20px','18px'][compress] + ' !important; font-size: ' + ['','13px','12px'][compress] + '; }';
  897. // styles += '#edit-panel .waze-btn { padding-top: ' + ['','3px','0px'][compress] + ' !important; padding-bottom: ' + ['','3px','1px'][compress] + '; height: ' + ['','20px','18px'][compress] + ' !important; line-height: ' + ['','20px','18px'][compress] + ' !important; font-size: ' + ['','13px','12px'][compress] + '; }';
  898. //radio button controls
  899. styles += '.waze-radio-container label { height: ' + ['','19px','16px'][compress] + '; width: ' + ['','19px','16px'][compress] + '; line-height: ' + ['','19px','16px'][compress] + '; font-size: ' + ['','13px','12px'][compress] + '; margin-bottom: ' + ['','3px','1px'][compress] + '; }';
  900. styles += '.waze-radio-container label { width: auto; padding-left: ' + ['','6px','3px'][compress] + ' !important; padding-right: ' + ['','6px','3px'][compress] + ' !important; }';
  901. //text input areas
  902. styles += '#sidebar textarea.form-control { height: auto; }';
  903. styles += '#sidebar textarea { max-width: unset; }';
  904. //specific changes
  905. //Selected segments info
  906. styles += '#edit-panel .selection { padding-top: ' + ['','8px','2px'][compress] + '; padding-bottom: ' + ['','8px','4px'][compress] + '; }';
  907. styles += '#edit-panel .segment .direction-message { margin-bottom: ' + ['','9px','3px'][compress] + '; }';
  908. //Segment details (closure warning)
  909. styles += '#edit-panel .segment .segment-details { padding: ' + ['','10px','5px'][compress] + '; padding-top: 0px; }';
  910. //All control labels
  911. styles += '#edit-panel .control-label { font-size: ' + ['','11px','10px'][compress] + '; margin-bottom: ' + ['','4px','1px'][compress] + '; }';
  912. //Address input
  913. styles += '#edit-panel .address-edit-view { cursor: pointer; margin-bottom: ' + ['','6px','2px'][compress] + '!important; }';
  914. styles += '#edit-panel .address-edit-input { padding: ' + ['','4px','1px'][compress] + '; font-size: ' + ['','13px','12px'][compress] + '; }';
  915. styles += '.tts-button { height: ' + ['','28px','21px'][compress] + '; }';
  916. //alt names
  917. styles += '.alt-street-list { margin-bottom: ' + ['','4px','0px'][compress] + '; }';
  918. styles += '#edit-panel .add-alt-street-form .alt-street { padding-top: ' + ['','13px','3px'][compress] + '; padding-bottom: ' + ['','13px','3px'][compress] + '; }';
  919. styles += '#edit-panel .add-alt-street-form .alt-street .alt-street-delete { top: ' + ['','12px','4px'][compress] + '; }';
  920. styles += '#edit-panel .segment .address-edit-view .address-form .action-buttons { padding-top: ' + ['','11px','6px'][compress] + '; padding-bottom: ' + ['','11px','6px'][compress] + '; margin-top: ' + ['','5px','0px'][compress] + '; height: ' + ['','45px','28px'][compress] + '; }';
  921. styles += '#edit-panel .add-alt-street-form .new-alt-street { padding-top: ' + ['','8px','3px'][compress] + '; padding-bottom: ' + ['','8px','3px'][compress] + '; }';
  922. //restrictions control
  923. styles += '#edit-panel .restriction-list { margin-bottom: ' + ['','5px','0px'][compress] + '; }';
  924. //speed limit controls
  925. styles += '#edit-panel .clearfix.controls.speed-limit { margin-top: ' + ['','0px','-5px'][compress] + '; }';
  926. styles += '#edit-panel .segment .speed-limit label { margin-bottom: ' + ['','3px','1px'][compress] + '; }';
  927. styles += '#edit-panel .segment .speed-limit .form-control { height: ' + ['','23px','19px'][compress] + '; padding-top: ' + ['','4px','2px'][compress] + '; font-size: ' + ['','13px','12px'][compress] + '; width: 5em; margin-left: 0px; }';
  928. styles += '#edit-panel .segment .speed-limit .direction-label { font-size: ' + ['','12px','11px'][compress] + '; line-height: ' + ['','2.0em','1.8em'][compress] + '; }';
  929. styles += '#edit-panel .segment .speed-limit .unit-label { font-size: ' + ['','12px','11px'][compress] + '; line-height: ' + ['','2.0em','1.8em'][compress] + '; margin-left: 0px;}';
  930. styles += '#edit-panel .segment .speed-limit .average-speed-camera { margin-left: 40px; }';
  931. styles += '#edit-panel .segment .speed-limit .average-speed-camera .camera-icon { vertical-align: top; }';
  932. styles += '#edit-panel .segment .speed-limit .verify-buttons { margin-bottom: ' + ['','5px','0px'][compress] + '; }';
  933. //more actions section
  934. styles += '#edit-panel .more-actions { padding-top: ' + ['','6px','2px'][compress] + '; }';
  935. styles += '#edit-panel .more-actions .waze-btn.waze-btn-white { padding-left: 0px; padding-right: 0px; }';
  936. //get more-actions buttons on one line
  937. styles += '#edit-panel .more-actions { display: inline-flex; }';
  938. styles += '#edit-panel .action-button { width: 155px; overflow: hidden; }';
  939. styles += '#edit-panel .action-button:before { margin-right: 0px !important; }';
  940. styles += '#edit-panel .more-actions .edit-house-numbers-btn-wrapper { margin-top: 0px; }';
  941. //additional attributes
  942. styles += '#edit-panel .additional-attributes { margin-bottom: ' + ['','3px','1px'][compress] + '; }';
  943. //history items
  944. styles += '.toggleHistory { padding: ' + ['','7px','3px'][compress] + '; }';
  945. styles += '.element-history-item:not(:last-child) { margin-bottom: ' + ['','3px','1px'][compress] + '; }';
  946. styles += '.element-history-item .tx-header { padding: ' + ['','6px','2px'][compress] + '; }';
  947. styles += '.element-history-item .tx-header .tx-author-date { margin-bottom: ' + ['','3px','1px'][compress] + '; }';
  948. styles += '.element-history-item .tx-content { padding: ' + ['','7px 7px 7px 22px','4px 4px 4px 22px'][compress] + '; }';
  949. styles += '.loadMoreContainer { padding: ' + ['','5px 0px','3px 0px'][compress] + '; }';
  950. //closures list
  951. styles += '.closures-list .add-closure-button { line-height: ' + ['','20px','18px'][compress] + '; }';
  952. styles += '.closures-list .closure-item:not(:last-child) { margin-bottom: ' + ['','6px','2px'][compress] + '; }';
  953. styles += '.closures-list .closure-item .details { padding: ' + ['','5px','0px'][compress] + '; font-size: ' + ['','12px','11px'][compress] + '; }';
  954. styles += '.closures-list .closure-item .buttons { top: ' + ['','7px','4px'][compress] + '; }';
  955. //tweak for Junction Box button
  956. styles += '#edit-panel .junction-actions > button { width: inherit; }';
  957. //PLACE DETAILS
  958. //alert
  959. styles += '#edit-panel .header-alert { margin-bottom: ' + ['','6px','2px'][compress] + '; padding: ' + ['','6px 32px','2px 32px'][compress] + '; }';
  960. //address input
  961. styles += '#edit-panel .full-address { padding-top: ' + ['','4px','1px'][compress] + '; padding-bottom: ' + ['','4px','1px'][compress] + '; font-size: ' + ['','13px','12px'][compress] + '; }';
  962. //alt names
  963. styles += '#edit-panel .aliases-view .list li { margin: ' + ['','12px 0','4px 0'][compress] + '; }';
  964. styles += '#edit-panel .aliases-view .delete { line-height: inherit; }';
  965. //categories
  966. styles += '#edit-panel .categories .select2-search-choice .category { margin: ' + ['','2px 0 2px 4px','1px 0 1px 3px'][compress] + '; height: ' + ['','18px','15px'][compress] + '; line-height: ' + ['','18px','15px'][compress] + '; }';
  967. styles += '#edit-panel .categories .select2-search-field input { height: ' + ['','18px','17px'][compress] + '; }';
  968. styles += '#edit-panel .categories .select2-choices { min-height: ' + ['','26px','19px'][compress] + '; }';
  969. styles += '#edit-panel .categories .select2-container { margin-bottom: 0px; }';
  970. //entry/exit points
  971. styles += '#edit-panel .navigation-point-view .navigation-point-list-item .preview { padding: ' + ['','3px 7px','0px 4px'][compress] + '; font-size: ' + ['','13px','12px'][compress] + '; }';
  972. styles += '#edit-panel .navigation-point-view .add-button { height: ' + ['','28px','18px'][contrast] + '; line-height: ' + ['','17px','16px'][contrast] + '; font-size: ' + ['','13px','12px'][compress] + '; }';
  973. //type buttons
  974. styles += '#sidebar .area-btn, #sidebar .point-btn { height: ' + ['','19px','16px'][compress] + '; line-height: ' + ['','19px','16px'][compress] + '; font-size: ' + ['','13px','12px'][compress] + '; }';
  975. // { height: ' + ['','19px','16px'][compress] + '; width: ' + ['','19px','16px'][compress] + '; line-height: ' + ['','19px','16px'][compress] + '; font-size: ' + ['','13px','12px'][compress] + '; margin-bottom: ' + ['','3px','1px'][compress] + '; }';
  976. //external providers
  977. styles += '.select2-container { font-size: ' + ['','13px','12px'][compress] + '; }';
  978. styles += '#edit-panel .external-providers-view .external-provider-item { margin-bottom: ' + ['','6px','2px'][compress] + '; }';
  979. styles += '.external-providers-view > div > ul { margin-bottom: ' + ['','4px','0px'][compress] + '; }';
  980. styles += '#edit-panel .external-providers-view .add { padding: ' + ['','3px 12px','1px 9px'][compress] + '; }';
  981. styles += '#edit-panel .waze-btn.waze-btn-smaller { line-height: ' + ['','26px','21px'][compress] + '; }';
  982. //residential toggle
  983. styles += '#edit-panel .toggle-residential { height: ' + ['','27px','22px'][compress] + '; }';
  984. //more info
  985. styles += '.service-checkbox { font-size: ' + ['','13px','12px'][compress] + '; }';
  986. //PARKING LOT SPECIFIC
  987. styles += '.parking-type-option{ display: inline-block; }';
  988. styles += '.payment-checkbox { display: inline-block; min-width: ' + ['','48%','31%'][compress] + '; }';
  989. styles += '.service-checkbox { display: inline-block; min-width: ' + ['','49%','32%'][compress] + '; font-size: ' + ['','12px','11px'][compress] + '; }';
  990. styles += '.lot-checkbox { display: inline-block; min-width: 49%; }';
  991. //MAP COMMENTS
  992. styles += '.map-comment-name-editor { padding: ' + ['','10px','5px'][compress] + '; }';
  993. styles += '.map-comment-name-editor .edit-button { margin-top: 0px; font-size: ' + ['','13px','12px'][compress] + '; padding-top: ' + ['','3px','1px'][compress] + '; }';
  994. styles += '.conversation-view .no-comments { padding: ' + ['','10px 15px','5px 15px'][compress] + '; }';
  995. styles += '.map-comment-feature-editor .conversation-view .comment-list { padding-top: ' + ['','8px','1px'][compress] + '; padding-bottom: ' + ['','8px','1px'][compress] + '; }';
  996. styles += '.map-comment-feature-editor .conversation-view .comment-list .comment .comment-content { padding: ' + ['','6px 0px','2px 0px'][compress] + '; }';
  997. styles += '.conversation-view .comment .text { padding: ' + ['','6px 9px','3px 4px'][compress] + '; font-size: ' + ['','13px','12px'][compress] + '; }';
  998. styles += '.conversation-view .new-comment-form { padding-top: ' + ['','10px','5px'][compress] + '; }';
  999. styles += '.map-comment-feature-editor .clear-btn { height: ' + ['','26px','19px'][compress] + '; line-height: ' + ['','26px','19px'][compress] + '; }';
  1000. //Compression for WME Speedhelper
  1001. styles += '.clearfix.controls.speed-limit { margin-top: ' + ['','-4px','-8px'][compress] + '; }';
  1002. //Compression for WME Clicksaver
  1003. styles += '.rth-btn-container { margin-bottom: ' + ['','2px','-1px'][compress] + '; }';
  1004. styles += '#csRoutingTypeContainer { height: ' + ['','23px','16px'][compress] + ' !important; margin-top: ' + ['','-2px','-4px'][compress] + '; }';
  1005. styles += '#csElevationButtonsContainer { margin-bottom: ' + ['','2px','-1px'][compress] + ' !important; }';
  1006. //tweak for WME Clicksaver tab controls
  1007. styles += '#sidepanel-clicksaver .controls-container { width: 100%; }';
  1008. //tweak for JAI tab controls
  1009. styles += '#sidepanel-ja .controls-container { width: 100%; }';
  1010. //tweaks for UR-MP Tracker
  1011. styles += '#sidepanel-urt { margin-left: ' + ['','-5px','0px'][compress] + ' !important; }';
  1012. styles += '#urt-main-title { margin-top: ' + ['','-5px','0px'][compress] + ' !important; }';
  1013. }
  1014. if (contrast > 0) {
  1015. //contrast enhancements
  1016. //general
  1017. styles += '#sidebar .form-group { border-top: 1px solid ' + ['','lightgrey','grey'][contrast] + '; }';
  1018. //text colour
  1019. styles += '#sidebar { color: black; }';
  1020. //advanced tools section
  1021. styles += '#sidebar waze-staff-tools { background-color: #c7c7c7; }';
  1022. //Tabs
  1023. styles += '#sidebar .nav-tabs { border: 1px solid ' + ['','lightgrey','grey'][contrast] + '; }';
  1024. styles += '#sidebar .nav-tabs li a { border: 1px solid ' + ['','lightgrey','grey'][contrast] + ' !important; }';
  1025. //Fix the un-noticeable feed refresh button
  1026. styles += 'span.fa.fa-repeat.feed-refresh.nav-tab-icon { width: 19px; color: orangered; }';
  1027. styles += 'span.fa.fa-repeat.feed-refresh.nav-tab-icon:hover { color: red; font-weight: bold; font-size: 15px; }';
  1028. //Feed
  1029. styles += '.feed-item { border: 1px solid ' + ['','lightgrey','grey'][contrast] + '; }';
  1030. styles += '.feed-issue .content .title .type { color: ' + ['','black','black'][contrast] + '; font-weight: bold; }';
  1031. styles += '.feed-issue .content .timestamp { color: ' + ['','dimgrey','black'][contrast] + '; }';
  1032. styles += '.feed-issue .content .subtext { color: ' + ['','dimgrey','black'][contrast] + '; }';
  1033. styles += '.feed-item .motivation { font-weight: bold; }';
  1034. //Drives & Areas
  1035. styles += '#sidebar .result-list .result { border: 1px solid ' + ['','lightgrey','grey'][contrast] + '; }';
  1036. //Segment edit panel
  1037. styles += '#edit-panel .selection { font-size: 13px; }';
  1038. styles += '#edit-panel .segment .direction-message { color: orangered; }';
  1039. styles += '#edit-panel .address-edit-input { color: black; border: 1px solid ' + ['','lightgrey','grey'][contrast] + '; }';
  1040. styles += '#sidebar .form-control { border: 1px solid ' + ['','lightgrey','grey'][contrast] + '; }';
  1041. //radio buttons when disabled
  1042. styles += '.waze-radio-container input[type="radio"]:disabled:checked + label { color: black; opacity: 0.7; font-weight:600; }';
  1043. //override border for lock levels
  1044. styles += '#sidebar .waze-radio-container { border: 0 none !important; }';
  1045. styles += '#edit-panel .waze-btn { color: black; border: 1px solid ' + ['','lightgrey','grey'][contrast] + '; }';
  1046. styles += '.waze-radio-container label { border: 1px solid ' + ['','lightgrey','grey'][contrast] + '; }';
  1047. //history items
  1048. styles += '.toggleHistory { color: black; text-align: center; }';
  1049. styles += '.element-history-item .tx-header { color: black; }';
  1050. styles += '.element-history-item.closed .tx-header { border-radius: 8px; border: 1px solid ' + ['','lightgrey','grey'][contrast] + '; }';
  1051. styles += '.loadMoreHistory { border: 1px solid ' + ['','lightgrey','grey'][contrast] + '; }';
  1052. //closures list
  1053. styles += '.closures-list .closure-item .details { border-radius: 8px; border: 1px solid ' + ['','lightgrey','grey'][contrast] + '; }';
  1054. styles += '.closures-list .closure-item .dates { color: black; }';
  1055. styles += '.closures-list .closure-item .dates .date-label { opacity: 1; }';
  1056. //Place details
  1057. //alert
  1058. styles += '#edit-panel .alert-danger { color: red; }';
  1059. //address input
  1060. styles += '#edit-panel .full-address { color: black; border: 1px solid ' + ['','lightgrey','grey'][contrast] + '; }';
  1061. styles += '#edit-panel a.waze-link { font-weight: bold; }';
  1062. //categories
  1063. styles += '#edit-panel .categories .select2-search-choice .category { text-transform: inherit; font-weight: bold; background: gray; }';
  1064. //entry/exit points
  1065. styles += '#edit-panel .navigation-point-view .navigation-point-list-item .preview { border: 1px solid ' + ['','lightgrey','grey'][contrast] + '; }';
  1066. styles += '#edit-panel .navigation-point-view .add-button { border: 1px solid ' + ['','lightgrey','grey'][contrast] + '; margin-top: 2px; padding: 0 5px; }';
  1067. //type buttons
  1068. styles += '#sidebar .point-btn { color: black; border: 1px solid ' + ['','lightgrey','grey'][contrast] + ' !important; }';
  1069. //external providers
  1070. styles += '.select2-container { color: teal; border: 1px solid ' + ['','lightgrey','grey'][contrast] + ' !important; }';
  1071. styles += '.select2-container .select2-choice { color: black; }';
  1072. //residential toggle
  1073. styles += '#edit-panel .toggle-residential { font-weight: bold; }';
  1074. //COMMENTS
  1075. styles += '.map-comment-name-editor { border-color: ' + ['','darkgrey','grey'][contrast] + '; }';
  1076. }
  1077. //fix for buttons of WME Image Overlay script
  1078. styles += '#sidepanel-imageoverlays > div.result-list button { height: 24px; }';
  1079. addStyle(prefix + fname,styles);
  1080. } else {
  1081. removeStyle(prefix + fname);
  1082. }
  1083. }
  1084.  
  1085. function compressLayersMenu() {
  1086. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1087. logit("function " + fname + " called", "debug");
  1088. removeStyle(prefix + fname);
  1089. var styles = "";
  1090. if (_cbCompressLayersMenu.checked) {
  1091. getId('layersColControls').style.opacity = '1';
  1092. var contrast = _inpUIContrast.value;
  1093. var compress = _inpUICompression.value;
  1094. if (compress > 0) {
  1095. //VERTICAL CHANGES
  1096. //Change menu to autoheight
  1097. var menuHeight = document.querySelector("#toolbar > div > div.layer-switcher-container > div > div > div > div > div.menu").style.height;
  1098. styles += '.layer-switcher .menu { height: auto !important; max-height: ' + menuHeight + '; overflow-y: scroll; width: auto; }';
  1099. //Shrink options toggler section
  1100. styles += '.layer-switcher .more-options-toggle { line-height: ' + ['','27px','19px'][compress] + '; height: ' + ['','27px','19px'][compress] + '; font-size: ' + ['','12px','11px'][compress] + '; }';
  1101. styles += '.layer-switcher .more-options-toggle .pinned { font-size: ' + ['','19px','17px'][compress] + '; width: auto; }';
  1102. styles += '.layer-switcher .scrollable { height: calc(100% - ' + ['','29px','22px'][compress] + '); overflow-x: hidden; font-size: ' + ['','13px','12px'][compress] + '; }';
  1103. //menu
  1104. styles += '.layer-switcher .togglers { padding: ' + ['','6px','2px'][compress] + '; width: auto; }';
  1105. //line spacing
  1106. styles += '.layer-switcher .toggler { padding-top: ' + ['','2px','0px'][compress] + '; padding-bottom: ' + ['','2px','0px'][compress] + '; line-height: ' + ['','16px','15px'][compress] + '; }';
  1107. styles += '.layer-switcher .togglers .text-checkboxes .text-checkbox { margin-top: ' + ['','-2px','-4px'][compress] + '; margin-left: ' + ['','7px','2px'][compress] + '; }';
  1108. //group separators
  1109. styles += '.layer-switcher .togglers .group:not(:last-child)::after { margin: ' + ['','5px -7px 5px -7px','0 -7px 0 -7px'][compress] + '; }';
  1110. //HORIZONTAL CHANGES
  1111. styles += '.layer-switcher .togglers .children { padding-left: ' + ['','17px','12px'][compress] + '; }';
  1112. if (_cbLayersColumns.checked) {
  1113. //2 column stuff
  1114. styles += '.layer-switcher .scrollable { columns: 2; }';
  1115. styles += '.controls-container input[type="checkbox"]:checked + label:after { WME: FU; transform: unset; }';
  1116. styles += 'li.group { break-inside: avoid; page-break-inside: avoid; }';
  1117. styles += '.layer-switcher .togglers { padding-top: 0px; }';
  1118. }
  1119. } else {
  1120. //2-columns not available without compression
  1121. getId('layersColControls').style.opacity = '0.5';
  1122. }
  1123. if (contrast > 0) {
  1124. //less options toggle
  1125. styles += '.layer-switcher .more-options-toggle { color: ' + ['','#5ca6bc','#2e6170'][contrast] + '; }';
  1126. //Group headers
  1127. styles += '.controls-container.main.toggler { color: white; background: dimgray; }';
  1128. styles += '.layer-switcher .toggler.main .label-text { text-transform: inherit; }';
  1129. //labels
  1130. styles += '.layer-switcher .togglers .children { color: ' + ['','#1e1e1e','#000000'][contrast] + '; }';
  1131. //column rule
  1132. styles += '.layer-switcher .scrollable { column-rule: 1px solid ' + ['','lightgrey','grey'][contrast] + '; }';
  1133. }
  1134. addStyle(prefix + fname,styles);
  1135. } else {
  1136. getId('layersColControls').style.opacity = '0.5';
  1137. removeStyle(prefix + fname);
  1138. }
  1139. }
  1140.  
  1141. function restyleReports() {
  1142. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1143. logit("function " + fname + " called", "debug");
  1144. var styles = "";
  1145. if (_cbRestyleReports.checked) {
  1146. var contrast = _inpUIContrast.value;
  1147. var compress = _inpUICompression.value;
  1148. if (compress > 0) {
  1149. //report header
  1150. styles += '#panel-container .header { padding: ' + ['','9px 36px','1px 36px'][compress] + '; line-height: ' + ['','19px','17px'][compress] + '; }';
  1151. styles += '#panel-container .header .dot { top: ' + ['','15px','7px'][compress] + '; }';
  1152. //special treatment for More Information checkboxes (with legends)
  1153. styles += '#panel-container .problem-edit .more-info .legend { left: 20px; top: 3px; }';
  1154. styles += '#panel-container .more-info input[type="checkbox"] + label { padding-left: 33px !important; }';
  1155. //report body
  1156. styles += '#panel-container .body { line-height: ' + ['','15px','13px'][compress] + '; font-size: ' + ['','13px','12px'][compress] + '; }';
  1157. //problem description
  1158. styles += '#panel-container div.description.section > div.collapsible.content { padding: ' + ['','9px','3px'][compress] + '; }';
  1159. //comments
  1160. styles += '#panel-container .conversation-view .comment .comment-content { padding: ' + ['','6px 9px','2px 3px'][compress] + '; }';
  1161. styles += '#panel-container .comment .text { padding: ' + ['','7px 9px','4px 4px'][compress] + '; }';
  1162. //new comment entry
  1163. styles += '#panel-container .conversation-view .new-comment-form { padding: ' + ['','8px 9px 6px 9px','1px 3px 2px 3px'][compress] + '; }';
  1164. //send button
  1165. styles += '#panel-container .conversation-view .send-button { padding: ' + ['','4px 16px','2px 12px'][compress] + '; box-shadow: ' + ['','3px 3px 4px 0 #def7ff','3px 2px 4px 0 #def7ff'][compress] + '; }';
  1166. //lower buttons
  1167. styles += '#panel-container > div > div > div.actions > div > div { WME: FU; padding-top: ' + ['','6px','3px'][compress] + '; }';
  1168. styles += '#panel-container .close-details.section { font-size: ' + ['','13px','12px'][compress] + '; line-height: ' + ['','13px','9px'][compress] + '; }';
  1169. styles += '#panel-container .problem-edit .actions .controls-container label { WME: FU; height: ' + ['','28px','21px'][compress] + '; line-height: ' + ['','28px','21px'][compress] + '; margin-bottom: ' + ['','5px','2px'][compress] + '; }';
  1170. styles += '#panel-container .waze-plain-btn { height: ' + ['','30px','20px'][compress] + '; line-height: ' + ['','30px','20px'][compress] + '; }';
  1171. styles += '.panel .navigation { margin-top: ' + ['','6px','2px'][compress] + '; }';
  1172. //WMEFP All PM button
  1173. styles += '#WMEFP-UR-ALLPM { top: ' + ['','5px','0px'][compress] + ' !important; }';
  1174. }
  1175. if (contrast > 0) {
  1176. styles += '#panel-container .section { border-bottom: 1px solid ' + ['','lightgrey','grey'][contrast] + '; }';
  1177. styles += '#panel-container .close-panel { border-color: ' + ['','lightgrey','grey'][contrast] + '; }';
  1178. styles += '#panel-container .main-title { font-weight: 900; }';
  1179. styles += '#panel-container .reported { color: ' + ['','dimgrey','black'][contrast] + '; }';
  1180. styles += '#panel-container .date { color: ' + ['','#6d6d6d','#3d3d3d'][contrast] + '; }';
  1181. styles += '#panel-container .comment .text { border: 1px solid ' + ['','lightgrey','grey'][contrast] + '; }';
  1182. styles += '#panel-container .comment-content.reporter .username { color: ' + ['','#159dc6','#107998'][contrast] + '; }';
  1183. styles += '#panel-container .conversation-view .new-comment-form textarea { border: 1px solid ' + ['','lightgrey','grey'][contrast] + '; }';
  1184. styles += '#panel-container .top-section { border-bottom: 1px solid ' + ['','lightgrey','grey'][contrast] + '; }';
  1185. styles += '#panel-container .waze-plain-btn { font-weight: 800; color: ' + ['','#159dc6','#107998'][contrast] + '; }';
  1186. }
  1187. addStyle(prefix + fname,styles);
  1188. if (wmeFUinitialising) {
  1189. setTimeout(draggablePanel, 5000);
  1190. } else {
  1191. draggablePanel();
  1192. }
  1193. } else {
  1194. removeStyle(prefix + fname);
  1195. if (jQuery.ui) {
  1196. if ( $("#panel-container").hasClass('ui-draggable') ) {
  1197. $("#panel-container").draggable("destroy");
  1198. }
  1199. getId("panel-container").style = "";
  1200. }
  1201. }
  1202. window.dispatchEvent(new Event('resize'));
  1203. }
  1204.  
  1205. function draggablePanel() {
  1206. if (jQuery.ui) {
  1207. if ($("#panel-container").data("ui-draggable")) {
  1208. $("#panel-container").draggable({ handle: ".header" });
  1209. }
  1210. }
  1211. }
  1212.  
  1213. function enhanceChat() {
  1214. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1215. logit("function " + fname + " called", "debug");
  1216. var styles = "";
  1217. if (_cbEnhanceChat.checked) {
  1218. removeStyle(prefix + fname);
  1219. var contrast = _inpUIContrast.value;
  1220. var compress = _inpUICompression.value;
  1221. var mapX = getId('map').clientWidth;
  1222. var mapY = getId('map').clientHeight;
  1223. var chatX = Math.floor( mapX * 0.45);
  1224. var chatY = Math.floor( mapY * 0.5);
  1225. var chatHeaderY = [50,35,20][compress];
  1226. var chatMessageInputY = [39,31,23][compress];
  1227. var chatMessagesY = chatY - chatHeaderY - chatMessageInputY;
  1228. var chatUsersY = chatY - chatHeaderY;
  1229. //change chat width to 45% of map view
  1230. styles += '#chat-overlay { width: ' + chatX + 'px; min-width: 334px; }'; //14px added for Chat addon
  1231. styles += '#chat .messages { width: 70%; min-width: 200px;}';
  1232. styles += '#map.street-view-mode #chat .messages { width: 70%; }';
  1233. styles += '#chat .messages .message-list { margin-bottom: 0px; }';
  1234. styles += '#chat .messages .new-message { position: inherit; width: unset; }';
  1235. styles += '#map.street-view-mode #chat .messages .new-message { position: inherit; width: unset; }';
  1236. styles += '#chat .users { width: 30%; min-width: 120px; }';
  1237. styles += '#chat .messages .message-list .message.normal-message { max-width: unset; }';
  1238. //change chat height to 50% of map view
  1239. styles += '#chat .messages .message-list { min-height: ' + chatMessagesY + 'px; }';
  1240. styles += '#chat .users { max-height: ' + chatUsersY + 'px; }';
  1241. // #chat .messages .unread-messages-notification width=70%, bottom64px>
  1242. if (compress > 0) {
  1243. //do compression
  1244. //header
  1245. styles += '#chat .header { line-height: ' + chatHeaderY + 'px; }';
  1246. styles += '#chat .header .dropdown .dropdown-toggle { line-height: ' + ['','30px','19px'][compress] + '; }';
  1247. styles += '#chat .header button { line-height: ' + ['','20px','19px'][compress] + '; font-size: ' + ['','13px','11px'][compress] + '; height: ' + ['','20px','19px'][compress] + '; }';
  1248. //message list
  1249. styles += '#chat .messages .message-list { padding: ' + ['','9px','3px'][compress] + '; }';
  1250. styles += '#chat .messages .message-list .message.normal-message { padding: ' + ['','6px','2px'][compress] + '; }';
  1251. styles += '#chat .messages .message-list .message { margin-bottom: ' + ['','8px','2px'][compress] + '; line-height: ' + ['','16px','14px'][compress] + '; font-size: ' + ['','12px','11px'][compress] + '; }';
  1252. styles += '#chat .messages .new-message input { height: ' + chatMessageInputY + 'px; }';
  1253. //user list
  1254. styles += '#chat .users { padding: ' + ['','8px','1px'][compress] + '; }';
  1255. styles += '#chat ul.user-list a.user { padding: ' + ['','2px','1px'][compress] + '; }';
  1256. styles += '#chat ul.user-list a.user .rank { width: ' + ['','25px','20px'][compress] + '; height: ' + ['','20px','16px'][compress] + '; margin-right: ' + ['','3px','1px'][compress] + '; }';
  1257. styles += '#chat ul.user-list a.user .username { line-height: ' + ['','21px','17px'][compress] + '; }';
  1258. styles += '#chat ul.user-list a.user:hover .crosshair { margin-top: ' + ['','3px','1px'][compress] + '; right: ' + ['','3px','1px'][compress] + '; }';
  1259. //fix for WME Chat Addon
  1260. styles += '#chat .users > ul > li > a { margin: 0px !important; }';
  1261. }
  1262. if (contrast > 0) {
  1263. //header
  1264. styles += '#chat .header { color: black; background-color: ' + ['','#d9d9d9','#bfbfbf'][contrast] + '; }';
  1265. styles += '#chat .messages .message-list { background-color: ' + ['','#e8e8e8','lightgrey'][contrast] + '; }';
  1266. styles += '#chat .messages .message-list .message.normal-message { color: black; float: left; }';
  1267. styles += '#chat .messages .message-list .message.normal-message .from { color: dimgrey; font-weight: bold; font-style: italic; }';
  1268. styles += '#chat .messages .message-list .message.own-message .from { color: black; background-color: #a1dcf5; }';
  1269. //user message timestamps
  1270. styles += '#chat > div.chat-body > div.messages > div.message-list > div > div.from > span { color: ' + ['','dimgrey','black'][contrast] + ' !important; }';
  1271. //system message timestamps
  1272. styles += '#chat > div.chat-body > div.messages > div.message-list > div > div.body > div > span { color: ' + ['','dimgrey','black'][contrast] + ' !important; }';
  1273. //fix for WME Chat Addon
  1274. styles += '#chat .body > div { color: black !important; }';
  1275. }
  1276. //fix for Chat Addon timestamps running up against names
  1277. styles += '#chat > div.chat-body > div.messages > div.message-list > div > div.from > span { margin-left: 5px; }';
  1278. addStyle(prefix + fname,styles);
  1279. } else {
  1280. removeStyle(prefix + fname);
  1281. }
  1282. }
  1283.  
  1284. function narrowSidePanel() {
  1285. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1286. logit("function " + fname + " called", "debug");
  1287. var styles = "";
  1288. if (_cbNarrowSidePanel.checked) {
  1289. //sidebar width
  1290. styles += '.row-fluid #sidebar { width: 250px; }';
  1291. //map width
  1292. styles += '.show-sidebar .row-fluid .fluid-fixed { margin-left: 250px; }';
  1293. //user info tweaks
  1294. styles += '#sidebar #user-info #user-box { padding: 0 0 5px 0; }';
  1295. styles += '#sidebar #user-details { width: 250px; }';
  1296. styles += '#sidebar #user-details .user-profile .level-icon { margin: 0; }';
  1297. styles += '#sidebar #user-details .user-profile .user-about { max-width: 161px; }';
  1298. //gradient bars
  1299. styles += '#sidebar .tab-scroll-gradient { width: 220px; }';
  1300. styles += '#sidebar #links:before { width: 236px; }';
  1301. //feed
  1302. styles += '.feed-item .content { max-width: 189px; }';
  1303. //segment edit panel
  1304. styles += '#edit-panel .more-actions .waze-btn.waze-btn-white { width: 122px; }';
  1305. //tweak for WME Bookmarks
  1306. styles += '#divBookmarksContent .divName { max-width: 164px; }';
  1307. addStyle(prefix + fname, styles);
  1308. } else {
  1309. removeStyle(prefix + fname);
  1310. }
  1311. compressSegmentTab();
  1312. window.dispatchEvent(new Event('resize'));
  1313. }
  1314.  
  1315. function shiftAerials() {
  1316. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1317. logit("function " + fname + " called", "debug");
  1318. // calculate meters/pixel for current map view
  1319. var ipu = OL.INCHES_PER_UNIT;
  1320. var metersPerPixel = W.map.getResolution() * ipu.m / ipu[W.map.getUnits()];
  1321. // Apply the shift and opacity
  1322. W.map.baseLayer.div.style.left = Math.round(getId("_inpASX").value / metersPerPixel) + 'px';
  1323. W.map.baseLayer.div.style.top = Math.round(- getId("_inpASY").value / metersPerPixel) + 'px';
  1324. W.map.baseLayer.div.style.opacity = getId("_inpASO").value/100;
  1325. if (getId("_inpASX").value != 0 || getId("_inpASY").value != 0) {
  1326. getId("WMEFU_AS").style.display = "block";
  1327. } else {
  1328. getId("WMEFU_AS").style.display = "none";
  1329. }
  1330. //turn off Enhance Chat if WME Chat Fix is loaded
  1331. if (document.getElementById('WMEfixChat-setting')) {
  1332. if (_cbEnhanceChat.checked === true) {
  1333. alert("WME FixUI: Enhance Chat disabled because WME Chat UI Fix detected");
  1334. }
  1335. _cbEnhanceChat.checked = false;
  1336. }
  1337. }
  1338.  
  1339. function fixExternalProviders () {
  1340. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1341. logit("function " + fname + " called", "debug");
  1342. var styles = "";
  1343. if (_cbFixExternalProviders.checked) {
  1344. //enlarge external provider boxes
  1345. styles += '#edit-panel .external-providers-view .select2-container { width: 90%; margin-bottom: 2px; }';
  1346. styles += '.select2-container .select2-choice { height: inherit; line-height: 16px; }';
  1347. styles += '.select2-container .select2-choice>.select2-chosen { white-space: normal; }';
  1348. styles += '.placeId { padding-bottom: 5px; }';
  1349. addStyle(prefix + fname,styles);
  1350. } else {
  1351. removeStyle(prefix + fname);
  1352. }
  1353. }
  1354.  
  1355. function warnCommentsOff() {
  1356. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1357. logit("function " + fname + " called", "debug");
  1358. if (W.map.getLayerByUniqueName('mapComments').visibility === false) {
  1359. removeStyle(prefix + fname);
  1360. addStyle(prefix + fname, '.toolbar { background-color: #FFC107; }');
  1361. } else {
  1362. removeStyle(prefix + fname);
  1363. }
  1364. // extra bit because killNodeLayer will be inactive
  1365. getId("_btnKillNode").innerHTML = "Hide junction nodes";
  1366. getId("_btnKillNode").style.backgroundColor = "";
  1367. }
  1368.  
  1369. function adjustGSV() {
  1370. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1371. logit("function " + fname + " called", "debug");
  1372. var styles = "";
  1373. styles += '.gm-style { filter: contrast(' + getId('_inpGSVContrast').value + '%) ';
  1374. styles += 'brightness(' + getId('_inpGSVBrightness').value + '%) ';
  1375. if (getId('_cbGSVInvert').checked) {
  1376. styles += 'invert(1); }';
  1377. } else {
  1378. styles += 'invert(0); }';
  1379. }
  1380. removeStyle(prefix + fname);
  1381. addStyle(prefix + fname, styles);
  1382. }
  1383.  
  1384.  
  1385. function permalinkCheck() {
  1386. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1387. logit("function " + fname + " called", "debug");
  1388. //clear any further calls
  1389. clearTimeout(PLCheckTimer);
  1390. W.selectionManager.events.unregister("selectionchanged", null, permalinkCheck);
  1391. //create array of selected segment IDs
  1392. SMSegments = [];
  1393. if (W.selectionManager.getSelectedFeatures().length > 0) {
  1394. for (i=0; i<W.selectionManager.getSelectedFeatures().length; i++) {
  1395. SMSegments.push(W.selectionManager.getSelectedFeatures()[i].model.attributes.id.toString());
  1396. }
  1397. }
  1398. if (SMSegments.length == 0) {
  1399. //no selected segments - so we must have been called from the timeout
  1400. alert("WARNING FROM WME FixUI!\n\n" +
  1401. "You have opened a permalink with " + URLSegments.length + " segments, but no segments have " +
  1402. "been selected after 10 seconds.\n\n" +
  1403. "The permalink may contain segments not selectable at this zoom, or not " +
  1404. "visible on-screen, or some segment IDs may have been changed since the " +
  1405. "permalink was created.\n\n" +
  1406. "Or WME may just be loading very slowly.");
  1407. } else {
  1408. //Some selected segments - so we need to compare
  1409. for ( i = 0; i < URLSegments.length; i++) {
  1410. if (!SMSegments.includes(URLSegments[i])) {
  1411. //found a URL segment that isn't currently selected
  1412. //need to delay the warning so WME can display the selection
  1413. setTimeout(PLWarning, 1000);
  1414. break;
  1415. }
  1416. }
  1417. }
  1418. }
  1419.  
  1420. function PLWarning() {
  1421. alert("WARNING FROM WME FixUI!\n\n" +
  1422. "You have opened a permalink with " + URLSegments.length + " segments, but they do not match the " +
  1423. "segments now selected in WME.\n\n" +
  1424. "The permalink may contain segments not selectable at this zoom, " +
  1425. "or not visible on-screen, or some segment IDs may have been " +
  1426. "changed since the permalink was created.\n\n" +
  1427. "It is also possible no segments were selected when WME loaded " +
  1428. "and you have manually selected something.");
  1429. }
  1430.  
  1431. function moveChatIcon() {
  1432. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1433. logit("function " + fname + " called", "debug");
  1434. var styles = "";
  1435. if (_cbMoveChatIcon.checked) {
  1436. styles += '#chat-overlay { left: inherit !important; right: 30px !important; }';
  1437. styles += '#chat-overlay #chat-toggle { right: 0px !important; }';
  1438. addStyle(prefix + fname,styles);
  1439. } else {
  1440. removeStyle(prefix + fname);
  1441. }
  1442. }
  1443.  
  1444. function highlightInvisible() {
  1445. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1446. logit("function " + fname + " called", "debug");
  1447. var styles = "";
  1448. if (_cbHighlightInvisible.checked) {
  1449. styles += '#chat-overlay.visible-false #chat-toggle button { filter: none; background-color: #ff0000c0; }';
  1450. addStyle(prefix + fname,styles);
  1451. } else {
  1452. removeStyle(prefix + fname);
  1453. }
  1454. }
  1455.  
  1456. function darkenSaveLayer() {
  1457. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1458. logit("function " + fname + " called", "debug");
  1459. var styles = "";
  1460. if (_cbDarkenSaveLayer.checked) {
  1461. //don't publish without alteration!
  1462. styles += '#popup-overlay { background-color: dimgrey !important; }';
  1463. addStyle(prefix + fname,styles);
  1464. } else {
  1465. removeStyle(prefix + fname);
  1466. }
  1467. }
  1468.  
  1469. function swapRoadsGPS() {
  1470. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1471. logit("function " + fname + " called", "debug");
  1472. var styles = "";
  1473. if (_cbSwapRoadsGPS.checked) {
  1474. var roadLayerId = W.map.getLayerByUniqueName("roads").id;
  1475. var GPSLayerId = W.map.getLayerByUniqueName("gps_points").id;
  1476. var roadLayerZ = W.map.getLayerByUniqueName("roads").getZIndex();
  1477. var GPSLayerZ = W.map.getLayerByUniqueName("gps_points").getZIndex();
  1478. logit("Layers identified\n\tRoads: " + roadLayerId + "," + roadLayerZ + "\n\tGPS: " + GPSLayerId + "," + GPSLayerZ, "info");
  1479. styles += '#' + roadLayerId.replace(/\./g,"\\2e") + ' { z-index: ' + GPSLayerZ + ' !important; }';
  1480. styles += '#' + GPSLayerId.replace(/\./g,"\\2e") + ' { z-index: ' + roadLayerZ + ' !important; }';
  1481. addStyle(prefix + fname,styles);
  1482. } else {
  1483. removeStyle(prefix + fname);
  1484. }
  1485. }
  1486.  
  1487. function killNode() {
  1488. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1489. logit("function " + fname + " called", "debug");
  1490. getId(W.map.getLayerByUniqueName("nodes").id + "_root").style.display = "none";
  1491. getId("_btnKillNode").style.backgroundColor = "yellow";
  1492. getId("_btnKillNode").innerHTML = "Junction nodes hidden!";
  1493. }
  1494.  
  1495. function undarkenAerials() {
  1496. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1497. logit("function " + fname + " called", "debug");
  1498. var styles = "";
  1499. if (_cbUndarkenAerials.checked) {
  1500. styles += '.olTileImage { filter: none !important; }'; // for current production WME
  1501. styles += '.satellite-overlay { display: none !important; }'; //for current beta WME
  1502. addStyle(prefix + fname,styles);
  1503. } else {
  1504. removeStyle(prefix + fname);
  1505. }
  1506. }
  1507.  
  1508. function showMapBlockers() {
  1509. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1510. logit("function " + fname + " called", "debug");
  1511. var styles = "";
  1512. if (_cbShowMapBlockers.checked) {
  1513. styles += '.street-view-layer { background-color: rgba(255,0,0,0.3); }';
  1514. styles += '.live-user-marker { background-color: rgba(255,0,0,0.3); }';
  1515. styles += '#overlay-buttons { background-color: rgba(255,0,0,0.3); }';
  1516. addStyle(prefix + fname,styles);
  1517. } else {
  1518. removeStyle(prefix + fname);
  1519. }
  1520. }
  1521.  
  1522. function fixBridgeButton() {
  1523. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1524. logit("function " + fname + " called", "debug");
  1525. var styles = "";
  1526. if (_cbFixBridgeButton.checked) {
  1527. styles += '.add-bridge { margin-top: -41px; width: 36px; height: 30px; background-position: -2px -1px; } .add-bridge:hover { background-position: -42px 0px; }';
  1528. addStyle(prefix + fname,styles);
  1529. } else {
  1530. removeStyle(prefix + fname);
  1531. }
  1532. }
  1533.  
  1534. function disableBridgeButton() {
  1535. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1536. logit("function " + fname + " called", "debug");
  1537. var styles = "";
  1538. if (_cbDisableBridgeButton.checked) {
  1539. styles += '.add-bridge { pointer-events: none; opacity: 0.4; }';
  1540. addStyle(prefix + fname,styles);
  1541. } else {
  1542. removeStyle(prefix + fname);
  1543. }
  1544. }
  1545.  
  1546. function hideLinks() {
  1547. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1548. logit("function " + fname + " called", "debug");
  1549. var styles = "";
  1550. if (_cbHideLinks.checked) {
  1551. //Nuke the links at the bottom of the side panel
  1552. styles += '#sidebar waze-links { display: none; }';
  1553. //extend side panel to the bottom
  1554. styles += '#edit-panel { height: calc(100% + 25px); }';
  1555. addStyle(prefix + fname,styles);
  1556. } else {
  1557. removeStyle(prefix + fname);
  1558. }
  1559. }
  1560.  
  1561. function disableKinetic() {
  1562. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1563. logit("function " + fname + " called", "debug");
  1564. if (_cbDisableKinetic.checked) {
  1565. W.map.controls.find(control => control.dragPan).dragPan.kinetic = null;
  1566. } else {
  1567. W.map.controls.find(control => control.dragPan).dragPan.kinetic = kineticDragParams;
  1568. }
  1569. }
  1570.  
  1571. function disableScrollZoom() {
  1572. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1573. logit("function " + fname + " called", "debug");
  1574. if (_cbDisableScrollZoom.checked) {
  1575. W.map.navigationControl.disableZoomWheel();
  1576. } else {
  1577. W.map.navigationControl.enableZoomWheel();
  1578. }
  1579. }
  1580.  
  1581. function PSclicked() {
  1582. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1583. logit("function " + fname + " called", "debug");
  1584. if (W.selectionManager.getSelectedFeatures().length > 0) {
  1585. if (getId("user-info").style.display == "none") {
  1586. getId("user-info").style.display = "block";
  1587. } else {
  1588. getId("user-info").style.display = "none";
  1589. }
  1590. }
  1591. }
  1592.  
  1593. function PSicon() {
  1594. var fname = arguments.callee.toString().match(/function ([^\(]+)/)[1];
  1595. logit("function " + fname + " called", "debug");
  1596. if (W.selectionManager.getSelectedFeatures().length > 0) {
  1597. getId("WMEFUPS").style.color = "red";
  1598. } else {
  1599. getId("WMEFUPS").style.color = "lightgrey";
  1600. }
  1601. }
  1602.  
  1603. function addGlobalStyle(css) {
  1604. var head, style;
  1605. head = document.getElementsByTagName('head')[0];
  1606. if (!head) {
  1607. return;
  1608. }
  1609. style = document.createElement('style');
  1610. style.type = 'text/css';
  1611. style.innerHTML = css;
  1612. head.appendChild(style);
  1613. }
  1614.  
  1615. function addStyle(ID, css) {
  1616. var head, style;
  1617. head = document.getElementsByTagName('head')[0];
  1618. if (!head) {
  1619. return;
  1620. }
  1621. removeStyle(ID); // in case it is already there
  1622. style = document.createElement('style');
  1623. style.type = 'text/css';
  1624. style.innerHTML = css;
  1625. style.id = ID;
  1626. head.appendChild(style);
  1627. }
  1628.  
  1629. function removeStyle(ID) {
  1630. var style = document.getElementById(ID);
  1631. if (style) { style.parentNode.removeChild(style); }
  1632. }
  1633.  
  1634. function getElementsByClassName(classname, node) {
  1635. if(!node) { node = document.getElementsByTagName("body")[0]; }
  1636. var a = [];
  1637. var re = new RegExp('\\b' + classname + '\\b');
  1638. var els = node.getElementsByTagName("*");
  1639. for (var i=0,j=els.length; i<j; i++) {
  1640. if (re.test(els[i].className)) { a.push(els[i]); }
  1641. }
  1642. return a;
  1643. }
  1644.  
  1645. function getId(node) {
  1646. return document.getElementById(node);
  1647. }
  1648.  
  1649. function ChromeWarning () {
  1650. var m = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
  1651. var CV = ( m ? parseInt(m[2], 10) : false);
  1652. if (CV) {
  1653. if (CV <62) {
  1654. return '\nWARNING: OUTDATED CHROME VERSION ' + CV + ' DETECTED.\nSettings saving may not work properly and update notice\nwill probably appear every time WME FixUI runs.\n';
  1655. } else {
  1656. return '';
  1657. }
  1658. } else {
  1659. return '';
  1660. }
  1661. }
  1662.  
  1663. function logit(msg, typ) {
  1664. if (!typ) {
  1665. console.log(prefix + ": " + msg);
  1666. } else {
  1667. switch(typ) {
  1668. case "error":
  1669. console.error(prefix + ": " + msg);
  1670. break;
  1671. case "warning":
  1672. console.warn(prefix + ": " + msg);
  1673. break;
  1674. case "info":
  1675. console.info(prefix + ": " + msg);
  1676. break;
  1677. case "debug":
  1678. if (debug) {
  1679. console.warn(prefix + ": " + msg);
  1680. }
  1681. break;
  1682. default:
  1683. console.log(prefix + " unknown message type: " + msg);
  1684. break;
  1685. }
  1686. }
  1687. }
  1688.  
  1689. // Start it running
  1690. setTimeout(init1, 200);
  1691. })();