Skip to content

Commit

Permalink
user message内のTagをクリックすることで、タグを購読などできるように。
Browse files Browse the repository at this point in the history
  • Loading branch information
uzulla committed Jun 13, 2012
1 parent 6f3481a commit 9456d04
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion public/js/connection.js
Expand Up @@ -276,8 +276,13 @@ function addTag(newtag){
//console.log(newtag); //console.log(newtag);
if(!data.tags[newtag]){ if(!data.tags[newtag]){
data.tags[newtag] = 0; data.tags[newtag] = 0;
} }
sendTags(); sendTags();

var re = new RegExp('#'+newtag+'( |$)', "i");
if(!$('#message').val().match(re)){
$('#message').val($('#message').val()+' #'+newtag);
}
} }


//send tag //send tag
Expand Down
5 changes: 5 additions & 0 deletions public/js/filter.js
Expand Up @@ -38,6 +38,11 @@ function user_message_filter(message){


message = message.replace(/\n/g, "<br />"); 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; return message;


} }

0 comments on commit 9456d04

Please sign in to comment.