Greasy Fork is available in English.

Typing Tube MOD 2

try to take over the world!

スクリプトをインストール?
作者が勧める他のスクリプト

RealTimeCombatting[Typing-Tube]も気に入るかもしれません。

スクリプトをインストール
質問やレビューの投稿はこちらへ、スクリプトの通報はこちらへどうぞ。
// ==UserScript==
// @name         Typing Tube MOD 2
// @namespace    https://typing-tube.net/
// @version      3.20
// @description  try to take over the world!
// @author       Toshi
// @match        https://typing-tube.net/movie/show/*
// @noframes
// @run-at document-end
// ==/UserScript==

/////////////////////////////////////////////////////////////////////////////////////////////////
/**
*@ロード時に読み込むもの ここから ---
*/
var timeoutID;
var skipID;
var ranking = false;

//初期音量25固定表示
$('#volume').html(25);

//プレイエリアにCombo数表示を追加。(HTML内1596行目の#comboを使用)
//$('<div id="combo" style="height:13px;position: relative;left: 3px"> </div>').insertBefore('#bar_base')

//playersetting()を発火
$(window).on('load', function () {
  timeoutID = window.setTimeout(playersetting, 300);
})

function playersetting(){
//初期音量25固定(好きな音量に変更)
    player.setVolume(25);
//ページ読み込み時に自動再生(コメントを外して使用可能)
//  mode='kana';player.playVideo()
//ミス表示で使用するCSSを追加
var stylesheet = document.styleSheets.item(0)
    stylesheet.insertRule("[data-kana]{    position: relative;}", 1);
    stylesheet.insertRule("[data-roma]{    position: relative;}", 2);
}


/**
*@ロード時に読み込むもの ここまで---
*/
/////////////////////////////////////////////////////////////////////////////////////////////////



/////////////////////////////////////////////////////////////////////////////////////////////////
/**
*@プレイ中の処理変更 ここから ---
*/

// プレイ中のタイプイベント
$(window).keydown(function(e){
    //Escでポーズ・再生(プレイ開始のショートカットキーとしても使用可)
if(event.keyCode == 27) {
    player.pauseVideo()
if(event.preventDefault) {
    event.preventDefault();
          }
if(event.keyCode == 27 && player.pauseVideo())
    player.playVideo()
if(event.preventDefault) {
    event.preventDefault();
}
}
    // プレイ中であれば有効
    if (is_played) {
        //F10で倍速
        if(event.keyCode ==121) {
            speedup();
            event.preventDefault();
        }else if(event.keyCode ==9) {
            event.preventDefault();
        } else if (next_char[0] == '' && event.keyCode == 32) {
        //ラインクリア・間奏中、スペースキーで一瞬skip = ON
            toggle_skip();
            skipID = window.setTimeout(toggle_skip, 20);
        } else if($("#score") && event.keyCode == 13 && !ranking){
            submit_score();
            ranking = true;
        }
        // 入力ラインの描画アップデート
        updateLineView();
    }
});

//プレイ時のCSS変更
$(".col-8").css({'cssText':'flex: 0 0 69.66667%;'+'max-width: 69.66667%;'});
$(".col-4").css({'cssText':'flex: 0 0 30.33333%;'+'max-width: 30.33333%;'});
$("#status").css({'cssText':'font-size:1.4rem;'});

var misslinetype = 0;
var miss = false;
// 歌詞が更新されたら入力ラインをアップデート
// ref. https://risaki-masa.com/function-for-observing-variable-with-js/
function observe( interval, onGet, onChanged ) {
    let     previousValue   = onGet();
    const   onObserve       = function() {
        const VALUE = onGet();
        if ( previousValue === VALUE ) return;

        onChanged( VALUE );
        previousValue = VALUE;
    };

    setInterval( onObserve, interval );
}
const INTERVAL  = 0;
const onGet     = function() { return count; };
const onChanged = function() { updateLineView();};

observe( INTERVAL, onGet, onChanged );


