Greasy Fork is available in English.

dアニメをちょっと使いやすく

試作段階

Ekde 2020/11/20. Vidu La ĝisdata versio.

// ==UserScript==
// @name         dアニメをちょっと使いやすく
// @namespace    http://tampermonkey.net/
// @version      0.2.1
// @description  試作段階
// @author       y_kahou
// @match        https://anime.dmkt-sp.jp/*
// @grant        none
// @noframes
// @require      http://code.jquery.com/jquery-1.12.4.min.js
// ==/UserScript==

var $ = window.jQuery;

function __css__() {/*
{* 90秒スキップボタン *}
button.seek90Button {
    color: white;
    height: 44px;
    margin: 5px 3px;
}
.seek90Button span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.seek90Button svg {
    fill: white;
}
#back90 svg {
    transform: scale(-1, 1);
}
*/}
function addStyle() {
    var css = (__css__).toString()
        .match(/[^]*\/\*([^]*)\*\/\}$/)[1]
        .replace(/\{\*/g, '/*')
        .replace(/\*\}/g, '*/');
    $('head').append(`<style id="mystyle" type="text/css">${css}</style>`)
}


(function() {
    'use strict';
    // Your code here...
    addStyle();

    var path = window.location.pathname.replace('/animestore/', '')

    // タグ検索ページ
    if (path == "tag_sel_pc") {
        $('h2').each((i, e) => {
            // 親要素クリックで子要素を表示
            $(e).on('click', (e) => {
                $(e.target).next().toggle();
            });
            $(e).css({'cursor': 'pointer'});

            var ul = $(e).next();
            ul.css({'display': 'none'});
            // 並べ替え
            ul.find('li').get()
                .map((e) => { return { dom: e, value: $(e).find('div').text() } })
                .sort((a, b) => { return a.value < b.value ? 1 : -1; })
                .forEach((v) => $(ul).append(v.dom))
        });
    }
    // 探すページ
    else if (path == "CF/search_index") {
        // タグ一覧へのリンク追加
        var tag = `
        <li id="tag">
            <a class="line2" href="/animestore/tag_sel_pc" style="background-color: #2fb6ff;">
                <span class="ui-clamp webkit2LineClamp">タグ一覧</span>
                <i class="icon iconCircleArrowBrownRight"></i>
            </a>
        </li>`
        $('ul.searchBtnGroup.clearfix').append($(tag));
    }
    // 再生ウインドウ
    else if (path == "sc_d_pc") {
        // 再生ウインドウのタイトルを変更
        window.onload = function() {
            var onchange = function() {
                console.log('タイトル更新');
                var t1 = $('.backInfoTxt1').text(), // アニメタイトル
                    t2 = $('.backInfoTxt2').text(), // 話数
                    t3 = $('.backInfoTxt3').text(); // サブタイ
                $('title').text(`${t1} ${t2} ${t3}`);
            }
            onchange();
            $('.backInfoTxt3').on('DOMSubtreeModified propertychange', onchange);
            
            
            var seek90 = `<button class="seek90Button">
                <span>90</span>
                <svg xmlns="http://www.w3.org/2000/svg" width="44" height="44" viewBox="0 0 26.458 26.458">
                <path d="M13.209 2.646A10.583 10.583 0 002.646 13.229a10.583 10.583 0 0010.583 10.583A10.583 10.583 0 0023.812 13.23H21.82a8.59 8.59 0 01-8.591 8.591 8.59 8.59 0 01-8.591-8.591 8.59 8.59 0 018.591-8.591V2.646a10.583 10.583 0 00-.02 0z"></path>
                <path d="M19.693 3.72l-6.464 2.811V.91z"></path>
                </svg>
            </button>`;
            var seek = (s) => $('video')[0].currentTime += s
            $(seek90).attr('id', 'skip90').on('click', () => seek(90)).appendTo('.skip .popupButtonWrap');
            $(seek90).attr('id', 'back90').on('click', () => seek(-90)).prependTo('.back .popupButtonWrap');
        }
    }
})();