WME Fix UI

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

当前为 2021-05-09 提交的版本,查看 最新版本

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