ハース翻訳

    @@ -5,6 +5,7 @@ * @include http://www.hearthhead.com/decks/* * @include http://hearthstone.metabomb.net/deck-guides/* * @include http://www.hearthstonetopdecks.com/decks/* + * @include https://tempostorm.com/hearthstone/decks/* * @license MIT License * @javascript_url */ @@ -63,6 +64,17 @@ var c = card.querySelector('span.card-count').textContent.trim(); cards.push([n, c]); } +} else if (href.startsWith('https://tempostorm.com/hearthstone/decks/')) { + deck_name = encodeURIComponent(document.title); + author = encodeURIComponent((document.querySelector('a.m-r-sm') || '?').textContent); + var cc = document.querySelectorAll('div.db-deck-card-name'); + var qq = document.querySelectorAll('div.db-deck-card-qty'); + for (var i = 0; i < cc.length; i++) { + var card = cc[i]; + var n = cc[i].textContent.trim(); + var c = qq[i].textContent.trim(); + cards.push([n, c]); + } } else { window.open('http://www.hearth.tokyo/unsupported'); } @@ -76,4 +88,4 @@ data = data + c_key + '=' + count + '&'; } var params = encodeURI(data); -//window.open('http://www.hearth.tokyo/translate?' + params); +window.open('http://www.hearth.tokyo/translate?' + params);
  • /*
     * @title ハース翻訳
     * @description ハースストーンのデッキを日本語に翻訳します。
     * @include http://www.hearthpwn.com/decks/*
     * @include http://www.hearthhead.com/decks/*
     * @include http://hearthstone.metabomb.net/deck-guides/*
     * @include http://www.hearthstonetopdecks.com/decks/*
     * @include https://tempostorm.com/hearthstone/decks/*
     * @license MIT License
     * @javascript_url
     */
    var deck_name, author;
    var cards = [];
    var href = window.location.href;
    if (href.startsWith('http://www.hearthpwn.com/decks/')) {
        deck_name = document.querySelector('h2.deck-title.tip').textContent;
        author = document.querySelector('#content section.user-details ul.user li.name a.tip').textContent.trim();
        var cc = document.querySelectorAll('table#cards tr td b a');
        for (var i = 0; i < cc.length; i++) {
            var card = cc[i];
            var c = card.getAttribute('data-count');
            var n = card.textContent.trim();
            cards.push([n, c]);
        }
    } else if (href.startsWith('http://www.hearthhead.com/decks/')) {
        deck_name = encodeURIComponent(window.HearthHeadData.deck.name);
        author = encodeURIComponent(window.HearthHeadData.deck.username);
        var cc = window.HearthHeadData.deck.cards;
        var set = new Set();
        for (var i = 0; i < cc.length; i++) {
            var card = cc[i];
            var n = card.name;
            if (set.has(n)) {
                cards.push([n, 2]);
                set.delete(n);
            } else {
                set.add(n);
            }
        }
        for (let name of set.values()) {
            cards.push([name, 1]);
        }
    } else if (href.startsWith('http://hearthstone.metabomb.net/deck-guides/')) {
        deck_name = encodeURIComponent(document.querySelector('h1.title').textContent.trim());
        author = encodeURIComponent(document.querySelector('i.fa-user + span').textContent);
        var cc = document.querySelectorAll('div.article-content section table tbody tr td');
        for (var i = 0; i < cc.length; i++) {
            var card = cc[i];
            var span = card.querySelector('span');
            if (span == null) {
                continue;
            }
            var n = card.querySelector('span').textContent.trim();
            var c = card.textContent.trim().substr(0, 1);
            cards.push([n, c]);
        }
    } else if (href.startsWith('http://www.hearthstonetopdecks.com/decks/')) {
        deck_name = encodeURIComponent(document.title);
        author = encodeURIComponent((document.querySelector('div.player-wrap h2 a') || '?').textContent);
        var cc = document.querySelectorAll('ul.deck-class li');
        for (var i = 0; i < cc.length; i++) {
            var card = cc[i];
            var n = card.querySelector('a span.card-name').textContent.trim();
            var c = card.querySelector('span.card-count').textContent.trim();
            cards.push([n, c]);
        }
    } else if (href.startsWith('https://tempostorm.com/hearthstone/decks/')) {
        deck_name = encodeURIComponent(document.title);
        author = encodeURIComponent((document.querySelector('a.m-r-sm') || '?').textContent);
        var cc = document.querySelectorAll('div.db-deck-card-name');
        var qq = document.querySelectorAll('div.db-deck-card-qty');
        for (var i = 0; i < cc.length; i++) {
            var card = cc[i];
            var n = cc[i].textContent.trim();
            var c = qq[i].textContent.trim();
            cards.push([n, c]);
        }
    } else {
        window.open('http://www.hearth.tokyo/unsupported');
    }
    var data = 'deck_name=' + deck_name + '&' + 'author=' + author + '&' + 'url=' + href + '&';
    for (i = 0; i < cards.length; i++) {
        var n_key = 'n' + i;
        var c_key = 'c' + i;
        var name = cards[i][0];
        var count = cards[i][1];
        data = data + n_key + '=' + name + '&';
        data = data + c_key + '=' + count + '&';
    }
    var params = encodeURI(data);
    window.open('http://www.hearth.tokyo/translate?' + params);
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2018/02/16 00:25:25 - 2018-02-16
  2. 2017/06/12 01:13:54 - 2017-06-12
  3. 2017/06/12 01:10:57 - 2017-06-12
  4. 2017/06/12 01:07:09 - 2017-06-12
  5. 2017/05/15 20:24:50 - 2017-05-15
  6. 2017/05/13 18:11:17 - 2017-05-13
  7. 2017/05/10 21:59:25 - 2017-05-10
  8. 2017/05/10 21:35:24 - 2017-05-10
  9. 2017/05/10 21:33:14 - 2017-05-10
  10. 2017/05/10 20:38:21 - 2017-05-10
  11. 2017/05/10 20:11:32 - 2017-05-10
  12. 2017/05/08 02:12:43 - 2017-05-08
  13. 2017/05/07 03:36:04 - 2017-05-07
  14. 2017/05/06 19:40:15 - 2017-05-06
  15. 2017/05/06 19:39:13 - 2017-05-06
  16. 2017/05/06 19:34:19 - 2017-05-06
  17. 2017/05/06 19:24:43 - 2017-05-06
  18. 2017/05/06 18:46:54 - 2017-05-06
  19. 2017/05/05 04:01:48 - 2017-05-05
  20. 2017/05/05 03:59:45 - 2017-05-05
  21. 2017/05/05 03:59:01 - 2017-05-05