Skip to content

Instantly share code, notes, and snippets.

@MSakamaki
Created February 7, 2015 15:04
Show Gist options
  • Save MSakamaki/ae570e0d68d2451f613f to your computer and use it in GitHub Desktop.
Save MSakamaki/ae570e0d68d2451f613f to your computer and use it in GitHub Desktop.
FaceBookMessange MemoTool
(function(){
var id = 'nikukyu';
sessionStorage.setItem(id, JSON.stringify({msg:[]}));
var makebtn = function(){
var btn = document.createElement("button");
btn.innerText = "メモAdd";
btn.onclick=function(e){
var ary = JSON.parse(sessionStorage.getItem(id)).msg;
var msg =e.srcElement.parentElement.querySelector('.clearfix').innerText;
ary.push(msg);
sessionStorage.setItem(id, JSON.stringify({msg:ary}));
e.srcElement.textContent = 'Done';
e.srcElement.disabled = false;
window.test = e.srcElement;
}
return btn;
};
var dom = document.querySelectorAll('.webMessengerMessageGroup');
Object.keys(dom).forEach(function(key){
dom[key].appendChild(makebtn());
});
document.querySelector('#js_q').appendChild((function(){
var btn = document.createElement("button");
btn.innerText = "CALL MESSAGE";
btn.onclick=function(e){
var ary = JSON.parse(sessionStorage.getItem(id)).msg;
ary.forEach(function(data){
console.log(data);
})
}
return btn;
})());
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment