Skip to content

Instantly share code, notes, and snippets.

@asonas
Forked from haruta/chatwork-to-all-helper.user.js
Last active January 26, 2017 04:42
Show Gist options
  • Save asonas/5537938 to your computer and use it in GitHub Desktop.
Save asonas/5537938 to your computer and use it in GitHub Desktop.
Chatworkが新しくバージョンアップしたことによるDOM構造の追随を施した。 使い方とかは https://gist.github.com/haruta/4173983
// ==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