chrome.extension.onRequest.addListener(function(n,t){if(n.ticketEvent=="refresh"&&n.times==0){chrome.tabs.sendRequest(t.tab.id,{ticketEvent:"flightHide"});return}n.ticketEvent==="refresh"&&n.times===config.for12306.ticketTimes&&chrome.tabs.sendRequest(t.tab.id,{ticketEvent:"get12306Query"},function(n){for(var r=[],u,f=(n.date[1]-n.date[0])/864e5+1,i=n.date[0];i<=n.date[1];i+=864e5)u=FlightFactory.getFromShort({shortFrom:n.shortFrom,shortTo:n.shortTo,date:[i,i]}),u.getData(!1,!0,function(n){r.push(n.main)},function(){},function(){f--;f==0&&r.length&&(r.sort(function(n,t){return n.date>t.date?1:n.date<t.date?-1:0}),chrome.tabs.sendRequest(t.tab.id,{ticketEvent:"flightShow",version:baseInfo.getInstance().info.version,query:{from:u.query.from,to:u.query.to},data:r,context:n.context===undefined?{}:n.context},function(n){n.status&&Statistics.trigger(57)}))})})})