Skip to content

Instantly share code, notes, and snippets.

@ci7lus
Last active January 4, 2020 08:32
Show Gist options
  • Save ci7lus/95d2574e41d5852164196691ca2dfab5 to your computer and use it in GitHub Desktop.
Save ci7lus/95d2574e41d5852164196691ca2dfab5 to your computer and use it in GitHub Desktop.
Azure DevOps Commit Log Emoji Replacer
// ==UserScript==
// @name Azure DevOps Commit Log Emoji Replacer
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Azure DevOps コミットログ絵文字置換スクリプト
// @author kokoro
// @match https://dev.azure.com/*/_git/*/commits
// @grant none
// @require https://cdn.jsdelivr.net/npm/emoji-js@3.4.1/lib/emoji.min.js
// ==/UserScript==
(function() {
'use strict';
const emojiRegex = new RegExp(/\:([A-Za-z0-9_-]+)\:/);
const emoji = new EmojiConvertor();
setTimeout(() => {
Array.from(document.querySelectorAll("div.repos-commits-table-content > div > div > div")).map(message => {
const text = message.textContent;
const match = emojiRegex.exec(text);
if (match) {
const converted = emoji.replace_colons(match[0]);
message.textContent = text.replace(match[0], converted);
}
})
}, 100);
// Your code here...
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment