Reddit - Add Removeddit links

Adds a Removeddit.com link to every comment and post

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

Bạn sẽ cần cài đặt một tiện ích mở rộng như Tampermonkey hoặc Violentmonkey để cài đặt kịch bản này.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name           Reddit - Add Removeddit links
// @icon           https://www.google.com/s2/favicons?domain=www.reddit.com
// @description    Adds a Removeddit.com link to every comment and post
// @author         Arudarin
// @version        1.0.1
// @namespace      Violentmonkey Scripts
// @match          *://*.reddit.com/r/*/comments/*
// @grant          GM_addStyle
// @run-at         document-start
// @require        https://unpkg.com/jquery@3/dist/jquery.min.js
// @require        https://greasyfork.org/scripts/7602-mutation-observer/code/mutation-observer.js
// ==/UserScript==

; ($ => {
  'use strict'

  // --------------------------------------------------------------------------

  const url = new URL(location.href)
  url.host = 'www.removeddit.com'

  const observer = new MutationSummary({
    callback(summaries) {
      $(summaries[0].added)
        .append(`
          <li>
              <a class="removeddit" href="${url}">
                removeddit
              </a>
          </li>
        `)
    },
    rootNode: document.body,
    queries: [
      { element: '.flat-list' }
    ]
  })

})(jQuery);

jQuery.noConflict(true);


/*  The old script, for future use
(function() {
'use strict';
  url = new URL(location.href);
  url.host = 'www.removeddit.com';
  
  $("ul.flat-list.buttons").append(`
    <li>
      <a class="removeddit" href="${url}">
              removeddit
      </a>
    </li>
  `);
}());
*/