Sha256: 377bb45f44343850abbdbeef5171a637235245cc1cb2fd4077dab74e4554ef9d

Contents?: true

Size: 694 Bytes

Versions: 6

Compression:

Stored size: 694 Bytes

Contents

(function(){

  var current = 0;
  var last = $(".screen").size() - 1;

  function draw() {
    $(".screen").hide();
    $("#s"+current).show();
  }

  function next() {
    if (current < last) {
      current++;
    }
    draw();
  }

  function previous() {
    console.log(current);
    if (current > 0) {
      current--;
    }
    draw();
  }

  $(".screen").hide();
  $("#intro").show();


  $(document).keydown(function(e) {
    switch(e.keyCode) {
      case 39: // ->
      case 78: // n
      case 13: // enter
        next();
        break;
      case 37: // <-
      case 80: // p
        previous();
        break;
      default:
        console.log(e.keyCode);
    }
  });

}());

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
shellplay-0.1.9 tpl/shellplay.js
shellplay-0.1.8 tpl/shellplay.js
shellplay-0.1.7 tpl/shellplay.js
shellplay-0.1.6 tpl/shellplay.js
shellplay-0.1.5 tpl/shellplay.js
shellplay-0.1.4 tpl/shellplay.js