Skip to content
Browse files

user message内のTagをクリックすることで、タグを購読などできるように。

  • Loading branch information...
1 parent 6f3481a commit 9456d04fddd9bcfbf59248adcafca420e88889f4 @uzulla uzulla committed
Showing with 11 additions and 1 deletion.
  1. +6 −1 public/js/connection.js
  2. +5 −0 public/js/filter.js
View
7 public/js/connection.js
@@ -276,8 +276,13 @@ function addTag(newtag){
//console.log(newtag);
if(!data.tags[newtag]){
data.tags[newtag] = 0;
- }
+ }
sendTags();
+
+ var re = new RegExp('#'+newtag+'( |$)', "i");
+ if(!$('#message').val().match(re)){
+ $('#message').val($('#message').val()+' #'+newtag);
+ }
}
//send tag
View
5 public/js/filter.js
@@ -38,6 +38,11 @@ function user_message_filter(message){
message = message.replace(/\n/g, "<br />");
+
+ message = message.replace(/#([a-zA-Z0-9]+)($| )/g, function(whole,s1) {
+ return( ' <span style="color:orange;font-weight:bold" onclick="addTag(\''+s1+'\')">#' + s1 + '</span> ' );
+ });
+
return message;
}

0 comments on commit 9456d04

Please sign in to comment.
Something went wrong with that request. Please try again.