Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tuantranf/4af08f19415432adb707 to your computer and use it in GitHub Desktop.
Save tuantranf/4af08f19415432adb707 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