WME Status Always Visible

After loading the page, makes sure your status is set to visible.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         WME Status Always Visible
// @namespace    https://greasyfork.org/en/users/1365511-robosphinx
// @version      2025.08.27.002
// @description  After loading the page, makes sure your status is set to visible.
// @copyright    2018, Magno (https://openuserjs.org/users/Magno, https://greasyfork.org/en/users/172473-magno)
// @license      MIT
// @author       MagnoBE, robosphinx
// @match        *://*.waze.com/*editor*
// @exclude      *://*.waze.com/user/editor*
// @grant        none
// @grant        GM_info
// ==/UserScript==

(function () {

  var CurrentVersion = GM_info.script.version;
  var VisibleVersionUpdateNotes = "WME Status Always Visible has been updated to " + CurrentVersion;
  VisibleVersionUpdateNotes += "\n\n" + "2025.08.27";
  VisibleVersionUpdateNotes += "\n" + "Updated to use button clicks instead of subscribing to events :/";

  VisibleVersionUpdateNotes += "\n" + "Will also keep you online without refresh";
  VisibleVersionUpdateNotes += "\n\n" + "2018.03.08";
  VisibleVersionUpdateNotes += "\n" + "Updated to use events instead of invoking button clicks";
  VisibleVersionUpdateNotes += "\n" + "Will also keep you online without refresh";

  VisibleVersionUpdateNotes += "\n\n" + "2018.02.26";
  VisibleVersionUpdateNotes += "\n" + "Initial Version";

  if (localStorage.getItem('WMEVisibleVersion') === CurrentVersion) {
    log("Version - " + CurrentVersion);
  }
  else {
    alert(VisibleVersionUpdateNotes);
    localStorage.setItem('WMEVisibleVersion', CurrentVersion);
  }

  function init(e) {
    // log("Getting e");
    if (e && e.user === null) {
      return;
    }

    // log("Getting W");
    if (typeof W === 'undefined') {
      setTimeout(init, 300);
    }

    // log("Getting loginManager");
    if (typeof W === 'undefined' ||
      typeof W.loginManager === 'undefined') {
      setTimeout(init, 100);
      return;
    }

    // log("Getting user");
    if (!W.loginManager.user) {
      W.loginManager.events.register("login", null, init);
      W.loginManager.events.register("loginStatus", null, init);
      if (!W.loginManager.user) {
        setTimeout(init, 300);
        return;
      }
    }

    // log("Getting online editors control");
    var onlineEditorsControl = $('.online-editors-bubble');
    if (onlineEditorsControl === null) {
      setTimeout(init, 300);
      return;
    }

    setStatusVisible();
  }

  init();

  var wasClosed = false;

  function setStatusVisible() {
      //log('Setting status to Visible');
      //log ("Getting editors list");
      if ($(".online-editors-list-wrapper").length === 0) {
          //log ("Editors list was closed.");
          wasClosed = true;
          $('.online-editors-bubble').click();
          setTimeout(setStatusVisible, 500);
          return;
      }

      //log ("Getting layer visibility");
      if ($(".turn-on-button").length === 1) {
          //log ("Layer is invisible.");
          $(".turn-on-button").click();
          //log ("Clicked \"Turn on\" button.");
          setTimeout(setStatusVisible, 500);
          return;
      }

      //log ("Getting editor visibility");
      if ($(".w-icon-invisible")) {
          //log ("Editor is invisible.");
          $(".w-icon-invisible").click();
          //log ("Clicked invisible icon.");
      }

      //log ("Returning editors list to previous state");
      if (wasClosed) {
          //log("Closing editors list.");
          $('.online-editors-bubble').click();
      }
      log('Status updated to Visible');
  }

  function log(message) {
    console.log('WME Visible: ' + message);
  }
})();