function updateLineView() {
    if (!$("#kashi_sub")[0]) {
        // DOM要素がない場合は初期化
        $("#kashi_roma").after($("<div>").attr('id', 'kashi_sub'));

        // モードによって出力を変更
        // わかりにくいけど #kashi_roma = main #kashi_sub = sub
        if (mode == 'roma') {
           $("#kashi_roma").addClass("roma_input_dom");
           $("#kashi_sub").addClass("kana_input_dom");
        //CSS変更
           $("#kashi_roma").css({'cssText': 'color:#FFF!important;' + 'margin-bottom: 0 !important;' + 'font-size:17.5px;'+ 'word-break: break-all;'});
           $("#kashi_sub").css({'cssText': 'color:#FFF;' + 'font-size:17.5px;' + 'font-weight:600;' + 'word-break: break-all;'});
           $("#kashi_area").css({'cssText': 'font-family:"メイリオ", "Meiryo", sans-serif!important;'});


        } else {
           $("#kashi_sub").addClass("roma_input_dom");
           $("#kashi_roma").addClass("kana_input_dom");
        //CSS変更
           $("#kashi_roma").css({'cssText': 'color:#FFF!important;' + 'margin-bottom: 0 !important;'+ 'font-size:17.5px;'+'word-break: break-all;'});
           $("#kashi_sub").css({'cssText': 'color:#FFF;' + 'font-size:17.5px;' + 'font-weight:600;' + 'text-transform:uppercase;' + 'word-break: break-all;'});
           $("#kashi_area").css({'cssText': 'font-family:"メイリオ", "Meiryo", sans-serif!important;'});

        }
    }

    if (is_played) {
        // 先頭を赤くする処理
        var kashi_kana_html = "<span style='color:#919395;'>"+already_input.replace(/ /g, '⎽')+"</span>"+"<span style='color:#FF0000;' data-kana='・'>" + String(next_char[0] || []) + '</span>' +  String(line_input_kana.join('').replace(/ /g, '  '));
        var kashi_roma_html = "<span style='color:#919395;'>"+already_input_roma.replace(/ /g, '⎽')+"</span>" + String(next_char[1] || '').replace(/(.)(\S*)/, "<span style='color:#FF0000;'  data-roma='・'>$1</span>$2") + String(line_input_roma.join(''));

        // DOMに表示

        $(".roma_input_dom").html(kashi_roma_html);
        $(".kana_input_dom").html(kashi_kana_html);

         if (already_input.length == 0) {
fired = true;
         }
if(already_input.length == 0  && miss && misslinetype == 0 ) {//最初にミスした
misslinetype = 1
}else if(already_input.length >= 1 && miss) {//途中でミスした
misslinetype = 2
}
if(already_input.length == 0 && miss && misslinetype == 2) {//途中でミスをしてライン通過したのでミス表示ミスフラグ初期化
        misslinetype = 0
        miss = false;
    var stylesheet = document.styleSheets.item(0)
        stylesheet.deleteRule(0);
}else if(already_input.length == 0 && !miss && misslinetype == 2) {//ミスをして、立て直してライン通過したのでミスフラグのみ初期化
        misslinetype = 0
}
}
}



//#status変更(update_status関数を上書き)
function evalInPage(fun) {
  location.href = "javascript:void (" + fun + ")()";
}
evalInPage(function () {

update_status = function(){
let correct = typing_count / (typing_miss_count + typing_count) * 100.0;
let linecorrect = complete_count / (failer_count + complete_count) * 100.0;
if (isNaN(correct)) {
          correct = 0;
}
if (isNaN(linecorrect)) {
          linecorrect = 100;
}

$("#status").html((Math.floor(parseInt(score)/20)/100).toFixed(2)+"<br>"+typing_miss_count+" miss<br>"+combo+"/"+max_combo+" combo<br>"+ typing_count + "/" + (200000 / score_per_char).toFixed(0) + "打 " + correct.toFixed(1) + "%<br>"+complete_count + " clear"+ " ["+(typing_array.filter( v => !!( '' + v )).length-failer_count)+"] "+linecorrect.toFixed(0)+"%");
update_skip();

}
})

//打鍵音
var key_type;
var miss_type;
var clear_type;
var combo_break;
var combo100 = false;
var fired = true;

