WME Fix UI

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

当前为 2019-05-17 提交的版本,查看 最新版本

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