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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

            
                <body id="twitchapp">
    <div class="navbar-fixed bottom">
      <nav class="black">
        <div class="nav-wrapper">
          <a href="javascript:void(0)" class="brand-logo center tooltipped" data-position="top" data-delay="50" data-tooltip="Start/Stop streaming" @click="poweronoff">
            <i class="fa fa-power-off text-accent-3" v-bind:class="{'green-text': power, 'red-text': !power}" aria-hidden="true" id="onoff"></i>
          </a>
          <ul class="right">
            <li>
              <a href="javascript:void(0)" @click="showtv" class="tooltipped" data-position="top" data-delay="50" data-tooltip="When selected the stream will be displayed on main screen">
                <i class="fa fa-television" v-bind:class="{'green-text': tvdisplay, 'white-text': !tvdisplay}" aria-hidden="true" id="tv-sensor"></i>
              </a>
            </li>
            <li>
              <a href="javascript:void(0)" @click="showpip" class="tooltipped" data-position="top" data-delay="50" data-tooltip="When selected the stream will be displayed as a PIP">
                <i class="fa fa-th-large"  v-bind:class="{'green-text': pip, 'white-text': !pip}" aria-hidden="true" id="pip-sensor"></i>
              </a>
            </li>
            <li>
              <a href="javascript:void(0)" @click="switchdisplay" class="tooltipped" data-position="top" data-delay="50" data-tooltip="Switch streams between displays">
                <i class="fa fa-retweet" aria-hidden="true"></i>
              </a>
            </li>
            <li>
              <a href="javascript:void(0)" @click="help" class="tooltipped" data-position="top" data-delay="50" data-tooltip="More help">
                <i class="fa fa-question" aria-hidden="true"></i>
              </a>
            </li>
          </ul>
        </div>
      </nav>
    </div>
    <div class="row animated fadeInDownBig" v-show="!power">
      <div class="valign-wrapper">
        <h1 class="valign center full-width">Welcome to my <i class="fa fa-twitch fa-6 purple-text" aria-hidden="true"></i> Streamer App</h1>
      </div>
    </div>
    <div class="row" v-show="power">
      <div class="col m3 animated fadeInLeftBig">
        <div class="input-field">
          <input v-model="filterstr" id="search" type="search" placeholder="Filter streams..." @keyup="filterStreams">
          <label for="search"><i class="material-icons grey-text">search</i></label>
          <i class="material-icons">close</i>
        </div>
        <ul class="collection" v-show="tvstreamer !== '' || pipstreamer !== ''">
          <li v-show="tvstreamer !== ''" class="collection-item transparent white-text"><div>Playing  <span class="red-text text-lighten-2">{{ tvstreamer }}</span> on...<a class="secondary-content" @click="tvstreamer = ''"><i class="fa fa-television green-text"></i></a></div></li>
          <li v-show="pipstreamer !== ''" class="collection-item transparent white-text"><div>Playing  <span class="red-text text-lighten-2">{{ pipstreamer }}</span> on..<a class="secondary-content" @click="pipstreamer = ''"><i class="fa fa-th-large green-text"></i></a></div></li>
        </ul>
        <div class="center">
          <a class="waves-effect waves-light btn grey" @click="filter=''">all</a>
          <a class="waves-effect waves-light btn green"  @click="filter=1">on</a>
          <a class="waves-effect waves-light btn red" @click="filter=0">off</a>
        </div>
        <ul class="collection" v-show="power" style="height: 460px; overflow-y: auto;">
          <li  @click="showStream(streamer.id)" class="collection-item avatar black-text z-depth-1" v-for="streamer in streamers | filterBy filterstr | filterBy filter in 'online'  | orderBy 'online' -1">
            <img src="{{ streamer.logo }}" alt="{{ streamer.id }}" class="circle">
            <span class="title">{{ streamer.id }}</span>
            <p>{{ streamer.game}}<br>
               {{ streamer.status }}
            </p>
            <a  class="secondary-content" @click="showStream(streamer.id)"><i class="fa fa-circle" v-bind:class="{'green-text': streamer.online, 'red-text': !streamer.online}"></i></a>
          </li>
        </ul>
      </div>
      <div class="col m9" id="content">
        <iframe id="main" v-show="tvstreamer !== ''"
          src="https://player.twitch.tv/?channel={{ tvstreamer }}&muted=false"
          height="540"
          width="960"
          frameborder="0"
          scrolling="no"
          allowfullscreen="true"
          muted="false">
        </iframe>
        <iframe id="pip" v-show="pipstreamer !== ''"
          src="https://player.twitch.tv/?channel={{ pipstreamer }}&muted=true"
          height="144"
          width="256"
          frameborder="0"
          scrolling="no"
          allowfullscreen="true"
          muted="true">
        </iframe>
      </div>
      </div>
    </div>
            
          
