WME Fix UI

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

当前为 2019-09-30 提交的版本,查看 最新版本

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