document.onkeypress =
    (function type_se(e) {
    if(is_played && !finished){
var stylesheet = document.styleSheets.item(0);
if (combo && next_char[0] != '') {
    key_type = new Audio();
    key_type.volume = 0.81
    key_type.preload = "auto";
    key_type.src = "https://typing.twi1.me/media/typing-js/type.mp3";
    key_type.play()
    fired = true;

}else if(fired && completed){
    fired = false;
    clear_type = new Audio();
    clear_type.volume = 0.49
    clear_type.preload = "auto";
    clear_type.src = "http://www.kurage-kosho.info/mp3/button68.mp3";
    clear_type.play()
}
if(miss_combo && next_char[0] != '') {
    miss_type = new Audio();
    miss_type.preload = "auto";
    miss_type.volume = 0.6
    miss_type.src = "https://typing.twi1.me/media/typing-js/miss-new.mp3";
    miss_type.play();
}
if(miss_combo && next_char[0] != '' && combo100){
    combo_break = new Audio();
    combo_break.preload = "auto";
    combo_break.volume = 0.1
    combo_break.src = "https://osuskinner.com/elements/sounds/combo-break/1/76941.wav";
    combo_break.play();
    miss_type.play();
    combo100 = false;
}
if(combo > 100){
    combo100 = true;
}
    }
});
//スペースキーの打鍵音
document.onkeydown =
    (function space_se(e) {
    if(!finished){
var stylesheet = document.styleSheets.item(0);

if (combo && next_char[0] != '' && event.keyCode == 32) {
    key_type = new Audio();
    key_type.volume = 0.81
    key_type.preload = "auto";
    key_type.src = "https://typing.twi1.me/media/typing-js/type.mp3";
    key_type.play();
}
if(combo == 1 && miss){//立て直したのでミス表示削除
    miss = false;
    stylesheet.deleteRule(0);

}
if(miss_combo && next_char[0] != '' && event.keyCode == 32) {
    miss_type = new Audio();
    miss_type.preload = "auto";
    miss_type.volume = 0.6
    miss_type.src = "https://typing.twi1.me/media/typing-js/miss-new.mp3";
    miss_type.play();
}
if(next_char[0] != '' && event.keyCode == 32) {
    miss_type = new Audio();
    miss_type.volume = 0.6
    miss_type.preload = "auto";
    miss_type.src = "https://typing.twi1.me/media/typing-js/miss-new.mp3";
    miss_type.play();
}
//ミス表示を追加
if (mode == 'kana') {
if(miss_combo && !miss && next_char[1][0] != ''){
        miss = true;
    if(next_char[0][0].match(/[\u3042\u3044\u3046\u3048\u304a-\u3062\u3064-\u3082\u3084\u3086\u3088-\u3094\u0025\u30FC\uFF5E]+$/)){//全角全角数字%
    stylesheet.insertRule("[data-kana]::before{    content: attr(data-kana);position: absolute;top: -.49em;left: -2px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[0][0].match(/[\u3041\u3043\u3045\u3047\u3049\u3063\u3083\u3085\u3087]+$/)){//ぁぃぅぇぉっゃゅょ
    stylesheet.insertRule("[data-kana]::before{    content: attr(data-kana);position: absolute;top: -.49em;left: -3.2px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[0][0].match(/[\u006E\u0070\u0071\u0075\u0026\u0067\u006B]+$/)){//npqu&gk
    stylesheet.insertRule("[data-kana]::before{    content: attr(data-kana);position: absolute;top: -.49em;left: -5.4px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[0][0].match(/[\u0063\u0064\u0065\u006F\u0068\u0062\u0054]+$/)){//cdeogT
    stylesheet.insertRule("[data-kana]::before{    content: attr(data-kana);position: absolute;top: -.49em;left: -5.9px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[0][0].match(/[\u0078\u0079\u0061]+$/)){//xya
    stylesheet.insertRule("[data-kana]::before{    content: attr(data-kana);position: absolute;top: -.49em;left: -6.2px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[0][0].match(/[\u003F\u0076\u0072\u0073\u007A]+$/)){//?vsrz
    stylesheet.insertRule("[data-kana]::before{    content: attr(data-kana);position: absolute;top: -.49em;left: -6.7px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[0][0].match(/[\u006A\u0066\u0074]+$/)){//jft
    stylesheet.insertRule("[data-kana]::before{    content: attr(data-kana);position: absolute;top: -.49em;left: -7.7px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[0][0].match(/[\u0021]+$/)){//!
    stylesheet.insertRule("[data-kana]::before{    content: attr(data-kana);position: absolute;top: -.49em;left: -8.2px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[0][0].match(/[\u002C\u002E\s]+$/)){//,.半角スペース
    stylesheet.insertRule("[data-kana]::before{    content: attr(data-kana);position: absolute;top: -.49em;left: -8.5px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[0][0].match(/[\u0027\u0069\u006C]+$/)){//'il
    stylesheet.insertRule("[data-kana]::before{    content: attr(data-kana);position: absolute;top: -.49em;left: -9.2px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[0][0].match(/[\u006D\uFF10-\uFF19]+$/)){//全角数字m
    stylesheet.insertRule("[data-kana]::before{    content: attr(data-kana);position: absolute;top: -.49em;left: -2.8px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[0][0].match(/[\u0077\u004D]+$/)){//wM
    stylesheet.insertRule("[data-kana]::before{    content: attr(data-kana);position: absolute;top: -.49em;left: -4px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[0][0].match(/[\u0041-\u0044\u004B\u004C\u0052\u0055]+$/)){//ABCDKLRU
    stylesheet.insertRule("[data-kana]::before{    content: attr(data-kana);position: absolute;top: -.49em;left: -5.3px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[0][0].match(/[\u0045\u0046\u0050\u0059\u005A\u0030-\u0039]$/)){//EFYZ半角01234566789
    stylesheet.insertRule("[data-kana]::before{    content: attr(data-kana);position: absolute;top: -.49em;left: -5.8px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[0][0].match(/[\u0047\u0048\u004E\u0051]+$/)){//GHNQ
    stylesheet.insertRule("[data-kana]::before{    content: attr(data-kana);position: absolute;top: -.49em;left: -4.7px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[0][0].match(/[\u0049\u004A]+$/)){//IJ
    stylesheet.insertRule("[data-kana]::before{    content: attr(data-kana);position: absolute;top: -.49em;left: -7.3px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[0][0].match(/[\u004F]+$/)){//O
    stylesheet.insertRule("[data-kana]::before{    content: attr(data-kana);position: absolute;top: -.49em;left: -5px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[0][0].match(/[\u0053\u0056\u0058\u002F]+$/)){//SVX/
    stylesheet.insertRule("[data-kana]::before{    content: attr(data-kana);position: absolute;top: -.49em;left:-5.5px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[0][0].match(/[\u0057]+$/)){//W
    stylesheet.insertRule("[data-kana]::before{    content: attr(data-kana);position: absolute;top: -.49em;left: -2.7px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[0][0].match(/[\u002D]+$/)){//-
    stylesheet.insertRule("[data-kana]::before{    content: attr(data-kana);position: absolute;top: -.49em;left: -7.9px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}
}
}
if (mode == 'roma') {
if(miss_combo && !miss && next_char[1][0] != ''){
        miss = true;
if(next_char[1][0].match(/[\u3042\u3044\u3046\u3048\u304a-\u3062\u3064-\u3082\u3084\u3086\u3088-\u3094\u0025\u30FC\uFF5E]+$/)){//全角全角数字%
    stylesheet.insertRule("[data-roma]::before{    content: attr(data-roma);position: absolute;top: -.49em;left: -2px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[1][0].match(/[\u3041\u3043\u3045\u3047\u3049\u3063\u3083\u3085\u3087]+$/)){//ぁぃぅぇぉっゃゅょ
    stylesheet.insertRule("[data-roma]::before{    content: attr(data-roma);position: absolute;top: -.49em;left: -3.2px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[1][0].match(/[\u006E\u0070\u0071\u0075\u0026\u0067\u006B]+$/)){//npqu&gk
    stylesheet.insertRule("[data-roma]::before{    content: attr(data-roma);position: absolute;top: -.49em;left: -5.4px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[1][0].match(/[\u0063\u0064\u0065\u006F\u0068\u0062\u0054]+$/)){//cdeogT
    stylesheet.insertRule("[data-roma]::before{    content: attr(data-roma);position: absolute;top: -.49em;left: -5.9px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[1][0].match(/[\u0078\u0079\u0061]+$/)){//xya
    stylesheet.insertRule("[data-roma]::before{    content: attr(data-roma);position: absolute;top: -.49em;left: -6.2px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[1][0].match(/[\u003F\u0076\u0072\u0073\u007A]+$/)){//?vsrz
    stylesheet.insertRule("[data-roma]::before{    content: attr(data-roma);position: absolute;top: -.49em;left: -6.7px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[1][0].match(/[\u006A\u0066\u0074]+$/)){//jft
    stylesheet.insertRule("[data-roma]::before{    content: attr(data-roma);position: absolute;top: -.49em;left: -7.7px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[1][0].match(/[\u0021]+$/)){//!
    stylesheet.insertRule("[data-roma]::before{    content: attr(data-roma);position: absolute;top: -.49em;left: -8.2px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[1][0].match(/[\u002C\u002E\s]+$/)){//,.半角スペース
    stylesheet.insertRule("[data-roma]::before{    content: attr(data-roma);position: absolute;top: -.49em;left: -8.5px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[1][0].match(/[\u0027\u0069\u006C]+$/)){//'il
    stylesheet.insertRule("[data-roma]::before{    content: attr(data-roma);position: absolute;top: -.49em;left: -9.2px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[1][0].match(/[\u006D\uFF10-\uFF19]+$/)){//全角数字m
    stylesheet.insertRule("[data-roma]::before{    content: attr(data-roma);position: absolute;top: -.49em;left: -2.8px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[1][0].match(/[\u0077\u004D]+$/)){//wM
    stylesheet.insertRule("[data-roma]::before{    content: attr(data-roma);position: absolute;top: -.49em;left: -4px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[1][0].match(/[\u0041-\u0044\u004B\u004C\u0052\u0055]+$/)){//ABCDKLRU
    stylesheet.insertRule("[data-roma]::before{    content: attr(data-roma);position: absolute;top: -.49em;left: -5.3px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[1][0].match(/[\u0045\u0046\u0050\u0059\u005A\u0030-\u0039]$/)){//EFYZ半角01234566789
    stylesheet.insertRule("[data-roma]::before{    content: attr(data-roma);position: absolute;top: -.49em;left: -5.8px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[1][0].match(/[\u0047\u0048\u004E\u0051]+$/)){//GHNQ
    stylesheet.insertRule("[data-roma]::before{    content: attr(data-roma);position: absolute;top: -.49em;left: -4.7px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[1][0].match(/[\u0049\u004A]+$/)){//IJ
    stylesheet.insertRule("[data-roma]::before{    content: attr(data-roma);position: absolute;top: -.49em;left: -7.3px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[1][0].match(/[\u004F]+$/)){//O
    stylesheet.insertRule("[data-roma]::before{    content: attr(data-roma);position: absolute;top: -.49em;left: -5px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[1][0].match(/[\u0053\u0056\u0058\u002F]+$/)){//SVX/
    stylesheet.insertRule("[data-roma]::before{    content: attr(data-roma);position: absolute;top: -.49em;left:-5.5px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[1][0].match(/[\u0057]+$/)){//W
    stylesheet.insertRule("[data-roma]::before{    content: attr(data-roma);position: absolute;top: -.49em;left: -2.7px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}else if(next_char[1][0].match(/[\u002D]+$/)){//-
    stylesheet.insertRule("[data-roma]::before{    content: attr(data-roma);position: absolute;top: -.49em;left: -7.9px;right: 0;margin: auto;font-size: 1.4em;}", 0);
}
}
}
}
})
/**
*@プレイ中の処理変更 ここまで---
*/
/////////////////////////////////////////////////////////////////////////////////////////////////