Reddit - Add Removeddit links

Adds a Removeddit.com link to every comment and post

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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>
  `);
}());
*/