high pena CSS for smartphone

high pena 2 スマホ用のCSSです。不具合があるかもしれないので自己責任で使ってください。Android版FirefoxにアドオンTampermonkeyで動作確認。iOSは不明。

Version au 13/02/2018. Voir la dernière version.

Vous devrez installer une extension telle que Tampermonkey, Greasemonkey ou Violentmonkey pour installer ce script.

You will need to install an extension such as Tampermonkey to install this script.

Vous devrez installer une extension telle que Tampermonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Userscripts pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey pour installer ce script.

Vous devrez installer une extension de gestionnaire de script utilisateur pour installer ce script.

(J'ai déjà un gestionnaire de scripts utilisateur, laissez-moi l'installer !)

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

(J'ai déjà un gestionnaire de style utilisateur, laissez-moi l'installer!)

// ==UserScript==
// @name         high pena CSS for smartphone
// @namespace    http://tampermonkey.net/
// @version      0.01
// @description  high pena 2 スマホ用のCSSです。不具合があるかもしれないので自己責任で使ってください。Android版FirefoxにアドオンTampermonkeyで動作確認。iOSは不明。
// @author       ankoiri
// @match     http://yaranaika.s64.coreserver.jp/highpena2/*
// @grant     none
// ==/UserScript==


(function() {


    var record = 'https://dl.dropboxusercontent.coms/c6d6gvviolrvww4/highpena_smartphone_record.css';
    var home_nihon = 'https://dl.dropboxusercontent.com/s/qsse5byyf2zqpvi/highpena_smartphone_top2.css';
    var home_off = 'https://dl.dropboxusercontent.com/s/x25b9em3jngr643/highpena_smartphone_top3.css';
    var home_on = 'https://dl.dropboxusercontent.com/s/hhvu2zxaa8e8wvj/highpena_smartphone_top.css';
    var skill = 'https://dl.dropboxusercontent.com/s/nut96x7hy54lcmd/highpena_smartphone_skill.css';
    var consciousness = 'https://dl.dropboxusercontent.com/s/hitepl4lpquluxh/highpena_smartphone_consciousness.css';
    var login = 'https://dl.dropboxusercontent.com/s/gxgfhntxnvn3so4/highpena_smartphone_login.css';
    var rule = 'https://dl.dropboxusercontent.com/s/hm6ogylb82almr4/highpena_smartphone_default.css';
    var defaultcss = 'https://dl.dropboxusercontent.com/s/zd422tt9fx8jcqj/highpena_smartphone_default.css';
    var drawer = 'https://dl.dropboxusercontent.com/s/j83j6si5bke1qpx/drawer.css';
    var team_mode = 'https://dl.dropboxusercontent.com/s/3jofc9ixzjm3x1m/highpena_smartphone_team_mode.css';

    var url = location.href;

    //ラッパーのtable width 変更
    var xpath = document.evaluate("/html/body/table" , document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
    var xpath_obj = xpath.singleNodeValue;
    xpath_obj.width = "99%";

    //野手・投手のテーブル横スクロール用
    var table_width = parseInt(window.innerWidth *0.90);
    //console.log("screen.width:" + table_width);



   var linkobj = document.getElementsByTagName('link')[0];
    //console.log("linkobj:" + linkobj);
    linkobj.parentNode.removeChild(linkobj);


    var head ;
    var link , link2;

    head  = document.getElementsByTagName('head')[0];
    console.log("head:"+head);
    if( ! head ) return ;

    //viewport980に固定

    var viewport_meta;

    viewport_meta = document.createElement('meta') ;
    viewport_meta.name = 'viewport';
    viewport_meta.content = 'width=980';
    head.appendChild(viewport_meta) ;

    //CSS追加
    link  = document.createElement('link') ;
    link.typ  = 'text/css' ;
    link.rel  = 'stylesheet' ;
    head.appendChild(link) ;

    link2  = document.createElement('link') ;
    link2.typ  = 'text/css' ;
    link2.rel  = 'stylesheet' ;
    link2.href = drawer;

    head.appendChild(link2) ;



    //トップ画面
    xpath = document.evaluate("/html/body/table/tbody/tr[1]/td[2]/table[2]/tbody/tr/td[3]/input[3]" , document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
    xpath_obj = xpath.singleNodeValue;
    //console.log("type=" + xpath_obj.value);

    //トップ画面(オフシーズン 日本シリーズ の場合)
    xpath4 = document.evaluate("/html/body/table/tbody/tr[1]/td[2]/table[4]/tbody/tr[1]/td/table/tbody/tr/td/table/tbody/tr/td[2]/font/font/b" , document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
    xpath_obj4 = xpath4.singleNodeValue;

    //console.log("type=" + xpath_obj.value);


    //能力アップ画面 意識設定画面
    xpath2 = document.evaluate("/html/body/table/tbody/tr[1]/td[2]/table[4]/tbody/tr/td/h3" , document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
    xpath_obj2 = xpath2.singleNodeValue;
    //console.log("xpath_obj2.innerHTML:" + xpath_obj2.innerHTML);


    //ログイン画面
    xpath3 = document.evaluate("/html/body/table/tbody/tr[1]/td[2]/table[5]/tbody/tr/td/table/tbody/tr/td[2]/table[2]/tbody/tr[1]/td[1]" , document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
    xpath_obj3 = xpath3.singleNodeValue;
    //console.log("xpath_obj3.innerHTML:" + xpath_obj3.innerHTML);

    //公式記録とタイトル
    xpath5 = document.evaluate("/html/body/table/tbody/tr[1]/td[2]/table[4]/tbody/tr/td/h3" , document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
    xpath_obj5 = xpath5.singleNodeValue;
    //console.log("xpath_obj3.innerHTML:" + xpath_obj3.innerHTML);



    var flag = 0;

    //記録
    if(xpath_obj5 && xpath_obj5.innerHTML.match(/公式記録とタイトル/)){

        //console.log( "URL:" + location.href);
        link.href = record;

    //球団偵察モード
    }else if(location.href.match(/mode=team&team_id/)){

        //console.log( "URL:" + location.href);
        link.href = team_mode;
        flag = 7;

    }else if(xpath_obj4 && xpath_obj4.innerHTML.match(/日本シリーズ/) && xpath_obj && xpath_obj.value == "ログイン"){
        //console.log("ホーム画面(日本シリーズ)");

        link.href = home_nihon;

        flag = 4;

        //ホーム画面(オフシーズン 新規登録リンク有り)
    }else if(xpath_obj4 && xpath_obj4.innerHTML.match(/オフシーズン/) && xpath_obj && xpath_obj.value == "ログイン"){
        //console.log("ホーム画面(オフシーズン)");

        link.href = home_off;
        flag = 5;

        //ホーム画面(オフ・日シリ以外)
    }else if (xpath_obj && xpath_obj.value == "ログイン" ){

        link.href = home_on;
        flag = 1;

        //能力アップ画面
    }else if(xpath_obj2 && xpath_obj2.innerHTML.match(/能力アップ/)){
        console.log("能力アップ画面1");
        link.href = skill;
        flag = 2;

    //意識設定画面
    }else if(xpath_obj2 && xpath_obj2.innerHTML.match(/意識設定/)){
        console.log("意識設定画面1");
        link.href = consciousness;
        flag = 6;

        //ログイン画面
    }else if(xpath_obj3 && xpath_obj3.innerHTML.match(/ドラフト指名/)){
        console.log("ログイン画面");

        link.href = login;

        flag = 3;

    }else if(location.href.match(/rule.html/)){
        console.log(location.href);
        link.href = rule;

    }else{

        link.href = defaultcss;

    }

    console.log("flag:" + flag);









    //ドロワー追加用
    var div_element = document.createElement("div");
    div_element.classList.add("header_wrapper");

    //オフシーズンの場合、新規登録を追加する
    if(flag === 5){
        div_element.innerHTML = '<div class="header"><div class="nav-drawer"><input id="nav-input" type="checkbox" class="nav-unshown"><label id="nav-open" for="nav-input"><span></span></label><label class="nav-unshown" id="nav-close" for="nav-input"></label><div id="nav-content">' +
        '<ul>' +
        '<li><a href="http://yaranaika.s64.coreserver.jp/highpena2/index.cgi">ホーム</a></li>' +
        '<li><a href="http://yaranaika.s64.coreserver.jp/highpena2/index.cgi?mode=ranking">ランキング</a></li>' +
        '<li><a href="http://yaranaika.s64.coreserver.jp/highpena2/index.cgi?mode=record">記録</a></li>' +
        '<li><a href="http://yaranaika.s64.coreserver.jp/highpena2/index.cgi?mode=calendar">日程</a></li>' +
        '<li><a href="http://yaranaika.s64.coreserver.jp/highpena2/rule.html">あそびかた</a></li>' +
        '<li><a href="http://jbbs.livedoor.jp/game/44608/">掲示板</a></li>' +
        '<li><a href="http://yaranaika.s64.coreserver.jp/highpena2/index.cgi?mode=draft">ドラフト</a></li>' +
        '<li><a href="http://yaranaika.s64.coreserver.jp/highpena2/index.cgi?mode=entry">新規登録</a></li>' +
        '</ul></div></div><DIV STYLE="font-size:60px;font-weight:900; color:#DC143C; margin-top:-70pt; margin-left:170pt">2</DIV><DIV STYLE="font-size:40px; font-weight:600; color:000000;margin-top:-45pt;margin-left:115pt">high pena</DIV></div>';

        //document.body.appendChild(div_element);
        //console.log(div_element.innerHTML);
    }else{


        div_element.innerHTML = '<div class="header"><div class="nav-drawer"><input id="nav-input" type="checkbox" class="nav-unshown"><label id="nav-open" for="nav-input"><span></span></label><label class="nav-unshown" id="nav-close" for="nav-input"></label><div id="nav-content">' +
        '<ul>' +
        '<li><a href="http://yaranaika.s64.coreserver.jp/highpena2/index.cgi">ホーム</a></li>' +
        '<li><a href="http://yaranaika.s64.coreserver.jp/highpena2/index.cgi?mode=ranking">ランキング</a></li>' +
        '<li><a href="http://yaranaika.s64.coreserver.jp/highpena2/index.cgi?mode=record">記録</a></li>' +
        '<li><a href="http://yaranaika.s64.coreserver.jp/highpena2/index.cgi?mode=calendar">日程</a></li>' +
        '<li><a href="http://yaranaika.s64.coreserver.jp/highpena2/rule.html">あそびかた</a></li>' +
        '<li><a href="http://jbbs.livedoor.jp/game/44608/">掲示板</a></li>' +
        '<li><a href="http://yaranaika.s64.coreserver.jp/highpena2/index.cgi?mode=draft">ドラフト</a></li>' +
        '</ul></div></div><DIV STYLE="font-size:60px;font-weight:900; color:#DC143C; margin-top:-70pt; margin-left:170pt">2</DIV><DIV STYLE="font-size:40px; font-weight:600; color:000000;margin-top:-45pt;margin-left:115pt">high pena</DIV></div>';

        //document.body.appendChild(div_element);
        //console.log(div_element.innerHTML);

    }

        //一番上に追加する
        var parentObject = document.getElementsByTagName("body")[0];
        parentObject.insertBefore(div_element,parentObject.firstChild);


    //-----------------------------------





 



    // ログイン後の画面
    if(flag === 3 ){





        //投手 折りたたむ
        xpath = document.evaluate("/html/body/table/tbody/tr[1]/td[2]/table[5]/tbody/tr/td/form/form/table[1]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);

        //console.log("xpathtousyu:" + xpath.singleNodeValue);
        xpath_obj = xpath.singleNodeValue;

        xpath_obj.outerHTML = "<div onclick=\"obj=document.getElementById('open2').style; obj.display=(obj.display=='none')?'block':'none';\"><a style=\"font-size:30px;cursor:pointer;text-decoration: underline;\">▼タップで表示</a></div><div id=\"open2\" style=\"display:none;clear:both;\"><div style=\"\width:" + table_width + "px; overflow-x:scroll;\">" + xpath_obj.outerHTML + "</div></div><br>";


        //野手 折りたたむ
        xpath = document.evaluate("/html/body/table/tbody/tr[1]/td[2]/table[5]/tbody/tr/td/form/table[1]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
        //console.log("xpathyasyu:" + xpath.singleNodeValue);
        xpath_obj = xpath.singleNodeValue;

        //var temp = "<thread>" + xpath_obj.innerHTML;
        //xpath_obj.innerHTML = temp;
        xpath_obj.outerHTML = "<div onclick=\"obj=document.getElementById('open1').style; obj.display=(obj.display=='none')?'block':'none';\"><a style=\"font-size:30px;cursor:pointer;text-decoration: underline;\">▼タップで表示</a></div><div id=\"open1\" style=\"display:none;clear:both;\"><div style=\"width:" + table_width + "px; overflow-x:scroll;\">" + xpath_obj.outerHTML + "</div></div><br>";

        //console.log("xpath_obj:" + xpath_obj.innerHTML);

        //チーム方針変更 折りたたむ
        xpath = document.evaluate("/html/body/table/tbody/tr[1]/td[2]/table[5]/tbody/tr/td/table/tbody/tr/td[1]/table[3]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
        //console.log("xpathhoushin:" + xpath.singleNodeValue);
        xpath_obj = xpath.singleNodeValue;

        xpath_obj.outerHTML = "<div onclick=\"obj=document.getElementById('open3').style; obj.display=(obj.display=='none')?'block':'none';\"><a style=\"font-size:30px;cursor:pointer;text-decoration: underline;\">▼チーム方針変更 表示</a></div><div id=\"open3\" style=\"display:none;clear:both;\">" + xpath_obj.outerHTML + "</div><br>";

        //野手ポジション・打順変更ボタン 左寄せ
        xpath = document.evaluate("//*[@id=\"open1\"]/div/table/tbody/tr/td/div", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
        xpath_obj = xpath.singleNodeValue;
        xpath_obj.align = "left";


        //投手起用順変更ボタン 左寄せ
        xpath = document.evaluate("//*[@id=\"open2\"]/div/table/tbody/tr/td/div", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
        xpath_obj = xpath.singleNodeValue;
        xpath_obj.align = "left";

        // 契約更改~設定 再設計
        xpath = document.evaluate("/html/body/table/tbody/tr[1]/td[2]/table[5]/tbody/tr/td/form/form/table[1]/tbody/tr/td[3]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
        //console.log("xpathhoushin:" + xpath.singleNodeValue);
        xpath_obj = xpath.singleNodeValue;


        var menu2 = ["","","","","","","","","","","","","",""];

        var arr = xpath_obj.innerHTML.split(/></g);
        var k=-1;

        //add the brackets back in
        for(var i = 0; i < arr.length; i++){


            if(i == 0){
                arr[i] =  arr[i] + '>';
            }else if(i == arr.length -1){
                arr[i] =  '<'  + arr[i];
            }else{
                arr[i] = '<' + arr[i] + '>';

            }


            //console.log("arr[" + i + "]:" + arr[i]);
            if(arr[i].match(/<h4/) || arr[i].match(/<table/) ){
                //console.log("next:" + k);
                k++;
            }

            if(!(arr[i].match(/<table/) || arr[i].match(/<\/table/) || arr[i].match(/<tbody/) || arr[i].match(/<\/tbody/) || arr[i].match(/<tr/) || arr[i].match(/<\/tr/) || arr[i].match(/<td/) || arr[i].match(/<\/td/)   )){
               menu2[k] += arr[i];

               }

        }
        var table_str ="<table>";

        for(i=0;i<k+1;i++){
            console.log("menu2[" + i + "]:" + menu2[i]);




            if(menu2[i].match(/<h4/)){
                table_str = table_str + "</tr><tr>";
                //console.log("tr:" + i);
            }

            table_str = table_str + "<td><form action='index.cgi' method='post'>" +  menu2[i] + "</td></form>";


        }
        
        table_str = table_str + "</table>";

        console.log("table_str:" + table_str);

        xpath_obj.innerHTML = table_str;











        //画面更新ボタン 左寄せ
        /*
        xpath = document.evaluate("/html/body/table/tbody/tr[1]/td[2]/table[5]/tbody/tr/td/form/form/table[1]/tbody/tr/td[1]/form/div", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
        xpath_obj = xpath.singleNodeValue;
        xpath_obj.align = "left";
        */


    }

    if(flag === 2) {
        //能力 ポイントテーブル tr入れ替え


        xpath = document.evaluate("/html/body/table/tbody/tr[1]/td[2]/table[4]/tbody/tr/td/table/tbody/tr[2]/td[1]/form/table", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
        var table = xpath.singleNodeValue;



        //console.log("row1:" + table.innerHTML);

        var point_cell = [];

        for(j=0;j<10;j++){

            console.log("table.rows[" + j + "].innerHTML" +  table.rows[j].cells[0].innerHTML);
            point_cell[j] = table.rows[j].cells[0].innerHTML;
        }

        table.innerHTML = "";

        // 行要素を追加
        var tr0 = table.insertRow(-1);
        var tr1 = table.insertRow(-1);

        var td = [];



        //table.innerHTML = "";

        for(j=0;j<10;j=j+2){

            td[j] = tr0.insertCell(-1);
            td[j].innerHTML = point_cell[j];
            td[j+1] = tr1.insertCell(-1);
            td[j+1].innerHTML = point_cell[j+1];

        }
        //console.log("aa" + newtable.innerHTML);






    }



    // 他球団偵察モードの画面

    if(flag === 7 ){

        console.log("table_width:" + table_width);

        //投手 テーブルスクロール
        xpath = document.evaluate("/html/body/table/tbody/tr[1]/td[2]/table[4]/tbody/tr/td/table[3]/tbody/tr/td/table", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);

        //console.log("xpathtousyu:" + xpath.singleNodeValue);
        xpath_obj = xpath.singleNodeValue;

        xpath_obj.outerHTML = "<div style=\"\width:" + table_width + "px; overflow-x:scroll; padding-bottom:30px;\">" + xpath_obj.outerHTML + "</div>";


        //野手 テーブルスクロール
        xpath = document.evaluate("/html/body/table/tbody/tr[1]/td[2]/table[4]/tbody/tr/td/table[2]/tbody/tr/td/table", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
        //console.log("xpathyasyu:" + xpath.singleNodeValue);
        xpath_obj = xpath.singleNodeValue;

        //var temp = "<thread>" + xpath_obj.innerHTML;
        //xpath_obj.innerHTML = temp;
        xpath_obj.outerHTML = "<div style=\"width:" + table_width + "px; overflow-x:scroll; padding-bottom:30px;\">" + xpath_obj.outerHTML + "</div><br>";

        //console.log("xpath_obj:" + xpath_obj.innerHTML);


    }











})();