!

CSS

            
                  body{
      margin:0px;
      padding-bottom: 70px;
      background-color: #000000;
      color: #ffffff;
    }
    h1{
      text-shadow: 0px 2px 2px rgba(206, 147, 216, 0.9);
    }
    li:hover{
      cursor: pointer;
    }
    #main{
      margin-top: 40px;
    }
    #pip{
      position:fixed;
      top:85px;
      right:55px;
      z-index: 999;
    }
    .bottom{
      position:fixed;
      bottom:0px;
    }
    .hidden{
      display: none;
    }
    .valign-wrapper{
      height:540px;
    }
    .full-width{
      width: 100%;
    }
    .input-field label.active{
      transform: translateY(0) !important;
    }
    .input-field input[type=search] ~ .material-icons{
      top: 0.6rem !important;
    }
    .secondary-content {
      cursor: pointer;
    }
    .collection{
      border-style: none;
    }
    .collection .collection-item{
      border-style: none;
    }
    #search{
      border-bottom: 1px solid grey;
      color: #cccccc;
    }

            
          
!

JS

            
              new Vue({
  el: "#twitchapp",
  ready: function() {
    $(".tooltipped").tooltip({ delay: 50 });
    this.updatestreamers();
    setInterval(
      function() {
        this.updatestreamers();
      }.bind(this),
      300000
    );
  },
  data: {
    power: false,
    tvdisplay: false,
    pip: false,
    filterstr: "",
    filter: "",
    tvstreamer: "",
    pipstreamer: "",
    streamers_list: [
      "freecodecamp",
      "nl_kripp",
      "beyondthesummit",
      "dota2ruhub",
      "esl_lol",
      "timthetatman",
      "blamethecontroller",
      "ogamingsc2",
      "comster404",
      "brunofin",
      "lirik",
      "riotgames",
      "starladder1",
      "imaqtpie",
      "sodapoppin",
      "gamesdonequick"
    ],
    streamers: []
  },
  methods: {
    poweronoff: function() {
      if (this.power == false) {
        this.power = true;
        this.tvdisplay = true;
      } else {
        this.power = false;
        this.tvdisplay = false;
        this.pip = false;
        this.tvstreamer = "";
        this.pipstreamer = "";
      }
    },
    showpip: function() {
      if (this.power == true) {
        if (this.tvdisplay == true) {
          this.tvdisplay = false;
          this.pip = true;
        }
      }
    },
    showtv: function() {
      if (this.power == true) {
        if (this.pip == true) {
          this.tvdisplay = true;
          this.pip = false;
        }
      }
    },
    showStream: function(data) {
      if (this.tvdisplay) {
        this.tvstreamer = data;
      } else {
        this.pipstreamer = data;
      }
    },
    switchdisplay: function() {
      var switchtv = this.tvstreamer;
      var switchpip = this.pipstreamer;
      this.tvstreamer = switchpip;
      this.pipstreamer = switchtv;
    },
    updatestreamers: function() {
      this.streamers = [];
      var myarr = this.streamers;
      var that = this.streamers_list;
      $.each(that, function(key, value) {
        $.ajax({
          url:
            "https://api.twitch.tv/kraken/streams/" +
            that[key] +
            "?client_id=f9bobcb20zctgn75idbd5wtd7dnjv8l",
          type: "GET",
          success: function(data) {
            if (data.stream) {
              myarr.push({
                id: data.stream.channel.name,
                logo: data.stream.channel.logo,
                game: "Playing " + data.stream.game,
                status: "Online",
                online: 1
              });
            }
            if (data.stream == null) {
              myarr.push({
                id: that[key],
                logo: "https://api.adorable.io/avatars/285/abott@adorable.png",
                game: "",
                status: "Offline",
                online: 0
              });
            }
          },
          error: function(data) {
            if (data.status == 404) {
              myarr.push({
                id: that[key],
                logo: "https://api.adorable.io/avatars/285/abott@adorable.png",
                game: "The account is closed",
                status: "Offline",
                online: 0
              });
            }
          }
        });
      });
    }
  }
});

            
          
!
999px

Console