WME Fix UI

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

当前为 2021-07-06 提交的版本,查看 最新版本

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