Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <head>
  <!-- Google Tag Manager -->
  <script>
    (function(w, d, s, l, i) {
      w[l] = w[l] || [];
      w[l].push({
        "gtm.start": new Date().getTime(),
        event: "gtm.js"
      });
      var f = d.getElementsByTagName(s)[0],
        j = d.createElement(s),
        dl = l != "dataLayer" ? "&l=" + l : "";
      j.async = true;
      j.src = "https://www.googletagmanager.com/gtm.js?id=" + i + dl;
      f.parentNode.insertBefore(j, f);
    })(window, document, "script", "dataLayer", "GTM-W2F7ZVT");
  </script>
  <!-- End Google Tag Manager -->
  <META http-equiv="Content-Type" content="text/html; charset=utf8">
  <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0">
  <meta name="description" content="紳さんのペペロンチーノの点数の推移" />
  <meta name="keywords" content="LIG,紳さん,ペペロンチーノ" />
  <meta property="og:locale" content="ja_JP" />
  <meta property="og:type" content="article" />
  <meta property="og:title" content="紳さんのペペロンチーノの点数の推移" />
  <meta property="og:description" content="紳さんのペペロンチーノの点数の推移" />
  <meta property="og:url" content="https://htanaka0828.github.io/pprn/" />
  <meta property="og:site_name" content="pprn" />
  <title>紳さんのペペロンチーノの点数の推移</title>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
  <script src="js/script.js"></script>

  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" type="text/css">
  <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.19/themes/redmond/jquery-ui.css" type="text/css">

  <link rel="stylesheet" type="text/css" href="css/index.css" />
</head>


<body>
  <!-- Google Tag Manager (noscript) -->
  <noscript>
    <iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W2F7ZVT"
            height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript>
  <!-- End Google Tag Manager (noscript) -->
  <div class="hed">
    <img src="http://gazo.shitao.info/r/i/20170625110135_000.png">
    <h1>TODAY'S PEPERON</h1>
  </div>
  <div class="box">
    <box></box>
  </div>
  <div class="kibun">
    <p class="today">今日のペペロンの気分は?</p>
    <select name="trigger" id="trigger">
        <option class="op" value="hudan">いつもの</option>
        <option value="genki"></option>
        <option value="gouka">少し豪華に</option>
        <option value="panchi">パンチが欲しいな</option>
        </select>
    <ul>
      <dt id="action">シェフに聞いて見る▶︎</dt>
    </ul>
    <p id="echo1"></p>
    <p id="echo2"></p>
    <p id="echo3"></p>
  </div>

  <div class="col-sm-2">
    <div class="col-sm-10 form-inline" style="padding: 3px;">日付
      <input type="text" class="form-control input-sm" id="date" placeholder="" size="20">
    </div>
  </div>
  <div class="col-sm-2">
    <div class="col-sm-10 form-inline" style="padding: 3px;">点数
      <input type="text" class="form-control input-sm" id="score" placeholder="" size="20">
    </div>
  </div>

  <button id="setBtn" class="btn btn-primary">登録</button>
  <box class="gp">

    <canvas id="lineChart" height="450" style="width: 70%; height: 450px"></canvas>

  </box>
  <footer class="cpr">
    <P class="c2017">copyright 2017 qlip All Right Reserved.</P>
</body>
              
            
!

CSS

              
                .hed {
    display: flex width: 100%;
    display: flex;
}
#setBtn{
    margin-top: 20px;
}

h1 {
    font-family: Open Sans;
    font-size: 24px;
    background-color: black;
    width: 100%;
    margin-bottom: 0px;
}

img {
    float: left;
    margin-top: 20px;
    height: auto;
    max-width: 100%;
    max-height: 100%;
}

.box {
    width: 100%;
    height: 3px;
    background-color: #FCD82B;
}

.kibun {
    width: 315px;
    height: 505px;
    float: left;
    background: url(http://gazo.shitao.info/r/i/20170625110516_000.png) no-repeat;
    background-size: 100% auto;
}

.today {
    margin: 50 30 10px;
    color: white;
}

#trigger {
    margin: 50 30 10px;
}

.btn btn-primary .col-sm-2 {
    width: 800px;
}

.c2017 {
    background-color: black;
    margin: 0 auto;
    font-size: 8px;
    font-family: "Open Sans";
    color: #9b9b9b;
    width: 100%;
    height: 25px;
    text-align: center;
    padding-top: 4px;
}




              
            
!

JS

              
                var pprn_org = {
    "3/13/2017": 27,
    "3/14/2017": 5,
    "3/15/2017": 32,
    "3/16/2017": 45,
    "3/17/2017": 6,
    "3/21/2017": 56,
    "3/22/2017": 64,
    "3/23/2017": 55,
    "3/24/2017": 23,
    "3/27/2017": 70,
    "3/28/2017": 75,
    "3/29/2017": 60,
    "3/30/2017": 81,
    "3/31/2017": 78,
    "4/4/2017": 75,
    "4/6/2017": 87,
    "4/7/2017": 88,
    "4/10/2017": 90,
    "4/11/2017": 95,
    "4/12/2017": 50,
    "4/13/2017": 100,
    "4/14/2017": 75,
    "4/18/2017": 90,
    "4/19/2017": 100,
    "4/20/2017": 88,
    "4/24/2017": 96,
    "4/25/2017": 105,
    "4/26/2017": 85,
    "4/27/2017": 105,
    "4/28/2017": 111,
    "5/1/2017": 107,
    "5/8/2017": 105,
    "5/10/2017": 117,
    "5/11/2017": 110,
    "5/12/2017": 116,
    "5/15/2017": 118,
    "5/17/2017": 87,
    "5/18/2017": 125,
    "5/19/2017": 107,
    "5/22/2017": 141,
    "5/23/2017": 140,
    "5/25/2017": 138,
    "5/26/2017": 150,
    "5/31/2017": 160,
    "6/1/2017": 187,
    "6/2/2017": 214
};


