diff --git a/bower.json b/bower.json
index b442442..97c2f13 100644
--- a/bower.json
+++ b/bower.json
@@ -1,7 +1,7 @@
{
"name": "jQuery-SlotMachine",
"description": "A simple jQuery plugin to make slot machine animation effect",
- "version": "2.0.6",
+ "version": "2.0.7",
"keywords": [
"slots",
"gambling",
diff --git a/dist/jquery.slotmachine.js b/dist/jquery.slotmachine.js
index bd33c35..7278a3d 100644
--- a/dist/jquery.slotmachine.js
+++ b/dist/jquery.slotmachine.js
@@ -1,4 +1,4 @@
-/*! SlotMachine - v2.0.6 - 2014-11-06
+/*! SlotMachine - v2.0.7 - 2014-11-06
* https://github.com/josex2r/jQuery-SlotMachine
* Copyright (c) 2014 Jose Luis Represa; Licensed MIT */
;(function($, window, document, undefined){
@@ -186,7 +186,7 @@
this._oncompleteStack = [ this.settings.complete ];
//Number of spins left before stop
this._spinsLeft = null;
- //Number of spins left before stop
+ //Future result
this.futureActive = null;
//Machine is running?
this.isRunning = false;
@@ -394,6 +394,8 @@
this.futureActive = rnd;
}
+ /*if(this.$slot.attr("id")==="machine1")
+ console.log(this.futureActive)*/
//Decreasing spin
if(typeof spins === 'number'){
//Change delay and speed
@@ -537,13 +539,7 @@
var machine;
if ( !$.data(element[0], 'plugin_' + pluginName) ){
machine = new SlotMachine(element, options);
- var publicObject = {};
- for(var name in machine){
- if(!name.match(/^_.+$/)){
- publicObject[name] = machine[name];
- }
- }
- $.data(element[0], 'plugin_' + pluginName, publicObject);
+ $.data(element[0], 'plugin_' + pluginName, machine);
}else{
machine = $.data(element[0], 'plugin_' + pluginName);
}
diff --git a/dist/jquery.slotmachine.min.js b/dist/jquery.slotmachine.min.js
index 5a7bc8e..1d272e6 100644
--- a/dist/jquery.slotmachine.min.js
+++ b/dist/jquery.slotmachine.min.js
@@ -1,4 +1,4 @@
-/*! SlotMachine - v2.0.6 - 2014-11-06
+/*! SlotMachine - v2.0.7 - 2014-11-06
* https://github.com/josex2r/jQuery-SlotMachine
* Copyright (c) 2014 Jose Luis Represa; Licensed MIT */
-!function(a,b,c,d){function e(a,b){var c,d,e=this,f=a,g=arguments,h=b;this.running=!1,this.onpause=function(){},this.onresume=function(){},this.cancel=function(){this.running=!1,clearTimeout(d)},this.pause=function(){this.running&&(b-=(new Date).getTime()-c,this.cancel(),this.onpause())},this.resume=function(){this.running||(this.running=!0,c=(new Date).getTime(),d=setTimeout(function(){f.apply(e,Array.prototype.slice.call(g,2,g.length))},b),this.onresume())},this.reset=function(){this.cancel(),this.running=!0,b=h,d=setTimeout(function(){f.apply(e,Array.prototype.slice.call(g,2,g.length))},h)},this.add=function(a){this.pause(),b+=a,this.resume()},this.resume()}function f(b,c){this.element=b,this.settings=a.extend({},i,c),this.defaults=i,this.name=h,this.$slot=a(b),this.$tiles=this.$slot.children(),this.$container=null,this._minTop=null,this._maxTop=null,this._$fakeFirstTile=null,this._$fakeLastTile=null,this._timer=null,this._oncompleteStack=[this.settings.complete],this._spinsLeft=null,this.futureActive=null,this.isRunning=!1,this.active=this.settings.active,this.$slot.css("overflow","hidden"),(this.settings.active<0||this.settings.active>=this.$tiles.length)&&(this.settings.active=0,this.active=0),this.$tiles.wrapAll("
"),this.$container=this.$slot.find(".slotMachineContainer"),this._maxTop=-this.$container.height(),this._$fakeFirstTile=this.$tiles.last().clone(),this._$fakeLastTile=this.$tiles.first().clone(),this.$container.prepend(this._$fakeFirstTile),this.$container.append(this._$fakeLastTile),this._minTop=-this._$fakeFirstTile.outerHeight(),this.$container.css("margin-top",this.getTileOffset(this.active)),this.settings.auto!==!1&&(this.settings.auto===!0?this.shuffle():this.auto())}function g(b,c){var d;if(a.data(b[0],"plugin_"+h))d=a.data(b[0],"plugin_"+h);else{d=new f(b,c);var e={};for(var g in d)g.match(/^_.+$/)||(e[g]=d[g]);a.data(b[0],"plugin_"+h,e)}return d}var h="slotMachine",i={active:0,delay:200,auto:!1,randomize:null,complete:null},j="slotMachineBlurFast",k="slotMachineBlurMedium",l="slotMachineBlurSlow",m="slotMachineGradient",n=m;a(c).ready(function(){a("filter#slotMachineBlurFilterFast").length<=0&&a("body").append(''),a("filter#slotMachineBlurFilterMedium").length<=0&&a("body").append(''),a("filter#slotMachineBlurFilterSlow").length<=0&&a("body").append(''),a("mask#slotMachineFadeMask").length<=0&&a("body").append(''),a("body").append("")}),"function"!=typeof a.easing.easeOutBounce&&a.extend(a.easing,{easeOutBounce:function(a,b,c,d,e){return(b/=e)<1/2.75?7.5625*d*b*b+c:2/2.75>b?d*(7.5625*(b-=1.5/2.75)*b+.75)+c:2.5/2.75>b?d*(7.5625*(b-=2.25/2.75)*b+.9375)+c:d*(7.5625*(b-=2.625/2.75)*b+.984375)+c}}),f.prototype.getTileOffset=function(b){for(var c=0,d=0;b>d;d++)c+=a(this.$tiles.get(d)).outerHeight();return-c+this._minTop},f.prototype.getVisibleTile=function(){var a=this.$tiles.first().height(),b=parseInt(this.$container.css("margin-top").replace(/px/,""),10);return Math.abs(Math.round(b/a))-1},f.prototype.setRandomize=function(a){if("number"==typeof a){var b=function(){return a};this.settings.randomize=b}else this.settings.randomize=a},f.prototype.getRandom=function(a){var b,c=a||!1;do b=Math.floor(Math.random()*this.$tiles.length);while(c&&b===this.active&&b>=0);return b},f.prototype.getCustom=function(){var a;if(null!==this.settings.randomize&&"function"==typeof this.settings.randomize){var b=this.settings.randomize.apply(this,[this.active]);(0>b||b>=this.$tiles.length)&&(b=0),a=b}else a=this.getRandom();return a},f.prototype.getPrev=function(){var a=this.active-1<0?this.$tiles.length-1:this.active-1;return a},f.prototype.getNext=function(){var a=this.active+1a(b).scrollTop()+a(b).height(),d=a(b).scrollTop()>this.$slot.height()+this.$slot.offset().top;return!c&&!d},f.prototype.prev=function(){return this.futureActive=this.getPrev(),this.isRunning=!0,this.stop(!1),this.futureActive},f.prototype.next=function(){return this.futureActive=this.getNext(),this.isRunning=!0,this.stop(!1),this.futureActive},f.prototype.shuffle=function(a,b){var c=this;b!==d&&(this._oncompleteStack[1]=b),this.isRunning=!0;var e=this.settings.delay;if(null===this.futureActive){var f=this.getCustom();this.futureActive=f}if("number"==typeof a)switch(a){case 1:case 2:this._setAnimationFX(l,!0);break;case 3:case 4:this._setAnimationFX(k,!0),e/=1.5;break;default:this._setAnimationFX(j,!0),e/=2}else this._setAnimationFX(j,!0),e/=2;return this.$container.animate({marginTop:this._maxTop},e,"linear",function(){c.$container.css("margin-top",0),0>=a-1?c.stop():c.shuffle(a-1)}),this.futureActive},f.prototype.stop=function(a){if(this.isRunning){var b=this;this.$container.clearQueue().stop(!0,!1),this._setAnimationFX(l,a===d?!0:a),this.isRunning=!0,this.active=this.getVisibleTile(),this.futureActive>this.active?0===this.active&&this.futureActive===this.$tiles.length-1&&this.$container.css("margin-top",this.getTileOffset(this.$tiles.length)):this.active===this.$tiles.length-1&&0===this.futureActive&&this.$container.css("margin-top",0),this.active=this.futureActive,this.futureActive=null;var c=3*this.settings.delay;return this.$container.animate({marginTop:this.getTileOffset(this.active)},c,"easeOutBounce",function(){b.isRunning=!1,"function"==typeof b._oncompleteStack[0]&&b._oncompleteStack[0].apply(b,[b.active]),"function"==typeof b._oncompleteStack[1]&&b._oncompleteStack[1].apply(b,[b.active])}),setTimeout(function(){b._setAnimationFX(n,!1)},c/1.75),this.active}},f.prototype.auto=function(){var a=this;this._timer=new e(function(){"function"!=typeof a.settings.randomize&&(a.futureActive=a.getNext()),a.isRunning=!0,a.shuffle(5,function(){a._timer.reset()})},this.settings.auto)},a.fn[h]=function(b){return 1===this.length?g(this,b):this.each(function(){a.data(this,"plugin_"+h)||g(this,b)})}}(jQuery,window,document);
\ No newline at end of file
+!function(a,b,c,d){function e(a,b){var c,d,e=this,f=a,g=arguments,h=b;this.running=!1,this.onpause=function(){},this.onresume=function(){},this.cancel=function(){this.running=!1,clearTimeout(d)},this.pause=function(){this.running&&(b-=(new Date).getTime()-c,this.cancel(),this.onpause())},this.resume=function(){this.running||(this.running=!0,c=(new Date).getTime(),d=setTimeout(function(){f.apply(e,Array.prototype.slice.call(g,2,g.length))},b),this.onresume())},this.reset=function(){this.cancel(),this.running=!0,b=h,d=setTimeout(function(){f.apply(e,Array.prototype.slice.call(g,2,g.length))},h)},this.add=function(a){this.pause(),b+=a,this.resume()},this.resume()}function f(b,c){this.element=b,this.settings=a.extend({},i,c),this.defaults=i,this.name=h,this.$slot=a(b),this.$tiles=this.$slot.children(),this.$container=null,this._minTop=null,this._maxTop=null,this._$fakeFirstTile=null,this._$fakeLastTile=null,this._timer=null,this._oncompleteStack=[this.settings.complete],this._spinsLeft=null,this.futureActive=null,this.isRunning=!1,this.active=this.settings.active,this.$slot.css("overflow","hidden"),(this.settings.active<0||this.settings.active>=this.$tiles.length)&&(this.settings.active=0,this.active=0),this.$tiles.wrapAll(""),this.$container=this.$slot.find(".slotMachineContainer"),this._maxTop=-this.$container.height(),this._$fakeFirstTile=this.$tiles.last().clone(),this._$fakeLastTile=this.$tiles.first().clone(),this.$container.prepend(this._$fakeFirstTile),this.$container.append(this._$fakeLastTile),this._minTop=-this._$fakeFirstTile.outerHeight(),this.$container.css("margin-top",this.getTileOffset(this.active)),this.settings.auto!==!1&&(this.settings.auto===!0?this.shuffle():this.auto())}function g(b,c){var d;return a.data(b[0],"plugin_"+h)?d=a.data(b[0],"plugin_"+h):(d=new f(b,c),a.data(b[0],"plugin_"+h,d)),d}var h="slotMachine",i={active:0,delay:200,auto:!1,randomize:null,complete:null},j="slotMachineBlurFast",k="slotMachineBlurMedium",l="slotMachineBlurSlow",m="slotMachineGradient",n=m;a(c).ready(function(){a("filter#slotMachineBlurFilterFast").length<=0&&a("body").append(''),a("filter#slotMachineBlurFilterMedium").length<=0&&a("body").append(''),a("filter#slotMachineBlurFilterSlow").length<=0&&a("body").append(''),a("mask#slotMachineFadeMask").length<=0&&a("body").append(''),a("body").append("")}),"function"!=typeof a.easing.easeOutBounce&&a.extend(a.easing,{easeOutBounce:function(a,b,c,d,e){return(b/=e)<1/2.75?7.5625*d*b*b+c:2/2.75>b?d*(7.5625*(b-=1.5/2.75)*b+.75)+c:2.5/2.75>b?d*(7.5625*(b-=2.25/2.75)*b+.9375)+c:d*(7.5625*(b-=2.625/2.75)*b+.984375)+c}}),f.prototype.getTileOffset=function(b){for(var c=0,d=0;b>d;d++)c+=a(this.$tiles.get(d)).outerHeight();return-c+this._minTop},f.prototype.getVisibleTile=function(){var a=this.$tiles.first().height(),b=parseInt(this.$container.css("margin-top").replace(/px/,""),10);return Math.abs(Math.round(b/a))-1},f.prototype.setRandomize=function(a){if("number"==typeof a){var b=function(){return a};this.settings.randomize=b}else this.settings.randomize=a},f.prototype.getRandom=function(a){var b,c=a||!1;do b=Math.floor(Math.random()*this.$tiles.length);while(c&&b===this.active&&b>=0);return b},f.prototype.getCustom=function(){var a;if(null!==this.settings.randomize&&"function"==typeof this.settings.randomize){var b=this.settings.randomize.apply(this,[this.active]);(0>b||b>=this.$tiles.length)&&(b=0),a=b}else a=this.getRandom();return a},f.prototype.getPrev=function(){var a=this.active-1<0?this.$tiles.length-1:this.active-1;return a},f.prototype.getNext=function(){var a=this.active+1a(b).scrollTop()+a(b).height(),d=a(b).scrollTop()>this.$slot.height()+this.$slot.offset().top;return!c&&!d},f.prototype.prev=function(){return this.futureActive=this.getPrev(),this.isRunning=!0,this.stop(!1),this.futureActive},f.prototype.next=function(){return this.futureActive=this.getNext(),this.isRunning=!0,this.stop(!1),this.futureActive},f.prototype.shuffle=function(a,b){var c=this;b!==d&&(this._oncompleteStack[1]=b),this.isRunning=!0;var e=this.settings.delay;if(null===this.futureActive){var f=this.getCustom();this.futureActive=f}if("number"==typeof a)switch(a){case 1:case 2:this._setAnimationFX(l,!0);break;case 3:case 4:this._setAnimationFX(k,!0),e/=1.5;break;default:this._setAnimationFX(j,!0),e/=2}else this._setAnimationFX(j,!0),e/=2;return this.$container.animate({marginTop:this._maxTop},e,"linear",function(){c.$container.css("margin-top",0),0>=a-1?c.stop():c.shuffle(a-1)}),this.futureActive},f.prototype.stop=function(a){if(this.isRunning){var b=this;this.$container.clearQueue().stop(!0,!1),this._setAnimationFX(l,a===d?!0:a),this.isRunning=!0,this.active=this.getVisibleTile(),this.futureActive>this.active?0===this.active&&this.futureActive===this.$tiles.length-1&&this.$container.css("margin-top",this.getTileOffset(this.$tiles.length)):this.active===this.$tiles.length-1&&0===this.futureActive&&this.$container.css("margin-top",0),this.active=this.futureActive,this.futureActive=null;var c=3*this.settings.delay;return this.$container.animate({marginTop:this.getTileOffset(this.active)},c,"easeOutBounce",function(){b.isRunning=!1,"function"==typeof b._oncompleteStack[0]&&b._oncompleteStack[0].apply(b,[b.active]),"function"==typeof b._oncompleteStack[1]&&b._oncompleteStack[1].apply(b,[b.active])}),setTimeout(function(){b._setAnimationFX(n,!1)},c/1.75),this.active}},f.prototype.auto=function(){var a=this;this._timer=new e(function(){"function"!=typeof a.settings.randomize&&(a.futureActive=a.getNext()),a.isRunning=!0,a.shuffle(5,function(){a._timer.reset()})},this.settings.auto)},a.fn[h]=function(b){return 1===this.length?g(this,b):this.each(function(){a.data(this,"plugin_"+h)||g(this,b)})}}(jQuery,window,document);
\ No newline at end of file
diff --git a/package.json b/package.json
index 9a32579..77d1c86 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "jquery-slotmachine",
- "version": "2.0.6",
+ "version": "2.0.7",
"engines": {
"node": ">= 0.8.0"
},
diff --git a/slotmachine.jquery.json b/slotmachine.jquery.json
index 617df66..f80393a 100644
--- a/slotmachine.jquery.json
+++ b/slotmachine.jquery.json
@@ -11,7 +11,7 @@
"winning",
"machine"
],
- "version": "2.0.6",
+ "version": "2.0.7",
"download": "https://github.com/josex2r/jQuery-SlotMachine",
"homepage": "https://github.com/josex2r/jQuery-SlotMachine",
"demo": "http://josex2r.github.io/jQuery-SlotMachine/",
diff --git a/src/jquery.slotmachine.js b/src/jquery.slotmachine.js
index f2f56b2..5f7c6ec 100644
--- a/src/jquery.slotmachine.js
+++ b/src/jquery.slotmachine.js
@@ -190,7 +190,7 @@
this._oncompleteStack = [ this.settings.complete ];
//Number of spins left before stop
this._spinsLeft = null;
- //Number of spins left before stop
+ //Future result
this.futureActive = null;
//Machine is running?
this.isRunning = false;
@@ -398,6 +398,8 @@
this.futureActive = rnd;
}
+ /*if(this.$slot.attr("id")==="machine1")
+ console.log(this.futureActive)*/
//Decreasing spin
if(typeof spins === 'number'){
//Change delay and speed
@@ -541,13 +543,7 @@
var machine;
if ( !$.data(element[0], 'plugin_' + pluginName) ){
machine = new SlotMachine(element, options);
- var publicObject = {};
- for(var name in machine){
- if(!name.match(/^_.+$/)){
- publicObject[name] = machine[name];
- }
- }
- $.data(element[0], 'plugin_' + pluginName, publicObject);
+ $.data(element[0], 'plugin_' + pluginName, machine);
}else{
machine = $.data(element[0], 'plugin_' + pluginName);
}