WebMoney PayButton

try to take over the world!

目前為 2017-06-03 提交的版本,檢視 最新版本

// ==UserScript==
// @name        WebMoney PayButton
// @namespace   http://tampermonkey.net/
// @version     1.0.2
// @description try to take over the world!
// @author      Bisumaruko
// @match       https://mini.wmtransfer.com/*
// @match       http://steamfarmkey.ru/*
// @match       http://steam1.lequeshop.ru/*
// @match       http://lastkey.ru/*
// @match       http://steamkeyswhosales.com/*
// @match       http://alfakeys.ru/*
// @match       http://cheap-steam-games.ru/*
// @icon        http://store.steampowered.com/favicon.ico
// ==/UserScript==

(function($) {
    'use strict';

    try {
        switch (location.host) {
            case 'mini.wmtransfer.com':
                if (location.href.includes('purses-view-history') && sessionStorage.getItem('wm_wmk')) window.close();
                if (location.pathname !== '/SendWebMoney.aspx') return;
                if (!location.search.length) return;

                try {
                    let search = location.href.split('?').pop(),
                        data = JSON.parse(decodeURIComponent(search));

                    if (!data.wm_wmk) return;

                    $('#ctl00_cph_tbEmailOrPurseNumber').val(data.purse);
                    $('#ctl00_cph_tbAmount').val(data.amount);
                    $('#ctl00_cph_tbDesc').val(data.desc);

                    sessionStorage.setItem('wm_wmk', 1);
                } catch (err) {
                    console.log(err);
                }
                break;
            case 'steamfarmkey.ru':
            case 'steamkeyswhosales.com':
            case 'alfakeys.ru':
                $('<span/>', {
                    'class': 'WM_WMK btn',
                    'text': 'Pay',
                    'style': 'margin-right: 10px;cursor: pointer;color: #FFF;background-color: #337ab7;border-color: #2e6da4;'
                }).
                on('click', payment).
                insertBefore('#check_pay');
                break;
            case 'cheap-steam-games.ru':
            case 'lastkey.ru':
                $('<span/>', {
                    'class': 'WM_WMK btn-leque btn-leque-primary btn-leque-xs',
                    'text': 'Pay',
                    'style': 'float: right;margin-top: 5px;'
                }).
                on('click', payment).
                insertAfter('.btn-leque-xs');
                break;
            case 'steam1.lequeshop.ru':
                $('<span/>', {
                    'class': 'WM_WMK btn btn-primary',
                    'text': 'Pay',
                    'style': 'margin-top: 10px;'
                }).
                on('click', payment).
                insertBefore('.checkpaybtn');
                break;
            default:
        }
    } catch (err) {
        console.log(err);
    }

    function payment() {
        let data = {wm_wmk: true};
        switch (location.host) {
            case 'steamfarmkey.ru':
            case 'steamkeyswhosales.com':
            case 'alfakeys.ru':
                data.purse = $('#purse > span').text();
                data.amount = $('#price > span').text();
                data.desc = $('#message > span').text();
                break;
            case 'cheap-steam-games.ru':
            case 'lastkey.ru':
            case 'steam1.lequeshop.ru':
                data.purse = $('#copyfund > b').text();
                data.amount = parseFloat($('.payprice').text());
                data.desc = $('#copybill > b').text();
                break;
            default:
        }

        window.open(
            'https://mini.wmtransfer.com/SendWebMoney.aspx?' + JSON.stringify(data),
            '',
            'height=800,width=1000'
        );
    }

})(jQuery);