MtG Stock EDH Rec Link Addition

Add link to EDHRec page of the card being viewed

  1. // ==UserScript==
  2. // @name MtG Stock EDH Rec Link Addition
  3. // @version 0.1
  4. // @description Add link to EDHRec page of the card being viewed
  5. // @author Peter Creutzberger
  6. // @match *://*.mtgstocks.com/prints/*
  7. // @grant none
  8. // @namespace https://www.mtgstocks.com/
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. addEDHRecLink();
  15.  
  16. function addEDHRecLink() {
  17. console.log('adding link');
  18. const cleanedName = document.getElementsByClassName('float-start')[0].innerText.split(' (')[0].replace(/\W+/g, '-').toLowerCase();
  19. document.getElementsByClassName('float-start')[0].innerHTML += `\t--\t<a href='https://edhrec.com/cards/${cleanedName}' target='_blank'>EDH Rec Link</a>`;
  20. }
  21.  
  22. })();