magicspoiler.com link for scryfall

Adds a link to look for current Magic The Gathering card in http://www.magicspoiler.com/

当前为 2019-07-25 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         magicspoiler.com link for scryfall
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Adds a link to look for current Magic The Gathering card in http://www.magicspoiler.com/
// @require      http://code.jquery.com/jquery-latest.js
// @author       rightdroid
// @match        https://scryfall.com/card/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    let $ = jQuery,
    url = $(location).attr('href'),
    parts = url.split("/"),
    cardName = parts[parts.length-1],
    cardNamePretty = $('meta[property="og:title"]').attr('content'),
    constructedUrl = 'http://www.magicspoiler.com/mtg-spoiler/' + cardName,
    style = 'width:100%;height:100%;display:inline-block;position:relative;padding:5px;',
    btnText = 'MagicSpoiler lookup [' + cardNamePretty + ']',
    node = '<li class="button-n"><a href="' + constructedUrl +'" target="_blank" class="mspoiler-link" title="'+btnText+'">'+btnText+'</a></li>';

    $('.toolbox-column:first-of-type ul.toolbox-links').prepend(node);
    $('.mspoiler-link').css({
        'width' : '100%',
        'height' : '100%',
        'display' : 'inline-block',
        'position' : 'relative',
        'padding' : '5px',
        'overflow': 'hidden',
        'text-overflow' : 'ellipsis',
        'white-space' : 'nowrap',
    });
})();