WME Fix UI

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

当前为 2018-04-25 提交的版本,查看 最新版本

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