Skip to content

Instantly share code, notes, and snippets.

@float1251
Created November 18, 2015 02:05
Show Gist options
  • Save float1251/6128807843d4be21ab54 to your computer and use it in GitHub Desktop.
Save float1251/6128807843d4be21ab54 to your computer and use it in GitHub Desktop.
チャットワークの画像をスタンプ風に変換するchrome拡張機能
// 画像の編集ボタンを押すと自動で編集して、送信する
(function(){
if(location.host.search("www.chatwork.com") == -1){
// 他サイトなので処理しない
return
}
// TODO ON,OFF出来るようにする
setInterval(function(){
var textElem = document.getElementsByClassName("chatSendTextareaEdit");
if(textElem.length == 0){
return
}
var res = textElem[0].children[0].value.match((/\[preview id=\d* ht=\d*\]/))
if(res.length != 0){
// textを編集して、送信する
textElem[0].children[0].value = res[0].replace(/ht=\d*/, "ht=230");
document.getElementById("_sendButton").click();
}
}, 200)
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment