Forked from haruta/chatwork-to-all-helper.user.js
Last active
January 26, 2017 04:42
-
-
Save asonas/5537938 to your computer and use it in GitHub Desktop.
Chatworkが新しくバージョンアップしたことによるDOM構造の追随を施した。
使い方とかは https://gist.github.com/haruta/4173983
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name chatwork to all helper | |
// @match https://www.chatwork.com/* | |
// @version 1.2 | |
// ==/UserScript== | |
(function() { | |
document.getElementById('_chatText').addEventListener('blur', function(e){ | |
if (/[@@]{2}/.test(e.target.value)) { | |
var to_list = []; | |
var imgs = document.getElementById('_toList').getElementsByTagName('img'); | |
for (var i=0; i < imgs.length; i++) { | |
var id = imgs[i].dataset.aid | |
to_list.push("[To:" + id + "]") | |
} | |
e.target.value = e.target.value.replace(/[@@]{2}/, to_list.join(" ")); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment