From f67b1c135931f43e7e63feb376e87cb44a37f90a Mon Sep 17 00:00:00 2001 From: ryushinka Date: Fri, 20 Jan 2017 16:04:01 +0800 Subject: [PATCH] fix the bug about indexof function --- js/lottery.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/lottery.js b/js/lottery.js index c241558..8b539cc 100644 --- a/js/lottery.js +++ b/js/lottery.js @@ -96,7 +96,9 @@ query: function( val ) { for(var key in window.localStorage){ if( 'first|second|third'.indexOf(key) >= 0 ){ - if(config.get( key ).indexOf(val) >= 0){ + //if(config.get( key ).indexOf(val) >= 0){ + var currKeys = config.get( key ).split(","); + if($.inArray(val+'', currKeys) >= 0){ return true; } } @@ -631,7 +633,9 @@ for(var key2 in window.localStorage){ if( 'first|second|third'.indexOf(key2) >= 0 ){ - if(config.get( key2 ).indexOf(index) >= 0){ + //if(config.get( key2 ).indexOf(index) >= 0){ + var currKeys = config.get( key2 ).split(","); + if($.inArray(index+'', currKeys) != "-1"){ config.remove(key2, index); break; }