Discussion for the unofficial, community-developed addons, extensions and scripts built for the Waze Map Editor.

The official index of these tools is the Community Plugins, Extensions and Tools wiki page.

Post Reply
Forum rules
Discussion for the unofficial, community-developed addons, extensions and scripts built for the Waze Map Editor.

DO NOT START a new thread unless it is about a new idea. Keep discussion of existing tools within the main thread for that tool.

The official index of these tools is the Community Plugins, Extensions and Tools wiki page.

[Request] Chat script

Post by petervdveen
Does anyone know if it's maybe possible to create a chat script that makes it possible to chat outside wme?

Then you would have a possibility to have better notifications and a chat history.

Verstuurd vanaf mijn HTC Sensation Z710e met Tapatalk
petervdveen
Coordinators
Coordinators
Posts: 10370
Has thanked: 212 times
Been thanked: 847 times

POSTER_ID:213312

1

Send a message
Coordinator Waze Netherlands

Click here to sign-up for slack, our communication platform

Contact by email: NL - BE - Lux - Benelux

Post by bgodette
Proof of Concept:
Uses WME event system to receive chat messages, outputs them to console.
The objects it receives can be found in the W.model.chat.messages.models array.

Code: Select all

// ==UserScript==
// @name                WME Chat POC
// @description         Proof of concept of hooking into WME's chat.
// @include             https://*.waze.com/editor/*
// @include             https://*.waze.com/*/editor/*
// @include             https://editor-beta.waze.com/*
// @version             0.1
// ==/UserScript==

if ('undefined' == typeof __RTLM_PAGE_SCOPE_RUN__) {
  (function page_scope_runner() {
    // If we're _not_ already running in the page, grab the full source
    // of this script.
    var my_src = "(" + page_scope_runner.caller.toString() + ")();";

    // Create a script node holding this script, plus a marker that lets us
    // know we are running in the page scope (not the Greasemonkey sandbox).
    // Note that we are intentionally *not* scope-wrapping here.
    var script = document.createElement('script');
    script.setAttribute("type", "text/javascript");
    script.textContent = "var __RTLM_PAGE_SCOPE_RUN__ = true;\n" + my_src;

    // Insert the script node into the page, so it will run, and immediately
    // remove it to clean up.  Use setTimeout to force execution "outside" of
    // the user script scope completely.
    setTimeout(function() {
      document.body.appendChild(script);
      document.body.removeChild(script);
    }, 1000);
  })();

  // Stop running, because we know Greasemonkey actually runs us in
  // an anonymous wrapper.
  return;
}

WME_Chat_Version = "v0.1";
console.log("WME-Chat: " + WME_Chat_Version + " starting");

WME_Chat_newMessage = function(e) {
  var now = new Date();
  if (e.attributes.from.name) {
    console.log("Chat: ", now.toLocaleString(), e.attributes.from.name + ":", e.attributes.body); 
  } else {
    console.log("Chat: ", now.toLocaleString(), e.attributes.body); 
  }
}

WME_Chat_Init = function() {
  console.log("WME-Chat: Init");
  W.model.chat.messages.on("add", WME_Chat_newMessage, W.Presenter.Chat);
}

$(document).ready(WME_Chat_Init);
bgodette
Waze Global Champs
Waze Global Champs
Posts: 3441
Has thanked: 27 times
Been thanked: 257 times
Send a message

Post by bgodette
FYI that code isn't perfect but it's a starting point for someone. Specifically it doesn't handle updates to e.attributes.body which happens if there's no other talker between two separate chat lines from the same person. Fortunately there's events for that too.
bgodette
Waze Global Champs
Waze Global Champs
Posts: 3441
Has thanked: 27 times
Been thanked: 257 times
Send a message

Post by orbitc
petervdveen wrote:Does anyone know if it's maybe possible to create a chat script that makes it possible to chat outside wme?

Then you would have a possibility to have better notifications and a chat history.

Verstuurd vanaf mijn HTC Sensation Z710e met Tapatalk
Like Google hangout?
orbitc
Waze Global Champs
Waze Global Champs
Posts: 6576
Has thanked: 946 times
Been thanked: 4916 times
Send a message
Regional Coordinator for Northeast & New England
•Tier1 •USA Coordinator •Global Champ & Mentor
•iOS & WME ßeta Tester •Beacon, CCP & Wiki Master
•Master Raiders •Localization •Content Raider


USA | MapRaid!

Post by orbitc
Agree with both...

That's probably the number one request.
orbitc
Waze Global Champs
Waze Global Champs
Posts: 6576
Has thanked: 946 times
Been thanked: 4916 times
Send a message
Regional Coordinator for Northeast & New England
•Tier1 •USA Coordinator •Global Champ & Mentor
•iOS & WME ßeta Tester •Beacon, CCP & Wiki Master
•Master Raiders •Localization •Content Raider


USA | MapRaid!

Post by petervdveen
^^ Correct.
And also not losing the full history if you press permalink by mistake ;-)
petervdveen
Coordinators
Coordinators
Posts: 10370
Has thanked: 212 times
Been thanked: 847 times
Send a message
Coordinator Waze Netherlands

Click here to sign-up for slack, our communication platform

Contact by email: NL - BE - Lux - Benelux

Post by sketch
I imagine he means the WME chat, but in a separate window and with added functionality. So we could still talk to those who rely on WME chat without it blocking half the map.


Sent from my iPhone using Tapatalk 2
sketch
Waze Global Champs
Waze Global Champs
Posts: 6770
Has thanked: 1118 times
Been thanked: 1664 times
Send a message
ALL US EDITORS READ: New USA road type guidance
the guidance linked above is now almost a decade old, but the link gives me a laugh every time i see it, so it stays (:
assistant regional coordinator • south central region • usa
waze global champ • beta leader • and more • new orleans

bye bye fuelly badge! i'm an EV guy now!

Post by sketch
walbing wrote:Hi, right now there are any problems with the pop-up chat?

Best regards.
I have been having problems all day — specifically, the chat window does not load at all.

Normally I would direct you to report this problem to the WME feedback thread, but I believe that thread relates to the version which is available only on the North America server right now. Since you're experiencing it on the ROW server, apparently the editor itself is not the (only) problem.
sketch
Waze Global Champs
Waze Global Champs
Posts: 6770
Has thanked: 1118 times
Been thanked: 1664 times
Send a message
ALL US EDITORS READ: New USA road type guidance
the guidance linked above is now almost a decade old, but the link gives me a laugh every time i see it, so it stays (:
assistant regional coordinator • south central region • usa
waze global champ • beta leader • and more • new orleans

bye bye fuelly badge! i'm an EV guy now!

Post by walbing
Hi, right now there are any problems with the pop-up chat?

Best regards.
walbing
Emeritus Local Champ
Emeritus Local Champ
Posts: 1321
Has thanked: 1431 times
Been thanked: 935 times
Send a message
Walther Bing - Walbing