From 279ded6072f4691eed6a82d837c758a4f7000166 Mon Sep 17 00:00:00 2001 From: Jeff Arnold Date: Thu, 10 Jan 2013 15:26:25 -0500 Subject: [PATCH] Notify when we see our username or our name plus punctuation (imported from commit 158c78de264ef31f61670694764d025a773ae840) --- zephyr/static/js/notifications.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zephyr/static/js/notifications.js b/zephyr/static/js/notifications.js index 4e4c9290b3..4934b8c4e2 100644 --- a/zephyr/static/js/notifications.js +++ b/zephyr/static/js/notifications.js @@ -16,6 +16,7 @@ function browser_desktop_notifications_on () { exports.initialize = function () { names = fullname.split(" "); + names.push(email.split("@")[0]); $(window).focus(function () { window_has_focus = true; @@ -122,6 +123,7 @@ function speaking_at_me(message) { var content_lc = $('
').html(message.content).text().toLowerCase(); var match_so_far = false; var indexof, after_name, after_atname; + var punctuation = /[\.,-\/#!$%\^&\*;:{}=\-_`~()\+\?\[\]\s]/; if (domain === "mit.edu") { return false; @@ -141,9 +143,9 @@ function speaking_at_me(message) { after_name = content_lc.charAt(indexof + name.length); } if ((indexof === 0 && - (after_name === " " || after_name === ":")) || + after_name.match(punctuation) !== null) || (indexof > 0 && content_lc.charAt(indexof-1) === "@" && - (after_name === " " || after_name === ":"))) { + after_name.match(punctuation) !== null)) { if (match_so_far) { match_so_far = false; return false;