Skip to content

Instantly share code, notes, and snippets.

@mpyw
Last active March 13, 2020 19:54
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpyw/240b40a9003cdc689f04941225033faa to your computer and use it in GitHub Desktop.
Save mpyw/240b40a9003cdc689f04941225033faa to your computer and use it in GitHub Desktop.
qiita_nonsense_lgtm_button_killer.user.js
// ==UserScript==
// @name Qiita Nonsense LGTM Button Killer
// @namespace https://github.com/mpyw
// @version 0.6
// @description Qiita の LGTM を倒す
// @author mpyw
// @match https://qiita.com/*
// @grant none
// ==/UserScript==
(() => {
const style = document.createElement('style');
style.textContent = `
.it-Footer_like button, .co-Item_like button {
background-color: transparent !important;
flex-shrink: 0;
}
.it-Footer_like button[style="background-color: rgb(85, 197, 0);"] {
background-color: rgb(85, 197, 0) !important;
color: rgb(255, 255, 255);
}
`;
document.head.appendChild(style);
for (const button of document.querySelectorAll('.it-Actions_item-like button, .it-Footer_like button, .co-Item_like button')) {
button.innerHTML = '<i class="fa fa-fw fa-thumbs-up"></i>';
}
for (const button of document.querySelectorAll('.it-Footer_like button')) {
button.insertAdjacentHTML('beforeend', '<span>Like</span>');
}
for (const svg of document.querySelectorAll('.it-Header_like svg')) {
const parent = svg.parentNode;
parent.removeChild(svg);
parent.insertAdjacentHTML('beforeend', '<i class="fa fa-fw fa-thumbs-up" style="font-size: 16px; color: #999"></i>');
}
const comments = document.getElementById('comments');
if (comments) {
new MutationObserver(() => {
for (const button of document.querySelectorAll('.co-Item_like button')) {
button.innerHTML = '<i class="fa fa-fw fa-3x fa-thumbs-up"></i>';
}
}).observe(comments, { childList: true });
}
})();
@hiromi-suzuki
Copy link

qiita_nonsense_lgtm_button_killer.user.js

ファイル名ww

@mpyw
Copy link
Author

mpyw commented Mar 13, 2020

ファイル名ww

LGTM 😎

@righteous-coder
Copy link

righteous-coder commented Mar 13, 2020

コメントのいいねボタンのborderが縦長になっているのとthums up アイコンが小さすぎると思ったので修正案です(あとstyle.innerHTMLからstyle.textContentに変えています).

(() => {
  const style = document.createElement('style');
  style.textContent = `
    .it-Footer_like button, .co-Item_like button {
      background-color: transparent !important;
      flex-shrink: 0;
    }
    .it-Footer_like button[style="background-color: rgb(85, 197, 0);"] {
      background-color: rgb(85, 197, 0) !important;
      color: rgb(255, 255, 255);
    }
  `;
  document.head.appendChild(style);

  for (const button of document.querySelectorAll('.it-Actions_item-like button, .it-Footer_like button, .co-Item_like button')) {
    button.innerHTML = '<i class="fa fa-fw fa-thumbs-up"></i>';
  }

  for (const button of document.querySelectorAll('.it-Footer_like button')) {
    button.insertAdjacentHTML('beforeend', '<span>Like</span>');
  }

  for (const svg of document.querySelectorAll('.it-Header_like svg')) {
    const parent = svg.parentNode;
    parent.removeChild(svg);
    parent.insertAdjacentHTML('beforeend', '<i class="fa fa-fw fa-thumbs-up" style="font-size: 16px; color: #999"></i>');
  }

  const comments = document.getElementById('comments');
  if (comments) {
    new MutationObserver(() => {
      for (const button of document.querySelectorAll('.co-Item_like button')) {
        button.innerHTML = '<i class="fa fa-fw fa-3x fa-thumbs-up"></i>';
      }
    }).observe(comments, { childList: true });
  }
})();

@mpyw
Copy link
Author

mpyw commented Mar 13, 2020

ありがとうございます!適用しておきます

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment