tkrkt
6/15/2017 - 3:42 PM

[userscript] [Qiita] link to user page by clicking username on Qiita's nortification

[userscript] [Qiita] link to user page by clicking username on Qiita's nortification

// ==UserScript==
// @name        [Qiita] User link on nortification
// @namespace   https://gist.github.com/tkrkt
// @description link to user page by clicking username on Qiita's nortification
// @include     http://qiita.com/*
// @version     1
// @grant       none
// ==/UserScript==

document.addEventListener('click', e => {
  if (e.target.matches('.globalNotificationContents_itemText .bold')) {
    const text = e.target.textContent.trim();
    if (text !== 'いいね') {
      e.preventDefault();
      e.stopPropagation();
      location.href = '/' + text;
    }
  }
});