korndaweizen / edhrec: link to mkm

// ==UserScript==
// @name         edhrec: link to mkm
// @description  edhrec.com
// @version      1.0.2
// @grant        none
// @icon         https://edhrec.com/favicon.ico
// @updateUrl    https://openuserjs.org/install/korndaweizen/edhrec_link_to_mkm.user.js
// @license      MIT
// @require      https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js
//
// @include      https://edhrec.com*
//
// ==/UserScript==

(function () {

    'use strict';

    var link,
        url = ((navigator.language || navigator.userLanguage) === 'de' ? 'http://www.magickartenmarkt.de' : 'http://www.magiccardmarket.eu'),
        query = '/?mainPage=showSearchResult&searchFor=',
        list = $('.nw > div.nwname');
    list.each(function(){
        var jqContext=$(this);
        var cardname =jqContext.text()
        jqContext.text("");
        var href = url + query + cardname + '&redirect=true';

        jqContext.siblings('.card').first().find('.hiddenprice > a').attr('href',href).attr('title',href);
        jqContext.append(($('<a target="_blank">'+cardname+'</a>').attr('href',href).attr('title',href)));
    })

})();