Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

adding build/ back

  • Loading branch information...
commit 641da302c550e7568b7e3da747a3293b2ffddd6b 1 parent c96444c
Mickele Moriconi authored

Showing 2 changed files with 7 additions and 2 deletions. Show diff stats Hide diff stats

  1. +4 0 build/fatality.min.js
  2. +3 2 index.html
4 build/fatality.min.js
... ... @@ -0,0 +1,4 @@
  1 +/*
  2 +Fatality.js - An event sequencer handler
  3 +0.1.0 - Mickele Moriconi
  4 +*/((function(){"use strict",this.Fatality=function(){function a(a){var b,c,d;if(!a.events)return;this.options={},d=this.defaultOptions;for(b in d)c=d[b],this.options[b]=c;for(b in a)c=a[b],this.options[b]=c;this.start()}return a.prototype.defaultOptions={events:[],timer:0,repeatable:!1,onStart:function(){},onEvent:function(){},onSuccess:function(){},onError:function(){},onTimeout:function(){}},a.prototype.eventsLeft=[],a.prototype.timer=null,a.prototype.running=!1,a.prototype.start=function(){return this.eventsLeft=this.getEvents()},a.prototype.stop=function(){return clearTimeout(this.timer),this.timer=null},a.prototype.fireEvent=function(a){if(this.eventsLeft[0]===a)return this.eventsLeft.length===this.options.events.length&&this.fireStart(),this.eventsLeft.shift(),this.options.onEvent.call(this),clearTimeout(this.timer),this.eventsLeft.length?this.handleTimer():this.fireSuccess();if(this.timer)return this.fireError()},a.prototype.handleTimer=function(){var a=this;if(!this.options.timer)return;return this.timer=setTimeout(function(){return a.fireTimeout()},this.options.timer)},a.prototype.getEvents=function(){return this.options.events.slice(0)},a.prototype.fireStart=function(){return this.options.onStart()},a.prototype.fireSuccess=function(){this.options.onSuccess(),this.stop();if(this.options.repeatable)return this.start()},a.prototype.fireError=function(){return this.stop(),this.start(),this.options.onError()},a.prototype.fireTimeout=function(){return this.stop(),this.start(),this.options.onTimeout()},a.addEventTo=function(a,b,c){return a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent(b,c)},a}(),Fatality.KeyBoard=function(){function a(a){var b=this;this.options=a,this.options.events=this.options.keys,this.fatality=new Fatality(this.options),Fatality.addEventTo(document,"keydown",function(a){return b.fatality.fireEvent(b.getKey(a))})}return a.prototype.keyCodes={8:"backspace",9:"tab",13:"enter",27:"esc",32:"space",37:"left",38:"up",39:"right",40:"down",46:"delete"},a.prototype.getKey=function(a){return this.keyCodes[a.keyCode]||String.fromCharCode(a.keyCode).toLowerCase()},a}()})).call(this);
5 index.html
@@ -2,9 +2,10 @@
2 2 <html>
3 3 <head>
4 4 <meta charset="utf-8">
5   - <title>Fatality.js - Javascript Event Sequencer</title>
  5 + <title>Fatality.js</title>
  6 + <meta http-equiv="refresh" content="1;url=example/">
6 7 </head>
7 8 <body>
8   - <script>location.href='example'</script>
  9 + <script>location.href='example/'</script>
9 10 </body>
10 11 </html>

0 comments on commit 641da30

Please sign in to comment.
Something went wrong with that request. Please try again.