WME Fix UI

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

当前为 2019-06-12 提交的版本,查看 最新版本

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