Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
v0.1.5 自分の名前をハードコードしていたのを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
mohno007 committed Dec 28, 2018
1 parent 1796e03 commit 97812b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typetalk-emoreact",
"version": "0.1.4",
"version": "0.1.5",
"description": "",
"scripts": {
"build": "rollup --config",
Expand Down
10 changes: 9 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ const mountEmoreact = messages => {
const typetalk = new Typetalk();
const actions_ = typetalkSideEffect(typetalk)(actions);

let myNameOpt = document.querySelector('.profile-content__name');
myNameOpt = myNameOpt && myNameOpt.textContent.match(/(.*) さん/);
myNameOpt = myNameOpt && myNameOpt[1];

if (!myNameOpt) return;

const myName = myNameOpt;

messages.forEach(message => {
const found = document.querySelector(`a[ng-href="${message.postUrl}"]`);

Expand All @@ -106,7 +114,7 @@ const mountEmoreact = messages => {
root,
view.reactions,
actions_,
createState(message, new User('Motohiro Ohno 👨🏻‍💻🦀'))
createState(message, new User(myName))
);
});
};
Expand Down

0 comments on commit 97812b3

Please sign in to comment.