[Request] Chat script

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.

Moderator: Unholy

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.

Re: [Request] Chat script

Postby bgodette » Tue Feb 18, 2014 5:25 am

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);
ImageImage
bgodette
Waze Global Champs
Waze Global Champs
 
Posts: 3194
Joined: Wed Jul 06, 2011 8:19 pm
Location: Denver, CO
Has thanked: 58 times
Been thanked: 361 times

Re: [Request] Chat script

Postby bgodette » Tue Feb 18, 2014 5:33 am

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.
ImageImage
bgodette
Waze Global Champs
Waze Global Champs
 
Posts: 3194
Joined: Wed Jul 06, 2011 8:19 pm
Location: Denver, CO
Has thanked: 58 times
Been thanked: 361 times

Re: [Request] Chat script

Postby orbitc » Fri Feb 14, 2014 7:07 pm

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?
Regional Coordinator for Northeast (DE, NJ, NY, PA) & New England (CT, ME, MA, NH, RI, VT)
CM: U.S.A. & T.C.
• ßeta Tester
• iOS: Always the latest Beta

Image
WME | Mentoring | AM | USA
orbitc
Map Raider
Map Raider
 
Posts: 4773
Joined: Mon Jun 25, 2012 1:51 pm
Location: NJ / NY, USA
Has thanked: 1171 times
Been thanked: 2359 times

Re: [Request] Chat script

Postby orbitc » Sat Feb 15, 2014 1:33 am

Agree with both...

That's probably the number one request.
Regional Coordinator for Northeast (DE, NJ, NY, PA) & New England (CT, ME, MA, NH, RI, VT)
CM: U.S.A. & T.C.
• ßeta Tester
• iOS: Always the latest Beta

Image
WME | Mentoring | AM | USA
orbitc
Map Raider
Map Raider
 
Posts: 4773
Joined: Mon Jun 25, 2012 1:51 pm
Location: NJ / NY, USA
Has thanked: 1171 times
Been thanked: 2359 times

[Request] Chat script

Postby petervdveen » Fri Feb 14, 2014 6:16 pm

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
 
Posts: 9028
Joined: Wed Mar 03, 2010 4:43 pm
Location: Netherlands
Has thanked: 345 times
Been thanked: 1086 times

Re: [Request] Chat script

Postby petervdveen » Fri Feb 14, 2014 11:04 pm

^^ Correct.
And also not losing the full history if you press permalink by mistake ;-)
petervdveen
 
Posts: 9028
Joined: Wed Mar 03, 2010 4:43 pm
Location: Netherlands
Has thanked: 345 times
Been thanked: 1086 times

Re: [Request] Chat script

Postby sketch » Fri Feb 14, 2014 10:26 pm

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
ALL US EDITORS READ: New USA road type guidance
new orleans based • detroit enthusiast • usa country manager
2013 ford focus titanium hatchback 5mt • performance blue
Image Image
sketch
Map Raider
Map Raider
 
Posts: 5212
Joined: Sat Aug 08, 2009 6:13 pm
Location: New Orleans, LA
Has thanked: 1028 times
Been thanked: 1352 times

Re: [Request] Chat script

Postby sketch » Wed Apr 09, 2014 1:36 am

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.
ALL US EDITORS READ: New USA road type guidance
new orleans based • detroit enthusiast • usa country manager
2013 ford focus titanium hatchback 5mt • performance blue
Image Image
sketch
Map Raider
Map Raider
 
Posts: 5212
Joined: Sat Aug 08, 2009 6:13 pm
Location: New Orleans, LA
Has thanked: 1028 times
Been thanked: 1352 times

Re: [Request] Chat script

Postby walbing » Wed Apr 09, 2014 1:19 am

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

Best regards.
Walther Bing - Walbing
Local Champ - Mentor Colombia
Image
walbing
Local Champ Mentor
Local Champ Mentor
 
Posts: 982
Joined: Wed Jun 13, 2012 10:57 pm
Has thanked: 1123 times
Been thanked: 426 times


Return to Addons, Extensions, and Scripts

Who is online

Users browsing this forum: No registered users

cron