$(function () {
    var pprn;
    // localStorageにpprnがあったらそれを変数に入れる
    if(localStorage.getItem("pprn")){
        pprn = JSON.parse(localStorage.getItem("pprn"));
    }
    // 無かったら↑のpprn_orgで日付を設定しlocalstorageに格納
    else{
        var pprn_json = JSON.stringify(pprn_org);
        localStorage.setItem("pprn", pprn_json);
        pprn = pprn_org;
    }
    draw(pprn);
    function draw(pprn) {
        var data = {
            labels: [],
            datasets: [
                {
                    label: "紳さんぺペロン日和",
                    fillColor: "rgba(220,220,220,0.2)",
                    strokeColor: "rgba(220,220,220,1)",
                    pointColor: "rgba(220,220,220,1)",
                    pointStrokeColor: "#fff",
                    pointHighlightFill: "#fff",
                    pointHighlightStroke: "rgba(220,220,220,1)",
                    data: []
                }
            ]
        };
        Object.keys(pprn).forEach(function (key) {
            data.labels.push(key);
            data.datasets[0].data.push(pprn[key]);
        });
        var ctx = $("#lineChart")[0].getContext('2d');
        var options = {
            scaleOverride: true,
            scaleSteps: 25,
            scaleStepWidth: 10,
            scaleStartValue: 0,
            scaleLabel: "<%=value%> 点",
            showTooltips: true,
        };
        new Chart(ctx).Line(data, options);
    }
    $("#setBtn").on("click", function () {
        var date = $("#date").val();
        var score = $("#score").val();
        pprn[date] = score;

        // updateしたpprn情報を格納
        localStorage.setItem("pprn", JSON.stringify(pprn_org));

        draw(pprn);
    });
    // 日付を入力する際にカレンダーを表示させる
    $("#date").datepicker();


    // 点数入力箇所は数字以外NGにする
    $('#score').on('keydown', function (e) {
        var k = e.keyCode;
        // 0~9, テンキ―0~9, スペース, backspace, delete, →, ←, ,. 以外は入力キャンセル
        if (!((k >= 48 && k <= 57) || (k >= 96 && k <= 105) || k == 32 || k == 8 || k == 46 || k == 39 || k == 37 || k == 190)) {
            return false;
        }
    });
})

//以下保坂レコメンド
//以下レコメンド記載
//レコメンド食材1
$("#action").on("click", function () {
    console.log('trigger.value : ', trigger.value);
    var r1 = Math.floor(Math.random() * 5 + 1);
    var r2 = Math.floor(Math.random() * 5 + 1);
    var r3 = Math.floor(Math.random() * 5 + 1);

    // var v1 = document.querySelector("#echo1");
    // var v2 = document.querySelector("#echo2");
    var v1 = document.querySelector("#echo1");
    var v2 = document.querySelector("#echo2");
    var v3 = document.querySelector("#echo3");
    console.log('v1 : ', v1)
    console.log('v2 : ', v2)
    console.log('v3 : ', v3)
    //チームメイン
    if (r1 == 1) {
        v1.innerHTML = "ベーコン";
    }
    if (r1 == 2) {
        v1.innerHTML = "ソーセージ";
    }
    if (r1 == 3) {
        v1.innerHTML = "たこ";
    }
    if (r1 == 4) {
        v1.innerHTML = "ホタテ";
    }
    if (r1 == 5) {
        v1.innerHTML = "えび";
    }
    //レコメンド食材2
    //チーム野菜
    if (r2 == 1) {
        v2.innerHTML = "ほうれん草";
    } else if (r2 == 2) {
        v2.innerHTML = "玉ねぎ";
    } else if (r2 == 3) {
        v2.innerHTML = "ブロッコリー";
    } else if (r2 == 4) {
        v2.innerHTML = "セロリ";
    } else if (r2 == 5) {
        v2.innerHTML = "キャベツ";
    }
    //レコメンド食材3

    //チームそのほか
    if (trigger.value === 'panchi') {
        v3.innerHTML = "ニンニクマシマシ";
    } else {
        if (r3 == 1) {
            v3.innerHTML = "しめじ";
        } else if (r3 == 2) {
            v3.innerHTML = "しらす";
        } else if (r3 == 3) {
            v3.innerHTML = "ニンニクマシマシ";
        } else if (r3 == 4) {
            v3.innerHTML = "大葉";
        } else if (r3 == 5) {
            v3.innerHTML = "エリンギ";
        }
    }
})
              
            
!
999px

Console