Commit 49e7d85feb90b62a35a4f19f79ebf5b654604158
Merge branch 'minhang' into qingpu
Showing
37 changed files
with
2225 additions
and
1489 deletions
Too many changes to show.
To preserve performance only 37 of 48 files are displayed.
src/main/java/com/bsth/controller/oil/YlbController.java
| @@ -2,7 +2,9 @@ package com.bsth.controller.oil; | @@ -2,7 +2,9 @@ package com.bsth.controller.oil; | ||
| 2 | 2 | ||
| 3 | import java.text.ParseException; | 3 | import java.text.ParseException; |
| 4 | import java.text.SimpleDateFormat; | 4 | import java.text.SimpleDateFormat; |
| 5 | +import java.util.ArrayList; | ||
| 5 | import java.util.Date; | 6 | import java.util.Date; |
| 7 | +import java.util.Iterator; | ||
| 6 | import java.util.List; | 8 | import java.util.List; |
| 7 | import java.util.Map; | 9 | import java.util.Map; |
| 8 | 10 | ||
| @@ -44,14 +46,47 @@ public class YlbController extends BaseController<Ylb, Integer>{ | @@ -44,14 +46,47 @@ public class YlbController extends BaseController<Ylb, Integer>{ | ||
| 44 | * @return | 46 | * @return |
| 45 | */ | 47 | */ |
| 46 | @RequestMapping(value = "/obtain",method = RequestMethod.GET) | 48 | @RequestMapping(value = "/obtain",method = RequestMethod.GET) |
| 47 | - public List<Map<String, Object>> obtain(@RequestParam Map<String, Object> map){ | 49 | + public Map<String, Object> obtain(@RequestParam Map<String, Object> map){ |
| 48 | String rq=map.get("rq").toString(); | 50 | String rq=map.get("rq").toString(); |
| 49 | - List<Map<String, Object>> list=yblService.obtain(rq); | 51 | + Map<String, Object> list=yblService.obtain(rq); |
| 50 | System.out.println(); | 52 | System.out.println(); |
| 51 | return list; | 53 | return list; |
| 52 | } | 54 | } |
| 53 | 55 | ||
| 54 | /** | 56 | /** |
| 57 | + * 拆分油量 | ||
| 58 | + * @param map | ||
| 59 | + * @return | ||
| 60 | + */ | ||
| 61 | + @RequestMapping(value = "/sort",method = RequestMethod.GET) | ||
| 62 | + public Map<String, Object> sort(@RequestParam Map<String, Object> map){ | ||
| 63 | + Map<String, Object> list=yblService.sort(map); | ||
| 64 | + return list; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * 进场油量等于出场油量 | ||
| 69 | + * @param map | ||
| 70 | + * @return | ||
| 71 | + */ | ||
| 72 | + @RequestMapping(value = "/outAndIn",method = RequestMethod.GET) | ||
| 73 | + public Map<String, Object> outAndIn(@RequestParam Map<String, Object> map){ | ||
| 74 | + Map<String, Object> list=yblService.outAndIn(map); | ||
| 75 | + return list; | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * 核对油量(有加油没里程) | ||
| 80 | + * @param map | ||
| 81 | + * @return | ||
| 82 | + */ | ||
| 83 | + @RequestMapping(value = "/checkYl",method = RequestMethod.GET) | ||
| 84 | + public Map<String, Object> checkYl(@RequestParam Map<String, Object> map){ | ||
| 85 | + Map<String, Object> list=yblService.checkYl(map); | ||
| 86 | + return list; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + /** | ||
| 55 | * | 90 | * |
| 56 | * @Title: list | 91 | * @Title: list |
| 57 | * @Description: TODO(多条件分页查询) | 92 | * @Description: TODO(多条件分页查询) |
src/main/java/com/bsth/controller/oil/YlxxbController.java
| 1 | package com.bsth.controller.oil; | 1 | package com.bsth.controller.oil; |
| 2 | 2 | ||
| 3 | +import java.util.Map; | ||
| 4 | + | ||
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 3 | import org.springframework.web.bind.annotation.RequestMapping; | 6 | import org.springframework.web.bind.annotation.RequestMapping; |
| 7 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 4 | import org.springframework.web.bind.annotation.RestController; | 9 | import org.springframework.web.bind.annotation.RestController; |
| 5 | 10 | ||
| 6 | import com.bsth.controller.BaseController; | 11 | import com.bsth.controller.BaseController; |
| 7 | import com.bsth.entity.oil.Ylxxb; | 12 | import com.bsth.entity.oil.Ylxxb; |
| 13 | +import com.bsth.service.oil.YlxxbService; | ||
| 14 | +import com.bsth.util.PageObject; | ||
| 8 | 15 | ||
| 9 | @RestController | 16 | @RestController |
| 10 | @RequestMapping("ylxxb") | 17 | @RequestMapping("ylxxb") |
| 11 | public class YlxxbController extends BaseController<Ylxxb, Integer>{ | 18 | public class YlxxbController extends BaseController<Ylxxb, Integer>{ |
| 12 | - | 19 | + @Autowired |
| 20 | + private YlxxbService service; | ||
| 21 | + @RequestMapping(value = "/pagequery",method = RequestMethod.GET) | ||
| 22 | + public PageObject<Ylxxb> pagequery(@RequestParam Map<String, Object> map){ | ||
| 23 | + PageObject<Ylxxb> pagequery=null; | ||
| 24 | + map.put("curPage", map.get("page").toString()); | ||
| 25 | + map.put("pageData","10"); | ||
| 26 | + pagequery=service.Pagequery(map); | ||
| 27 | + return pagequery; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 核对油量(有加油没里程) | ||
| 33 | + * @param map | ||
| 34 | + * @return | ||
| 35 | + */ | ||
| 36 | + @RequestMapping(value = "/check",method = RequestMethod.GET) | ||
| 37 | + public Map<String, Object> check(@RequestParam Map<String, Object> map){ | ||
| 38 | + Map<String, Object> list=service.checkJsy(map); | ||
| 39 | + return list; | ||
| 40 | + } | ||
| 13 | } | 41 | } |
src/main/java/com/bsth/data/arrival/AnalyseData.java
| @@ -78,6 +78,9 @@ public class AnalyseData { | @@ -78,6 +78,9 @@ public class AnalyseData { | ||
| 78 | && curr.getTs() - prve.getTs() < SHIFT_TIME){ | 78 | && curr.getTs() - prve.getTs() < SHIFT_TIME){ |
| 79 | prve.setEnable(false); | 79 | prve.setEnable(false); |
| 80 | } | 80 | } |
| 81 | +// else if(curr.getInOut()){ | ||
| 82 | +// //curr.getTs() - prve.getTs() < 30000 | ||
| 83 | +// } | ||
| 81 | } | 84 | } |
| 82 | else{ | 85 | else{ |
| 83 | //上下行的同名站,新走向的第一个出站信号开始有效 | 86 | //上下行的同名站,新走向的第一个出站信号开始有效 |
src/main/java/com/bsth/data/arrival/ArrivalData_GPS.java
| @@ -51,7 +51,7 @@ public class ArrivalData_GPS implements CommandLineRunner{ | @@ -51,7 +51,7 @@ public class ArrivalData_GPS implements CommandLineRunner{ | ||
| 51 | @Override | 51 | @Override |
| 52 | public void run(String... arg0) throws Exception { | 52 | public void run(String... arg0) throws Exception { |
| 53 | logger.info("ArrivalData_GPS,30,10"); | 53 | logger.info("ArrivalData_GPS,30,10"); |
| 54 | - Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 30, 10, TimeUnit.SECONDS); | 54 | + //Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 40, 20, TimeUnit.SECONDS); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | @Component | 57 | @Component |
src/main/java/com/bsth/data/arrival/DataLoader.java
| @@ -58,7 +58,7 @@ public class DataLoader { | @@ -58,7 +58,7 @@ public class DataLoader { | ||
| 58 | PreparedStatement ps = null; | 58 | PreparedStatement ps = null; |
| 59 | ResultSet rs = null; | 59 | ResultSet rs = null; |
| 60 | 60 | ||
| 61 | - String sql = "select * from bsth_c_arrival_info where weeks_year=? AND create_timestamp > ? AND create_timestamp <=? AND ABS(create_timestamp - ts) < 3600000 order by ts"; | 61 | + String sql = "select * from bsth_c_arrival_info where weeks_year=? AND create_timestamp > ? AND create_timestamp <=? AND ABS(create_timestamp - ts) < 3600000 order by create_date"; |
| 62 | try{ | 62 | try{ |
| 63 | long t = System.currentTimeMillis(); | 63 | long t = System.currentTimeMillis(); |
| 64 | 64 |
src/main/java/com/bsth/data/directive/FirstScheduleCheckThread.java
| @@ -8,6 +8,8 @@ import org.slf4j.LoggerFactory; | @@ -8,6 +8,8 @@ import org.slf4j.LoggerFactory; | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.stereotype.Component; | 9 | import org.springframework.stereotype.Component; |
| 10 | 10 | ||
| 11 | +import com.bsth.data.match.Arrival2Schedule; | ||
| 12 | +import com.bsth.data.match.ExpectArrivalEnd; | ||
| 11 | import com.bsth.data.schedule.DayOfSchedule; | 13 | import com.bsth.data.schedule.DayOfSchedule; |
| 12 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 14 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 13 | import com.bsth.service.directive.DirectiveService; | 15 | import com.bsth.service.directive.DirectiveService; |
| @@ -63,6 +65,26 @@ public class FirstScheduleCheckThread extends Thread{ | @@ -63,6 +65,26 @@ public class FirstScheduleCheckThread extends Thread{ | ||
| 63 | && Math.abs(first.getDfsjT() - t) < THREE_MINUTES){ | 65 | && Math.abs(first.getDfsjT() - t) < THREE_MINUTES){ |
| 64 | 66 | ||
| 65 | directiveService.send60Dispatch(first, dayOfSchedule.doneSum(first.getClZbh()), "定补@系统"); | 67 | directiveService.send60Dispatch(first, dayOfSchedule.doneSum(first.getClZbh()), "定补@系统"); |
| 68 | + //期望完成出场班次时间 | ||
| 69 | + long endTime; | ||
| 70 | + | ||
| 71 | + if(first.getZdsj() != null) | ||
| 72 | + endTime=first.getZdsjT() - 60000; | ||
| 73 | + else | ||
| 74 | + endTime=schList.get(1).getDfsjT() - 60000; | ||
| 75 | + | ||
| 76 | + ExpectArrivalEnd ead = new ExpectArrivalEnd() | ||
| 77 | + ,ead2 = new ExpectArrivalEnd(); | ||
| 78 | + ead.setNbbm(car); | ||
| 79 | + ead.setEndStation(first.getQdzCode()); | ||
| 80 | + ead.setEndTime(endTime); | ||
| 81 | + | ||
| 82 | + ead2.setNbbm(car); | ||
| 83 | + ead2.setEndStation(first.getZdzCode()); | ||
| 84 | + ead2.setEndTime(endTime); | ||
| 85 | + | ||
| 86 | + Arrival2Schedule.addExpect(car, ead); | ||
| 87 | + Arrival2Schedule.addExpect(car, ead2); | ||
| 66 | } | 88 | } |
| 67 | } | 89 | } |
| 68 | } | 90 | } |
src/main/java/com/bsth/data/directive/GatewayHttpUtils.java
| @@ -51,13 +51,13 @@ public class GatewayHttpUtils { | @@ -51,13 +51,13 @@ public class GatewayHttpUtils { | ||
| 51 | 51 | ||
| 52 | post.setEntity(new StringEntity(jsonStr, "utf-8")); | 52 | post.setEntity(new StringEntity(jsonStr, "utf-8")); |
| 53 | 53 | ||
| 54 | - CloseableHttpResponse response = httpClient.execute(post); | ||
| 55 | - | ||
| 56 | - JSONObject json = JSONObject.parseObject(EntityUtils.toString(response.getEntity())); | ||
| 57 | - if(null != json && json.getInteger("errCode") == 0) | ||
| 58 | - code = 0; | ||
| 59 | - else | ||
| 60 | - logger.error("和网关http通讯失败,rs: " + json); | 54 | +// CloseableHttpResponse response = httpClient.execute(post); |
| 55 | +// | ||
| 56 | +// JSONObject json = JSONObject.parseObject(EntityUtils.toString(response.getEntity())); | ||
| 57 | +// if(null != json && json.getInteger("errCode") == 0) | ||
| 58 | +// code = 0; | ||
| 59 | +// else | ||
| 60 | +// logger.error("和网关http通讯失败,rs: " + json); | ||
| 61 | }catch(Exception e){ | 61 | }catch(Exception e){ |
| 62 | logger.error("", e); | 62 | logger.error("", e); |
| 63 | }finally { | 63 | }finally { |
src/main/java/com/bsth/data/match/Arrival2Schedule.java
| @@ -3,9 +3,7 @@ package com.bsth.data.match; | @@ -3,9 +3,7 @@ package com.bsth.data.match; | ||
| 3 | import java.text.SimpleDateFormat; | 3 | import java.text.SimpleDateFormat; |
| 4 | import java.util.ArrayList; | 4 | import java.util.ArrayList; |
| 5 | import java.util.Collections; | 5 | import java.util.Collections; |
| 6 | -import java.util.HashMap; | ||
| 7 | import java.util.List; | 6 | import java.util.List; |
| 8 | -import java.util.Map; | ||
| 9 | import java.util.Set; | 7 | import java.util.Set; |
| 10 | 8 | ||
| 11 | import org.slf4j.Logger; | 9 | import org.slf4j.Logger; |
| @@ -15,14 +13,18 @@ import org.springframework.context.ApplicationContext; | @@ -15,14 +13,18 @@ import org.springframework.context.ApplicationContext; | ||
| 15 | import org.springframework.context.ApplicationContextAware; | 13 | import org.springframework.context.ApplicationContextAware; |
| 16 | import org.springframework.stereotype.Component; | 14 | import org.springframework.stereotype.Component; |
| 17 | 15 | ||
| 16 | +import com.bsth.data.LineConfigData; | ||
| 18 | import com.bsth.data.arrival.ArrivalComparator; | 17 | import com.bsth.data.arrival.ArrivalComparator; |
| 19 | import com.bsth.data.arrival.ArrivalData_GPS; | 18 | import com.bsth.data.arrival.ArrivalData_GPS; |
| 20 | import com.bsth.data.arrival.ArrivalEntity; | 19 | import com.bsth.data.arrival.ArrivalEntity; |
| 21 | import com.bsth.data.schedule.DayOfSchedule; | 20 | import com.bsth.data.schedule.DayOfSchedule; |
| 22 | import com.bsth.data.schedule.ScheduleComparator; | 21 | import com.bsth.data.schedule.ScheduleComparator; |
| 22 | +import com.bsth.entity.realcontrol.LineConfig; | ||
| 23 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 23 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 24 | import com.bsth.service.directive.DirectiveService; | 24 | import com.bsth.service.directive.DirectiveService; |
| 25 | import com.bsth.websocket.handler.SendUtils; | 25 | import com.bsth.websocket.handler.SendUtils; |
| 26 | +import com.google.common.collect.ArrayListMultimap; | ||
| 27 | +import com.google.common.collect.ListMultimap; | ||
| 26 | 28 | ||
| 27 | /** | 29 | /** |
| 28 | * | 30 | * |
| @@ -38,13 +40,14 @@ public class Arrival2Schedule implements ApplicationContextAware { | @@ -38,13 +40,14 @@ public class Arrival2Schedule implements ApplicationContextAware { | ||
| 38 | private static DayOfSchedule dayOfSchedule; | 40 | private static DayOfSchedule dayOfSchedule; |
| 39 | private static SendUtils sendUtils; | 41 | private static SendUtils sendUtils; |
| 40 | private static DirectiveService directiveService; | 42 | private static DirectiveService directiveService; |
| 43 | + private static LineConfigData lineConfigData; | ||
| 41 | private final static int ONE_MINUTE = 1000 * 60; | 44 | private final static int ONE_MINUTE = 1000 * 60; |
| 42 | //定一个4小时的范围,基本能对正常班次进行容错。主要防止早上停车场GPS飘导致完成晚上的进场班次 | 45 | //定一个4小时的范围,基本能对正常班次进行容错。主要防止早上停车场GPS飘导致完成晚上的进场班次 |
| 43 | private final static int FOUR_HOURS = 1000 * 60 * 60 * 4; | 46 | private final static int FOUR_HOURS = 1000 * 60 * 60 * 4; |
| 44 | 47 | ||
| 45 | private static Logger logger = LoggerFactory.getLogger(Arrival2Schedule.class); | 48 | private static Logger logger = LoggerFactory.getLogger(Arrival2Schedule.class); |
| 46 | 49 | ||
| 47 | - private static Map<String, ExpectArrivalEnd> expectMap = new HashMap<>(); | 50 | + private static ArrayListMultimap<String, ExpectArrivalEnd> expectMap = ArrayListMultimap.create(); |
| 48 | 51 | ||
| 49 | /** | 52 | /** |
| 50 | * | 53 | * |
| @@ -61,6 +64,8 @@ public class Arrival2Schedule implements ApplicationContextAware { | @@ -61,6 +64,8 @@ public class Arrival2Schedule implements ApplicationContextAware { | ||
| 61 | 64 | ||
| 62 | public static class SchMatchThread extends Thread{ | 65 | public static class SchMatchThread extends Thread{ |
| 63 | String nbbm; | 66 | String nbbm; |
| 67 | + LineConfig conf; | ||
| 68 | + | ||
| 64 | public SchMatchThread(String nbbm){ | 69 | public SchMatchThread(String nbbm){ |
| 65 | this.nbbm = nbbm; | 70 | this.nbbm = nbbm; |
| 66 | } | 71 | } |
| @@ -73,7 +78,6 @@ public class Arrival2Schedule implements ApplicationContextAware { | @@ -73,7 +78,6 @@ public class Arrival2Schedule implements ApplicationContextAware { | ||
| 73 | 78 | ||
| 74 | @Override | 79 | @Override |
| 75 | public void run() { | 80 | public void run() { |
| 76 | - | ||
| 77 | //班次列表 | 81 | //班次列表 |
| 78 | List<ScheduleRealInfo> schList = dayOfSchedule.findByNbbm(nbbm); | 82 | List<ScheduleRealInfo> schList = dayOfSchedule.findByNbbm(nbbm); |
| 79 | //进出起终点数据 | 83 | //进出起终点数据 |
| @@ -82,6 +86,7 @@ public class Arrival2Schedule implements ApplicationContextAware { | @@ -82,6 +86,7 @@ public class Arrival2Schedule implements ApplicationContextAware { | ||
| 82 | if(schList.size() == 0 || arrList.size() == 0) | 86 | if(schList.size() == 0 || arrList.size() == 0) |
| 83 | return; | 87 | return; |
| 84 | 88 | ||
| 89 | + conf = lineConfigData.get(schList.get(0).getXlBm()); | ||
| 85 | //排序 | 90 | //排序 |
| 86 | Collections.sort(schList, schComparator); | 91 | Collections.sort(schList, schComparator); |
| 87 | Collections.sort(arrList, arrComparator); | 92 | Collections.sort(arrList, arrComparator); |
| @@ -113,8 +118,8 @@ public class Arrival2Schedule implements ApplicationContextAware { | @@ -113,8 +118,8 @@ public class Arrival2Schedule implements ApplicationContextAware { | ||
| 113 | if(sch.isDestroy()) | 118 | if(sch.isDestroy()) |
| 114 | continue; | 119 | continue; |
| 115 | 120 | ||
| 116 | - //没有里程的不匹配 | ||
| 117 | - if(sch.getBcsj() == null && sch.getJhlc() == null) | 121 | + //线路配置出站既出场,并且没有里程的不匹配 |
| 122 | + if(conf.getOutConfig()==2 && sch.getBcsj() == null && sch.getJhlc() == null) | ||
| 118 | continue; | 123 | continue; |
| 119 | 124 | ||
| 120 | list.add(sch); | 125 | list.add(sch); |
| @@ -194,7 +199,15 @@ public class Arrival2Schedule implements ApplicationContextAware { | @@ -194,7 +199,15 @@ public class Arrival2Schedule implements ApplicationContextAware { | ||
| 194 | mr = new MatchResult(); | 199 | mr = new MatchResult(); |
| 195 | mr.sch = sch; | 200 | mr.sch = sch; |
| 196 | mr.ts = inArr.getTs(); | 201 | mr.ts = inArr.getTs(); |
| 197 | - mr.diff = inArr.getTs() - sch.getZdsjT(); | 202 | + //班次没有里程和运送时间的 |
| 203 | + if(sch.getZdsj() == null){ | ||
| 204 | + if(i < schList.size()-1) | ||
| 205 | + mr.diff = inArr.getTs() - schList.get(i + 1).getDfsjT(); | ||
| 206 | + else | ||
| 207 | + mr.diff = inArr.getTs() - sch.getDfsjT(); | ||
| 208 | + } | ||
| 209 | + else | ||
| 210 | + mr.diff = inArr.getTs() - sch.getZdsjT(); | ||
| 198 | mr.success = dayOfSchedule.validEndTime(sch, inArr.getTs()); | 211 | mr.success = dayOfSchedule.validEndTime(sch, inArr.getTs()); |
| 199 | if(Math.abs(mr.diff) < FOUR_HOURS && mr.success) | 212 | if(Math.abs(mr.diff) < FOUR_HOURS && mr.success) |
| 200 | mrs.add(mr); | 213 | mrs.add(mr); |
| @@ -216,13 +229,8 @@ public class Arrival2Schedule implements ApplicationContextAware { | @@ -216,13 +229,8 @@ public class Arrival2Schedule implements ApplicationContextAware { | ||
| 216 | public void carOut(MatchResult mr){ | 229 | public void carOut(MatchResult mr){ |
| 217 | ScheduleRealInfo sch = mr.sch; | 230 | ScheduleRealInfo sch = mr.sch; |
| 218 | 231 | ||
| 219 | - if(expectMap.containsKey(nbbm)){ | ||
| 220 | - ExpectArrivalEnd ead = expectMap.get(nbbm); | ||
| 221 | - if(mr.ts < ead.getEndTime()) | ||
| 222 | - return; | ||
| 223 | - else | ||
| 224 | - expectMap.remove(nbbm); | ||
| 225 | - } | 232 | + if(!isExpectOut(mr)) |
| 233 | + return; | ||
| 226 | //设置发车时间 | 234 | //设置发车时间 |
| 227 | sch.setFcsjActualAll(mr.ts); | 235 | sch.setFcsjActualAll(mr.ts); |
| 228 | //通知客户端 | 236 | //通知客户端 |
| @@ -231,8 +239,32 @@ public class Arrival2Schedule implements ApplicationContextAware { | @@ -231,8 +239,32 @@ public class Arrival2Schedule implements ApplicationContextAware { | ||
| 231 | dayOfSchedule.save(sch); | 239 | dayOfSchedule.save(sch); |
| 232 | //车辆当前执行班次 | 240 | //车辆当前执行班次 |
| 233 | dayOfSchedule.addExecPlan(sch); | 241 | dayOfSchedule.addExecPlan(sch); |
| 242 | + | ||
| 234 | //期望车辆到达的终点 | 243 | //期望车辆到达的终点 |
| 235 | - expectMap.put(nbbm, ExpectArrivalEnd.getEndInstance(sch, mr.ts)); | 244 | + if(sch.getZdsj() != null) |
| 245 | + expectMap.put(nbbm, ExpectArrivalEnd.getEndInstance(sch, mr.ts)); | ||
| 246 | + } | ||
| 247 | + | ||
| 248 | + /** | ||
| 249 | + * | ||
| 250 | + * @Title: isExpectOut | ||
| 251 | + * @Description: TODO(是否是一个期望的出站匹配结果) | ||
| 252 | + */ | ||
| 253 | + private boolean isExpectOut(MatchResult mr){ | ||
| 254 | + ScheduleRealInfo sch = mr.sch; | ||
| 255 | + String nbbm = sch.getClZbh(); | ||
| 256 | + if(expectMap.containsKey(nbbm)){ | ||
| 257 | + List<ExpectArrivalEnd> eads = expectMap.get(nbbm); | ||
| 258 | + for(ExpectArrivalEnd ead : eads){ | ||
| 259 | + if(sch.getQdzCode().equals(ead.getEndStation()) | ||
| 260 | + || mr.ts > ead.getEndTime()){ | ||
| 261 | + expectMap.removeAll(nbbm); | ||
| 262 | + return true; | ||
| 263 | + } | ||
| 264 | + } | ||
| 265 | + return false; | ||
| 266 | + } | ||
| 267 | + return true; | ||
| 236 | } | 268 | } |
| 237 | 269 | ||
| 238 | /** | 270 | /** |
| @@ -243,15 +275,8 @@ public class Arrival2Schedule implements ApplicationContextAware { | @@ -243,15 +275,8 @@ public class Arrival2Schedule implements ApplicationContextAware { | ||
| 243 | public void carInStop(MatchResult mr){ | 275 | public void carInStop(MatchResult mr){ |
| 244 | ScheduleRealInfo sch = mr.sch; | 276 | ScheduleRealInfo sch = mr.sch; |
| 245 | String nbbm=sch.getClZbh(); | 277 | String nbbm=sch.getClZbh(); |
| 246 | - if(expectMap.containsKey(nbbm)){ | ||
| 247 | - ExpectArrivalEnd ead = expectMap.get(nbbm); | ||
| 248 | - if(mr.ts < ead.getEndTime() | ||
| 249 | - && !mr.sch.getZdzCode().equals(ead.getEndStation())){ | ||
| 250 | - return; | ||
| 251 | - } | ||
| 252 | - else | ||
| 253 | - expectMap.remove(nbbm); | ||
| 254 | - } | 278 | + if(!isExpectIn(mr)) |
| 279 | + return; | ||
| 255 | 280 | ||
| 256 | //如果是进停车场,并且实达时间差值大于 30 分钟,并且之前还有未完成班次。 | 281 | //如果是进停车场,并且实达时间差值大于 30 分钟,并且之前还有未完成班次。 |
| 257 | if(sch.getBcType().equals("in") && Math.abs(mr.diff) > (1000 * 60 * 30)){ | 282 | if(sch.getBcType().equals("in") && Math.abs(mr.diff) > (1000 * 60 * 30)){ |
| @@ -289,6 +314,28 @@ public class Arrival2Schedule implements ApplicationContextAware { | @@ -289,6 +314,28 @@ public class Arrival2Schedule implements ApplicationContextAware { | ||
| 289 | 314 | ||
| 290 | /** | 315 | /** |
| 291 | * | 316 | * |
| 317 | + * @Title: isExpectOut | ||
| 318 | + * @Description: TODO(是否是一个期望的进站匹配结果) | ||
| 319 | + */ | ||
| 320 | + private boolean isExpectIn(MatchResult mr){ | ||
| 321 | + ScheduleRealInfo sch = mr.sch; | ||
| 322 | + String nbbm = sch.getClZbh(); | ||
| 323 | + if(expectMap.containsKey(nbbm)){ | ||
| 324 | + List<ExpectArrivalEnd> eads = expectMap.get(nbbm); | ||
| 325 | + for(ExpectArrivalEnd ead : eads){ | ||
| 326 | + if(sch.getZdzCode().equals(ead.getEndStation()) | ||
| 327 | + || mr.ts > ead.getEndTime()){ | ||
| 328 | + expectMap.removeAll(nbbm); | ||
| 329 | + return true; | ||
| 330 | + } | ||
| 331 | + } | ||
| 332 | + return false; | ||
| 333 | + } | ||
| 334 | + return true; | ||
| 335 | + } | ||
| 336 | + | ||
| 337 | + /** | ||
| 338 | + * | ||
| 292 | * @Title: correctFirstSignal | 339 | * @Title: correctFirstSignal |
| 293 | * @Description: TODO(检查并纠正首班出场到离站) | 340 | * @Description: TODO(检查并纠正首班出场到离站) |
| 294 | */ | 341 | */ |
| @@ -367,6 +414,7 @@ public class Arrival2Schedule implements ApplicationContextAware { | @@ -367,6 +414,7 @@ public class Arrival2Schedule implements ApplicationContextAware { | ||
| 367 | sendUtils = arg0.getBean(SendUtils.class); | 414 | sendUtils = arg0.getBean(SendUtils.class); |
| 368 | dayOfSchedule = arg0.getBean(DayOfSchedule.class); | 415 | dayOfSchedule = arg0.getBean(DayOfSchedule.class); |
| 369 | directiveService = arg0.getBean(DirectiveService.class); | 416 | directiveService = arg0.getBean(DirectiveService.class); |
| 417 | + lineConfigData = arg0.getBean(LineConfigData.class); | ||
| 370 | } | 418 | } |
| 371 | 419 | ||
| 372 | /** | 420 | /** |
| @@ -376,6 +424,10 @@ public class Arrival2Schedule implements ApplicationContextAware { | @@ -376,6 +424,10 @@ public class Arrival2Schedule implements ApplicationContextAware { | ||
| 376 | * @param @param nbbm | 424 | * @param @param nbbm |
| 377 | */ | 425 | */ |
| 378 | public void removeExpect(String nbbm){ | 426 | public void removeExpect(String nbbm){ |
| 379 | - expectMap.remove(nbbm); | 427 | + expectMap.removeAll(nbbm); |
| 428 | + } | ||
| 429 | + | ||
| 430 | + public static void addExpect(String nbbm, ExpectArrivalEnd eae){ | ||
| 431 | + expectMap.put(nbbm, eae); | ||
| 380 | } | 432 | } |
| 381 | } | 433 | } |
src/main/java/com/bsth/data/match/ExpectArrivalEnd.java
| @@ -5,7 +5,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; | @@ -5,7 +5,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 5 | /** | 5 | /** |
| 6 | * | 6 | * |
| 7 | * @ClassName: ExpectArrivalEnd | 7 | * @ClassName: ExpectArrivalEnd |
| 8 | - * @Description: TODO(期望车辆在某个时间段到达某个终点........) | 8 | + * @Description: TODO(期望车辆在某个时间段到达某个终点或 发出某个起点........) |
| 9 | * @author PanZhao | 9 | * @author PanZhao |
| 10 | * @date 2016年11月2日 下午8:04:43 | 10 | * @date 2016年11月2日 下午8:04:43 |
| 11 | * | 11 | * |
| @@ -29,6 +29,7 @@ public class ExpectArrivalEnd { | @@ -29,6 +29,7 @@ public class ExpectArrivalEnd { | ||
| 29 | } | 29 | } |
| 30 | return ead; | 30 | return ead; |
| 31 | } | 31 | } |
| 32 | + | ||
| 32 | 33 | ||
| 33 | public String getNbbm() { | 34 | public String getNbbm() { |
| 34 | return nbbm; | 35 | return nbbm; |
src/main/java/com/bsth/entity/oil/Ylb.java
| 1 | package com.bsth.entity.oil; | 1 | package com.bsth.entity.oil; |
| 2 | 2 | ||
| 3 | +import java.text.DecimalFormat; | ||
| 3 | import java.util.Date; | 4 | import java.util.Date; |
| 4 | 5 | ||
| 5 | import javax.persistence.Entity; | 6 | import javax.persistence.Entity; |
| 6 | import javax.persistence.GeneratedValue; | 7 | import javax.persistence.GeneratedValue; |
| 7 | import javax.persistence.Id; | 8 | import javax.persistence.Id; |
| 8 | import javax.persistence.Table; | 9 | import javax.persistence.Table; |
| 10 | +import javax.persistence.Transient; | ||
| 9 | 11 | ||
| 10 | import org.springframework.format.annotation.DateTimeFormat; | 12 | import org.springframework.format.annotation.DateTimeFormat; |
| 11 | 13 | ||
| 14 | +import com.bsth.data.BasicData; | ||
| 15 | + | ||
| 12 | @Entity | 16 | @Entity |
| 13 | @Table(name = "bsth_c_ylb") | 17 | @Table(name = "bsth_c_ylb") |
| 14 | public class Ylb { | 18 | public class Ylb { |
| @@ -22,23 +26,23 @@ public class Ylb { | @@ -22,23 +26,23 @@ public class Ylb { | ||
| 22 | private String fgsdm; | 26 | private String fgsdm; |
| 23 | private String nbbm; | 27 | private String nbbm; |
| 24 | private String jsy; | 28 | private String jsy; |
| 25 | - private Double czlc; | ||
| 26 | - private Double jzlc; | ||
| 27 | - private Double czyl; | ||
| 28 | - private Double jzyl; | 29 | + private Double czlc=0.0; |
| 30 | + private Double jzlc=0.0; | ||
| 31 | + private Double czyl=0.0; | ||
| 32 | + private Double jzyl=0.0; | ||
| 29 | private Double jzl; | 33 | private Double jzl; |
| 30 | private int sfkt; | 34 | private int sfkt; |
| 31 | private String jhsj; | 35 | private String jhsj; |
| 32 | - private Double yh; | ||
| 33 | - private Double sh; | 36 | + private Double yh=0.0; |
| 37 | + private Double sh=0.0; | ||
| 34 | private String shyy; | 38 | private String shyy; |
| 35 | - private Double zlc; | 39 | + private Double zlc=0.0; |
| 36 | private int yhlx; | 40 | private int yhlx; |
| 37 | private String rylx; | 41 | private String rylx; |
| 38 | - private Double ns; | ||
| 39 | - private Double fyylc; | ||
| 40 | - private Double jhzlc; | ||
| 41 | - private Double jhfyylc; | 42 | + private Double ns=0.0; |
| 43 | + private Double fyylc=0.0; | ||
| 44 | + private Double jhzlc=0.0; | ||
| 45 | + private Double jhfyylc=0.0; | ||
| 42 | private int jhzbc; | 46 | private int jhzbc; |
| 43 | private int jhbc; | 47 | private int jhbc; |
| 44 | private int sjzbc; | 48 | private int sjzbc; |
| @@ -49,6 +53,16 @@ public class Ylb { | @@ -49,6 +53,16 @@ public class Ylb { | ||
| 49 | private int nylx; | 53 | private int nylx; |
| 50 | //进场顺序(根据最先出场和最后进场来关联车辆的存油量) | 54 | //进场顺序(根据最先出场和最后进场来关联车辆的存油量) |
| 51 | private int jcsx; | 55 | private int jcsx; |
| 56 | + | ||
| 57 | + @Transient | ||
| 58 | + private String bglyh; | ||
| 59 | + | ||
| 60 | + @Transient | ||
| 61 | + private String xlname; | ||
| 62 | + | ||
| 63 | + @Transient | ||
| 64 | + private String gsname; | ||
| 65 | + | ||
| 52 | 66 | ||
| 53 | public Integer getId() { | 67 | public Integer getId() { |
| 54 | return id; | 68 | return id; |
| @@ -254,5 +268,38 @@ public class Ylb { | @@ -254,5 +268,38 @@ public class Ylb { | ||
| 254 | public void setJcsx(int jcsx){ | 268 | public void setJcsx(int jcsx){ |
| 255 | this.jcsx=jcsx; | 269 | this.jcsx=jcsx; |
| 256 | } | 270 | } |
| 271 | + | ||
| 272 | + public String getBglyh() { | ||
| 273 | + if(this.getZlc()==0){ | ||
| 274 | + return "0.00"; | ||
| 275 | + }else{ | ||
| 276 | + DecimalFormat df = new DecimalFormat("0.00"); | ||
| 277 | + return df.format(this.getYh()/this.getZlc()*100); | ||
| 278 | + } | ||
| 279 | + } | ||
| 280 | + | ||
| 281 | + public void setBglyh(String bglyh) { | ||
| 282 | + this.bglyh = bglyh; | ||
| 283 | + } | ||
| 284 | + | ||
| 285 | + public String getXlname() { | ||
| 286 | + return BasicData.lineCode2NameMap.get(this.xlbm); | ||
| 287 | + } | ||
| 288 | + | ||
| 289 | + public void setXlname(String xlname) { | ||
| 290 | + this.xlname = xlname; | ||
| 291 | + } | ||
| 292 | + | ||
| 293 | + public String getGsname() { | ||
| 294 | + return BasicData.nbbm2CompanyCodeMap.get(this.nbbm); | ||
| 295 | + } | ||
| 296 | + | ||
| 297 | + public void setGsname(String gsname) { | ||
| 298 | + this.gsname = gsname; | ||
| 299 | + } | ||
| 300 | + | ||
| 301 | + | ||
| 302 | + | ||
| 303 | + | ||
| 257 | 304 | ||
| 258 | } | 305 | } |
src/main/java/com/bsth/entity/oil/Ylxxb.java
| @@ -6,6 +6,9 @@ import javax.persistence.Entity; | @@ -6,6 +6,9 @@ import javax.persistence.Entity; | ||
| 6 | import javax.persistence.GeneratedValue; | 6 | import javax.persistence.GeneratedValue; |
| 7 | import javax.persistence.Id; | 7 | import javax.persistence.Id; |
| 8 | import javax.persistence.Table; | 8 | import javax.persistence.Table; |
| 9 | +import javax.persistence.Transient; | ||
| 10 | + | ||
| 11 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 9 | 12 | ||
| 10 | @Entity | 13 | @Entity |
| 11 | @Table(name = "bsth_c_ylxxb") | 14 | @Table(name = "bsth_c_ylxxb") |
| @@ -13,6 +16,7 @@ public class Ylxxb { | @@ -13,6 +16,7 @@ public class Ylxxb { | ||
| 13 | @Id | 16 | @Id |
| 14 | @GeneratedValue | 17 | @GeneratedValue |
| 15 | private Integer id; | 18 | private Integer id; |
| 19 | + @DateTimeFormat(pattern="yyyy-MM-dd") | ||
| 16 | private Date yyrq; | 20 | private Date yyrq; |
| 17 | private Date jlrq; | 21 | private Date jlrq; |
| 18 | private String nbbm; | 22 | private String nbbm; |
| @@ -29,6 +33,12 @@ public class Ylxxb { | @@ -29,6 +33,12 @@ public class Ylxxb { | ||
| 29 | private String xgr; | 33 | private String xgr; |
| 30 | private String fromgsdm; | 34 | private String fromgsdm; |
| 31 | private int nylx; | 35 | private int nylx; |
| 36 | + @Transient | ||
| 37 | + private String ldgh; | ||
| 38 | + //0为接口数据,1为手工输入 | ||
| 39 | + private int jylx=0; | ||
| 40 | + | ||
| 41 | + | ||
| 32 | public Integer getId() { | 42 | public Integer getId() { |
| 33 | return id; | 43 | return id; |
| 34 | } | 44 | } |
| @@ -131,6 +141,18 @@ public class Ylxxb { | @@ -131,6 +141,18 @@ public class Ylxxb { | ||
| 131 | public void setNylx(int nylx) { | 141 | public void setNylx(int nylx) { |
| 132 | this.nylx = nylx; | 142 | this.nylx = nylx; |
| 133 | } | 143 | } |
| 144 | + public String getLdgh() { | ||
| 145 | + return ldgh; | ||
| 146 | + } | ||
| 147 | + public void setLdgh(String ldgh) { | ||
| 148 | + this.ldgh = ldgh; | ||
| 149 | + } | ||
| 150 | + public int getJylx() { | ||
| 151 | + return jylx; | ||
| 152 | + } | ||
| 153 | + public void setJylx(int jylx) { | ||
| 154 | + this.jylx = jylx; | ||
| 155 | + } | ||
| 134 | 156 | ||
| 135 | 157 | ||
| 136 | 158 |
src/main/java/com/bsth/filter/ResourceFilter.java
| 1 | -package com.bsth.filter; | ||
| 2 | - | ||
| 3 | -import java.io.File; | ||
| 4 | -import java.io.IOException; | ||
| 5 | - | ||
| 6 | -import javax.servlet.FilterChain; | ||
| 7 | -import javax.servlet.ServletException; | ||
| 8 | -import javax.servlet.http.HttpServletRequest; | ||
| 9 | -import javax.servlet.http.HttpServletResponse; | ||
| 10 | - | ||
| 11 | -import org.apache.commons.lang3.StringUtils; | ||
| 12 | - | ||
| 13 | -import com.bsth.util.RequestUtils; | ||
| 14 | - | ||
| 15 | -/** | ||
| 16 | - * | ||
| 17 | - * @ClassName: ResourceFilter | ||
| 18 | - * @Description: TODO(HTML片段过滤器) | ||
| 19 | - * @author PanZhao | ||
| 20 | - * @date 2016年3月19日 下午10:10:11 | ||
| 21 | - * | ||
| 22 | - */ | ||
| 23 | -public class ResourceFilter extends BaseFilter { | ||
| 24 | - | ||
| 25 | - String[] params = new String[]{"no"}; | ||
| 26 | - | ||
| 27 | - @Override | ||
| 28 | - public void doFilter(HttpServletRequest request, | ||
| 29 | - HttpServletResponse response, FilterChain chain) | ||
| 30 | - throws IOException, ServletException { | ||
| 31 | - | ||
| 32 | - String uri = request.getRequestURI(); | ||
| 33 | - int len = uri.length(); | ||
| 34 | - if (RequestUtils.isAjaxRequest(request) || | ||
| 35 | - !uri.substring(len - 5, len).equals(".html")) { | ||
| 36 | - super.doFilter(request, response, chain); | ||
| 37 | - } else { | ||
| 38 | - | ||
| 39 | - String fPath = this.getClass().getResource("/").getPath() | ||
| 40 | - + "static/" + uri; | ||
| 41 | - | ||
| 42 | - File f = new File(fPath); | ||
| 43 | - | ||
| 44 | - | ||
| 45 | - if (f.exists() && f.isFile() ){ | ||
| 46 | - request.getRequestDispatcher("/?initFragment=" + joinParam(request)).forward(request, response);; | ||
| 47 | - }else | ||
| 48 | - response.sendRedirect("/"); | ||
| 49 | - } | ||
| 50 | - } | ||
| 51 | - | ||
| 52 | - /** | ||
| 53 | - * 拼接参数 | ||
| 54 | - * @param request | ||
| 55 | - * @return | ||
| 56 | - */ | ||
| 57 | - public String joinParam(HttpServletRequest request){ | ||
| 58 | - | ||
| 59 | - StringBuilder sb = new StringBuilder(); | ||
| 60 | - | ||
| 61 | - String v | ||
| 62 | - ,url = request.getRequestURI(); | ||
| 63 | - for(String p : params){ | ||
| 64 | - v = request.getParameter(p); | ||
| 65 | - if(!StringUtils.isEmpty(v)) | ||
| 66 | - sb.append("&" + p + "=" + v); | ||
| 67 | - } | ||
| 68 | - | ||
| 69 | - if(sb.length() > 0) | ||
| 70 | - url += "?" + sb.substring(1, sb.length()); | ||
| 71 | - return url; | ||
| 72 | - } | ||
| 73 | -} | 1 | +package com.bsth.filter; |
| 2 | + | ||
| 3 | +import java.io.File; | ||
| 4 | +import java.io.IOException; | ||
| 5 | + | ||
| 6 | +import javax.servlet.FilterChain; | ||
| 7 | +import javax.servlet.ServletException; | ||
| 8 | +import javax.servlet.http.HttpServletRequest; | ||
| 9 | +import javax.servlet.http.HttpServletResponse; | ||
| 10 | + | ||
| 11 | +import org.apache.commons.lang3.StringUtils; | ||
| 12 | + | ||
| 13 | +import com.bsth.util.RequestUtils; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * | ||
| 17 | + * @ClassName: ResourceFilter | ||
| 18 | + * @Description: TODO(HTML片段过滤器) | ||
| 19 | + * @author PanZhao | ||
| 20 | + * @date 2016年3月19日 下午10:10:11 | ||
| 21 | + * | ||
| 22 | + */ | ||
| 23 | +public class ResourceFilter extends BaseFilter { | ||
| 24 | + | ||
| 25 | + String[] params = new String[]{"no"}; | ||
| 26 | + | ||
| 27 | + @Override | ||
| 28 | + public void doFilter(HttpServletRequest request, | ||
| 29 | + HttpServletResponse response, FilterChain chain) | ||
| 30 | + throws IOException, ServletException { | ||
| 31 | + | ||
| 32 | + String uri = request.getRequestURI(); | ||
| 33 | + int len = uri.length(); | ||
| 34 | + if (RequestUtils.isAjaxRequest(request) || | ||
| 35 | + !uri.substring(len - 5, len).equals(".html")) { | ||
| 36 | + super.doFilter(request, response, chain); | ||
| 37 | + } else { | ||
| 38 | + | ||
| 39 | + String fPath = this.getClass().getResource("/").getPath() | ||
| 40 | + + "static/" + uri; | ||
| 41 | + | ||
| 42 | + File f = new File(fPath); | ||
| 43 | + | ||
| 44 | + | ||
| 45 | + if (f.exists() && f.isFile() ){ | ||
| 46 | + request.getRequestDispatcher("/?initFragment=" + joinParam(request)).forward(request, response);; | ||
| 47 | + }else | ||
| 48 | + response.sendRedirect("/"); | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * 拼接参数 | ||
| 54 | + * @param request | ||
| 55 | + * @return | ||
| 56 | + */ | ||
| 57 | + public String joinParam(HttpServletRequest request){ | ||
| 58 | + | ||
| 59 | + StringBuilder sb = new StringBuilder(); | ||
| 60 | + | ||
| 61 | + String v | ||
| 62 | + ,url = request.getRequestURI(); | ||
| 63 | + for(String p : params){ | ||
| 64 | + v = request.getParameter(p); | ||
| 65 | + if(!StringUtils.isEmpty(v)) | ||
| 66 | + sb.append("&" + p + "=" + v); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + if(sb.length() > 0) | ||
| 70 | + url += "?" + sb.substring(1, sb.length()); | ||
| 71 | + return url; | ||
| 72 | + } | ||
| 73 | +} |
src/main/java/com/bsth/repository/oil/YlbRepository.java
| 1 | package com.bsth.repository.oil; | 1 | package com.bsth.repository.oil; |
| 2 | 2 | ||
| 3 | +import java.util.Date; | ||
| 3 | import java.util.List; | 4 | import java.util.List; |
| 5 | +import java.util.Map; | ||
| 4 | 6 | ||
| 5 | import org.springframework.data.jpa.repository.Modifying; | 7 | import org.springframework.data.jpa.repository.Modifying; |
| 6 | import org.springframework.data.jpa.repository.Query; | 8 | import org.springframework.data.jpa.repository.Query; |
| @@ -19,7 +21,9 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | @@ -19,7 +21,9 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | ||
| 19 | */ | 21 | */ |
| 20 | @Transactional | 22 | @Transactional |
| 21 | @Modifying | 23 | @Modifying |
| 22 | - @Query(value="SELECT * FROM bsth_c_ylb where to_days(?)-to_days(rq)=1",nativeQuery=true) | 24 | + @Query(value="SELECT a.* FROM bsth_c_ylb a where to_days(?1)-to_days(a.rq)=1" |
| 25 | + + " and jcsx=(select max(b.jcsx) from bsth_c_ylb b where a.nbbm=b.nbbm and " | ||
| 26 | + + " to_days(?1)-to_days(b.rq)=1 ) group by nbbm",nativeQuery=true) | ||
| 23 | List<Ylb> obtainYlbefore(String rq); | 27 | List<Ylb> obtainYlbefore(String rq); |
| 24 | 28 | ||
| 25 | /** | 29 | /** |
| @@ -31,4 +35,15 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | @@ -31,4 +35,15 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | ||
| 31 | @Modifying | 35 | @Modifying |
| 32 | @Query(value="SELECT * FROM bsth_c_ylb where to_days(?)=to_days(rq)",nativeQuery=true) | 36 | @Query(value="SELECT * FROM bsth_c_ylb where to_days(?)=to_days(rq)",nativeQuery=true) |
| 33 | List<Ylb> obtainYl(String rq); | 37 | List<Ylb> obtainYl(String rq); |
| 38 | + | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 查询当天总的加注量和总里程 | ||
| 42 | + * @param rq | ||
| 43 | + * @return | ||
| 44 | + */ | ||
| 45 | + @Transactional | ||
| 46 | + @Modifying | ||
| 47 | + @Query(value="select sum(jzl) as jzl,sum(zlc) as zlc from bsth_c_ylb where nbbm=?1 and rq=?2",nativeQuery=true) | ||
| 48 | + List<Object[]> sumLcYl(String nbbm,Date rq); | ||
| 34 | } | 49 | } |
src/main/java/com/bsth/repository/oil/YlxxbRepository.java
| @@ -21,4 +21,10 @@ public interface YlxxbRepository extends BaseRepository<Ylxxb, Integer>{ | @@ -21,4 +21,10 @@ public interface YlxxbRepository extends BaseRepository<Ylxxb, Integer>{ | ||
| 21 | @Modifying | 21 | @Modifying |
| 22 | @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?)=to_days(yyrq)",nativeQuery=true) | 22 | @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?)=to_days(yyrq)",nativeQuery=true) |
| 23 | List<Ylxxb> obtainYlxx(String rq); | 23 | List<Ylxxb> obtainYlxx(String rq); |
| 24 | + | ||
| 25 | + @Transactional | ||
| 26 | + @Modifying | ||
| 27 | + @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?1)=to_days(yyrq) and nbbm =?2 and jylx=1",nativeQuery=true) | ||
| 28 | + List<Ylxxb> obtainYlxx2(String rq,String nbbm); | ||
| 29 | + | ||
| 24 | } | 30 | } |
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| @@ -23,6 +23,9 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | @@ -23,6 +23,9 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | ||
| 23 | @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.id,s.jGh,s.clZbh,s.lpName order by (lpName+1)") | 23 | @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.id,s.jGh,s.clZbh,s.lpName order by (lpName+1)") |
| 24 | List<ScheduleRealInfo> queryUserInfo(String line,String date); | 24 | List<ScheduleRealInfo> queryUserInfo(String line,String date); |
| 25 | 25 | ||
| 26 | + @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,s.jName from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.jGh,s.clZbh,s.lpName ,s.jName order by (lpName+1)") | ||
| 27 | + List<ScheduleRealInfo> queryUserInfo2(String line,String date); | ||
| 28 | + | ||
| 26 | @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 order by bcs") | 29 | @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 order by bcs") |
| 27 | List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName); | 30 | List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName); |
| 28 | 31 | ||
| @@ -57,6 +60,9 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | @@ -57,6 +60,9 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | ||
| 57 | @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') order by bcs") | 60 | @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') order by bcs") |
| 58 | List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date); | 61 | List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date); |
| 59 | 62 | ||
| 63 | + @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and bcType='normal' order by bcs") | ||
| 64 | + List<ScheduleRealInfo> queryListWaybill2(String jName,String clZbh,String lpName,String date); | ||
| 65 | + | ||
| 60 | @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2") | 66 | @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2") |
| 61 | List<ScheduleRealInfo> scheduleDaily(String line,String date); | 67 | List<ScheduleRealInfo> scheduleDaily(String line,String date); |
| 62 | 68 | ||
| @@ -72,7 +78,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | @@ -72,7 +78,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | ||
| 72 | @Query(value = "delete ScheduleRealInfo s where s.xlBm=?1 and s.scheduleDateStr=?2") | 78 | @Query(value = "delete ScheduleRealInfo s where s.xlBm=?1 and s.scheduleDateStr=?2") |
| 73 | void deleteByLineCodeAndDate(String xlBm, String schDate); | 79 | void deleteByLineCodeAndDate(String xlBm, String schDate); |
| 74 | 80 | ||
| 75 | - @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2") | 81 | + @Query(value="select s from ScheduleRealInfo s where (s.xlBm = ?1 or s.xlBm is not null) and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2") |
| 76 | List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date); | 82 | List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date); |
| 77 | 83 | ||
| 78 | @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh) from ScheduleRealInfo s where (s.xlBm = ?1 or s.xlBm is not null) and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY xlBm,clZbh,jGh ORDER BY xlBm,clZbh,realExecDate,fcsjActual") | 84 | @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh) from ScheduleRealInfo s where (s.xlBm = ?1 or s.xlBm is not null) and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY xlBm,clZbh,jGh ORDER BY xlBm,clZbh,realExecDate,fcsjActual") |
src/main/java/com/bsth/service/oil/YlbService.java
| 1 | package com.bsth.service.oil; | 1 | package com.bsth.service.oil; |
| 2 | 2 | ||
| 3 | -import java.util.List; | ||
| 4 | import java.util.Map; | 3 | import java.util.Map; |
| 5 | 4 | ||
| 6 | import com.bsth.entity.oil.Ylb; | 5 | import com.bsth.entity.oil.Ylb; |
| 7 | import com.bsth.service.BaseService; | 6 | import com.bsth.service.BaseService; |
| 8 | 7 | ||
| 9 | public interface YlbService extends BaseService<Ylb, Integer>{ | 8 | public interface YlbService extends BaseService<Ylb, Integer>{ |
| 10 | - List<Map<String, Object>> obtain(String rq); | 9 | + Map<String, Object> obtain(String rq); |
| 10 | + | ||
| 11 | + Map<String, Object> sort(Map<String, Object> map); | ||
| 12 | + | ||
| 13 | + Map<String, Object> outAndIn(Map<String, Object> map); | ||
| 14 | + | ||
| 15 | + Map<String, Object> checkYl(Map<String, Object> map); | ||
| 11 | } | 16 | } |
src/main/java/com/bsth/service/oil/YlxxbService.java
| 1 | package com.bsth.service.oil; | 1 | package com.bsth.service.oil; |
| 2 | 2 | ||
| 3 | +import java.util.Map; | ||
| 4 | + | ||
| 3 | import com.bsth.entity.oil.Ylxxb; | 5 | import com.bsth.entity.oil.Ylxxb; |
| 4 | import com.bsth.service.BaseService; | 6 | import com.bsth.service.BaseService; |
| 7 | +import com.bsth.util.PageObject; | ||
| 5 | 8 | ||
| 6 | public interface YlxxbService extends BaseService<Ylxxb, Integer>{ | 9 | public interface YlxxbService extends BaseService<Ylxxb, Integer>{ |
| 10 | + PageObject<Ylxxb> Pagequery(Map<String, Object> map) ; | ||
| 11 | + | ||
| 12 | + Map<String, Object> checkJsy(Map<String, Object> map); | ||
| 7 | 13 | ||
| 8 | } | 14 | } |
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
| 1 | package com.bsth.service.oil.impl; | 1 | package com.bsth.service.oil.impl; |
| 2 | 2 | ||
| 3 | +import java.text.DecimalFormat; | ||
| 4 | +import java.text.ParseException; | ||
| 5 | +import java.text.SimpleDateFormat; | ||
| 3 | import java.util.ArrayList; | 6 | import java.util.ArrayList; |
| 7 | +import java.util.Date; | ||
| 4 | import java.util.HashMap; | 8 | import java.util.HashMap; |
| 9 | +import java.util.Iterator; | ||
| 5 | import java.util.List; | 10 | import java.util.List; |
| 6 | import java.util.Map; | 11 | import java.util.Map; |
| 7 | 12 | ||
| 13 | +import javax.transaction.Transactional; | ||
| 14 | + | ||
| 8 | import org.slf4j.Logger; | 15 | import org.slf4j.Logger; |
| 9 | import org.slf4j.LoggerFactory; | 16 | import org.slf4j.LoggerFactory; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 17 | import org.springframework.beans.factory.annotation.Autowired; |
| 18 | +import org.springframework.data.domain.Sort; | ||
| 19 | +import org.springframework.data.domain.Sort.Direction; | ||
| 11 | import org.springframework.stereotype.Service; | 20 | import org.springframework.stereotype.Service; |
| 12 | 21 | ||
| 13 | import com.bsth.common.ResponseCode; | 22 | import com.bsth.common.ResponseCode; |
| 23 | +import com.bsth.entity.oil.Cyl; | ||
| 14 | import com.bsth.entity.oil.Ylb; | 24 | import com.bsth.entity.oil.Ylb; |
| 15 | import com.bsth.entity.oil.Ylxxb; | 25 | import com.bsth.entity.oil.Ylxxb; |
| 26 | +import com.bsth.entity.search.CustomerSpecs; | ||
| 27 | +import com.bsth.repository.oil.CylRepository; | ||
| 16 | import com.bsth.repository.oil.YlbRepository; | 28 | import com.bsth.repository.oil.YlbRepository; |
| 17 | import com.bsth.repository.oil.YlxxbRepository; | 29 | import com.bsth.repository.oil.YlxxbRepository; |
| 18 | import com.bsth.service.impl.BaseServiceImpl; | 30 | import com.bsth.service.impl.BaseServiceImpl; |
| 19 | import com.bsth.service.oil.YlbService; | 31 | import com.bsth.service.oil.YlbService; |
| 32 | +import com.bsth.service.realcontrol.ScheduleRealInfoService; | ||
| 20 | import com.github.abel533.echarts.code.Y; | 33 | import com.github.abel533.echarts.code.Y; |
| 21 | 34 | ||
| 22 | @Service | 35 | @Service |
| @@ -27,43 +40,356 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -27,43 +40,356 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 27 | @Autowired | 40 | @Autowired |
| 28 | YlxxbRepository ylxxbRepository; | 41 | YlxxbRepository ylxxbRepository; |
| 29 | 42 | ||
| 43 | + @Autowired | ||
| 44 | + CylRepository cylRepository; | ||
| 45 | + | ||
| 46 | + @Autowired | ||
| 47 | + ScheduleRealInfoService scheduleRealInfoService; | ||
| 48 | + | ||
| 30 | Logger logger = LoggerFactory.getLogger(this.getClass()); | 49 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 50 | + | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * 获取进存油信息 | ||
| 54 | + * @Transactional 回滚事物 | ||
| 55 | + */ | ||
| 56 | + @Transactional | ||
| 31 | @Override | 57 | @Override |
| 32 | - public List<Map<String, Object>> obtain(String rq) { | 58 | + public Map<String, Object> obtain(String rq) { |
| 59 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 60 | + //保留两位小数 | ||
| 61 | + DecimalFormat df = new DecimalFormat("#.00"); | ||
| 33 | // TODO Auto-generated method stub | 62 | // TODO Auto-generated method stub |
| 34 | - List<Map<String, Object>> list=new ArrayList<Map<String, Object>>(); | 63 | + Map<String, Object> newMap=new HashMap<String,Object>(); |
| 35 | //当天YLB信息 | 64 | //当天YLB信息 |
| 36 | List<Ylb> ylList=repository.obtainYl(rq); | 65 | List<Ylb> ylList=repository.obtainYl(rq); |
| 37 | //当天YLXXB信息 | 66 | //当天YLXXB信息 |
| 38 | List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq); | 67 | List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq); |
| 39 | - | ||
| 40 | - //前一天YLB信息 | 68 | + //前一天所有车辆最后进场班次信息 |
| 41 | List<Ylb> ylListBe=repository.obtainYlbefore(rq); | 69 | List<Ylb> ylListBe=repository.obtainYlbefore(rq); |
| 70 | + //从排班表中计算出行驶的总里程 | ||
| 71 | + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("1024",rq); | ||
| 72 | + | ||
| 73 | + for(int x=0;x<listpb.size();x++){ | ||
| 74 | + | ||
| 75 | + Map<String, Object> map=listpb.get(x); | ||
| 42 | 76 | ||
| 43 | - for(int i=0;i<ylList.size();i++){ | ||
| 44 | - Map<String, Object> map = new HashMap<String, Object>(); | ||
| 45 | - Ylb t=ylList.get(i); | ||
| 46 | - Double jzl=0.0; | ||
| 47 | - //把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断) | ||
| 48 | - for(int j=0;j<ylxxList.size();j++){ | ||
| 49 | - Ylxxb ylxxb= ylxxList.get(j); | ||
| 50 | - if(t.getNbbm().equals(ylxxb.getNbbm()) && t.getJsy().equals(ylxxb.getJsy())){ | ||
| 51 | - jzl+=ylxxb.getJzl(); | 77 | + //判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) |
| 78 | + Ylb t=new Ylb(); | ||
| 79 | + for(int k=0;k<ylList.size();k++){ | ||
| 80 | + Ylb t1=ylList.get(k); | ||
| 81 | + if(t1.getNbbm().equals(map.get("clZbh").toString()) | ||
| 82 | + &&t1.getJsy().equals(map.get("jGh").toString()) | ||
| 83 | + &&t1.getXlbm().equals(map.get("xlBm").toString())) | ||
| 84 | + { | ||
| 85 | + t=t1; | ||
| 52 | } | 86 | } |
| 53 | } | 87 | } |
| 54 | - t.setJzl(jzl); | 88 | + try { |
| 89 | + //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | ||
| 90 | + if(map.get("seqNumber").toString().equals("1")){ | ||
| 91 | + for (int y = 0; y < ylListBe.size(); y++) { | ||
| 92 | + Ylb ylb=ylListBe.get(y); | ||
| 93 | + if(map.get("clZbh").toString().equals(ylb.getNbbm())){ | ||
| 94 | + t.setCzyl(ylb.getJzyl()); | ||
| 95 | + break; | ||
| 96 | + }else{ | ||
| 97 | + t.setCzyl(0.0); | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + Double jzl=0.0; | ||
| 103 | + //把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断) | ||
| 104 | + for(int j=0;j<ylxxList.size();j++){ | ||
| 105 | + Ylxxb ylxxb= ylxxList.get(j); | ||
| 106 | + if(map.get("clZbh").toString().equals(ylxxb.getNbbm()) &&map.get("jGh").toString().equals(ylxxb.getJsy())){ | ||
| 107 | + jzl+=ylxxb.getJzl(); | ||
| 108 | + } | ||
| 109 | + } | ||
| 110 | + t.setJzl(jzl); | ||
| 111 | + t.setNbbm(map.get("clZbh").toString()); | ||
| 112 | + t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString()); | ||
| 113 | + t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString())))); | ||
| 114 | + t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString()); | ||
| 115 | + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | ||
| 116 | + t.setSsgsdm(map.get("company").toString()); | ||
| 117 | + t.setRq(sdf.parse(rq)); | ||
| 118 | + repository.save(t); | ||
| 119 | + newMap.put("status", ResponseCode.SUCCESS); | ||
| 120 | + } catch (ParseException e) { | ||
| 121 | + // TODO Auto-generated catch block | ||
| 122 | + newMap.put("status", ResponseCode.ERROR); | ||
| 123 | + e.printStackTrace(); | ||
| 124 | + } | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + return newMap; | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + | ||
| 131 | + /** | ||
| 132 | + * 进场等于出场 | ||
| 133 | + */ | ||
| 134 | + @Transactional | ||
| 135 | + @Override | ||
| 136 | + public Map<String, Object> outAndIn(Map<String, Object> map){ | ||
| 137 | + // TODO Auto-generated method stub | ||
| 138 | + Map<String, Object> newMap=new HashMap<String,Object>(); | ||
| 139 | + Map<String, Object> map2=new HashMap<String,Object>(); | ||
| 140 | + String rq=map.get("rq").toString(); | ||
| 141 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 142 | + | ||
| 143 | + try { | ||
| 144 | + map.put("rq_eq", sdf.parse(rq)); | ||
| 145 | + } catch (ParseException e1) { | ||
| 146 | + // TODO Auto-generated catch block | ||
| 147 | + e1.printStackTrace(); | ||
| 148 | + } | ||
| 149 | + //获取车辆存油信息 | ||
| 150 | + List<Cyl> cylList=cylRepository.findAll(new CustomerSpecs<Cyl>(newMap)); | ||
| 151 | + //指定日期YLB信息 | ||
| 152 | + Iterator<Ylb> iterator= repository.findAll(new CustomerSpecs<Ylb>(map)).iterator(); | ||
| 153 | + while(iterator.hasNext()){ | ||
| 154 | + Ylb ylb=iterator.next(); | ||
| 155 | + //判断是否已经计算过 | ||
| 156 | + if(newMap.get("nbbm"+ylb.getNbbm())==null){ | ||
| 157 | + String nbbm_eq=ylb.getNbbm(); | ||
| 158 | + Date rq_eq=ylb.getRq(); | ||
| 159 | + //得到一天总的加油和里程(根据车,时间) | ||
| 160 | + List<Object[]> sumList=repository.sumLcYl(nbbm_eq, rq_eq); | ||
| 161 | + //保存总的加油量 | ||
| 162 | + Double jzl=Double.valueOf(sumList.get(0)[0].toString()); | ||
| 163 | + //保存总的里程 | ||
| 164 | + Double zlc=Double.valueOf(sumList.get(0)[1].toString()); | ||
| 165 | + //保留两位小数 | ||
| 166 | + DecimalFormat df = new DecimalFormat("#.00"); | ||
| 167 | + Double zyl=0.0; | ||
| 168 | + Double nextJzyl=0.0; | ||
| 169 | + | ||
| 170 | + //保存已经计算过的车辆,相同车辆编号的车不在计算 | ||
| 171 | + newMap.put("nbbm"+ylb.getNbbm(), ylb.getNbbm()); | ||
| 172 | + | ||
| 173 | + //查询指定车辆,设置进、存、耗油量 | ||
| 174 | + map.remove("nbbm_eq"); | ||
| 175 | + map.put("nbbm_eq", ylb.getNbbm()); | ||
| 176 | + Iterator<Ylb> iterator2= repository.findAll(new CustomerSpecs<Ylb>(map),new Sort(Direction.ASC, "jcsx")).iterator(); | ||
| 177 | + while(iterator2.hasNext()){ | ||
| 178 | + try{ | ||
| 179 | + Ylb t = iterator2.next(); | ||
| 180 | + if(t.getJcsx()==1){ | ||
| 181 | + //进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量 | ||
| 182 | + Double yl=t.getCzyl(); | ||
| 183 | + Double jcyl=t.getCzyl(); | ||
| 184 | + zyl=jcyl+jzl-yl; | ||
| 185 | + Double yh=Double.parseDouble(df.format(zyl*(t.getZlc()/zlc))); | ||
| 186 | + t.setYh(yh); | ||
| 187 | + nextJzyl=t.getJzl()+t.getCzyl()-yh; | ||
| 188 | + t.setJzyl(Double.parseDouble(df.format(nextJzyl))); | ||
| 189 | + }else{ | ||
| 190 | + t.setCzyl(Double.parseDouble(df.format(nextJzyl))); | ||
| 191 | + Double yh=Double.parseDouble(df.format(zyl*(t.getZlc()/zlc))); | ||
| 192 | + t.setYh(yh); | ||
| 193 | + nextJzyl=t.getJzl()+nextJzyl-yh; | ||
| 194 | + t.setJzyl(Double.parseDouble(df.format(nextJzyl))); | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + repository.save(t); | ||
| 198 | + //设置存油量 | ||
| 199 | + Cyl cyl=null; | ||
| 200 | + boolean fage=false; | ||
| 201 | + for(int z=0;z<cylList.size();z++){ | ||
| 202 | + cyl=cylList.get(z); | ||
| 203 | + if(t.getNbbm().equals(cyl.getNbbm())){ | ||
| 204 | + cyl.setCyl(t.getJzyl()); | ||
| 205 | + cyl.setUpdatetime(t.getRq()); | ||
| 206 | + fage=true; | ||
| 207 | + break; | ||
| 208 | + } | ||
| 209 | + } | ||
| 210 | + | ||
| 211 | + if(fage){ | ||
| 212 | + cylRepository.save(cyl); | ||
| 213 | + }else{ | ||
| 214 | + cyl=new Cyl(); | ||
| 215 | + cyl.setNbbm(t.getNbbm()); | ||
| 216 | + cyl.setCyl(t.getJzyl()); | ||
| 217 | + cyl.setGsdm(t.getSsgsdm()); | ||
| 218 | + cyl.setUpdatetime(t.getRq()); | ||
| 219 | + cylRepository.save(cyl); | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + | ||
| 223 | + map2.put("status", ResponseCode.SUCCESS); | ||
| 224 | + }catch(Exception e){ | ||
| 225 | + map2.put("status", ResponseCode.ERROR); | ||
| 226 | + logger.error("save erro.", e); | ||
| 227 | + } | ||
| 228 | + } | ||
| 229 | + | ||
| 230 | + | ||
| 231 | + } | ||
| 232 | + } | ||
| 233 | + | ||
| 234 | + return map2; | ||
| 235 | + } | ||
| 236 | + | ||
| 237 | + /** | ||
| 238 | + * 拆分 | ||
| 239 | + */ | ||
| 240 | + @Transactional | ||
| 241 | + @Override | ||
| 242 | + public Map<String, Object> sort(Map<String, Object> map) { | ||
| 243 | + // TODO Auto-generated method stub | ||
| 244 | + Map<String, Object> newMap = new HashMap<String, Object>(); | ||
| 245 | + //获取车辆存油信息 | ||
| 246 | + List<Cyl> cylList=cylRepository.findAll(new CustomerSpecs<Cyl>(newMap)); | ||
| 247 | + int id=Integer.parseInt(map.get("id").toString()); | ||
| 248 | + //最后存油量 | ||
| 249 | + Double yl=Double.parseDouble(map.get("jzyl").toString()); | ||
| 250 | + Ylb ylb=repository.findOne(id); | ||
| 251 | + String nbbm_eq=ylb.getNbbm(); | ||
| 252 | + Date rq_eq=ylb.getRq(); | ||
| 253 | + //得到一天总的加油和里程(根据车,时间) | ||
| 254 | + List<Object[]> sumList=repository.sumLcYl(nbbm_eq, rq_eq); | ||
| 255 | + //保存总的加油量 | ||
| 256 | + Double jzl=Double.valueOf(sumList.get(0)[0].toString()); | ||
| 257 | + //保存总的里程 | ||
| 258 | + Double zlc=Double.valueOf(sumList.get(0)[1].toString()); | ||
| 259 | + map.put("nbbm_eq", nbbm_eq); | ||
| 260 | + map.put("rq_eq",rq_eq); | ||
| 261 | + Iterator<Ylb> iterator= repository.findAll(new CustomerSpecs<Ylb>(map),new Sort(Direction.ASC, "jcsx")).iterator(); | ||
| 262 | + //根据jcyl排序1为该车当日第一个出场,出场油量为前一天的存油 | ||
| 263 | + //保留两位小数 | ||
| 264 | + DecimalFormat df = new DecimalFormat("#.00"); | ||
| 265 | + Double zyl=0.0; | ||
| 266 | + Double nextJzyl=0.0; | ||
| 267 | + //车的,进,出油量及耗油 | ||
| 268 | + while(iterator.hasNext()){ | ||
| 55 | try{ | 269 | try{ |
| 270 | + Ylb t = iterator.next(); | ||
| 271 | + if(t.getJcsx()==1){ | ||
| 272 | + Double jcyl=t.getCzyl(); | ||
| 273 | + zyl=jcyl+jzl-yl; | ||
| 274 | + Double yh=Double.parseDouble(df.format(zyl*(t.getZlc()/zlc))); | ||
| 275 | + t.setYh(yh); | ||
| 276 | + nextJzyl=t.getJzl()+t.getCzyl()-yh; | ||
| 277 | + t.setJzyl(Double.parseDouble(df.format(nextJzyl))); | ||
| 278 | + }else{ | ||
| 279 | + if(t.getZlc()!=0){ | ||
| 280 | + t.setCzyl(Double.parseDouble(df.format(nextJzyl))); | ||
| 281 | + Double yh=Double.parseDouble(df.format(zyl*(t.getZlc()/zlc))); | ||
| 282 | + t.setYh(yh); | ||
| 283 | + nextJzyl=t.getJzl()+nextJzyl-yh; | ||
| 284 | + t.setJzyl(Double.parseDouble(df.format(nextJzyl))); | ||
| 285 | + } | ||
| 286 | + | ||
| 287 | + } | ||
| 56 | repository.save(t); | 288 | repository.save(t); |
| 57 | - map.put("status", ResponseCode.SUCCESS); | ||
| 58 | - map.put("t", t); | ||
| 59 | - list.add(map); | 289 | + |
| 290 | + //设置存油量 | ||
| 291 | + Cyl cyl=null; | ||
| 292 | + boolean fage=false; | ||
| 293 | + for(int z=0;z<cylList.size();z++){ | ||
| 294 | + cyl=cylList.get(z); | ||
| 295 | + if(t.getNbbm().equals(cyl.getNbbm())){ | ||
| 296 | + cyl.setCyl(t.getJzyl()); | ||
| 297 | + cyl.setUpdatetime(t.getRq()); | ||
| 298 | + fage=true; | ||
| 299 | + break; | ||
| 300 | + } | ||
| 301 | + } | ||
| 302 | + if(fage){ | ||
| 303 | + cylRepository.save(cyl); | ||
| 304 | + }else{ | ||
| 305 | + cyl=new Cyl(); | ||
| 306 | + cyl.setNbbm(t.getNbbm()); | ||
| 307 | + cyl.setCyl(t.getJzyl()); | ||
| 308 | + cyl.setGsdm(t.getSsgsdm()); | ||
| 309 | + cyl.setUpdatetime(t.getRq()); | ||
| 310 | + cylRepository.save(cyl); | ||
| 311 | + } | ||
| 312 | + | ||
| 313 | + newMap.put("status", ResponseCode.SUCCESS); | ||
| 60 | }catch(Exception e){ | 314 | }catch(Exception e){ |
| 61 | - map.put("status", ResponseCode.ERROR); | 315 | + newMap.put("status", ResponseCode.ERROR); |
| 62 | logger.error("save erro.", e); | 316 | logger.error("save erro.", e); |
| 63 | - list.add(map); | ||
| 64 | } | 317 | } |
| 65 | } | 318 | } |
| 66 | - return list; | 319 | + return newMap; |
| 67 | } | 320 | } |
| 68 | 321 | ||
| 322 | + /** | ||
| 323 | + * 核对,有加注没里程 | ||
| 324 | + * @param map | ||
| 325 | + * @return | ||
| 326 | + */ | ||
| 327 | + @Transactional | ||
| 328 | + @Override | ||
| 329 | + public Map<String, Object> checkYl(Map<String, Object> map) { | ||
| 330 | + Map<String, Object> newMap=new HashMap<String,Object>(); | ||
| 331 | + // TODO Auto-generated method stub | ||
| 332 | + try{ | ||
| 333 | + //获取车辆存油信息 | ||
| 334 | + List<Cyl> cylList=cylRepository.findAll(new CustomerSpecs<Cyl>(newMap)); | ||
| 335 | + String rq=map.get("rq").toString(); | ||
| 336 | + List<Ylb> ylbList=repository.obtainYl(rq); | ||
| 337 | + List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq); | ||
| 338 | + for (int i = 0; i < ylxxbList.size(); i++) { | ||
| 339 | + Boolean fage=true; | ||
| 340 | + Ylxxb y1=ylxxbList.get(i); | ||
| 341 | + for(int y=0;y<ylbList.size();y++){ | ||
| 342 | + Ylb y2=ylbList.get(y); | ||
| 343 | + if(y1.getNbbm().equals(y2.getNbbm())){ | ||
| 344 | + fage=false; | ||
| 345 | + break; | ||
| 346 | + } | ||
| 347 | + } | ||
| 348 | + | ||
| 349 | + if(fage){ | ||
| 350 | + Ylb t=new Ylb(); | ||
| 351 | + t.setNbbm(y1.getNbbm()); | ||
| 352 | + t.setRq(y1.getYyrq()); | ||
| 353 | + t.setJsy(y1.getJsy()); | ||
| 354 | + t.setJzl(y1.getJzl()); | ||
| 355 | + t.setSsgsdm(y1.getGsdm()); | ||
| 356 | + t.setXlbm("1024"); | ||
| 357 | + repository.save(t); | ||
| 358 | + | ||
| 359 | + //设置存油量 | ||
| 360 | + Cyl cyl=null; | ||
| 361 | + boolean status=false; | ||
| 362 | + for(int z=0;z<cylList.size();z++){ | ||
| 363 | + cyl=cylList.get(z); | ||
| 364 | + if(t.getNbbm().equals(cyl.getNbbm())){ | ||
| 365 | + cyl.setCyl(cyl.getCyl()+t.getJzl()); | ||
| 366 | + cyl.setUpdatetime(t.getRq()); | ||
| 367 | + status=true; | ||
| 368 | + break; | ||
| 369 | + } | ||
| 370 | + } | ||
| 371 | + if(status){ | ||
| 372 | + cylRepository.save(cyl); | ||
| 373 | + }else{ | ||
| 374 | + cyl=new Cyl(); | ||
| 375 | + cyl.setNbbm(t.getNbbm()); | ||
| 376 | + cyl.setCyl(t.getJzl()); | ||
| 377 | + cyl.setGsdm(t.getSsgsdm()); | ||
| 378 | + cyl.setUpdatetime(t.getRq()); | ||
| 379 | + cylRepository.save(cyl); | ||
| 380 | + } | ||
| 381 | + | ||
| 382 | + | ||
| 383 | + } | ||
| 384 | + } | ||
| 385 | + newMap.put("status", ResponseCode.SUCCESS); | ||
| 386 | + }catch(Exception e){ | ||
| 387 | + newMap.put("status", ResponseCode.ERROR); | ||
| 388 | + logger.error("save erro.", e); | ||
| 389 | + } | ||
| 390 | + | ||
| 391 | + return newMap; | ||
| 392 | + } | ||
| 393 | + | ||
| 394 | + | ||
| 69 | } | 395 | } |
src/main/java/com/bsth/service/oil/impl/YlxxbServiceImpl.java
| 1 | package com.bsth.service.oil.impl; | 1 | package com.bsth.service.oil.impl; |
| 2 | 2 | ||
| 3 | +import java.text.ParseException; | ||
| 4 | +import java.text.SimpleDateFormat; | ||
| 5 | +import java.util.ArrayList; | ||
| 6 | +import java.util.HashMap; | ||
| 7 | +import java.util.List; | ||
| 8 | +import java.util.Map; | ||
| 9 | + | ||
| 10 | +import org.slf4j.Logger; | ||
| 11 | +import org.slf4j.LoggerFactory; | ||
| 12 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 3 | import org.springframework.stereotype.Service; | 13 | import org.springframework.stereotype.Service; |
| 4 | 14 | ||
| 15 | +import com.bsth.common.ResponseCode; | ||
| 16 | +import com.bsth.entity.oil.Ylb; | ||
| 5 | import com.bsth.entity.oil.Ylxxb; | 17 | import com.bsth.entity.oil.Ylxxb; |
| 18 | +import com.bsth.entity.search.CustomerSpecs; | ||
| 19 | +import com.bsth.repository.oil.YlbRepository; | ||
| 20 | +import com.bsth.repository.oil.YlxxbRepository; | ||
| 6 | import com.bsth.service.impl.BaseServiceImpl; | 21 | import com.bsth.service.impl.BaseServiceImpl; |
| 7 | import com.bsth.service.oil.YlxxbService; | 22 | import com.bsth.service.oil.YlxxbService; |
| 23 | +import com.bsth.util.PageHelper; | ||
| 24 | +import com.bsth.util.PageObject; | ||
| 8 | 25 | ||
| 9 | @Service | 26 | @Service |
| 10 | public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements YlxxbService | 27 | public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements YlxxbService |
| 11 | { | 28 | { |
| 29 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 30 | + @Autowired | ||
| 31 | + YlxxbRepository repository; | ||
| 32 | + @Autowired | ||
| 33 | + YlbRepository ylbRepository; | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public PageObject<Ylxxb> Pagequery(Map<String, Object> map) { | ||
| 37 | + String rq=map.get("yyrq").toString(); | ||
| 38 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 39 | + try { | ||
| 40 | + map.put("yyrq_eq", sdf.parseObject(rq)); | ||
| 41 | + } catch (ParseException e) { | ||
| 42 | + // TODO Auto-generated catch block | ||
| 43 | + e.printStackTrace(); | ||
| 44 | + } | ||
| 45 | + //根具条件查询指定日期Ylxxb的数据 | ||
| 46 | + List<Ylxxb> iterator=repository.findAll(new CustomerSpecs<Ylxxb>(map)); | ||
| 47 | + map.remove("yyrq_eq"); | ||
| 48 | + try { | ||
| 49 | + map.put("rq_eq", sdf.parse(rq)); | ||
| 50 | + } catch (ParseException e) { | ||
| 51 | + // TODO Auto-generated catch block | ||
| 52 | + e.printStackTrace(); | ||
| 53 | + } | ||
| 54 | + //根具条件查询指定日期Ylb的数据 | ||
| 55 | + List<Ylb> ylbIterator=(List<Ylb>) ylbRepository.findAll(new CustomerSpecs<Ylb>(map)); | ||
| 56 | + List<Ylxxb> list=new ArrayList<Ylxxb>(); | ||
| 57 | + for (int i = 0; i < iterator.size(); i++) { | ||
| 58 | + Ylxxb y1=iterator.get(i); | ||
| 59 | + boolean fage=true; | ||
| 60 | + String ldgh=""; | ||
| 61 | + for (int j = 0; j < ylbIterator.size(); j++) { | ||
| 62 | + Ylb y2 = ylbIterator.get(j); | ||
| 63 | + if(y1.getNbbm().equals(y2.getNbbm())){ | ||
| 64 | + if(y1.getJsy().equals(y2.getJsy())){ | ||
| 65 | + fage=false; | ||
| 66 | + } | ||
| 67 | + ldgh +=y2.getJsy()+"/"; | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + if(fage){ | ||
| 71 | + y1.setLdgh(ldgh); | ||
| 72 | + list.add(y1); | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + PageHelper pageHelper = new PageHelper(list.size(), map); | ||
| 77 | + pageHelper.getMap(); | ||
| 78 | + PageObject<Ylxxb> pageObject=pageHelper.getPageObject(); | ||
| 79 | + pageObject.setDataList(list); | ||
| 80 | + return pageObject; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + @Override | ||
| 84 | + public Map<String, Object> checkJsy(Map<String, Object> map) { | ||
| 85 | + Map<String, Object> newMap=new HashMap<String,Object>(); | ||
| 86 | + // TODO Auto-generated method stub | ||
| 87 | + try { | ||
| 88 | + int id=Integer.parseInt(map.get("id").toString()); | ||
| 89 | + String jsy=map.get("jsy").toString(); | ||
| 90 | + Ylxxb ylxxb=repository.findOne(id); | ||
| 91 | + ylxxb.setJsy(jsy); | ||
| 92 | + repository.save(ylxxb); | ||
| 93 | + newMap.put("status", ResponseCode.SUCCESS); | ||
| 94 | + }catch(Exception e){ | ||
| 95 | + newMap.put("status", ResponseCode.ERROR); | ||
| 96 | + logger.error("save erro.", e); | ||
| 97 | + } | ||
| 98 | + return newMap; | ||
| 99 | + } | ||
| 12 | 100 | ||
| 13 | } | 101 | } |
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| @@ -113,6 +113,9 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | @@ -113,6 +113,9 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | ||
| 113 | 113 | ||
| 114 | List<ScheduleRealInfo> realScheduleList(String line,String date); | 114 | List<ScheduleRealInfo> realScheduleList(String line,String date); |
| 115 | 115 | ||
| 116 | + | ||
| 117 | + List<Map<String,Object>> yesterdayDataList(String line,String date); | ||
| 118 | + | ||
| 116 | List<Map<String,Object>> yesterdayDataList(String line); | 119 | List<Map<String,Object>> yesterdayDataList(String line); |
| 117 | 120 | ||
| 118 | Map<String, Object> multi_tzrc(List<ChangePersonCar> cpcs); | 121 | Map<String, Object> multi_tzrc(List<ChangePersonCar> cpcs); |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -509,7 +509,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -509,7 +509,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 509 | 509 | ||
| 510 | @Override | 510 | @Override |
| 511 | public List<ScheduleRealInfo> queryUserInfo(String line, String date) { | 511 | public List<ScheduleRealInfo> queryUserInfo(String line, String date) { |
| 512 | - return scheduleRealInfoRepository.queryUserInfo(line, date); | 512 | + return scheduleRealInfoRepository.queryUserInfo2(line, date); |
| 513 | } | 513 | } |
| 514 | /** | 514 | /** |
| 515 | * | 515 | * |
| @@ -1165,7 +1165,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1165,7 +1165,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1165 | @Override | 1165 | @Override |
| 1166 | public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh, | 1166 | public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh, |
| 1167 | String lpName,String date) { | 1167 | String lpName,String date) { |
| 1168 | - return scheduleRealInfoRepository.queryListWaybill(jName,clZbh,lpName,date); | 1168 | + return scheduleRealInfoRepository.queryListWaybill2(jName,clZbh,lpName,date); |
| 1169 | } | 1169 | } |
| 1170 | 1170 | ||
| 1171 | @Override | 1171 | @Override |
| @@ -1467,9 +1467,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1467,9 +1467,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1467 | } | 1467 | } |
| 1468 | 1468 | ||
| 1469 | 1469 | ||
| 1470 | - public List<Map<String,Object>> yesterdayDataList(String line) { | 1470 | + public List<Map<String,Object>> yesterdayDataList(String line,String date) { |
| 1471 | //前一天日期 | 1471 | //前一天日期 |
| 1472 | - String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1)); | 1472 | +// String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1)); |
| 1473 | +// String date = "2016-09-20"; | ||
| 1473 | List<Map<String,Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date); | 1474 | List<Map<String,Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date); |
| 1474 | List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date); | 1475 | List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date); |
| 1475 | for(ScheduleRealInfo scheduleRealInfo:list){ | 1476 | for(ScheduleRealInfo scheduleRealInfo:list){ |
| @@ -1609,4 +1610,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1609,4 +1610,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1609 | rs.put("ts", list); | 1610 | rs.put("ts", list); |
| 1610 | return rs; | 1611 | return rs; |
| 1611 | } | 1612 | } |
| 1613 | + | ||
| 1614 | + @Override | ||
| 1615 | + public List<Map<String, Object>> yesterdayDataList(String line) { | ||
| 1616 | + // TODO Auto-generated method stub | ||
| 1617 | + return null; | ||
| 1618 | + } | ||
| 1619 | + | ||
| 1612 | } | 1620 | } |
src/main/java/com/bsth/service/schedule/rules/strategy/IStrategy.java
| 1 | -package com.bsth.service.schedule.rules.strategy; | ||
| 2 | - | ||
| 3 | -import com.bsth.entity.Line; | ||
| 4 | -import com.bsth.entity.schedule.CarConfigInfo; | ||
| 5 | -import com.bsth.entity.schedule.EmployeeConfigInfo; | ||
| 6 | -import com.bsth.entity.schedule.TTInfo; | ||
| 7 | -import com.bsth.entity.schedule.TTInfoDetail; | ||
| 8 | -import com.bsth.entity.schedule.rule.ScheduleRule1Flat; | ||
| 9 | -import com.google.common.collect.Multimap; | ||
| 10 | - | ||
| 11 | -import java.util.Date; | ||
| 12 | -import java.util.List; | ||
| 13 | -import java.util.Map; | ||
| 14 | - | ||
| 15 | -/** | ||
| 16 | - * 获取数据的策略。 | ||
| 17 | - */ | ||
| 18 | -public interface IStrategy { | ||
| 19 | - | ||
| 20 | - /** | ||
| 21 | - * 获取线路信息。 | ||
| 22 | - * @param xlId 线路id | ||
| 23 | - * @return | ||
| 24 | - */ | ||
| 25 | - Line getLine(Integer xlId); | ||
| 26 | - | ||
| 27 | - /** | ||
| 28 | - * 获取指定线路下,可用的时刻表。 | ||
| 29 | - * @param xlId 线路id | ||
| 30 | - * @return 时刻表 | ||
| 31 | - */ | ||
| 32 | - List<TTInfo> getTTInfo(Integer xlId); | ||
| 33 | - | ||
| 34 | - /** | ||
| 35 | - * 获取指定线路的时刻表的明细。 | ||
| 36 | - * @param xlId 线路id | ||
| 37 | - * @return | ||
| 38 | - */ | ||
| 39 | - List<TTInfoDetail> getTTInfoDetail(Integer xlId); | ||
| 40 | - | ||
| 41 | - /** | ||
| 42 | - * 获取指定线路下,可用的排班规则。 | ||
| 43 | - * @param xlId | ||
| 44 | - * @return | ||
| 45 | - */ | ||
| 46 | - Iterable<ScheduleRule1Flat> getScheduleRule(Integer xlId); | ||
| 47 | - | ||
| 48 | - /** | ||
| 49 | - * 获取指定线路下,日期与路牌与时刻明细对应的Map。 | ||
| 50 | - * @param xlId 线路id | ||
| 51 | - * @param fromDate 开始日期 | ||
| 52 | - * @param toDate 结束日期 | ||
| 53 | - * @return 路牌id为key,时刻明细 Collection<TTInfoDetail> 为value | ||
| 54 | - */ | ||
| 55 | - Map<Date, Multimap<Long, TTInfoDetail>> getGuideboardXlTTInfoDetailMaps(Integer xlId, Date fromDate, Date toDate); | ||
| 56 | - | ||
| 57 | - /** | ||
| 58 | - * 获取指定线路下,车辆配置与车辆信息对应的Map。 | ||
| 59 | - * @param xlId 线路id | ||
| 60 | - * @return 车辆配置id为key,具体车辆配置信息为value。 | ||
| 61 | - */ | ||
| 62 | - Map<Long, CarConfigInfo> getCarConfigMaps(Integer xlId); | ||
| 63 | - | ||
| 64 | - /** | ||
| 65 | - * 获取指定线路下,人员配置与人员对应的Map。 | ||
| 66 | - * @param xlId 线路id | ||
| 67 | - * @return 人员配置id为key,具体人员配置信息为value。 | ||
| 68 | - */ | ||
| 69 | - Map<Long, EmployeeConfigInfo> getEmployeeConfigMaps(Integer xlId); | ||
| 70 | -} | 1 | +package com.bsth.service.schedule.rules.strategy; |
| 2 | + | ||
| 3 | +import com.bsth.entity.Line; | ||
| 4 | +import com.bsth.entity.schedule.CarConfigInfo; | ||
| 5 | +import com.bsth.entity.schedule.EmployeeConfigInfo; | ||
| 6 | +import com.bsth.entity.schedule.TTInfo; | ||
| 7 | +import com.bsth.entity.schedule.TTInfoDetail; | ||
| 8 | +import com.bsth.entity.schedule.rule.ScheduleRule1Flat; | ||
| 9 | +import com.google.common.collect.Multimap; | ||
| 10 | + | ||
| 11 | +import java.util.Date; | ||
| 12 | +import java.util.List; | ||
| 13 | +import java.util.Map; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * 获取数据的策略。 | ||
| 17 | + */ | ||
| 18 | +public interface IStrategy { | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 获取线路信息。 | ||
| 22 | + * @param xlId 线路id | ||
| 23 | + * @return | ||
| 24 | + */ | ||
| 25 | + Line getLine(Integer xlId); | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 获取指定线路下,可用的时刻表。 | ||
| 29 | + * @param xlId 线路id | ||
| 30 | + * @return 时刻表 | ||
| 31 | + */ | ||
| 32 | + List<TTInfo> getTTInfo(Integer xlId); | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 获取指定线路的时刻表的明细。 | ||
| 36 | + * @param xlId 线路id | ||
| 37 | + * @return | ||
| 38 | + */ | ||
| 39 | + List<TTInfoDetail> getTTInfoDetail(Integer xlId); | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 获取指定线路下,可用的排班规则。 | ||
| 43 | + * @param xlId | ||
| 44 | + * @return | ||
| 45 | + */ | ||
| 46 | + Iterable<ScheduleRule1Flat> getScheduleRule(Integer xlId); | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * 获取指定线路下,日期与路牌与时刻明细对应的Map。 | ||
| 50 | + * @param xlId 线路id | ||
| 51 | + * @param fromDate 开始日期 | ||
| 52 | + * @param toDate 结束日期 | ||
| 53 | + * @return 路牌id为key,时刻明细 Collection<TTInfoDetail> 为value | ||
| 54 | + */ | ||
| 55 | + Map<Date, Multimap<Long, TTInfoDetail>> getGuideboardXlTTInfoDetailMaps(Integer xlId, Date fromDate, Date toDate); | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 获取指定线路下,车辆配置与车辆信息对应的Map。 | ||
| 59 | + * @param xlId 线路id | ||
| 60 | + * @return 车辆配置id为key,具体车辆配置信息为value。 | ||
| 61 | + */ | ||
| 62 | + Map<Long, CarConfigInfo> getCarConfigMaps(Integer xlId); | ||
| 63 | + | ||
| 64 | + /** | ||
| 65 | + * 获取指定线路下,人员配置与人员对应的Map。 | ||
| 66 | + * @param xlId 线路id | ||
| 67 | + * @return 人员配置id为key,具体人员配置信息为value。 | ||
| 68 | + */ | ||
| 69 | + Map<Long, EmployeeConfigInfo> getEmployeeConfigMaps(Integer xlId); | ||
| 70 | +} |
src/main/java/com/bsth/websocket/handler/RealControlSocketHandler.java
| @@ -3,6 +3,7 @@ package com.bsth.websocket.handler; | @@ -3,6 +3,7 @@ package com.bsth.websocket.handler; | ||
| 3 | import java.io.IOException; | 3 | import java.io.IOException; |
| 4 | import java.util.ArrayList; | 4 | import java.util.ArrayList; |
| 5 | import java.util.HashMap; | 5 | import java.util.HashMap; |
| 6 | +import java.util.Iterator; | ||
| 6 | import java.util.List; | 7 | import java.util.List; |
| 7 | import java.util.Map; | 8 | import java.util.Map; |
| 8 | import java.util.Set; | 9 | import java.util.Set; |
| @@ -83,7 +84,7 @@ public class RealControlSocketHandler implements WebSocketHandler { | @@ -83,7 +84,7 @@ public class RealControlSocketHandler implements WebSocketHandler { | ||
| 83 | default: | 84 | default: |
| 84 | break; | 85 | break; |
| 85 | } | 86 | } |
| 86 | - System.out.println(msg); | 87 | + logger.info(msg.getPayload().toString()); |
| 87 | } | 88 | } |
| 88 | 89 | ||
| 89 | @Override | 90 | @Override |
| @@ -145,22 +146,23 @@ public class RealControlSocketHandler implements WebSocketHandler { | @@ -145,22 +146,23 @@ public class RealControlSocketHandler implements WebSocketHandler { | ||
| 145 | * @param message | 146 | * @param message |
| 146 | */ | 147 | */ |
| 147 | public synchronized void sendMessageToLine(String lineCode, String msg) { | 148 | public synchronized void sendMessageToLine(String lineCode, String msg) { |
| 148 | - //Set<String> uids = BasicData.lineCode2SocketUserMap.get(lineCode); | ||
| 149 | - //if(null == uids || uids.size() == 0) | ||
| 150 | - // return; | ||
| 151 | 149 | ||
| 152 | TextMessage message = new TextMessage(msg.getBytes()); | 150 | TextMessage message = new TextMessage(msg.getBytes()); |
| 153 | 151 | ||
| 154 | - List<WebSocketSession> sessList = listenMap.get(lineCode); | 152 | + Iterator<WebSocketSession> iterator = listenMap.get(lineCode).iterator(); |
| 155 | 153 | ||
| 156 | - for (WebSocketSession user : sessList) { | 154 | + WebSocketSession user; |
| 155 | + while(iterator.hasNext()){ | ||
| 156 | + user = iterator.next(); | ||
| 157 | try { | 157 | try { |
| 158 | if (user.isOpen()) { | 158 | if (user.isOpen()) { |
| 159 | user.sendMessage(message); | 159 | user.sendMessage(message); |
| 160 | } | 160 | } |
| 161 | - } catch (IOException e) { | 161 | + } catch (Exception e) { |
| 162 | + logger.error("sendMessageToLine error ...."+msg); | ||
| 162 | logger.error("sendMessageToLine error ....", e); | 163 | logger.error("sendMessageToLine error ....", e); |
| 163 | } | 164 | } |
| 165 | + | ||
| 164 | } | 166 | } |
| 165 | } | 167 | } |
| 166 | } | 168 | } |
src/main/resources/application-dev.properties
| @@ -8,9 +8,9 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy | @@ -8,9 +8,9 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy | ||
| 8 | spring.jpa.database= MYSQL | 8 | spring.jpa.database= MYSQL |
| 9 | spring.jpa.show-sql= true | 9 | spring.jpa.show-sql= true |
| 10 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver | 10 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver |
| 11 | -spring.datasource.url= jdbc:mysql://127.0.0.1:3306/qp_control | 11 | +spring.datasource.url= jdbc:mysql://192.168.168.201:3306/mh_control |
| 12 | spring.datasource.username= root | 12 | spring.datasource.username= root |
| 13 | -spring.datasource.password= panzhao | 13 | +spring.datasource.password= 123456 |
| 14 | #DATASOURCE | 14 | #DATASOURCE |
| 15 | spring.datasource.max-active=100 | 15 | spring.datasource.max-active=100 |
| 16 | spring.datasource.max-idle=8 | 16 | spring.datasource.max-idle=8 |
src/main/resources/fatso/package.json
| 1 | -{ | ||
| 2 | - "name": "fatso", | ||
| 3 | - "version": "1.0.0", | ||
| 4 | - "description": "子页面js检查、合并、压缩等处理", | ||
| 5 | - "main": "start.js", | ||
| 6 | - "scripts": { | ||
| 7 | - "test": "echo \"Error: no test specified\" && exit 1" | ||
| 8 | - }, | ||
| 9 | - "author": "panzhaov5", | ||
| 10 | - "license": "ISC", | ||
| 11 | - "dependencies": { | ||
| 12 | - "cheerio": "^0.20.0", | ||
| 13 | - "colors": "^1.1.2", | ||
| 14 | - "eventproxy": "^0.3.4", | ||
| 15 | - "uglify-js": "^2.6.2" | ||
| 16 | - } | ||
| 17 | -} | 1 | +{ |
| 2 | + "name": "fatso", | ||
| 3 | + "version": "1.0.0", | ||
| 4 | + "description": "子页面js检查、合并、压缩等处理", | ||
| 5 | + "main": "start.js", | ||
| 6 | + "scripts": { | ||
| 7 | + "test": "echo \"Error: no test specified\" && exit 1" | ||
| 8 | + }, | ||
| 9 | + "author": "panzhaov5", | ||
| 10 | + "license": "ISC", | ||
| 11 | + "dependencies": { | ||
| 12 | + "cheerio": "^0.20.0", | ||
| 13 | + "colors": "^1.1.2", | ||
| 14 | + "eventproxy": "^0.3.4", | ||
| 15 | + "uglify-js": "^2.6.2" | ||
| 16 | + } | ||
| 17 | +} |
src/main/resources/ms-jdbc.properties
| @@ -4,6 +4,6 @@ | @@ -4,6 +4,6 @@ | ||
| 4 | #ms.mysql.password= 123456 | 4 | #ms.mysql.password= 123456 |
| 5 | 5 | ||
| 6 | ms.mysql.driver= com.mysql.jdbc.Driver | 6 | ms.mysql.driver= com.mysql.jdbc.Driver |
| 7 | -ms.mysql.url= jdbc:mysql://127.0.0.1:3306/ms?useUnicode=true&characterEncoding=utf-8 | 7 | +ms.mysql.url= jdbc:mysql://192.168.168.201:3306/ms?useUnicode=true&characterEncoding=utf-8 |
| 8 | ms.mysql.username= root | 8 | ms.mysql.username= root |
| 9 | -ms.mysql.password= panzhao | 9 | +ms.mysql.password= 123456 |
src/main/resources/static/assets/js/eventproxy.js
| 1 | -/*global define*/ | ||
| 2 | -!(function (name, definition) { | ||
| 3 | - // Check define | ||
| 4 | - var hasDefine = typeof define === 'function', | ||
| 5 | - // Check exports | ||
| 6 | - hasExports = typeof module !== 'undefined' && module.exports; | ||
| 7 | - | ||
| 8 | - if (hasDefine) { | ||
| 9 | - // AMD Module or CMD Module | ||
| 10 | - define('eventproxy_debug', function () {return function () {};}); | ||
| 11 | - define(['eventproxy_debug'], definition); | ||
| 12 | - } else if (hasExports) { | ||
| 13 | - // Node.js Module | ||
| 14 | - module.exports = definition(require('debug')('eventproxy')); | ||
| 15 | - } else { | ||
| 16 | - // Assign to common namespaces or simply the global object (window) | ||
| 17 | - this[name] = definition(); | ||
| 18 | - } | ||
| 19 | -})('EventProxy', function (debug) { | ||
| 20 | - debug = debug || function () {}; | ||
| 21 | - | ||
| 22 | - /*! | ||
| 23 | - * refs | ||
| 24 | - */ | ||
| 25 | - var SLICE = Array.prototype.slice; | ||
| 26 | - var CONCAT = Array.prototype.concat; | ||
| 27 | - var ALL_EVENT = '__all__'; | ||
| 28 | - | ||
| 29 | - /** | ||
| 30 | - * EventProxy. An implementation of task/event based asynchronous pattern. | ||
| 31 | - * A module that can be mixed in to *any object* in order to provide it with custom events. | ||
| 32 | - * You may `bind` or `unbind` a callback function to an event; | ||
| 33 | - * `trigger`-ing an event fires all callbacks in succession. | ||
| 34 | - * Examples: | ||
| 35 | - * ```js | ||
| 36 | - * var render = function (template, resources) {}; | ||
| 37 | - * var proxy = new EventProxy(); | ||
| 38 | - * proxy.assign("template", "l10n", render); | ||
| 39 | - * proxy.trigger("template", template); | ||
| 40 | - * proxy.trigger("l10n", resources); | ||
| 41 | - * ``` | ||
| 42 | - */ | ||
| 43 | - var EventProxy = function () { | ||
| 44 | - if (!(this instanceof EventProxy)) { | ||
| 45 | - return new EventProxy(); | ||
| 46 | - } | ||
| 47 | - this._callbacks = {}; | ||
| 48 | - this._fired = {}; | ||
| 49 | - }; | ||
| 50 | - | ||
| 51 | - /** | ||
| 52 | - * Bind an event, specified by a string name, `ev`, to a `callback` function. | ||
| 53 | - * Passing __ALL_EVENT__ will bind the callback to all events fired. | ||
| 54 | - * Examples: | ||
| 55 | - * ```js | ||
| 56 | - * var proxy = new EventProxy(); | ||
| 57 | - * proxy.addListener("template", function (event) { | ||
| 58 | - * // TODO | ||
| 59 | - * }); | ||
| 60 | - * ``` | ||
| 61 | - * @param {String} eventname Event name. | ||
| 62 | - * @param {Function} callback Callback. | ||
| 63 | - */ | ||
| 64 | - EventProxy.prototype.addListener = function (ev, callback) { | ||
| 65 | - debug('Add listener for %s', ev); | ||
| 66 | - this._callbacks[ev] = this._callbacks[ev] || []; | ||
| 67 | - this._callbacks[ev].push(callback); | ||
| 68 | - return this; | ||
| 69 | - }; | ||
| 70 | - /** | ||
| 71 | - * `addListener` alias, `bind` | ||
| 72 | - */ | ||
| 73 | - EventProxy.prototype.bind = EventProxy.prototype.addListener; | ||
| 74 | - /** | ||
| 75 | - * `addListener` alias, `on` | ||
| 76 | - */ | ||
| 77 | - EventProxy.prototype.on = EventProxy.prototype.addListener; | ||
| 78 | - /** | ||
| 79 | - * `addListener` alias, `subscribe` | ||
| 80 | - */ | ||
| 81 | - EventProxy.prototype.subscribe = EventProxy.prototype.addListener; | ||
| 82 | - | ||
| 83 | - /** | ||
| 84 | - * Bind an event, but put the callback into head of all callbacks. | ||
| 85 | - * @param {String} eventname Event name. | ||
| 86 | - * @param {Function} callback Callback. | ||
| 87 | - */ | ||
| 88 | - EventProxy.prototype.headbind = function (ev, callback) { | ||
| 89 | - debug('Add listener for %s', ev); | ||
| 90 | - this._callbacks[ev] = this._callbacks[ev] || []; | ||
| 91 | - this._callbacks[ev].unshift(callback); | ||
| 92 | - return this; | ||
| 93 | - }; | ||
| 94 | - | ||
| 95 | - /** | ||
| 96 | - * Remove one or many callbacks. | ||
| 97 | - * | ||
| 98 | - * - If `callback` is null, removes all callbacks for the event. | ||
| 99 | - * - If `eventname` is null, removes all bound callbacks for all events. | ||
| 100 | - * @param {String} eventname Event name. | ||
| 101 | - * @param {Function} callback Callback. | ||
| 102 | - */ | ||
| 103 | - EventProxy.prototype.removeListener = function (eventname, callback) { | ||
| 104 | - var calls = this._callbacks; | ||
| 105 | - if (!eventname) { | ||
| 106 | - debug('Remove all listeners'); | ||
| 107 | - this._callbacks = {}; | ||
| 108 | - } else { | ||
| 109 | - if (!callback) { | ||
| 110 | - debug('Remove all listeners of %s', eventname); | ||
| 111 | - calls[eventname] = []; | ||
| 112 | - } else { | ||
| 113 | - var list = calls[eventname]; | ||
| 114 | - if (list) { | ||
| 115 | - var l = list.length; | ||
| 116 | - for (var i = 0; i < l; i++) { | ||
| 117 | - if (callback === list[i]) { | ||
| 118 | - debug('Remove a listener of %s', eventname); | ||
| 119 | - list[i] = null; | ||
| 120 | - } | ||
| 121 | - } | ||
| 122 | - } | ||
| 123 | - } | ||
| 124 | - } | ||
| 125 | - return this; | ||
| 126 | - }; | ||
| 127 | - /** | ||
| 128 | - * `removeListener` alias, unbind | ||
| 129 | - */ | ||
| 130 | - EventProxy.prototype.unbind = EventProxy.prototype.removeListener; | ||
| 131 | - | ||
| 132 | - /** | ||
| 133 | - * Remove all listeners. It equals unbind() | ||
| 134 | - * Just add this API for as same as Event.Emitter. | ||
| 135 | - * @param {String} event Event name. | ||
| 136 | - */ | ||
| 137 | - EventProxy.prototype.removeAllListeners = function (event) { | ||
| 138 | - return this.unbind(event); | ||
| 139 | - }; | ||
| 140 | - | ||
| 141 | - /** | ||
| 142 | - * Bind the ALL_EVENT event | ||
| 143 | - */ | ||
| 144 | - EventProxy.prototype.bindForAll = function (callback) { | ||
| 145 | - this.bind(ALL_EVENT, callback); | ||
| 146 | - }; | ||
| 147 | - | ||
| 148 | - /** | ||
| 149 | - * Unbind the ALL_EVENT event | ||
| 150 | - */ | ||
| 151 | - EventProxy.prototype.unbindForAll = function (callback) { | ||
| 152 | - this.unbind(ALL_EVENT, callback); | ||
| 153 | - }; | ||
| 154 | - | ||
| 155 | - /** | ||
| 156 | - * Trigger an event, firing all bound callbacks. Callbacks are passed the | ||
| 157 | - * same arguments as `trigger` is, apart from the event name. | ||
| 158 | - * Listening for `"all"` passes the true event name as the first argument. | ||
| 159 | - * @param {String} eventname Event name | ||
| 160 | - * @param {Mix} data Pass in data | ||
| 161 | - */ | ||
| 162 | - EventProxy.prototype.trigger = function (eventname, data) { | ||
| 163 | - var list, ev, callback, i, l; | ||
| 164 | - var both = 2; | ||
| 165 | - var calls = this._callbacks; | ||
| 166 | - debug('Emit event %s with data %j', eventname, data); | ||
| 167 | - while (both--) { | ||
| 168 | - ev = both ? eventname : ALL_EVENT; | ||
| 169 | - list = calls[ev]; | ||
| 170 | - if (list) { | ||
| 171 | - for (i = 0, l = list.length; i < l; i++) { | ||
| 172 | - if (!(callback = list[i])) { | ||
| 173 | - list.splice(i, 1); | ||
| 174 | - i--; | ||
| 175 | - l--; | ||
| 176 | - } else { | ||
| 177 | - var args = []; | ||
| 178 | - var start = both ? 1 : 0; | ||
| 179 | - for (var j = start; j < arguments.length; j++) { | ||
| 180 | - args.push(arguments[j]); | ||
| 181 | - } | ||
| 182 | - callback.apply(this, args); | ||
| 183 | - } | ||
| 184 | - } | ||
| 185 | - } | ||
| 186 | - } | ||
| 187 | - return this; | ||
| 188 | - }; | ||
| 189 | - | ||
| 190 | - /** | ||
| 191 | - * `trigger` alias | ||
| 192 | - */ | ||
| 193 | - EventProxy.prototype.emit = EventProxy.prototype.trigger; | ||
| 194 | - /** | ||
| 195 | - * `trigger` alias | ||
| 196 | - */ | ||
| 197 | - EventProxy.prototype.fire = EventProxy.prototype.trigger; | ||
| 198 | - | ||
| 199 | - /** | ||
| 200 | - * Bind an event like the bind method, but will remove the listener after it was fired. | ||
| 201 | - * @param {String} ev Event name | ||
| 202 | - * @param {Function} callback Callback | ||
| 203 | - */ | ||
| 204 | - EventProxy.prototype.once = function (ev, callback) { | ||
| 205 | - var self = this; | ||
| 206 | - var wrapper = function () { | ||
| 207 | - callback.apply(self, arguments); | ||
| 208 | - self.unbind(ev, wrapper); | ||
| 209 | - }; | ||
| 210 | - this.bind(ev, wrapper); | ||
| 211 | - return this; | ||
| 212 | - }; | ||
| 213 | - | ||
| 214 | - var later = (typeof setImmediate !== 'undefined' && setImmediate) || | ||
| 215 | - (typeof process !== 'undefined' && process.nextTick) || function (fn) { | ||
| 216 | - setTimeout(fn, 0); | ||
| 217 | - }; | ||
| 218 | - | ||
| 219 | - /** | ||
| 220 | - * emitLater | ||
| 221 | - * make emit async | ||
| 222 | - */ | ||
| 223 | - EventProxy.prototype.emitLater = function () { | ||
| 224 | - var self = this; | ||
| 225 | - var args = arguments; | ||
| 226 | - later(function () { | ||
| 227 | - self.trigger.apply(self, args); | ||
| 228 | - }); | ||
| 229 | - }; | ||
| 230 | - | ||
| 231 | - /** | ||
| 232 | - * Bind an event, and trigger it immediately. | ||
| 233 | - * @param {String} ev Event name. | ||
| 234 | - * @param {Function} callback Callback. | ||
| 235 | - * @param {Mix} data The data that will be passed to calback as arguments. | ||
| 236 | - */ | ||
| 237 | - EventProxy.prototype.immediate = function (ev, callback, data) { | ||
| 238 | - this.bind(ev, callback); | ||
| 239 | - this.trigger(ev, data); | ||
| 240 | - return this; | ||
| 241 | - }; | ||
| 242 | - /** | ||
| 243 | - * `immediate` alias | ||
| 244 | - */ | ||
| 245 | - EventProxy.prototype.asap = EventProxy.prototype.immediate; | ||
| 246 | - | ||
| 247 | - var _assign = function (eventname1, eventname2, cb, once) { | ||
| 248 | - var proxy = this; | ||
| 249 | - var argsLength = arguments.length; | ||
| 250 | - var times = 0; | ||
| 251 | - var flag = {}; | ||
| 252 | - | ||
| 253 | - // Check the arguments length. | ||
| 254 | - if (argsLength < 3) { | ||
| 255 | - return this; | ||
| 256 | - } | ||
| 257 | - | ||
| 258 | - var events = SLICE.call(arguments, 0, -2); | ||
| 259 | - var callback = arguments[argsLength - 2]; | ||
| 260 | - var isOnce = arguments[argsLength - 1]; | ||
| 261 | - | ||
| 262 | - // Check the callback type. | ||
| 263 | - if (typeof callback !== "function") { | ||
| 264 | - return this; | ||
| 265 | - } | ||
| 266 | - debug('Assign listener for events %j, once is %s', events, !!isOnce); | ||
| 267 | - var bind = function (key) { | ||
| 268 | - var method = isOnce ? "once" : "bind"; | ||
| 269 | - proxy[method](key, function (data) { | ||
| 270 | - proxy._fired[key] = proxy._fired[key] || {}; | ||
| 271 | - proxy._fired[key].data = data; | ||
| 272 | - if (!flag[key]) { | ||
| 273 | - flag[key] = true; | ||
| 274 | - times++; | ||
| 275 | - } | ||
| 276 | - }); | ||
| 277 | - }; | ||
| 278 | - | ||
| 279 | - var length = events.length; | ||
| 280 | - for (var index = 0; index < length; index++) { | ||
| 281 | - bind(events[index]); | ||
| 282 | - } | ||
| 283 | - | ||
| 284 | - var _all = function (event) { | ||
| 285 | - if (times < length) { | ||
| 286 | - return; | ||
| 287 | - } | ||
| 288 | - if (!flag[event]) { | ||
| 289 | - return; | ||
| 290 | - } | ||
| 291 | - var data = []; | ||
| 292 | - for (var index = 0; index < length; index++) { | ||
| 293 | - data.push(proxy._fired[events[index]].data); | ||
| 294 | - } | ||
| 295 | - if (isOnce) { | ||
| 296 | - proxy.unbindForAll(_all); | ||
| 297 | - } | ||
| 298 | - debug('Events %j all emited with data %j', events, data); | ||
| 299 | - callback.apply(null, data); | ||
| 300 | - }; | ||
| 301 | - proxy.bindForAll(_all); | ||
| 302 | - }; | ||
| 303 | - | ||
| 304 | - /** | ||
| 305 | - * Assign some events, after all events were fired, the callback will be executed once. | ||
| 306 | - * | ||
| 307 | - * Examples: | ||
| 308 | - * ```js | ||
| 309 | - * proxy.all(ev1, ev2, callback); | ||
| 310 | - * proxy.all([ev1, ev2], callback); | ||
| 311 | - * proxy.all(ev1, [ev2, ev3], callback); | ||
| 312 | - * ``` | ||
| 313 | - * @param {String} eventname1 First event name. | ||
| 314 | - * @param {String} eventname2 Second event name. | ||
| 315 | - * @param {Function} callback Callback, that will be called after predefined events were fired. | ||
| 316 | - */ | ||
| 317 | - EventProxy.prototype.all = function (eventname1, eventname2, callback) { | ||
| 318 | - var args = CONCAT.apply([], arguments); | ||
| 319 | - args.push(true); | ||
| 320 | - _assign.apply(this, args); | ||
| 321 | - return this; | ||
| 322 | - }; | ||
| 323 | - /** | ||
| 324 | - * `all` alias | ||
| 325 | - */ | ||
| 326 | - EventProxy.prototype.assign = EventProxy.prototype.all; | ||
| 327 | - | ||
| 328 | - /** | ||
| 329 | - * Assign the only one 'error' event handler. | ||
| 330 | - * @param {Function(err)} callback | ||
| 331 | - */ | ||
| 332 | - EventProxy.prototype.fail = function (callback) { | ||
| 333 | - var that = this; | ||
| 334 | - | ||
| 335 | - that.once('error', function () { | ||
| 336 | - that.unbind(); | ||
| 337 | - // put all arguments to the error handler | ||
| 338 | - // fail(function(err, args1, args2, ...){}) | ||
| 339 | - callback.apply(null, arguments); | ||
| 340 | - }); | ||
| 341 | - return this; | ||
| 342 | - }; | ||
| 343 | - | ||
| 344 | - /** | ||
| 345 | - * A shortcut of ep#emit('error', err) | ||
| 346 | - */ | ||
| 347 | - EventProxy.prototype.throw = function () { | ||
| 348 | - var that = this; | ||
| 349 | - that.emit.apply(that, ['error'].concat(SLICE.call(arguments))); | ||
| 350 | - }; | ||
| 351 | - | ||
| 352 | - /** | ||
| 353 | - * Assign some events, after all events were fired, the callback will be executed first time. | ||
| 354 | - * Then any event that predefined be fired again, the callback will executed with the newest data. | ||
| 355 | - * Examples: | ||
| 356 | - * ```js | ||
| 357 | - * proxy.tail(ev1, ev2, callback); | ||
| 358 | - * proxy.tail([ev1, ev2], callback); | ||
| 359 | - * proxy.tail(ev1, [ev2, ev3], callback); | ||
| 360 | - * ``` | ||
| 361 | - * @param {String} eventname1 First event name. | ||
| 362 | - * @param {String} eventname2 Second event name. | ||
| 363 | - * @param {Function} callback Callback, that will be called after predefined events were fired. | ||
| 364 | - */ | ||
| 365 | - EventProxy.prototype.tail = function () { | ||
| 366 | - var args = CONCAT.apply([], arguments); | ||
| 367 | - args.push(false); | ||
| 368 | - _assign.apply(this, args); | ||
| 369 | - return this; | ||
| 370 | - }; | ||
| 371 | - /** | ||
| 372 | - * `tail` alias, assignAll | ||
| 373 | - */ | ||
| 374 | - EventProxy.prototype.assignAll = EventProxy.prototype.tail; | ||
| 375 | - /** | ||
| 376 | - * `tail` alias, assignAlways | ||
| 377 | - */ | ||
| 378 | - EventProxy.prototype.assignAlways = EventProxy.prototype.tail; | ||
| 379 | - | ||
| 380 | - /** | ||
| 381 | - * The callback will be executed after the event be fired N times. | ||
| 382 | - * @param {String} eventname Event name. | ||
| 383 | - * @param {Number} times N times. | ||
| 384 | - * @param {Function} callback Callback, that will be called after event was fired N times. | ||
| 385 | - */ | ||
| 386 | - EventProxy.prototype.after = function (eventname, times, callback) { | ||
| 387 | - if (times === 0) { | ||
| 388 | - callback.call(null, []); | ||
| 389 | - return this; | ||
| 390 | - } | ||
| 391 | - var proxy = this, | ||
| 392 | - firedData = []; | ||
| 393 | - this._after = this._after || {}; | ||
| 394 | - var group = eventname + '_group'; | ||
| 395 | - this._after[group] = { | ||
| 396 | - index: 0, | ||
| 397 | - results: [] | ||
| 398 | - }; | ||
| 399 | - debug('After emit %s times, event %s\'s listenner will execute', times, eventname); | ||
| 400 | - var all = function (name, data) { | ||
| 401 | - if (name === eventname) { | ||
| 402 | - times--; | ||
| 403 | - firedData.push(data); | ||
| 404 | - if (times < 1) { | ||
| 405 | - debug('Event %s was emit %s, and execute the listenner', eventname, times); | ||
| 406 | - proxy.unbindForAll(all); | ||
| 407 | - callback.apply(null, [firedData]); | ||
| 408 | - } | ||
| 409 | - } | ||
| 410 | - if (name === group) { | ||
| 411 | - times--; | ||
| 412 | - proxy._after[group].results[data.index] = data.result; | ||
| 413 | - if (times < 1) { | ||
| 414 | - debug('Event %s was emit %s, and execute the listenner', eventname, times); | ||
| 415 | - proxy.unbindForAll(all); | ||
| 416 | - callback.call(null, proxy._after[group].results); | ||
| 417 | - } | ||
| 418 | - } | ||
| 419 | - }; | ||
| 420 | - proxy.bindForAll(all); | ||
| 421 | - return this; | ||
| 422 | - }; | ||
| 423 | - | ||
| 424 | - /** | ||
| 425 | - * The `after` method's helper. Use it will return ordered results. | ||
| 426 | - * If you need manipulate result, you need callback | ||
| 427 | - * Examples: | ||
| 428 | - * ```js | ||
| 429 | - * var ep = new EventProxy(); | ||
| 430 | - * ep.after('file', files.length, function (list) { | ||
| 431 | - * // Ordered results | ||
| 432 | - * }); | ||
| 433 | - * for (var i = 0; i < files.length; i++) { | ||
| 434 | - * fs.readFile(files[i], 'utf-8', ep.group('file')); | ||
| 435 | - * } | ||
| 436 | - * ``` | ||
| 437 | - * @param {String} eventname Event name, shoule keep consistent with `after`. | ||
| 438 | - * @param {Function} callback Callback function, should return the final result. | ||
| 439 | - */ | ||
| 440 | - EventProxy.prototype.group = function (eventname, callback) { | ||
| 441 | - var that = this; | ||
| 442 | - var group = eventname + '_group'; | ||
| 443 | - var index = that._after[group].index; | ||
| 444 | - that._after[group].index++; | ||
| 445 | - return function (err, data) { | ||
| 446 | - if (err) { | ||
| 447 | - // put all arguments to the error handler | ||
| 448 | - return that.emit.apply(that, ['error'].concat(SLICE.call(arguments))); | ||
| 449 | - } | ||
| 450 | - that.emit(group, { | ||
| 451 | - index: index, | ||
| 452 | - // callback(err, args1, args2, ...) | ||
| 453 | - result: callback ? callback.apply(null, SLICE.call(arguments, 1)) : data | ||
| 454 | - }); | ||
| 455 | - }; | ||
| 456 | - }; | ||
| 457 | - | ||
| 458 | - /** | ||
| 459 | - * The callback will be executed after any registered event was fired. It only executed once. | ||
| 460 | - * @param {String} eventname1 Event name. | ||
| 461 | - * @param {String} eventname2 Event name. | ||
| 462 | - * @param {Function} callback The callback will get a map that has data and eventname attributes. | ||
| 463 | - */ | ||
| 464 | - EventProxy.prototype.any = function () { | ||
| 465 | - var proxy = this, | ||
| 466 | - callback = arguments[arguments.length - 1], | ||
| 467 | - events = SLICE.call(arguments, 0, -1), | ||
| 468 | - _eventname = events.join("_"); | ||
| 469 | - | ||
| 470 | - debug('Add listenner for Any of events %j emit', events); | ||
| 471 | - proxy.once(_eventname, callback); | ||
| 472 | - | ||
| 473 | - var _bind = function (key) { | ||
| 474 | - proxy.bind(key, function (data) { | ||
| 475 | - debug('One of events %j emited, execute the listenner'); | ||
| 476 | - proxy.trigger(_eventname, {"data": data, eventName: key}); | ||
| 477 | - }); | ||
| 478 | - }; | ||
| 479 | - | ||
| 480 | - for (var index = 0; index < events.length; index++) { | ||
| 481 | - _bind(events[index]); | ||
| 482 | - } | ||
| 483 | - }; | ||
| 484 | - | ||
| 485 | - /** | ||
| 486 | - * The callback will be executed when the event name not equals with assigned event. | ||
| 487 | - * @param {String} eventname Event name. | ||
| 488 | - * @param {Function} callback Callback. | ||
| 489 | - */ | ||
| 490 | - EventProxy.prototype.not = function (eventname, callback) { | ||
| 491 | - var proxy = this; | ||
| 492 | - debug('Add listenner for not event %s', eventname); | ||
| 493 | - proxy.bindForAll(function (name, data) { | ||
| 494 | - if (name !== eventname) { | ||
| 495 | - debug('listenner execute of event %s emit, but not event %s.', name, eventname); | ||
| 496 | - callback(data); | ||
| 497 | - } | ||
| 498 | - }); | ||
| 499 | - }; | ||
| 500 | - | ||
| 501 | - /** | ||
| 502 | - * Success callback wrapper, will handler err for you. | ||
| 503 | - * | ||
| 504 | - * ```js | ||
| 505 | - * fs.readFile('foo.txt', ep.done('content')); | ||
| 506 | - * | ||
| 507 | - * // equal to => | ||
| 508 | - * | ||
| 509 | - * fs.readFile('foo.txt', function (err, content) { | ||
| 510 | - * if (err) { | ||
| 511 | - * return ep.emit('error', err); | ||
| 512 | - * } | ||
| 513 | - * ep.emit('content', content); | ||
| 514 | - * }); | ||
| 515 | - * ``` | ||
| 516 | - * | ||
| 517 | - * ```js | ||
| 518 | - * fs.readFile('foo.txt', ep.done('content', function (content) { | ||
| 519 | - * return content.trim(); | ||
| 520 | - * })); | ||
| 521 | - * | ||
| 522 | - * // equal to => | ||
| 523 | - * | ||
| 524 | - * fs.readFile('foo.txt', function (err, content) { | ||
| 525 | - * if (err) { | ||
| 526 | - * return ep.emit('error', err); | ||
| 527 | - * } | ||
| 528 | - * ep.emit('content', content.trim()); | ||
| 529 | - * }); | ||
| 530 | - * ``` | ||
| 531 | - * @param {Function|String} handler, success callback or event name will be emit after callback. | ||
| 532 | - * @return {Function} | ||
| 533 | - */ | ||
| 534 | - EventProxy.prototype.done = function (handler, callback) { | ||
| 535 | - var that = this; | ||
| 536 | - return function (err, data) { | ||
| 537 | - if (err) { | ||
| 538 | - // put all arguments to the error handler | ||
| 539 | - return that.emit.apply(that, ['error'].concat(SLICE.call(arguments))); | ||
| 540 | - } | ||
| 541 | - | ||
| 542 | - // callback(err, args1, args2, ...) | ||
| 543 | - var args = SLICE.call(arguments, 1); | ||
| 544 | - | ||
| 545 | - if (typeof handler === 'string') { | ||
| 546 | - // getAsync(query, ep.done('query')); | ||
| 547 | - // or | ||
| 548 | - // getAsync(query, ep.done('query', function (data) { | ||
| 549 | - // return data.trim(); | ||
| 550 | - // })); | ||
| 551 | - if (callback) { | ||
| 552 | - // only replace the args when it really return a result | ||
| 553 | - return that.emit(handler, callback.apply(null, args)); | ||
| 554 | - } else { | ||
| 555 | - // put all arguments to the done handler | ||
| 556 | - //ep.done('some'); | ||
| 557 | - //ep.on('some', function(args1, args2, ...){}); | ||
| 558 | - return that.emit.apply(that, [handler].concat(args)); | ||
| 559 | - } | ||
| 560 | - } | ||
| 561 | - | ||
| 562 | - // speed improve for mostly case: `callback(err, data)` | ||
| 563 | - if (arguments.length <= 2) { | ||
| 564 | - return handler(data); | ||
| 565 | - } | ||
| 566 | - | ||
| 567 | - // callback(err, args1, args2, ...) | ||
| 568 | - handler.apply(null, args); | ||
| 569 | - }; | ||
| 570 | - }; | ||
| 571 | - | ||
| 572 | - /** | ||
| 573 | - * make done async | ||
| 574 | - * @return {Function} delay done | ||
| 575 | - */ | ||
| 576 | - EventProxy.prototype.doneLater = function (handler, callback) { | ||
| 577 | - var _doneHandler = this.done(handler, callback); | ||
| 578 | - return function (err, data) { | ||
| 579 | - var args = arguments; | ||
| 580 | - later(function () { | ||
| 581 | - _doneHandler.apply(null, args); | ||
| 582 | - }); | ||
| 583 | - }; | ||
| 584 | - }; | ||
| 585 | - | ||
| 586 | - /** | ||
| 587 | - * Create a new EventProxy | ||
| 588 | - * Examples: | ||
| 589 | - * ```js | ||
| 590 | - * var ep = EventProxy.create(); | ||
| 591 | - * ep.assign('user', 'articles', function(user, articles) { | ||
| 592 | - * // do something... | ||
| 593 | - * }); | ||
| 594 | - * // or one line ways: Create EventProxy and Assign | ||
| 595 | - * var ep = EventProxy.create('user', 'articles', function(user, articles) { | ||
| 596 | - * // do something... | ||
| 597 | - * }); | ||
| 598 | - * ``` | ||
| 599 | - * @return {EventProxy} EventProxy instance | ||
| 600 | - */ | ||
| 601 | - EventProxy.create = function () { | ||
| 602 | - var ep = new EventProxy(); | ||
| 603 | - var args = CONCAT.apply([], arguments); | ||
| 604 | - if (args.length) { | ||
| 605 | - var errorHandler = args[args.length - 1]; | ||
| 606 | - var callback = args[args.length - 2]; | ||
| 607 | - if (typeof errorHandler === 'function' && typeof callback === 'function') { | ||
| 608 | - args.pop(); | ||
| 609 | - ep.fail(errorHandler); | ||
| 610 | - } | ||
| 611 | - ep.assign.apply(ep, args); | ||
| 612 | - } | ||
| 613 | - return ep; | ||
| 614 | - }; | ||
| 615 | - | ||
| 616 | - // Backwards compatibility | ||
| 617 | - EventProxy.EventProxy = EventProxy; | ||
| 618 | - | ||
| 619 | - return EventProxy; | ||
| 620 | -}); | 1 | +/*global define*/ |
| 2 | +!(function (name, definition) { | ||
| 3 | + // Check define | ||
| 4 | + var hasDefine = typeof define === 'function', | ||
| 5 | + // Check exports | ||
| 6 | + hasExports = typeof module !== 'undefined' && module.exports; | ||
| 7 | + | ||
| 8 | + if (hasDefine) { | ||
| 9 | + // AMD Module or CMD Module | ||
| 10 | + define('eventproxy_debug', function () {return function () {};}); | ||
| 11 | + define(['eventproxy_debug'], definition); | ||
| 12 | + } else if (hasExports) { | ||
| 13 | + // Node.js Module | ||
| 14 | + module.exports = definition(require('debug')('eventproxy')); | ||
| 15 | + } else { | ||
| 16 | + // Assign to common namespaces or simply the global object (window) | ||
| 17 | + this[name] = definition(); | ||
| 18 | + } | ||
| 19 | +})('EventProxy', function (debug) { | ||
| 20 | + debug = debug || function () {}; | ||
| 21 | + | ||
| 22 | + /*! | ||
| 23 | + * refs | ||
| 24 | + */ | ||
| 25 | + var SLICE = Array.prototype.slice; | ||
| 26 | + var CONCAT = Array.prototype.concat; | ||
| 27 | + var ALL_EVENT = '__all__'; | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * EventProxy. An implementation of task/event based asynchronous pattern. | ||
| 31 | + * A module that can be mixed in to *any object* in order to provide it with custom events. | ||
| 32 | + * You may `bind` or `unbind` a callback function to an event; | ||
| 33 | + * `trigger`-ing an event fires all callbacks in succession. | ||
| 34 | + * Examples: | ||
| 35 | + * ```js | ||
| 36 | + * var render = function (template, resources) {}; | ||
| 37 | + * var proxy = new EventProxy(); | ||
| 38 | + * proxy.assign("template", "l10n", render); | ||
| 39 | + * proxy.trigger("template", template); | ||
| 40 | + * proxy.trigger("l10n", resources); | ||
| 41 | + * ``` | ||
| 42 | + */ | ||
| 43 | + var EventProxy = function () { | ||
| 44 | + if (!(this instanceof EventProxy)) { | ||
| 45 | + return new EventProxy(); | ||
| 46 | + } | ||
| 47 | + this._callbacks = {}; | ||
| 48 | + this._fired = {}; | ||
| 49 | + }; | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * Bind an event, specified by a string name, `ev`, to a `callback` function. | ||
| 53 | + * Passing __ALL_EVENT__ will bind the callback to all events fired. | ||
| 54 | + * Examples: | ||
| 55 | + * ```js | ||
| 56 | + * var proxy = new EventProxy(); | ||
| 57 | + * proxy.addListener("template", function (event) { | ||
| 58 | + * // TODO | ||
| 59 | + * }); | ||
| 60 | + * ``` | ||
| 61 | + * @param {String} eventname Event name. | ||
| 62 | + * @param {Function} callback Callback. | ||
| 63 | + */ | ||
| 64 | + EventProxy.prototype.addListener = function (ev, callback) { | ||
| 65 | + debug('Add listener for %s', ev); | ||
| 66 | + this._callbacks[ev] = this._callbacks[ev] || []; | ||
| 67 | + this._callbacks[ev].push(callback); | ||
| 68 | + return this; | ||
| 69 | + }; | ||
| 70 | + /** | ||
| 71 | + * `addListener` alias, `bind` | ||
| 72 | + */ | ||
| 73 | + EventProxy.prototype.bind = EventProxy.prototype.addListener; | ||
| 74 | + /** | ||
| 75 | + * `addListener` alias, `on` | ||
| 76 | + */ | ||
| 77 | + EventProxy.prototype.on = EventProxy.prototype.addListener; | ||
| 78 | + /** | ||
| 79 | + * `addListener` alias, `subscribe` | ||
| 80 | + */ | ||
| 81 | + EventProxy.prototype.subscribe = EventProxy.prototype.addListener; | ||
| 82 | + | ||
| 83 | + /** | ||
| 84 | + * Bind an event, but put the callback into head of all callbacks. | ||
| 85 | + * @param {String} eventname Event name. | ||
| 86 | + * @param {Function} callback Callback. | ||
| 87 | + */ | ||
| 88 | + EventProxy.prototype.headbind = function (ev, callback) { | ||
| 89 | + debug('Add listener for %s', ev); | ||
| 90 | + this._callbacks[ev] = this._callbacks[ev] || []; | ||
| 91 | + this._callbacks[ev].unshift(callback); | ||
| 92 | + return this; | ||
| 93 | + }; | ||
| 94 | + | ||
| 95 | + /** | ||
| 96 | + * Remove one or many callbacks. | ||
| 97 | + * | ||
| 98 | + * - If `callback` is null, removes all callbacks for the event. | ||
| 99 | + * - If `eventname` is null, removes all bound callbacks for all events. | ||
| 100 | + * @param {String} eventname Event name. | ||
| 101 | + * @param {Function} callback Callback. | ||
| 102 | + */ | ||
| 103 | + EventProxy.prototype.removeListener = function (eventname, callback) { | ||
| 104 | + var calls = this._callbacks; | ||
| 105 | + if (!eventname) { | ||
| 106 | + debug('Remove all listeners'); | ||
| 107 | + this._callbacks = {}; | ||
| 108 | + } else { | ||
| 109 | + if (!callback) { | ||
| 110 | + debug('Remove all listeners of %s', eventname); | ||
| 111 | + calls[eventname] = []; | ||
| 112 | + } else { | ||
| 113 | + var list = calls[eventname]; | ||
| 114 | + if (list) { | ||
| 115 | + var l = list.length; | ||
| 116 | + for (var i = 0; i < l; i++) { | ||
| 117 | + if (callback === list[i]) { | ||
| 118 | + debug('Remove a listener of %s', eventname); | ||
| 119 | + list[i] = null; | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | + return this; | ||
| 126 | + }; | ||
| 127 | + /** | ||
| 128 | + * `removeListener` alias, unbind | ||
| 129 | + */ | ||
| 130 | + EventProxy.prototype.unbind = EventProxy.prototype.removeListener; | ||
| 131 | + | ||
| 132 | + /** | ||
| 133 | + * Remove all listeners. It equals unbind() | ||
| 134 | + * Just add this API for as same as Event.Emitter. | ||
| 135 | + * @param {String} event Event name. | ||
| 136 | + */ | ||
| 137 | + EventProxy.prototype.removeAllListeners = function (event) { | ||
| 138 | + return this.unbind(event); | ||
| 139 | + }; | ||
| 140 | + | ||
| 141 | + /** | ||
| 142 | + * Bind the ALL_EVENT event | ||
| 143 | + */ | ||
| 144 | + EventProxy.prototype.bindForAll = function (callback) { | ||
| 145 | + this.bind(ALL_EVENT, callback); | ||
| 146 | + }; | ||
| 147 | + | ||
| 148 | + /** | ||
| 149 | + * Unbind the ALL_EVENT event | ||
| 150 | + */ | ||
| 151 | + EventProxy.prototype.unbindForAll = function (callback) { | ||
| 152 | + this.unbind(ALL_EVENT, callback); | ||
| 153 | + }; | ||
| 154 | + | ||
| 155 | + /** | ||
| 156 | + * Trigger an event, firing all bound callbacks. Callbacks are passed the | ||
| 157 | + * same arguments as `trigger` is, apart from the event name. | ||
| 158 | + * Listening for `"all"` passes the true event name as the first argument. | ||
| 159 | + * @param {String} eventname Event name | ||
| 160 | + * @param {Mix} data Pass in data | ||
| 161 | + */ | ||
| 162 | + EventProxy.prototype.trigger = function (eventname, data) { | ||
| 163 | + var list, ev, callback, i, l; | ||
| 164 | + var both = 2; | ||
| 165 | + var calls = this._callbacks; | ||
| 166 | + debug('Emit event %s with data %j', eventname, data); | ||
| 167 | + while (both--) { | ||
| 168 | + ev = both ? eventname : ALL_EVENT; | ||
| 169 | + list = calls[ev]; | ||
| 170 | + if (list) { | ||
| 171 | + for (i = 0, l = list.length; i < l; i++) { | ||
| 172 | + if (!(callback = list[i])) { | ||
| 173 | + list.splice(i, 1); | ||
| 174 | + i--; | ||
| 175 | + l--; | ||
| 176 | + } else { | ||
| 177 | + var args = []; | ||
| 178 | + var start = both ? 1 : 0; | ||
| 179 | + for (var j = start; j < arguments.length; j++) { | ||
| 180 | + args.push(arguments[j]); | ||
| 181 | + } | ||
| 182 | + callback.apply(this, args); | ||
| 183 | + } | ||
| 184 | + } | ||
| 185 | + } | ||
| 186 | + } | ||
| 187 | + return this; | ||
| 188 | + }; | ||
| 189 | + | ||
| 190 | + /** | ||
| 191 | + * `trigger` alias | ||
| 192 | + */ | ||
| 193 | + EventProxy.prototype.emit = EventProxy.prototype.trigger; | ||
| 194 | + /** | ||
| 195 | + * `trigger` alias | ||
| 196 | + */ | ||
| 197 | + EventProxy.prototype.fire = EventProxy.prototype.trigger; | ||
| 198 | + | ||
| 199 | + /** | ||
| 200 | + * Bind an event like the bind method, but will remove the listener after it was fired. | ||
| 201 | + * @param {String} ev Event name | ||
| 202 | + * @param {Function} callback Callback | ||
| 203 | + */ | ||
| 204 | + EventProxy.prototype.once = function (ev, callback) { | ||
| 205 | + var self = this; | ||
| 206 | + var wrapper = function () { | ||
| 207 | + callback.apply(self, arguments); | ||
| 208 | + self.unbind(ev, wrapper); | ||
| 209 | + }; | ||
| 210 | + this.bind(ev, wrapper); | ||
| 211 | + return this; | ||
| 212 | + }; | ||
| 213 | + | ||
| 214 | + var later = (typeof setImmediate !== 'undefined' && setImmediate) || | ||
| 215 | + (typeof process !== 'undefined' && process.nextTick) || function (fn) { | ||
| 216 | + setTimeout(fn, 0); | ||
| 217 | + }; | ||
| 218 | + | ||
| 219 | + /** | ||
| 220 | + * emitLater | ||
| 221 | + * make emit async | ||
| 222 | + */ | ||
| 223 | + EventProxy.prototype.emitLater = function () { | ||
| 224 | + var self = this; | ||
| 225 | + var args = arguments; | ||
| 226 | + later(function () { | ||
| 227 | + self.trigger.apply(self, args); | ||
| 228 | + }); | ||
| 229 | + }; | ||
| 230 | + | ||
| 231 | + /** | ||
| 232 | + * Bind an event, and trigger it immediately. | ||
| 233 | + * @param {String} ev Event name. | ||
| 234 | + * @param {Function} callback Callback. | ||
| 235 | + * @param {Mix} data The data that will be passed to calback as arguments. | ||
| 236 | + */ | ||
| 237 | + EventProxy.prototype.immediate = function (ev, callback, data) { | ||
| 238 | + this.bind(ev, callback); | ||
| 239 | + this.trigger(ev, data); | ||
| 240 | + return this; | ||
| 241 | + }; | ||
| 242 | + /** | ||
| 243 | + * `immediate` alias | ||
| 244 | + */ | ||
| 245 | + EventProxy.prototype.asap = EventProxy.prototype.immediate; | ||
| 246 | + | ||
| 247 | + var _assign = function (eventname1, eventname2, cb, once) { | ||
| 248 | + var proxy = this; | ||
| 249 | + var argsLength = arguments.length; | ||
| 250 | + var times = 0; | ||
| 251 | + var flag = {}; | ||
| 252 | + | ||
| 253 | + // Check the arguments length. | ||
| 254 | + if (argsLength < 3) { | ||
| 255 | + return this; | ||
| 256 | + } | ||
| 257 | + | ||
| 258 | + var events = SLICE.call(arguments, 0, -2); | ||
| 259 | + var callback = arguments[argsLength - 2]; | ||
| 260 | + var isOnce = arguments[argsLength - 1]; | ||
| 261 | + | ||
| 262 | + // Check the callback type. | ||
| 263 | + if (typeof callback !== "function") { | ||
| 264 | + return this; | ||
| 265 | + } | ||
| 266 | + debug('Assign listener for events %j, once is %s', events, !!isOnce); | ||
| 267 | + var bind = function (key) { | ||
| 268 | + var method = isOnce ? "once" : "bind"; | ||
| 269 | + proxy[method](key, function (data) { | ||
| 270 | + proxy._fired[key] = proxy._fired[key] || {}; | ||
| 271 | + proxy._fired[key].data = data; | ||
| 272 | + if (!flag[key]) { | ||
| 273 | + flag[key] = true; | ||
| 274 | + times++; | ||
| 275 | + } | ||
| 276 | + }); | ||
| 277 | + }; | ||
| 278 | + | ||
| 279 | + var length = events.length; | ||
| 280 | + for (var index = 0; index < length; index++) { | ||
| 281 | + bind(events[index]); | ||
| 282 | + } | ||
| 283 | + | ||
| 284 | + var _all = function (event) { | ||
| 285 | + if (times < length) { | ||
| 286 | + return; | ||
| 287 | + } | ||
| 288 | + if (!flag[event]) { | ||
| 289 | + return; | ||
| 290 | + } | ||
| 291 | + var data = []; | ||
| 292 | + for (var index = 0; index < length; index++) { | ||
| 293 | + data.push(proxy._fired[events[index]].data); | ||
| 294 | + } | ||
| 295 | + if (isOnce) { | ||
| 296 | + proxy.unbindForAll(_all); | ||
| 297 | + } | ||
| 298 | + debug('Events %j all emited with data %j', events, data); | ||
| 299 | + callback.apply(null, data); | ||
| 300 | + }; | ||
| 301 | + proxy.bindForAll(_all); | ||
| 302 | + }; | ||
| 303 | + | ||
| 304 | + /** | ||
| 305 | + * Assign some events, after all events were fired, the callback will be executed once. | ||
| 306 | + * | ||
| 307 | + * Examples: | ||
| 308 | + * ```js | ||
| 309 | + * proxy.all(ev1, ev2, callback); | ||
| 310 | + * proxy.all([ev1, ev2], callback); | ||
| 311 | + * proxy.all(ev1, [ev2, ev3], callback); | ||
| 312 | + * ``` | ||
| 313 | + * @param {String} eventname1 First event name. | ||
| 314 | + * @param {String} eventname2 Second event name. | ||
| 315 | + * @param {Function} callback Callback, that will be called after predefined events were fired. | ||
| 316 | + */ | ||
| 317 | + EventProxy.prototype.all = function (eventname1, eventname2, callback) { | ||
| 318 | + var args = CONCAT.apply([], arguments); | ||
| 319 | + args.push(true); | ||
| 320 | + _assign.apply(this, args); | ||
| 321 | + return this; | ||
| 322 | + }; | ||
| 323 | + /** | ||
| 324 | + * `all` alias | ||
| 325 | + */ | ||
| 326 | + EventProxy.prototype.assign = EventProxy.prototype.all; | ||
| 327 | + | ||
| 328 | + /** | ||
| 329 | + * Assign the only one 'error' event handler. | ||
| 330 | + * @param {Function(err)} callback | ||
| 331 | + */ | ||
| 332 | + EventProxy.prototype.fail = function (callback) { | ||
| 333 | + var that = this; | ||
| 334 | + | ||
| 335 | + that.once('error', function () { | ||
| 336 | + that.unbind(); | ||
| 337 | + // put all arguments to the error handler | ||
| 338 | + // fail(function(err, args1, args2, ...){}) | ||
| 339 | + callback.apply(null, arguments); | ||
| 340 | + }); | ||
| 341 | + return this; | ||
| 342 | + }; | ||
| 343 | + | ||
| 344 | + /** | ||
| 345 | + * A shortcut of ep#emit('error', err) | ||
| 346 | + */ | ||
| 347 | + EventProxy.prototype.throw = function () { | ||
| 348 | + var that = this; | ||
| 349 | + that.emit.apply(that, ['error'].concat(SLICE.call(arguments))); | ||
| 350 | + }; | ||
| 351 | + | ||
| 352 | + /** | ||
| 353 | + * Assign some events, after all events were fired, the callback will be executed first time. | ||
| 354 | + * Then any event that predefined be fired again, the callback will executed with the newest data. | ||
| 355 | + * Examples: | ||
| 356 | + * ```js | ||
| 357 | + * proxy.tail(ev1, ev2, callback); | ||
| 358 | + * proxy.tail([ev1, ev2], callback); | ||
| 359 | + * proxy.tail(ev1, [ev2, ev3], callback); | ||
| 360 | + * ``` | ||
| 361 | + * @param {String} eventname1 First event name. | ||
| 362 | + * @param {String} eventname2 Second event name. | ||
| 363 | + * @param {Function} callback Callback, that will be called after predefined events were fired. | ||
| 364 | + */ | ||
| 365 | + EventProxy.prototype.tail = function () { | ||
| 366 | + var args = CONCAT.apply([], arguments); | ||
| 367 | + args.push(false); | ||
| 368 | + _assign.apply(this, args); | ||
| 369 | + return this; | ||
| 370 | + }; | ||
| 371 | + /** | ||
| 372 | + * `tail` alias, assignAll | ||
| 373 | + */ | ||
| 374 | + EventProxy.prototype.assignAll = EventProxy.prototype.tail; | ||
| 375 | + /** | ||
| 376 | + * `tail` alias, assignAlways | ||
| 377 | + */ | ||
| 378 | + EventProxy.prototype.assignAlways = EventProxy.prototype.tail; | ||
| 379 | + | ||
| 380 | + /** | ||
| 381 | + * The callback will be executed after the event be fired N times. | ||
| 382 | + * @param {String} eventname Event name. | ||
| 383 | + * @param {Number} times N times. | ||
| 384 | + * @param {Function} callback Callback, that will be called after event was fired N times. | ||
| 385 | + */ | ||
| 386 | + EventProxy.prototype.after = function (eventname, times, callback) { | ||
| 387 | + if (times === 0) { | ||
| 388 | + callback.call(null, []); | ||
| 389 | + return this; | ||
| 390 | + } | ||
| 391 | + var proxy = this, | ||
| 392 | + firedData = []; | ||
| 393 | + this._after = this._after || {}; | ||
| 394 | + var group = eventname + '_group'; | ||
| 395 | + this._after[group] = { | ||
| 396 | + index: 0, | ||
| 397 | + results: [] | ||
| 398 | + }; | ||
| 399 | + debug('After emit %s times, event %s\'s listenner will execute', times, eventname); | ||
| 400 | + var all = function (name, data) { | ||
| 401 | + if (name === eventname) { | ||
| 402 | + times--; | ||
| 403 | + firedData.push(data); | ||
| 404 | + if (times < 1) { | ||
| 405 | + debug('Event %s was emit %s, and execute the listenner', eventname, times); | ||
| 406 | + proxy.unbindForAll(all); | ||
| 407 | + callback.apply(null, [firedData]); | ||
| 408 | + } | ||
| 409 | + } | ||
| 410 | + if (name === group) { | ||
| 411 | + times--; | ||
| 412 | + proxy._after[group].results[data.index] = data.result; | ||
| 413 | + if (times < 1) { | ||
| 414 | + debug('Event %s was emit %s, and execute the listenner', eventname, times); | ||
| 415 | + proxy.unbindForAll(all); | ||
| 416 | + callback.call(null, proxy._after[group].results); | ||
| 417 | + } | ||
| 418 | + } | ||
| 419 | + }; | ||
| 420 | + proxy.bindForAll(all); | ||
| 421 | + return this; | ||
| 422 | + }; | ||
| 423 | + | ||
| 424 | + /** | ||
| 425 | + * The `after` method's helper. Use it will return ordered results. | ||
| 426 | + * If you need manipulate result, you need callback | ||
| 427 | + * Examples: | ||
| 428 | + * ```js | ||
| 429 | + * var ep = new EventProxy(); | ||
| 430 | + * ep.after('file', files.length, function (list) { | ||
| 431 | + * // Ordered results | ||
| 432 | + * }); | ||
| 433 | + * for (var i = 0; i < files.length; i++) { | ||
| 434 | + * fs.readFile(files[i], 'utf-8', ep.group('file')); | ||
| 435 | + * } | ||
| 436 | + * ``` | ||
| 437 | + * @param {String} eventname Event name, shoule keep consistent with `after`. | ||
| 438 | + * @param {Function} callback Callback function, should return the final result. | ||
| 439 | + */ | ||
| 440 | + EventProxy.prototype.group = function (eventname, callback) { | ||
| 441 | + var that = this; | ||
| 442 | + var group = eventname + '_group'; | ||
| 443 | + var index = that._after[group].index; | ||
| 444 | + that._after[group].index++; | ||
| 445 | + return function (err, data) { | ||
| 446 | + if (err) { | ||
| 447 | + // put all arguments to the error handler | ||
| 448 | + return that.emit.apply(that, ['error'].concat(SLICE.call(arguments))); | ||
| 449 | + } | ||
| 450 | + that.emit(group, { | ||
| 451 | + index: index, | ||
| 452 | + // callback(err, args1, args2, ...) | ||
| 453 | + result: callback ? callback.apply(null, SLICE.call(arguments, 1)) : data | ||
| 454 | + }); | ||
| 455 | + }; | ||
| 456 | + }; | ||
| 457 | + | ||
| 458 | + /** | ||
| 459 | + * The callback will be executed after any registered event was fired. It only executed once. | ||
| 460 | + * @param {String} eventname1 Event name. | ||
| 461 | + * @param {String} eventname2 Event name. | ||
| 462 | + * @param {Function} callback The callback will get a map that has data and eventname attributes. | ||
| 463 | + */ | ||
| 464 | + EventProxy.prototype.any = function () { | ||
| 465 | + var proxy = this, | ||
| 466 | + callback = arguments[arguments.length - 1], | ||
| 467 | + events = SLICE.call(arguments, 0, -1), | ||
| 468 | + _eventname = events.join("_"); | ||
| 469 | + | ||
| 470 | + debug('Add listenner for Any of events %j emit', events); | ||
| 471 | + proxy.once(_eventname, callback); | ||
| 472 | + | ||
| 473 | + var _bind = function (key) { | ||
| 474 | + proxy.bind(key, function (data) { | ||
| 475 | + debug('One of events %j emited, execute the listenner'); | ||
| 476 | + proxy.trigger(_eventname, {"data": data, eventName: key}); | ||
| 477 | + }); | ||
| 478 | + }; | ||
| 479 | + | ||
| 480 | + for (var index = 0; index < events.length; index++) { | ||
| 481 | + _bind(events[index]); | ||
| 482 | + } | ||
| 483 | + }; | ||
| 484 | + | ||
| 485 | + /** | ||
| 486 | + * The callback will be executed when the event name not equals with assigned event. | ||
| 487 | + * @param {String} eventname Event name. | ||
| 488 | + * @param {Function} callback Callback. | ||
| 489 | + */ | ||
| 490 | + EventProxy.prototype.not = function (eventname, callback) { | ||
| 491 | + var proxy = this; | ||
| 492 | + debug('Add listenner for not event %s', eventname); | ||
| 493 | + proxy.bindForAll(function (name, data) { | ||
| 494 | + if (name !== eventname) { | ||
| 495 | + debug('listenner execute of event %s emit, but not event %s.', name, eventname); | ||
| 496 | + callback(data); | ||
| 497 | + } | ||
| 498 | + }); | ||
| 499 | + }; | ||
| 500 | + | ||
| 501 | + /** | ||
| 502 | + * Success callback wrapper, will handler err for you. | ||
| 503 | + * | ||
| 504 | + * ```js | ||
| 505 | + * fs.readFile('foo.txt', ep.done('content')); | ||
| 506 | + * | ||
| 507 | + * // equal to => | ||
| 508 | + * | ||
| 509 | + * fs.readFile('foo.txt', function (err, content) { | ||
| 510 | + * if (err) { | ||
| 511 | + * return ep.emit('error', err); | ||
| 512 | + * } | ||
| 513 | + * ep.emit('content', content); | ||
| 514 | + * }); | ||
| 515 | + * ``` | ||
| 516 | + * | ||
| 517 | + * ```js | ||
| 518 | + * fs.readFile('foo.txt', ep.done('content', function (content) { | ||
| 519 | + * return content.trim(); | ||
| 520 | + * })); | ||
| 521 | + * | ||
| 522 | + * // equal to => | ||
| 523 | + * | ||
| 524 | + * fs.readFile('foo.txt', function (err, content) { | ||
| 525 | + * if (err) { | ||
| 526 | + * return ep.emit('error', err); | ||
| 527 | + * } | ||
| 528 | + * ep.emit('content', content.trim()); | ||
| 529 | + * }); | ||
| 530 | + * ``` | ||
| 531 | + * @param {Function|String} handler, success callback or event name will be emit after callback. | ||
| 532 | + * @return {Function} | ||
| 533 | + */ | ||
| 534 | + EventProxy.prototype.done = function (handler, callback) { | ||
| 535 | + var that = this; | ||
| 536 | + return function (err, data) { | ||
| 537 | + if (err) { | ||
| 538 | + // put all arguments to the error handler | ||
| 539 | + return that.emit.apply(that, ['error'].concat(SLICE.call(arguments))); | ||
| 540 | + } | ||
| 541 | + | ||
| 542 | + // callback(err, args1, args2, ...) | ||
| 543 | + var args = SLICE.call(arguments, 1); | ||
| 544 | + | ||
| 545 | + if (typeof handler === 'string') { | ||
| 546 | + // getAsync(query, ep.done('query')); | ||
| 547 | + // or | ||
| 548 | + // getAsync(query, ep.done('query', function (data) { | ||
| 549 | + // return data.trim(); | ||
| 550 | + // })); | ||
| 551 | + if (callback) { | ||
| 552 | + // only replace the args when it really return a result | ||
| 553 | + return that.emit(handler, callback.apply(null, args)); | ||
| 554 | + } else { | ||
| 555 | + // put all arguments to the done handler | ||
| 556 | + //ep.done('some'); | ||
| 557 | + //ep.on('some', function(args1, args2, ...){}); | ||
| 558 | + return that.emit.apply(that, [handler].concat(args)); | ||
| 559 | + } | ||
| 560 | + } | ||
| 561 | + | ||
| 562 | + // speed improve for mostly case: `callback(err, data)` | ||
| 563 | + if (arguments.length <= 2) { | ||
| 564 | + return handler(data); | ||
| 565 | + } | ||
| 566 | + | ||
| 567 | + // callback(err, args1, args2, ...) | ||
| 568 | + handler.apply(null, args); | ||
| 569 | + }; | ||
| 570 | + }; | ||
| 571 | + | ||
| 572 | + /** | ||
| 573 | + * make done async | ||
| 574 | + * @return {Function} delay done | ||
| 575 | + */ | ||
| 576 | + EventProxy.prototype.doneLater = function (handler, callback) { | ||
| 577 | + var _doneHandler = this.done(handler, callback); | ||
| 578 | + return function (err, data) { | ||
| 579 | + var args = arguments; | ||
| 580 | + later(function () { | ||
| 581 | + _doneHandler.apply(null, args); | ||
| 582 | + }); | ||
| 583 | + }; | ||
| 584 | + }; | ||
| 585 | + | ||
| 586 | + /** | ||
| 587 | + * Create a new EventProxy | ||
| 588 | + * Examples: | ||
| 589 | + * ```js | ||
| 590 | + * var ep = EventProxy.create(); | ||
| 591 | + * ep.assign('user', 'articles', function(user, articles) { | ||
| 592 | + * // do something... | ||
| 593 | + * }); | ||
| 594 | + * // or one line ways: Create EventProxy and Assign | ||
| 595 | + * var ep = EventProxy.create('user', 'articles', function(user, articles) { | ||
| 596 | + * // do something... | ||
| 597 | + * }); | ||
| 598 | + * ``` | ||
| 599 | + * @return {EventProxy} EventProxy instance | ||
| 600 | + */ | ||
| 601 | + EventProxy.create = function () { | ||
| 602 | + var ep = new EventProxy(); | ||
| 603 | + var args = CONCAT.apply([], arguments); | ||
| 604 | + if (args.length) { | ||
| 605 | + var errorHandler = args[args.length - 1]; | ||
| 606 | + var callback = args[args.length - 2]; | ||
| 607 | + if (typeof errorHandler === 'function' && typeof callback === 'function') { | ||
| 608 | + args.pop(); | ||
| 609 | + ep.fail(errorHandler); | ||
| 610 | + } | ||
| 611 | + ep.assign.apply(ep, args); | ||
| 612 | + } | ||
| 613 | + return ep; | ||
| 614 | + }; | ||
| 615 | + | ||
| 616 | + // Backwards compatibility | ||
| 617 | + EventProxy.EventProxy = EventProxy; | ||
| 618 | + | ||
| 619 | + return EventProxy; | ||
| 620 | +}); |
src/main/resources/static/assets/js/sockjs.min.js
| 1 | -/* sockjs-client v1.1.1 | http://sockjs.org | MIT license */ | ||
| 2 | -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.SockJS=t()}}(function(){var t;return function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};t[s][0].call(c.exports,function(e){var n=t[s][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(t,e){(function(n){"use strict";var r=t("./transport-list");e.exports=t("./main")(r),"_sockjs_onload"in n&&setTimeout(n._sockjs_onload,1)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./main":14,"./transport-list":16}],2:[function(t,e){"use strict";function n(){i.call(this),this.initEvent("close",!1,!1),this.wasClean=!1,this.code=0,this.reason=""}var r=t("inherits"),i=t("./event");r(n,i),e.exports=n},{"./event":4,inherits:54}],3:[function(t,e){"use strict";function n(){i.call(this)}var r=t("inherits"),i=t("./eventtarget");r(n,i),n.prototype.removeAllListeners=function(t){t?delete this._listeners[t]:this._listeners={}},n.prototype.once=function(t,e){function n(){r.removeListener(t,n),i||(i=!0,e.apply(this,arguments))}var r=this,i=!1;this.on(t,n)},n.prototype.emit=function(){var t=arguments[0],e=this._listeners[t];if(e){for(var n=arguments.length,r=new Array(n-1),i=1;n>i;i++)r[i-1]=arguments[i];for(var o=0;o<e.length;o++)e[o].apply(this,r)}},n.prototype.on=n.prototype.addListener=i.prototype.addEventListener,n.prototype.removeListener=i.prototype.removeEventListener,e.exports.EventEmitter=n},{"./eventtarget":5,inherits:54}],4:[function(t,e){"use strict";function n(t){this.type=t}n.prototype.initEvent=function(t,e,n){return this.type=t,this.bubbles=e,this.cancelable=n,this.timeStamp=+new Date,this},n.prototype.stopPropagation=function(){},n.prototype.preventDefault=function(){},n.CAPTURING_PHASE=1,n.AT_TARGET=2,n.BUBBLING_PHASE=3,e.exports=n},{}],5:[function(t,e){"use strict";function n(){this._listeners={}}n.prototype.addEventListener=function(t,e){t in this._listeners||(this._listeners[t]=[]);var n=this._listeners[t];-1===n.indexOf(e)&&(n=n.concat([e])),this._listeners[t]=n},n.prototype.removeEventListener=function(t,e){var n=this._listeners[t];if(n){var r=n.indexOf(e);return-1!==r?void(n.length>1?this._listeners[t]=n.slice(0,r).concat(n.slice(r+1)):delete this._listeners[t]):void 0}},n.prototype.dispatchEvent=function(){var t=arguments[0],e=t.type,n=1===arguments.length?[t]:Array.apply(null,arguments);if(this["on"+e]&&this["on"+e].apply(this,n),e in this._listeners)for(var r=this._listeners[e],i=0;i<r.length;i++)r[i].apply(this,n)},e.exports=n},{}],6:[function(t,e){"use strict";function n(t){i.call(this),this.initEvent("message",!1,!1),this.data=t}var r=t("inherits"),i=t("./event");r(n,i),e.exports=n},{"./event":4,inherits:54}],7:[function(t,e){"use strict";function n(t){this._transport=t,t.on("message",this._transportMessage.bind(this)),t.on("close",this._transportClose.bind(this))}var r=t("json3"),i=t("./utils/iframe");n.prototype._transportClose=function(t,e){i.postMessage("c",r.stringify([t,e]))},n.prototype._transportMessage=function(t){i.postMessage("t",t)},n.prototype._send=function(t){this._transport.send(t)},n.prototype._close=function(){this._transport.close(),this._transport.removeAllListeners()},e.exports=n},{"./utils/iframe":47,json3:55}],8:[function(t,e){"use strict";var n=t("./utils/url"),r=t("./utils/event"),i=t("json3"),o=t("./facade"),s=t("./info-iframe-receiver"),a=t("./utils/iframe"),u=t("./location");e.exports=function(t,e){var l={};e.forEach(function(t){t.facadeTransport&&(l[t.facadeTransport.transportName]=t.facadeTransport)}),l[s.transportName]=s;var c;t.bootstrap_iframe=function(){var e;a.currentWindowId=u.hash.slice(1);var s=function(r){if(r.source===parent&&("undefined"==typeof c&&(c=r.origin),r.origin===c)){var s;try{s=i.parse(r.data)}catch(f){return}if(s.windowId===a.currentWindowId)switch(s.type){case"s":var h;try{h=i.parse(s.data)}catch(f){break}var d=h[0],p=h[1],v=h[2],m=h[3];if(d!==t.version)throw new Error('Incompatible SockJS! Main site uses: "'+d+'", the iframe: "'+t.version+'".');if(!n.isOriginEqual(v,u.href)||!n.isOriginEqual(m,u.href))throw new Error("Can't connect to different domain from within an iframe. ("+u.href+", "+v+", "+m+")");e=new o(new l[p](v,m));break;case"m":e._send(s.data);break;case"c":e&&e._close(),e=null}}};r.attachEvent("message",s),a.postMessage("s")}}},{"./facade":7,"./info-iframe-receiver":10,"./location":13,"./utils/event":46,"./utils/iframe":47,"./utils/url":52,debug:void 0,json3:55}],9:[function(t,e){"use strict";function n(t,e){r.call(this);var n=this,i=+new Date;this.xo=new e("GET",t),this.xo.once("finish",function(t,e){var r,a;if(200===t){if(a=+new Date-i,e)try{r=o.parse(e)}catch(u){}s.isObject(r)||(r={})}n.emit("finish",r,a),n.removeAllListeners()})}var r=t("events").EventEmitter,i=t("inherits"),o=t("json3"),s=t("./utils/object");i(n,r),n.prototype.close=function(){this.removeAllListeners(),this.xo.close()},e.exports=n},{"./utils/object":49,debug:void 0,events:3,inherits:54,json3:55}],10:[function(t,e){"use strict";function n(t){var e=this;i.call(this),this.ir=new a(t,s),this.ir.once("finish",function(t,n){e.ir=null,e.emit("message",o.stringify([t,n]))})}var r=t("inherits"),i=t("events").EventEmitter,o=t("json3"),s=t("./transport/sender/xhr-local"),a=t("./info-ajax");r(n,i),n.transportName="iframe-info-receiver",n.prototype.close=function(){this.ir&&(this.ir.close(),this.ir=null),this.removeAllListeners()},e.exports=n},{"./info-ajax":9,"./transport/sender/xhr-local":37,events:3,inherits:54,json3:55}],11:[function(t,e){(function(n){"use strict";function r(t,e){var r=this;i.call(this);var o=function(){var n=r.ifr=new u(l.transportName,e,t);n.once("message",function(t){if(t){var e;try{e=s.parse(t)}catch(n){return r.emit("finish"),void r.close()}var i=e[0],o=e[1];r.emit("finish",i,o)}r.close()}),n.once("close",function(){r.emit("finish"),r.close()})};n.document.body?o():a.attachEvent("load",o)}var i=t("events").EventEmitter,o=t("inherits"),s=t("json3"),a=t("./utils/event"),u=t("./transport/iframe"),l=t("./info-iframe-receiver");o(r,i),r.enabled=function(){return u.enabled()},r.prototype.close=function(){this.ifr&&this.ifr.close(),this.removeAllListeners(),this.ifr=null},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./info-iframe-receiver":10,"./transport/iframe":22,"./utils/event":46,debug:void 0,events:3,inherits:54,json3:55}],12:[function(t,e){"use strict";function n(t,e){var n=this;r.call(this),setTimeout(function(){n.doXhr(t,e)},0)}var r=t("events").EventEmitter,i=t("inherits"),o=t("./utils/url"),s=t("./transport/sender/xdr"),a=t("./transport/sender/xhr-cors"),u=t("./transport/sender/xhr-local"),l=t("./transport/sender/xhr-fake"),c=t("./info-iframe"),f=t("./info-ajax");i(n,r),n._getReceiver=function(t,e,n){return n.sameOrigin?new f(e,u):a.enabled?new f(e,a):s.enabled&&n.sameScheme?new f(e,s):c.enabled()?new c(t,e):new f(e,l)},n.prototype.doXhr=function(t,e){var r=this,i=o.addPath(t,"/info");this.xo=n._getReceiver(t,i,e),this.timeoutRef=setTimeout(function(){r._cleanup(!1),r.emit("finish")},n.timeout),this.xo.once("finish",function(t,e){r._cleanup(!0),r.emit("finish",t,e)})},n.prototype._cleanup=function(t){clearTimeout(this.timeoutRef),this.timeoutRef=null,!t&&this.xo&&this.xo.close(),this.xo=null},n.prototype.close=function(){this.removeAllListeners(),this._cleanup(!1)},n.timeout=8e3,e.exports=n},{"./info-ajax":9,"./info-iframe":11,"./transport/sender/xdr":34,"./transport/sender/xhr-cors":35,"./transport/sender/xhr-fake":36,"./transport/sender/xhr-local":37,"./utils/url":52,debug:void 0,events:3,inherits:54}],13:[function(t,e){(function(t){"use strict";e.exports=t.location||{origin:"http://localhost:80",protocol:"http",host:"localhost",port:80,href:"http://localhost/",hash:""}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],14:[function(t,e){(function(n){"use strict";function r(t,e,n){if(!(this instanceof r))return new r(t,e,n);if(arguments.length<1)throw new TypeError("Failed to construct 'SockJS: 1 argument required, but only 0 present");b.call(this),this.readyState=r.CONNECTING,this.extensions="",this.protocol="",n=n||{},n.protocols_whitelist&&m.warn("'protocols_whitelist' is DEPRECATED. Use 'transports' instead."),this._transportsWhitelist=n.transports,this._transportOptions=n.transportOptions||{};var i=n.sessionId||8;if("function"==typeof i)this._generateSessionId=i;else{if("number"!=typeof i)throw new TypeError("If sessionId is used in the options, it needs to be a number or a function.");this._generateSessionId=function(){return l.string(i)}}this._server=n.server||l.numberString(1e3);var o=new s(t);if(!o.host||!o.protocol)throw new SyntaxError("The URL '"+t+"' is invalid");if(o.hash)throw new SyntaxError("The URL must not contain a fragment");if("http:"!==o.protocol&&"https:"!==o.protocol)throw new SyntaxError("The URL's scheme must be either 'http:' or 'https:'. '"+o.protocol+"' is not allowed.");var a="https:"===o.protocol;if("https"===g.protocol&&!a)throw new Error("SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS");e?Array.isArray(e)||(e=[e]):e=[];var u=e.sort();u.forEach(function(t,e){if(!t)throw new SyntaxError("The protocols entry '"+t+"' is invalid.");if(e<u.length-1&&t===u[e+1])throw new SyntaxError("The protocols entry '"+t+"' is duplicated.")});var c=f.getOrigin(g.href);this._origin=c?c.toLowerCase():null,o.set("pathname",o.pathname.replace(/\/+$/,"")),this.url=o.href,this._urlInfo={nullOrigin:!v.hasDomain(),sameOrigin:f.isOriginEqual(this.url,g.href),sameScheme:f.isSchemeEqual(this.url,g.href)},this._ir=new _(this.url,this._urlInfo),this._ir.once("finish",this._receiveInfo.bind(this))}function i(t){return 1e3===t||t>=3e3&&4999>=t}t("./shims");var o,s=t("url-parse"),a=t("inherits"),u=t("json3"),l=t("./utils/random"),c=t("./utils/escape"),f=t("./utils/url"),h=t("./utils/event"),d=t("./utils/transport"),p=t("./utils/object"),v=t("./utils/browser"),m=t("./utils/log"),y=t("./event/event"),b=t("./event/eventtarget"),g=t("./location"),w=t("./event/close"),x=t("./event/trans-message"),_=t("./info-receiver");a(r,b),r.prototype.close=function(t,e){if(t&&!i(t))throw new Error("InvalidAccessError: Invalid code");if(e&&e.length>123)throw new SyntaxError("reason argument has an invalid length");if(this.readyState!==r.CLOSING&&this.readyState!==r.CLOSED){var n=!0;this._close(t||1e3,e||"Normal closure",n)}},r.prototype.send=function(t){if("string"!=typeof t&&(t=""+t),this.readyState===r.CONNECTING)throw new Error("InvalidStateError: The connection has not been established yet");this.readyState===r.OPEN&&this._transport.send(c.quote(t))},r.version=t("./version"),r.CONNECTING=0,r.OPEN=1,r.CLOSING=2,r.CLOSED=3,r.prototype._receiveInfo=function(t,e){if(this._ir=null,!t)return void this._close(1002,"Cannot connect to server");this._rto=this.countRTO(e),this._transUrl=t.base_url?t.base_url:this.url,t=p.extend(t,this._urlInfo);var n=o.filterToEnabled(this._transportsWhitelist,t);this._transports=n.main,this._connect()},r.prototype._connect=function(){for(var t=this._transports.shift();t;t=this._transports.shift()){if(t.needBody&&(!n.document.body||"undefined"!=typeof n.document.readyState&&"complete"!==n.document.readyState&&"interactive"!==n.document.readyState))return this._transports.unshift(t),void h.attachEvent("load",this._connect.bind(this));var e=this._rto*t.roundTrips||5e3;this._transportTimeoutId=setTimeout(this._transportTimeout.bind(this),e);var r=f.addPath(this._transUrl,"/"+this._server+"/"+this._generateSessionId()),i=this._transportOptions[t.transportName],o=new t(r,this._transUrl,i);return o.on("message",this._transportMessage.bind(this)),o.once("close",this._transportClose.bind(this)),o.transportName=t.transportName,void(this._transport=o)}this._close(2e3,"All transports failed",!1)},r.prototype._transportTimeout=function(){this.readyState===r.CONNECTING&&this._transportClose(2007,"Transport timed out")},r.prototype._transportMessage=function(t){var e,n=this,r=t.slice(0,1),i=t.slice(1);switch(r){case"o":return void this._open();case"h":return void this.dispatchEvent(new y("heartbeat"))}if(i)try{e=u.parse(i)}catch(o){}if("undefined"!=typeof e)switch(r){case"a":Array.isArray(e)&&e.forEach(function(t){n.dispatchEvent(new x(t))});break;case"m":this.dispatchEvent(new x(e));break;case"c":Array.isArray(e)&&2===e.length&&this._close(e[0],e[1],!0)}},r.prototype._transportClose=function(t,e){return this._transport&&(this._transport.removeAllListeners(),this._transport=null,this.transport=null),i(t)||2e3===t||this.readyState!==r.CONNECTING?void this._close(t,e):void this._connect()},r.prototype._open=function(){this.readyState===r.CONNECTING?(this._transportTimeoutId&&(clearTimeout(this._transportTimeoutId),this._transportTimeoutId=null),this.readyState=r.OPEN,this.transport=this._transport.transportName,this.dispatchEvent(new y("open"))):this._close(1006,"Server lost session")},r.prototype._close=function(t,e,n){var i=!1;if(this._ir&&(i=!0,this._ir.close(),this._ir=null),this._transport&&(this._transport.close(),this._transport=null,this.transport=null),this.readyState===r.CLOSED)throw new Error("InvalidStateError: SockJS has already been closed");this.readyState=r.CLOSING,setTimeout(function(){this.readyState=r.CLOSED,i&&this.dispatchEvent(new y("error"));var o=new w("close");o.wasClean=n||!1,o.code=t||1e3,o.reason=e,this.dispatchEvent(o),this.onmessage=this.onclose=this.onerror=null}.bind(this),0)},r.prototype.countRTO=function(t){return t>100?4*t:300+t},e.exports=function(e){return o=d(e),t("./iframe-bootstrap")(r,e),r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./event/close":2,"./event/event":4,"./event/eventtarget":5,"./event/trans-message":6,"./iframe-bootstrap":8,"./info-receiver":12,"./location":13,"./shims":15,"./utils/browser":44,"./utils/escape":45,"./utils/event":46,"./utils/log":48,"./utils/object":49,"./utils/random":50,"./utils/transport":51,"./utils/url":52,"./version":53,debug:void 0,inherits:54,json3:55,"url-parse":56}],15:[function(){"use strict";function t(t){var e=+t;return e!==e?e=0:0!==e&&e!==1/0&&e!==-(1/0)&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function e(t){return t>>>0}function n(){}var r,i=Array.prototype,o=Object.prototype,s=Function.prototype,a=String.prototype,u=i.slice,l=o.toString,c=function(t){return"[object Function]"===o.toString.call(t)},f=function(t){return"[object Array]"===l.call(t)},h=function(t){return"[object String]"===l.call(t)},d=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}();r=d?function(t,e,n,r){!r&&e in t||Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:!0,value:n})}:function(t,e,n,r){!r&&e in t||(t[e]=n)};var p=function(t,e,n){for(var i in e)o.hasOwnProperty.call(e,i)&&r(t,i,e[i],n)},v=function(t){if(null==t)throw new TypeError("can't convert "+t+" to object");return Object(t)};p(s,{bind:function(t){var e=this;if(!c(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var r=u.call(arguments,1),i=function(){if(this instanceof l){var n=e.apply(this,r.concat(u.call(arguments)));return Object(n)===n?n:this}return e.apply(t,r.concat(u.call(arguments)))},o=Math.max(0,e.length-r.length),s=[],a=0;o>a;a++)s.push("$"+a);var l=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this, arguments); }")(i);return e.prototype&&(n.prototype=e.prototype,l.prototype=new n,n.prototype=null),l}}),p(Array,{isArray:f});var m=Object("a"),y="a"!==m[0]||!(0 in m),b=function(t){var e=!0,n=!0;return t&&(t.call("foo",function(t,n,r){"object"!=typeof r&&(e=!1)}),t.call([1],function(){n="string"==typeof this},"x")),!!t&&e&&n};p(i,{forEach:function(t){var e=v(this),n=y&&h(this)?this.split(""):e,r=arguments[1],i=-1,o=n.length>>>0;if(!c(t))throw new TypeError;for(;++i<o;)i in n&&t.call(r,n[i],i,e)}},!b(i.forEach));var g=Array.prototype.indexOf&&-1!==[0,1].indexOf(1,2);p(i,{indexOf:function(e){var n=y&&h(this)?this.split(""):v(this),r=n.length>>>0;if(!r)return-1;var i=0;for(arguments.length>1&&(i=t(arguments[1])),i=i>=0?i:Math.max(0,r+i);r>i;i++)if(i in n&&n[i]===e)return i;return-1}},g);var w=a.split;2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||4!=="test".split(/(?:)/,-1).length||"".split(/.?/).length||".".split(/()()/).length>1?!function(){var t=void 0===/()??/.exec("")[1];a.split=function(n,r){var o=this;if(void 0===n&&0===r)return[];if("[object RegExp]"!==l.call(n))return w.call(this,n,r);var s,a,u,c,f=[],h=(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.extended?"x":"")+(n.sticky?"y":""),d=0;for(n=new RegExp(n.source,h+"g"),o+="",t||(s=new RegExp("^"+n.source+"$(?!\\s)",h)),r=void 0===r?-1>>>0:e(r);(a=n.exec(o))&&(u=a.index+a[0].length,!(u>d&&(f.push(o.slice(d,a.index)),!t&&a.length>1&&a[0].replace(s,function(){for(var t=1;t<arguments.length-2;t++)void 0===arguments[t]&&(a[t]=void 0)}),a.length>1&&a.index<o.length&&i.push.apply(f,a.slice(1)),c=a[0].length,d=u,f.length>=r)));)n.lastIndex===a.index&&n.lastIndex++;return d===o.length?(c||!n.test(""))&&f.push(""):f.push(o.slice(d)),f.length>r?f.slice(0,r):f}}():"0".split(void 0,0).length&&(a.split=function(t,e){return void 0===t&&0===e?[]:w.call(this,t,e)});var x=" \n\f\r \u2028\u2029",_="",E="["+x+"]",j=new RegExp("^"+E+E+"*"),T=new RegExp(E+E+"*$"),S=a.trim&&(x.trim()||!_.trim());p(a,{trim:function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");return String(this).replace(j,"").replace(T,"")}},S);var O=a.substr,C="".substr&&"b"!=="0b".substr(-1);p(a,{substr:function(t,e){return O.call(this,0>t&&(t=this.length+t)<0?0:t,e)}},C)},{}],16:[function(t,e){"use strict";e.exports=[t("./transport/websocket"),t("./transport/xhr-streaming"),t("./transport/xdr-streaming"),t("./transport/eventsource"),t("./transport/lib/iframe-wrap")(t("./transport/eventsource")),t("./transport/htmlfile"),t("./transport/lib/iframe-wrap")(t("./transport/htmlfile")),t("./transport/xhr-polling"),t("./transport/xdr-polling"),t("./transport/lib/iframe-wrap")(t("./transport/xhr-polling")),t("./transport/jsonp-polling")]},{"./transport/eventsource":20,"./transport/htmlfile":21,"./transport/jsonp-polling":23,"./transport/lib/iframe-wrap":26,"./transport/websocket":38,"./transport/xdr-polling":39,"./transport/xdr-streaming":40,"./transport/xhr-polling":41,"./transport/xhr-streaming":42}],17:[function(t,e){(function(n){"use strict";function r(t,e,n,r){var o=this;i.call(this),setTimeout(function(){o._start(t,e,n,r)},0)}var i=t("events").EventEmitter,o=t("inherits"),s=t("../../utils/event"),a=t("../../utils/url"),u=n.XMLHttpRequest;o(r,i),r.prototype._start=function(t,e,n,i){var o=this;try{this.xhr=new u}catch(l){}if(!this.xhr)return this.emit("finish",0,"no xhr support"),void this._cleanup();e=a.addQuery(e,"t="+ +new Date),this.unloadRef=s.unloadAdd(function(){o._cleanup(!0)});try{this.xhr.open(t,e,!0),this.timeout&&"timeout"in this.xhr&&(this.xhr.timeout=this.timeout,this.xhr.ontimeout=function(){o.emit("finish",0,""),o._cleanup(!1)})}catch(c){return this.emit("finish",0,""),void this._cleanup(!1)}if(i&&i.noCredentials||!r.supportsCORS||(this.xhr.withCredentials="true"),i&&i.headers)for(var f in i.headers)this.xhr.setRequestHeader(f,i.headers[f]);this.xhr.onreadystatechange=function(){if(o.xhr){var t,e,n=o.xhr;switch(n.readyState){case 3:try{e=n.status,t=n.responseText}catch(r){}1223===e&&(e=204),200===e&&t&&t.length>0&&o.emit("chunk",e,t);break;case 4:e=n.status,1223===e&&(e=204),(12005===e||12029===e)&&(e=0),o.emit("finish",e,n.responseText),o._cleanup(!1)}}};try{o.xhr.send(n)}catch(c){o.emit("finish",0,""),o._cleanup(!1)}},r.prototype._cleanup=function(t){if(this.xhr){if(this.removeAllListeners(),s.unloadDel(this.unloadRef),this.xhr.onreadystatechange=function(){},this.xhr.ontimeout&&(this.xhr.ontimeout=null),t)try{this.xhr.abort()}catch(e){}this.unloadRef=this.xhr=null}},r.prototype.close=function(){this._cleanup(!0)},r.enabled=!!u;var l=["Active"].concat("Object").join("X");!r.enabled&&l in n&&(u=function(){try{return new n[l]("Microsoft.XMLHTTP")}catch(t){return null}},r.enabled=!!new u);var c=!1;try{c="withCredentials"in new u}catch(f){}r.supportsCORS=c,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/event":46,"../../utils/url":52,debug:void 0,events:3,inherits:54}],18:[function(t,e){(function(t){e.exports=t.EventSource}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(t,e){(function(t){"use strict";var n=t.WebSocket||t.MozWebSocket;n&&(e.exports=function(t){return new n(t)})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],20:[function(t,e){"use strict";function n(t){if(!n.enabled())throw new Error("Transport created when disabled");i.call(this,t,"/eventsource",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/eventsource"),s=t("./sender/xhr-cors"),a=t("eventsource");r(n,i),n.enabled=function(){return!!a},n.transportName="eventsource",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/eventsource":29,"./sender/xhr-cors":35,eventsource:18,inherits:54}],21:[function(t,e){"use strict";function n(t){if(!i.enabled)throw new Error("Transport created when disabled");s.call(this,t,"/htmlfile",i,o)}var r=t("inherits"),i=t("./receiver/htmlfile"),o=t("./sender/xhr-local"),s=t("./lib/ajax-based");r(n,s),n.enabled=function(t){return i.enabled&&t.sameOrigin},n.transportName="htmlfile",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/htmlfile":30,"./sender/xhr-local":37,inherits:54}],22:[function(t,e){"use strict";function n(t,e,r){if(!n.enabled())throw new Error("Transport created when disabled");o.call(this);var i=this;this.origin=a.getOrigin(r),this.baseUrl=r,this.transUrl=e,this.transport=t,this.windowId=c.string(8);var s=a.addPath(r,"/iframe.html")+"#"+this.windowId;this.iframeObj=u.createIframe(s,function(t){i.emit("close",1006,"Unable to load an iframe ("+t+")"),i.close()}),this.onmessageCallback=this._message.bind(this),l.attachEvent("message",this.onmessageCallback)}var r=t("inherits"),i=t("json3"),o=t("events").EventEmitter,s=t("../version"),a=t("../utils/url"),u=t("../utils/iframe"),l=t("../utils/event"),c=t("../utils/random");r(n,o),n.prototype.close=function(){if(this.removeAllListeners(),this.iframeObj){l.detachEvent("message",this.onmessageCallback);try{this.postMessage("c")}catch(t){}this.iframeObj.cleanup(),this.iframeObj=null,this.onmessageCallback=this.iframeObj=null}},n.prototype._message=function(t){if(a.isOriginEqual(t.origin,this.origin)){var e;try{e=i.parse(t.data)}catch(n){return}if(e.windowId===this.windowId)switch(e.type){case"s":this.iframeObj.loaded(),this.postMessage("s",i.stringify([s,this.transport,this.transUrl,this.baseUrl]));break;case"t":this.emit("message",e.data);break;case"c":var r;try{r=i.parse(e.data)}catch(n){return}this.emit("close",r[0],r[1]),this.close()}}},n.prototype.postMessage=function(t,e){this.iframeObj.post(i.stringify({windowId:this.windowId,type:t,data:e||""}),this.origin)},n.prototype.send=function(t){this.postMessage("m",t)},n.enabled=function(){return u.iframeEnabled},n.transportName="iframe",n.roundTrips=2,e.exports=n},{"../utils/event":46,"../utils/iframe":47,"../utils/random":50,"../utils/url":52,"../version":53,debug:void 0,events:3,inherits:54,json3:55}],23:[function(t,e){(function(n){"use strict";function r(t){if(!r.enabled())throw new Error("Transport created when disabled");o.call(this,t,"/jsonp",a,s)}var i=t("inherits"),o=t("./lib/sender-receiver"),s=t("./receiver/jsonp"),a=t("./sender/jsonp");i(r,o),r.enabled=function(){return!!n.document},r.transportName="jsonp-polling",r.roundTrips=1,r.needBody=!0,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/sender-receiver":28,"./receiver/jsonp":31,"./sender/jsonp":33,inherits:54}],24:[function(t,e){"use strict";function n(t){return function(e,n,r){var i={};"string"==typeof n&&(i.headers={"Content-type":"text/plain"});var s=o.addPath(e,"/xhr_send"),a=new t("POST",s,n,i);return a.once("finish",function(t){return a=null,200!==t&&204!==t?r(new Error("http status "+t)):void r()}),function(){a.close(),a=null;var t=new Error("Aborted");t.code=1e3,r(t)}}}function r(t,e,r,i){s.call(this,t,e,n(i),r,i)}var i=t("inherits"),o=t("../../utils/url"),s=t("./sender-receiver");i(r,s),e.exports=r},{"../../utils/url":52,"./sender-receiver":28,debug:void 0,inherits:54}],25:[function(t,e){"use strict";function n(t,e){i.call(this),this.sendBuffer=[],this.sender=e,this.url=t}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype.send=function(t){this.sendBuffer.push(t),this.sendStop||this.sendSchedule()},n.prototype.sendScheduleWait=function(){var t,e=this;this.sendStop=function(){e.sendStop=null,clearTimeout(t)},t=setTimeout(function(){e.sendStop=null,e.sendSchedule()},25)},n.prototype.sendSchedule=function(){var t=this;if(this.sendBuffer.length>0){var e="["+this.sendBuffer.join(",")+"]";this.sendStop=this.sender(this.url,e,function(e){t.sendStop=null,e?(t.emit("close",e.code||1006,"Sending error: "+e),t._cleanup()):t.sendScheduleWait()}),this.sendBuffer=[]}},n.prototype._cleanup=function(){this.removeAllListeners()},n.prototype.stop=function(){this._cleanup(),this.sendStop&&(this.sendStop(),this.sendStop=null)},e.exports=n},{debug:void 0,events:3,inherits:54}],26:[function(t,e){(function(n){"use strict";var r=t("inherits"),i=t("../iframe"),o=t("../../utils/object");e.exports=function(t){function e(e,n){i.call(this,t.transportName,e,n)}return r(e,i),e.enabled=function(e,r){if(!n.document)return!1;var s=o.extend({},r);return s.sameOrigin=!0,t.enabled(s)&&i.enabled()},e.transportName="iframe-"+t.transportName,e.needBody=!0,e.roundTrips=i.roundTrips+t.roundTrips-1,e.facadeTransport=t,e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/object":49,"../iframe":22,inherits:54}],27:[function(t,e){"use strict";function n(t,e,n){i.call(this),this.Receiver=t,this.receiveUrl=e,this.AjaxObject=n,this._scheduleReceiver()}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype._scheduleReceiver=function(){var t=this,e=this.poll=new this.Receiver(this.receiveUrl,this.AjaxObject);e.on("message",function(e){t.emit("message",e)}),e.once("close",function(n,r){t.poll=e=null,t.pollIsClosing||("network"===r?t._scheduleReceiver():(t.emit("close",n||1006,r),t.removeAllListeners()))})},n.prototype.abort=function(){this.removeAllListeners(),this.pollIsClosing=!0,this.poll&&this.poll.abort()},e.exports=n},{debug:void 0,events:3,inherits:54}],28:[function(t,e){"use strict";function n(t,e,n,r,a){var u=i.addPath(t,e),l=this;o.call(this,t,n),this.poll=new s(r,u,a),this.poll.on("message",function(t){l.emit("message",t)}),this.poll.once("close",function(t,e){l.poll=null,l.emit("close",t,e),l.close()})}var r=t("inherits"),i=t("../../utils/url"),o=t("./buffered-sender"),s=t("./polling");r(n,o),n.prototype.close=function(){this.removeAllListeners(),this.poll&&(this.poll.abort(),this.poll=null),this.stop()},e.exports=n},{"../../utils/url":52,"./buffered-sender":25,"./polling":27,debug:void 0,inherits:54}],29:[function(t,e){"use strict";function n(t){i.call(this);var e=this,n=this.es=new o(t);n.onmessage=function(t){e.emit("message",decodeURI(t.data))},n.onerror=function(t){var r=2!==n.readyState?"network":"permanent";e._cleanup(),e._close(r)}}var r=t("inherits"),i=t("events").EventEmitter,o=t("eventsource");r(n,i),n.prototype.abort=function(){this._cleanup(),this._close("user")},n.prototype._cleanup=function(){var t=this.es;t&&(t.onmessage=t.onerror=null,t.close(),this.es=null)},n.prototype._close=function(t){var e=this;setTimeout(function(){e.emit("close",null,t),e.removeAllListeners()},200)},e.exports=n},{debug:void 0,events:3,eventsource:18,inherits:54}],30:[function(t,e){(function(n){"use strict";function r(t){a.call(this);var e=this;o.polluteGlobalNamespace(),this.id="a"+u.string(6),t=s.addQuery(t,"c="+decodeURIComponent(o.WPrefix+"."+this.id));var i=r.htmlfileEnabled?o.createHtmlfile:o.createIframe;n[o.WPrefix][this.id]={start:function(){e.iframeObj.loaded()},message:function(t){e.emit("message",t)},stop:function(){e._cleanup(),e._close("network")}},this.iframeObj=i(t,function(){e._cleanup(),e._close("permanent")})}var i=t("inherits"),o=t("../../utils/iframe"),s=t("../../utils/url"),a=t("events").EventEmitter,u=t("../../utils/random");i(r,a),r.prototype.abort=function(){this._cleanup(),this._close("user")},r.prototype._cleanup=function(){this.iframeObj&&(this.iframeObj.cleanup(),this.iframeObj=null),delete n[o.WPrefix][this.id]},r.prototype._close=function(t){this.emit("close",null,t),this.removeAllListeners()},r.htmlfileEnabled=!1;var l=["Active"].concat("Object").join("X");if(l in n)try{r.htmlfileEnabled=!!new n[l]("htmlfile")}catch(c){}r.enabled=r.htmlfileEnabled||o.iframeEnabled,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],31:[function(t,e){(function(n){"use strict";function r(t){var e=this;l.call(this),i.polluteGlobalNamespace(),this.id="a"+o.string(6);var s=a.addQuery(t,"c="+encodeURIComponent(i.WPrefix+"."+this.id));n[i.WPrefix][this.id]=this._callback.bind(this),this._createScript(s),this.timeoutId=setTimeout(function(){e._abort(new Error("JSONP script loaded abnormally (timeout)"))},r.timeout)}var i=t("../../utils/iframe"),o=t("../../utils/random"),s=t("../../utils/browser"),a=t("../../utils/url"),u=t("inherits"),l=t("events").EventEmitter;u(r,l),r.prototype.abort=function(){if(n[i.WPrefix][this.id]){var t=new Error("JSONP user aborted read");t.code=1e3,this._abort(t)}},r.timeout=35e3,r.scriptErrorTimeout=1e3,r.prototype._callback=function(t){this._cleanup(),this.aborting||(t&&this.emit("message",t),this.emit("close",null,"network"),this.removeAllListeners())},r.prototype._abort=function(t){this._cleanup(),this.aborting=!0,this.emit("close",t.code,t.message),this.removeAllListeners()},r.prototype._cleanup=function(){if(clearTimeout(this.timeoutId),this.script2&&(this.script2.parentNode.removeChild(this.script2),this.script2=null),this.script){var t=this.script;t.parentNode.removeChild(t),t.onreadystatechange=t.onerror=t.onload=t.onclick=null,this.script=null}delete n[i.WPrefix][this.id]},r.prototype._scriptError=function(){var t=this;this.errorTimer||(this.errorTimer=setTimeout(function(){t.loadedOkay||t._abort(new Error("JSONP script loaded abnormally (onerror)"))},r.scriptErrorTimeout))},r.prototype._createScript=function(t){var e,r=this,i=this.script=n.document.createElement("script");if(i.id="a"+o.string(8),i.src=t,i.type="text/javascript",i.charset="UTF-8",i.onerror=this._scriptError.bind(this),i.onload=function(){r._abort(new Error("JSONP script loaded abnormally (onload)"))},i.onreadystatechange=function(){if(/loaded|closed/.test(i.readyState)){if(i&&i.htmlFor&&i.onclick){r.loadedOkay=!0;try{i.onclick()}catch(t){}}i&&r._abort(new Error("JSONP script loaded abnormally (onreadystatechange)")) | 1 | +/* sockjs-client v1.1.1 | http://sockjs.org | MIT license */ |
| 2 | +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.SockJS=t()}}(function(){var t;return function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};t[s][0].call(c.exports,function(e){var n=t[s][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(t,e){(function(n){"use strict";var r=t("./transport-list");e.exports=t("./main")(r),"_sockjs_onload"in n&&setTimeout(n._sockjs_onload,1)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./main":14,"./transport-list":16}],2:[function(t,e){"use strict";function n(){i.call(this),this.initEvent("close",!1,!1),this.wasClean=!1,this.code=0,this.reason=""}var r=t("inherits"),i=t("./event");r(n,i),e.exports=n},{"./event":4,inherits:54}],3:[function(t,e){"use strict";function n(){i.call(this)}var r=t("inherits"),i=t("./eventtarget");r(n,i),n.prototype.removeAllListeners=function(t){t?delete this._listeners[t]:this._listeners={}},n.prototype.once=function(t,e){function n(){r.removeListener(t,n),i||(i=!0,e.apply(this,arguments))}var r=this,i=!1;this.on(t,n)},n.prototype.emit=function(){var t=arguments[0],e=this._listeners[t];if(e){for(var n=arguments.length,r=new Array(n-1),i=1;n>i;i++)r[i-1]=arguments[i];for(var o=0;o<e.length;o++)e[o].apply(this,r)}},n.prototype.on=n.prototype.addListener=i.prototype.addEventListener,n.prototype.removeListener=i.prototype.removeEventListener,e.exports.EventEmitter=n},{"./eventtarget":5,inherits:54}],4:[function(t,e){"use strict";function n(t){this.type=t}n.prototype.initEvent=function(t,e,n){return this.type=t,this.bubbles=e,this.cancelable=n,this.timeStamp=+new Date,this},n.prototype.stopPropagation=function(){},n.prototype.preventDefault=function(){},n.CAPTURING_PHASE=1,n.AT_TARGET=2,n.BUBBLING_PHASE=3,e.exports=n},{}],5:[function(t,e){"use strict";function n(){this._listeners={}}n.prototype.addEventListener=function(t,e){t in this._listeners||(this._listeners[t]=[]);var n=this._listeners[t];-1===n.indexOf(e)&&(n=n.concat([e])),this._listeners[t]=n},n.prototype.removeEventListener=function(t,e){var n=this._listeners[t];if(n){var r=n.indexOf(e);return-1!==r?void(n.length>1?this._listeners[t]=n.slice(0,r).concat(n.slice(r+1)):delete this._listeners[t]):void 0}},n.prototype.dispatchEvent=function(){var t=arguments[0],e=t.type,n=1===arguments.length?[t]:Array.apply(null,arguments);if(this["on"+e]&&this["on"+e].apply(this,n),e in this._listeners)for(var r=this._listeners[e],i=0;i<r.length;i++)r[i].apply(this,n)},e.exports=n},{}],6:[function(t,e){"use strict";function n(t){i.call(this),this.initEvent("message",!1,!1),this.data=t}var r=t("inherits"),i=t("./event");r(n,i),e.exports=n},{"./event":4,inherits:54}],7:[function(t,e){"use strict";function n(t){this._transport=t,t.on("message",this._transportMessage.bind(this)),t.on("close",this._transportClose.bind(this))}var r=t("json3"),i=t("./utils/iframe");n.prototype._transportClose=function(t,e){i.postMessage("c",r.stringify([t,e]))},n.prototype._transportMessage=function(t){i.postMessage("t",t)},n.prototype._send=function(t){this._transport.send(t)},n.prototype._close=function(){this._transport.close(),this._transport.removeAllListeners()},e.exports=n},{"./utils/iframe":47,json3:55}],8:[function(t,e){"use strict";var n=t("./utils/url"),r=t("./utils/event"),i=t("json3"),o=t("./facade"),s=t("./info-iframe-receiver"),a=t("./utils/iframe"),u=t("./location");e.exports=function(t,e){var l={};e.forEach(function(t){t.facadeTransport&&(l[t.facadeTransport.transportName]=t.facadeTransport)}),l[s.transportName]=s;var c;t.bootstrap_iframe=function(){var e;a.currentWindowId=u.hash.slice(1);var s=function(r){if(r.source===parent&&("undefined"==typeof c&&(c=r.origin),r.origin===c)){var s;try{s=i.parse(r.data)}catch(f){return}if(s.windowId===a.currentWindowId)switch(s.type){case"s":var h;try{h=i.parse(s.data)}catch(f){break}var d=h[0],p=h[1],v=h[2],m=h[3];if(d!==t.version)throw new Error('Incompatible SockJS! Main site uses: "'+d+'", the iframe: "'+t.version+'".');if(!n.isOriginEqual(v,u.href)||!n.isOriginEqual(m,u.href))throw new Error("Can't connect to different domain from within an iframe. ("+u.href+", "+v+", "+m+")");e=new o(new l[p](v,m));break;case"m":e._send(s.data);break;case"c":e&&e._close(),e=null}}};r.attachEvent("message",s),a.postMessage("s")}}},{"./facade":7,"./info-iframe-receiver":10,"./location":13,"./utils/event":46,"./utils/iframe":47,"./utils/url":52,debug:void 0,json3:55}],9:[function(t,e){"use strict";function n(t,e){r.call(this);var n=this,i=+new Date;this.xo=new e("GET",t),this.xo.once("finish",function(t,e){var r,a;if(200===t){if(a=+new Date-i,e)try{r=o.parse(e)}catch(u){}s.isObject(r)||(r={})}n.emit("finish",r,a),n.removeAllListeners()})}var r=t("events").EventEmitter,i=t("inherits"),o=t("json3"),s=t("./utils/object");i(n,r),n.prototype.close=function(){this.removeAllListeners(),this.xo.close()},e.exports=n},{"./utils/object":49,debug:void 0,events:3,inherits:54,json3:55}],10:[function(t,e){"use strict";function n(t){var e=this;i.call(this),this.ir=new a(t,s),this.ir.once("finish",function(t,n){e.ir=null,e.emit("message",o.stringify([t,n]))})}var r=t("inherits"),i=t("events").EventEmitter,o=t("json3"),s=t("./transport/sender/xhr-local"),a=t("./info-ajax");r(n,i),n.transportName="iframe-info-receiver",n.prototype.close=function(){this.ir&&(this.ir.close(),this.ir=null),this.removeAllListeners()},e.exports=n},{"./info-ajax":9,"./transport/sender/xhr-local":37,events:3,inherits:54,json3:55}],11:[function(t,e){(function(n){"use strict";function r(t,e){var r=this;i.call(this);var o=function(){var n=r.ifr=new u(l.transportName,e,t);n.once("message",function(t){if(t){var e;try{e=s.parse(t)}catch(n){return r.emit("finish"),void r.close()}var i=e[0],o=e[1];r.emit("finish",i,o)}r.close()}),n.once("close",function(){r.emit("finish"),r.close()})};n.document.body?o():a.attachEvent("load",o)}var i=t("events").EventEmitter,o=t("inherits"),s=t("json3"),a=t("./utils/event"),u=t("./transport/iframe"),l=t("./info-iframe-receiver");o(r,i),r.enabled=function(){return u.enabled()},r.prototype.close=function(){this.ifr&&this.ifr.close(),this.removeAllListeners(),this.ifr=null},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./info-iframe-receiver":10,"./transport/iframe":22,"./utils/event":46,debug:void 0,events:3,inherits:54,json3:55}],12:[function(t,e){"use strict";function n(t,e){var n=this;r.call(this),setTimeout(function(){n.doXhr(t,e)},0)}var r=t("events").EventEmitter,i=t("inherits"),o=t("./utils/url"),s=t("./transport/sender/xdr"),a=t("./transport/sender/xhr-cors"),u=t("./transport/sender/xhr-local"),l=t("./transport/sender/xhr-fake"),c=t("./info-iframe"),f=t("./info-ajax");i(n,r),n._getReceiver=function(t,e,n){return n.sameOrigin?new f(e,u):a.enabled?new f(e,a):s.enabled&&n.sameScheme?new f(e,s):c.enabled()?new c(t,e):new f(e,l)},n.prototype.doXhr=function(t,e){var r=this,i=o.addPath(t,"/info");this.xo=n._getReceiver(t,i,e),this.timeoutRef=setTimeout(function(){r._cleanup(!1),r.emit("finish")},n.timeout),this.xo.once("finish",function(t,e){r._cleanup(!0),r.emit("finish",t,e)})},n.prototype._cleanup=function(t){clearTimeout(this.timeoutRef),this.timeoutRef=null,!t&&this.xo&&this.xo.close(),this.xo=null},n.prototype.close=function(){this.removeAllListeners(),this._cleanup(!1)},n.timeout=8e3,e.exports=n},{"./info-ajax":9,"./info-iframe":11,"./transport/sender/xdr":34,"./transport/sender/xhr-cors":35,"./transport/sender/xhr-fake":36,"./transport/sender/xhr-local":37,"./utils/url":52,debug:void 0,events:3,inherits:54}],13:[function(t,e){(function(t){"use strict";e.exports=t.location||{origin:"http://localhost:80",protocol:"http",host:"localhost",port:80,href:"http://localhost/",hash:""}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],14:[function(t,e){(function(n){"use strict";function r(t,e,n){if(!(this instanceof r))return new r(t,e,n);if(arguments.length<1)throw new TypeError("Failed to construct 'SockJS: 1 argument required, but only 0 present");b.call(this),this.readyState=r.CONNECTING,this.extensions="",this.protocol="",n=n||{},n.protocols_whitelist&&m.warn("'protocols_whitelist' is DEPRECATED. Use 'transports' instead."),this._transportsWhitelist=n.transports,this._transportOptions=n.transportOptions||{};var i=n.sessionId||8;if("function"==typeof i)this._generateSessionId=i;else{if("number"!=typeof i)throw new TypeError("If sessionId is used in the options, it needs to be a number or a function.");this._generateSessionId=function(){return l.string(i)}}this._server=n.server||l.numberString(1e3);var o=new s(t);if(!o.host||!o.protocol)throw new SyntaxError("The URL '"+t+"' is invalid");if(o.hash)throw new SyntaxError("The URL must not contain a fragment");if("http:"!==o.protocol&&"https:"!==o.protocol)throw new SyntaxError("The URL's scheme must be either 'http:' or 'https:'. '"+o.protocol+"' is not allowed.");var a="https:"===o.protocol;if("https"===g.protocol&&!a)throw new Error("SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS");e?Array.isArray(e)||(e=[e]):e=[];var u=e.sort();u.forEach(function(t,e){if(!t)throw new SyntaxError("The protocols entry '"+t+"' is invalid.");if(e<u.length-1&&t===u[e+1])throw new SyntaxError("The protocols entry '"+t+"' is duplicated.")});var c=f.getOrigin(g.href);this._origin=c?c.toLowerCase():null,o.set("pathname",o.pathname.replace(/\/+$/,"")),this.url=o.href,this._urlInfo={nullOrigin:!v.hasDomain(),sameOrigin:f.isOriginEqual(this.url,g.href),sameScheme:f.isSchemeEqual(this.url,g.href)},this._ir=new _(this.url,this._urlInfo),this._ir.once("finish",this._receiveInfo.bind(this))}function i(t){return 1e3===t||t>=3e3&&4999>=t}t("./shims");var o,s=t("url-parse"),a=t("inherits"),u=t("json3"),l=t("./utils/random"),c=t("./utils/escape"),f=t("./utils/url"),h=t("./utils/event"),d=t("./utils/transport"),p=t("./utils/object"),v=t("./utils/browser"),m=t("./utils/log"),y=t("./event/event"),b=t("./event/eventtarget"),g=t("./location"),w=t("./event/close"),x=t("./event/trans-message"),_=t("./info-receiver");a(r,b),r.prototype.close=function(t,e){if(t&&!i(t))throw new Error("InvalidAccessError: Invalid code");if(e&&e.length>123)throw new SyntaxError("reason argument has an invalid length");if(this.readyState!==r.CLOSING&&this.readyState!==r.CLOSED){var n=!0;this._close(t||1e3,e||"Normal closure",n)}},r.prototype.send=function(t){if("string"!=typeof t&&(t=""+t),this.readyState===r.CONNECTING)throw new Error("InvalidStateError: The connection has not been established yet");this.readyState===r.OPEN&&this._transport.send(c.quote(t))},r.version=t("./version"),r.CONNECTING=0,r.OPEN=1,r.CLOSING=2,r.CLOSED=3,r.prototype._receiveInfo=function(t,e){if(this._ir=null,!t)return void this._close(1002,"Cannot connect to server");this._rto=this.countRTO(e),this._transUrl=t.base_url?t.base_url:this.url,t=p.extend(t,this._urlInfo);var n=o.filterToEnabled(this._transportsWhitelist,t);this._transports=n.main,this._connect()},r.prototype._connect=function(){for(var t=this._transports.shift();t;t=this._transports.shift()){if(t.needBody&&(!n.document.body||"undefined"!=typeof n.document.readyState&&"complete"!==n.document.readyState&&"interactive"!==n.document.readyState))return this._transports.unshift(t),void h.attachEvent("load",this._connect.bind(this));var e=this._rto*t.roundTrips||5e3;this._transportTimeoutId=setTimeout(this._transportTimeout.bind(this),e);var r=f.addPath(this._transUrl,"/"+this._server+"/"+this._generateSessionId()),i=this._transportOptions[t.transportName],o=new t(r,this._transUrl,i);return o.on("message",this._transportMessage.bind(this)),o.once("close",this._transportClose.bind(this)),o.transportName=t.transportName,void(this._transport=o)}this._close(2e3,"All transports failed",!1)},r.prototype._transportTimeout=function(){this.readyState===r.CONNECTING&&this._transportClose(2007,"Transport timed out")},r.prototype._transportMessage=function(t){var e,n=this,r=t.slice(0,1),i=t.slice(1);switch(r){case"o":return void this._open();case"h":return void this.dispatchEvent(new y("heartbeat"))}if(i)try{e=u.parse(i)}catch(o){}if("undefined"!=typeof e)switch(r){case"a":Array.isArray(e)&&e.forEach(function(t){n.dispatchEvent(new x(t))});break;case"m":this.dispatchEvent(new x(e));break;case"c":Array.isArray(e)&&2===e.length&&this._close(e[0],e[1],!0)}},r.prototype._transportClose=function(t,e){return this._transport&&(this._transport.removeAllListeners(),this._transport=null,this.transport=null),i(t)||2e3===t||this.readyState!==r.CONNECTING?void this._close(t,e):void this._connect()},r.prototype._open=function(){this.readyState===r.CONNECTING?(this._transportTimeoutId&&(clearTimeout(this._transportTimeoutId),this._transportTimeoutId=null),this.readyState=r.OPEN,this.transport=this._transport.transportName,this.dispatchEvent(new y("open"))):this._close(1006,"Server lost session")},r.prototype._close=function(t,e,n){var i=!1;if(this._ir&&(i=!0,this._ir.close(),this._ir=null),this._transport&&(this._transport.close(),this._transport=null,this.transport=null),this.readyState===r.CLOSED)throw new Error("InvalidStateError: SockJS has already been closed");this.readyState=r.CLOSING,setTimeout(function(){this.readyState=r.CLOSED,i&&this.dispatchEvent(new y("error"));var o=new w("close");o.wasClean=n||!1,o.code=t||1e3,o.reason=e,this.dispatchEvent(o),this.onmessage=this.onclose=this.onerror=null}.bind(this),0)},r.prototype.countRTO=function(t){return t>100?4*t:300+t},e.exports=function(e){return o=d(e),t("./iframe-bootstrap")(r,e),r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./event/close":2,"./event/event":4,"./event/eventtarget":5,"./event/trans-message":6,"./iframe-bootstrap":8,"./info-receiver":12,"./location":13,"./shims":15,"./utils/browser":44,"./utils/escape":45,"./utils/event":46,"./utils/log":48,"./utils/object":49,"./utils/random":50,"./utils/transport":51,"./utils/url":52,"./version":53,debug:void 0,inherits:54,json3:55,"url-parse":56}],15:[function(){"use strict";function t(t){var e=+t;return e!==e?e=0:0!==e&&e!==1/0&&e!==-(1/0)&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function e(t){return t>>>0}function n(){}var r,i=Array.prototype,o=Object.prototype,s=Function.prototype,a=String.prototype,u=i.slice,l=o.toString,c=function(t){return"[object Function]"===o.toString.call(t)},f=function(t){return"[object Array]"===l.call(t)},h=function(t){return"[object String]"===l.call(t)},d=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}();r=d?function(t,e,n,r){!r&&e in t||Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:!0,value:n})}:function(t,e,n,r){!r&&e in t||(t[e]=n)};var p=function(t,e,n){for(var i in e)o.hasOwnProperty.call(e,i)&&r(t,i,e[i],n)},v=function(t){if(null==t)throw new TypeError("can't convert "+t+" to object");return Object(t)};p(s,{bind:function(t){var e=this;if(!c(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var r=u.call(arguments,1),i=function(){if(this instanceof l){var n=e.apply(this,r.concat(u.call(arguments)));return Object(n)===n?n:this}return e.apply(t,r.concat(u.call(arguments)))},o=Math.max(0,e.length-r.length),s=[],a=0;o>a;a++)s.push("$"+a);var l=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this, arguments); }")(i);return e.prototype&&(n.prototype=e.prototype,l.prototype=new n,n.prototype=null),l}}),p(Array,{isArray:f});var m=Object("a"),y="a"!==m[0]||!(0 in m),b=function(t){var e=!0,n=!0;return t&&(t.call("foo",function(t,n,r){"object"!=typeof r&&(e=!1)}),t.call([1],function(){n="string"==typeof this},"x")),!!t&&e&&n};p(i,{forEach:function(t){var e=v(this),n=y&&h(this)?this.split(""):e,r=arguments[1],i=-1,o=n.length>>>0;if(!c(t))throw new TypeError;for(;++i<o;)i in n&&t.call(r,n[i],i,e)}},!b(i.forEach));var g=Array.prototype.indexOf&&-1!==[0,1].indexOf(1,2);p(i,{indexOf:function(e){var n=y&&h(this)?this.split(""):v(this),r=n.length>>>0;if(!r)return-1;var i=0;for(arguments.length>1&&(i=t(arguments[1])),i=i>=0?i:Math.max(0,r+i);r>i;i++)if(i in n&&n[i]===e)return i;return-1}},g);var w=a.split;2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||4!=="test".split(/(?:)/,-1).length||"".split(/.?/).length||".".split(/()()/).length>1?!function(){var t=void 0===/()??/.exec("")[1];a.split=function(n,r){var o=this;if(void 0===n&&0===r)return[];if("[object RegExp]"!==l.call(n))return w.call(this,n,r);var s,a,u,c,f=[],h=(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.extended?"x":"")+(n.sticky?"y":""),d=0;for(n=new RegExp(n.source,h+"g"),o+="",t||(s=new RegExp("^"+n.source+"$(?!\\s)",h)),r=void 0===r?-1>>>0:e(r);(a=n.exec(o))&&(u=a.index+a[0].length,!(u>d&&(f.push(o.slice(d,a.index)),!t&&a.length>1&&a[0].replace(s,function(){for(var t=1;t<arguments.length-2;t++)void 0===arguments[t]&&(a[t]=void 0)}),a.length>1&&a.index<o.length&&i.push.apply(f,a.slice(1)),c=a[0].length,d=u,f.length>=r)));)n.lastIndex===a.index&&n.lastIndex++;return d===o.length?(c||!n.test(""))&&f.push(""):f.push(o.slice(d)),f.length>r?f.slice(0,r):f}}():"0".split(void 0,0).length&&(a.split=function(t,e){return void 0===t&&0===e?[]:w.call(this,t,e)});var x=" \n\f\r \u2028\u2029",_="",E="["+x+"]",j=new RegExp("^"+E+E+"*"),T=new RegExp(E+E+"*$"),S=a.trim&&(x.trim()||!_.trim());p(a,{trim:function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");return String(this).replace(j,"").replace(T,"")}},S);var O=a.substr,C="".substr&&"b"!=="0b".substr(-1);p(a,{substr:function(t,e){return O.call(this,0>t&&(t=this.length+t)<0?0:t,e)}},C)},{}],16:[function(t,e){"use strict";e.exports=[t("./transport/websocket"),t("./transport/xhr-streaming"),t("./transport/xdr-streaming"),t("./transport/eventsource"),t("./transport/lib/iframe-wrap")(t("./transport/eventsource")),t("./transport/htmlfile"),t("./transport/lib/iframe-wrap")(t("./transport/htmlfile")),t("./transport/xhr-polling"),t("./transport/xdr-polling"),t("./transport/lib/iframe-wrap")(t("./transport/xhr-polling")),t("./transport/jsonp-polling")]},{"./transport/eventsource":20,"./transport/htmlfile":21,"./transport/jsonp-polling":23,"./transport/lib/iframe-wrap":26,"./transport/websocket":38,"./transport/xdr-polling":39,"./transport/xdr-streaming":40,"./transport/xhr-polling":41,"./transport/xhr-streaming":42}],17:[function(t,e){(function(n){"use strict";function r(t,e,n,r){var o=this;i.call(this),setTimeout(function(){o._start(t,e,n,r)},0)}var i=t("events").EventEmitter,o=t("inherits"),s=t("../../utils/event"),a=t("../../utils/url"),u=n.XMLHttpRequest;o(r,i),r.prototype._start=function(t,e,n,i){var o=this;try{this.xhr=new u}catch(l){}if(!this.xhr)return this.emit("finish",0,"no xhr support"),void this._cleanup();e=a.addQuery(e,"t="+ +new Date),this.unloadRef=s.unloadAdd(function(){o._cleanup(!0)});try{this.xhr.open(t,e,!0),this.timeout&&"timeout"in this.xhr&&(this.xhr.timeout=this.timeout,this.xhr.ontimeout=function(){o.emit("finish",0,""),o._cleanup(!1)})}catch(c){return this.emit("finish",0,""),void this._cleanup(!1)}if(i&&i.noCredentials||!r.supportsCORS||(this.xhr.withCredentials="true"),i&&i.headers)for(var f in i.headers)this.xhr.setRequestHeader(f,i.headers[f]);this.xhr.onreadystatechange=function(){if(o.xhr){var t,e,n=o.xhr;switch(n.readyState){case 3:try{e=n.status,t=n.responseText}catch(r){}1223===e&&(e=204),200===e&&t&&t.length>0&&o.emit("chunk",e,t);break;case 4:e=n.status,1223===e&&(e=204),(12005===e||12029===e)&&(e=0),o.emit("finish",e,n.responseText),o._cleanup(!1)}}};try{o.xhr.send(n)}catch(c){o.emit("finish",0,""),o._cleanup(!1)}},r.prototype._cleanup=function(t){if(this.xhr){if(this.removeAllListeners(),s.unloadDel(this.unloadRef),this.xhr.onreadystatechange=function(){},this.xhr.ontimeout&&(this.xhr.ontimeout=null),t)try{this.xhr.abort()}catch(e){}this.unloadRef=this.xhr=null}},r.prototype.close=function(){this._cleanup(!0)},r.enabled=!!u;var l=["Active"].concat("Object").join("X");!r.enabled&&l in n&&(u=function(){try{return new n[l]("Microsoft.XMLHTTP")}catch(t){return null}},r.enabled=!!new u);var c=!1;try{c="withCredentials"in new u}catch(f){}r.supportsCORS=c,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/event":46,"../../utils/url":52,debug:void 0,events:3,inherits:54}],18:[function(t,e){(function(t){e.exports=t.EventSource}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(t,e){(function(t){"use strict";var n=t.WebSocket||t.MozWebSocket;n&&(e.exports=function(t){return new n(t)})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],20:[function(t,e){"use strict";function n(t){if(!n.enabled())throw new Error("Transport created when disabled");i.call(this,t,"/eventsource",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/eventsource"),s=t("./sender/xhr-cors"),a=t("eventsource");r(n,i),n.enabled=function(){return!!a},n.transportName="eventsource",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/eventsource":29,"./sender/xhr-cors":35,eventsource:18,inherits:54}],21:[function(t,e){"use strict";function n(t){if(!i.enabled)throw new Error("Transport created when disabled");s.call(this,t,"/htmlfile",i,o)}var r=t("inherits"),i=t("./receiver/htmlfile"),o=t("./sender/xhr-local"),s=t("./lib/ajax-based");r(n,s),n.enabled=function(t){return i.enabled&&t.sameOrigin},n.transportName="htmlfile",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/htmlfile":30,"./sender/xhr-local":37,inherits:54}],22:[function(t,e){"use strict";function n(t,e,r){if(!n.enabled())throw new Error("Transport created when disabled");o.call(this);var i=this;this.origin=a.getOrigin(r),this.baseUrl=r,this.transUrl=e,this.transport=t,this.windowId=c.string(8);var s=a.addPath(r,"/iframe.html")+"#"+this.windowId;this.iframeObj=u.createIframe(s,function(t){i.emit("close",1006,"Unable to load an iframe ("+t+")"),i.close()}),this.onmessageCallback=this._message.bind(this),l.attachEvent("message",this.onmessageCallback)}var r=t("inherits"),i=t("json3"),o=t("events").EventEmitter,s=t("../version"),a=t("../utils/url"),u=t("../utils/iframe"),l=t("../utils/event"),c=t("../utils/random");r(n,o),n.prototype.close=function(){if(this.removeAllListeners(),this.iframeObj){l.detachEvent("message",this.onmessageCallback);try{this.postMessage("c")}catch(t){}this.iframeObj.cleanup(),this.iframeObj=null,this.onmessageCallback=this.iframeObj=null}},n.prototype._message=function(t){if(a.isOriginEqual(t.origin,this.origin)){var e;try{e=i.parse(t.data)}catch(n){return}if(e.windowId===this.windowId)switch(e.type){case"s":this.iframeObj.loaded(),this.postMessage("s",i.stringify([s,this.transport,this.transUrl,this.baseUrl]));break;case"t":this.emit("message",e.data);break;case"c":var r;try{r=i.parse(e.data)}catch(n){return}this.emit("close",r[0],r[1]),this.close()}}},n.prototype.postMessage=function(t,e){this.iframeObj.post(i.stringify({windowId:this.windowId,type:t,data:e||""}),this.origin)},n.prototype.send=function(t){this.postMessage("m",t)},n.enabled=function(){return u.iframeEnabled},n.transportName="iframe",n.roundTrips=2,e.exports=n},{"../utils/event":46,"../utils/iframe":47,"../utils/random":50,"../utils/url":52,"../version":53,debug:void 0,events:3,inherits:54,json3:55}],23:[function(t,e){(function(n){"use strict";function r(t){if(!r.enabled())throw new Error("Transport created when disabled");o.call(this,t,"/jsonp",a,s)}var i=t("inherits"),o=t("./lib/sender-receiver"),s=t("./receiver/jsonp"),a=t("./sender/jsonp");i(r,o),r.enabled=function(){return!!n.document},r.transportName="jsonp-polling",r.roundTrips=1,r.needBody=!0,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/sender-receiver":28,"./receiver/jsonp":31,"./sender/jsonp":33,inherits:54}],24:[function(t,e){"use strict";function n(t){return function(e,n,r){var i={};"string"==typeof n&&(i.headers={"Content-type":"text/plain"});var s=o.addPath(e,"/xhr_send"),a=new t("POST",s,n,i);return a.once("finish",function(t){return a=null,200!==t&&204!==t?r(new Error("http status "+t)):void r()}),function(){a.close(),a=null;var t=new Error("Aborted");t.code=1e3,r(t)}}}function r(t,e,r,i){s.call(this,t,e,n(i),r,i)}var i=t("inherits"),o=t("../../utils/url"),s=t("./sender-receiver");i(r,s),e.exports=r},{"../../utils/url":52,"./sender-receiver":28,debug:void 0,inherits:54}],25:[function(t,e){"use strict";function n(t,e){i.call(this),this.sendBuffer=[],this.sender=e,this.url=t}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype.send=function(t){this.sendBuffer.push(t),this.sendStop||this.sendSchedule()},n.prototype.sendScheduleWait=function(){var t,e=this;this.sendStop=function(){e.sendStop=null,clearTimeout(t)},t=setTimeout(function(){e.sendStop=null,e.sendSchedule()},25)},n.prototype.sendSchedule=function(){var t=this;if(this.sendBuffer.length>0){var e="["+this.sendBuffer.join(",")+"]";this.sendStop=this.sender(this.url,e,function(e){t.sendStop=null,e?(t.emit("close",e.code||1006,"Sending error: "+e),t._cleanup()):t.sendScheduleWait()}),this.sendBuffer=[]}},n.prototype._cleanup=function(){this.removeAllListeners()},n.prototype.stop=function(){this._cleanup(),this.sendStop&&(this.sendStop(),this.sendStop=null)},e.exports=n},{debug:void 0,events:3,inherits:54}],26:[function(t,e){(function(n){"use strict";var r=t("inherits"),i=t("../iframe"),o=t("../../utils/object");e.exports=function(t){function e(e,n){i.call(this,t.transportName,e,n)}return r(e,i),e.enabled=function(e,r){if(!n.document)return!1;var s=o.extend({},r);return s.sameOrigin=!0,t.enabled(s)&&i.enabled()},e.transportName="iframe-"+t.transportName,e.needBody=!0,e.roundTrips=i.roundTrips+t.roundTrips-1,e.facadeTransport=t,e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/object":49,"../iframe":22,inherits:54}],27:[function(t,e){"use strict";function n(t,e,n){i.call(this),this.Receiver=t,this.receiveUrl=e,this.AjaxObject=n,this._scheduleReceiver()}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype._scheduleReceiver=function(){var t=this,e=this.poll=new this.Receiver(this.receiveUrl,this.AjaxObject);e.on("message",function(e){t.emit("message",e)}),e.once("close",function(n,r){t.poll=e=null,t.pollIsClosing||("network"===r?t._scheduleReceiver():(t.emit("close",n||1006,r),t.removeAllListeners()))})},n.prototype.abort=function(){this.removeAllListeners(),this.pollIsClosing=!0,this.poll&&this.poll.abort()},e.exports=n},{debug:void 0,events:3,inherits:54}],28:[function(t,e){"use strict";function n(t,e,n,r,a){var u=i.addPath(t,e),l=this;o.call(this,t,n),this.poll=new s(r,u,a),this.poll.on("message",function(t){l.emit("message",t)}),this.poll.once("close",function(t,e){l.poll=null,l.emit("close",t,e),l.close()})}var r=t("inherits"),i=t("../../utils/url"),o=t("./buffered-sender"),s=t("./polling");r(n,o),n.prototype.close=function(){this.removeAllListeners(),this.poll&&(this.poll.abort(),this.poll=null),this.stop()},e.exports=n},{"../../utils/url":52,"./buffered-sender":25,"./polling":27,debug:void 0,inherits:54}],29:[function(t,e){"use strict";function n(t){i.call(this);var e=this,n=this.es=new o(t);n.onmessage=function(t){e.emit("message",decodeURI(t.data))},n.onerror=function(t){var r=2!==n.readyState?"network":"permanent";e._cleanup(),e._close(r)}}var r=t("inherits"),i=t("events").EventEmitter,o=t("eventsource");r(n,i),n.prototype.abort=function(){this._cleanup(),this._close("user")},n.prototype._cleanup=function(){var t=this.es;t&&(t.onmessage=t.onerror=null,t.close(),this.es=null)},n.prototype._close=function(t){var e=this;setTimeout(function(){e.emit("close",null,t),e.removeAllListeners()},200)},e.exports=n},{debug:void 0,events:3,eventsource:18,inherits:54}],30:[function(t,e){(function(n){"use strict";function r(t){a.call(this);var e=this;o.polluteGlobalNamespace(),this.id="a"+u.string(6),t=s.addQuery(t,"c="+decodeURIComponent(o.WPrefix+"."+this.id));var i=r.htmlfileEnabled?o.createHtmlfile:o.createIframe;n[o.WPrefix][this.id]={start:function(){e.iframeObj.loaded()},message:function(t){e.emit("message",t)},stop:function(){e._cleanup(),e._close("network")}},this.iframeObj=i(t,function(){e._cleanup(),e._close("permanent")})}var i=t("inherits"),o=t("../../utils/iframe"),s=t("../../utils/url"),a=t("events").EventEmitter,u=t("../../utils/random");i(r,a),r.prototype.abort=function(){this._cleanup(),this._close("user")},r.prototype._cleanup=function(){this.iframeObj&&(this.iframeObj.cleanup(),this.iframeObj=null),delete n[o.WPrefix][this.id]},r.prototype._close=function(t){this.emit("close",null,t),this.removeAllListeners()},r.htmlfileEnabled=!1;var l=["Active"].concat("Object").join("X");if(l in n)try{r.htmlfileEnabled=!!new n[l]("htmlfile")}catch(c){}r.enabled=r.htmlfileEnabled||o.iframeEnabled,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],31:[function(t,e){(function(n){"use strict";function r(t){var e=this;l.call(this),i.polluteGlobalNamespace(),this.id="a"+o.string(6);var s=a.addQuery(t,"c="+encodeURIComponent(i.WPrefix+"."+this.id));n[i.WPrefix][this.id]=this._callback.bind(this),this._createScript(s),this.timeoutId=setTimeout(function(){e._abort(new Error("JSONP script loaded abnormally (timeout)"))},r.timeout)}var i=t("../../utils/iframe"),o=t("../../utils/random"),s=t("../../utils/browser"),a=t("../../utils/url"),u=t("inherits"),l=t("events").EventEmitter;u(r,l),r.prototype.abort=function(){if(n[i.WPrefix][this.id]){var t=new Error("JSONP user aborted read");t.code=1e3,this._abort(t)}},r.timeout=35e3,r.scriptErrorTimeout=1e3,r.prototype._callback=function(t){this._cleanup(),this.aborting||(t&&this.emit("message",t),this.emit("close",null,"network"),this.removeAllListeners())},r.prototype._abort=function(t){this._cleanup(),this.aborting=!0,this.emit("close",t.code,t.message),this.removeAllListeners()},r.prototype._cleanup=function(){if(clearTimeout(this.timeoutId),this.script2&&(this.script2.parentNode.removeChild(this.script2),this.script2=null),this.script){var t=this.script;t.parentNode.removeChild(t),t.onreadystatechange=t.onerror=t.onload=t.onclick=null,this.script=null}delete n[i.WPrefix][this.id]},r.prototype._scriptError=function(){var t=this;this.errorTimer||(this.errorTimer=setTimeout(function(){t.loadedOkay||t._abort(new Error("JSONP script loaded abnormally (onerror)"))},r.scriptErrorTimeout))},r.prototype._createScript=function(t){var e,r=this,i=this.script=n.document.createElement("script");if(i.id="a"+o.string(8),i.src=t,i.type="text/javascript",i.charset="UTF-8",i.onerror=this._scriptError.bind(this),i.onload=function(){r._abort(new Error("JSONP script loaded abnormally (onload)"))},i.onreadystatechange=function(){if(/loaded|closed/.test(i.readyState)){if(i&&i.htmlFor&&i.onclick){r.loadedOkay=!0;try{i.onclick()}catch(t){}}i&&r._abort(new Error("JSONP script loaded abnormally (onreadystatechange)")) | ||
| 3 | }},"undefined"==typeof i.async&&n.document.attachEvent)if(s.isOpera())e=this.script2=n.document.createElement("script"),e.text="try{var a = document.getElementById('"+i.id+"'); if(a)a.onerror();}catch(x){};",i.async=e.async=!1;else{try{i.htmlFor=i.id,i.event="onclick"}catch(a){}i.async=!0}"undefined"!=typeof i.async&&(i.async=!0);var u=n.document.getElementsByTagName("head")[0];u.insertBefore(i,u.firstChild),e&&u.insertBefore(e,u.firstChild)},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/browser":44,"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],32:[function(t,e){"use strict";function n(t,e){i.call(this);var n=this;this.bufferPosition=0,this.xo=new e("POST",t,null),this.xo.on("chunk",this._chunkHandler.bind(this)),this.xo.once("finish",function(t,e){n._chunkHandler(t,e),n.xo=null;var r=200===t?"network":"permanent";n.emit("close",null,r),n._cleanup()})}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype._chunkHandler=function(t,e){if(200===t&&e)for(var n=-1;;this.bufferPosition+=n+1){var r=e.slice(this.bufferPosition);if(n=r.indexOf("\n"),-1===n)break;var i=r.slice(0,n);i&&this.emit("message",i)}},n.prototype._cleanup=function(){this.removeAllListeners()},n.prototype.abort=function(){this.xo&&(this.xo.close(),this.emit("close",null,"user"),this.xo=null),this._cleanup()},e.exports=n},{debug:void 0,events:3,inherits:54}],33:[function(t,e){(function(n){"use strict";function r(t){try{return n.document.createElement('<iframe name="'+t+'">')}catch(e){var r=n.document.createElement("iframe");return r.name=t,r}}function i(){o=n.document.createElement("form"),o.style.display="none",o.style.position="absolute",o.method="POST",o.enctype="application/x-www-form-urlencoded",o.acceptCharset="UTF-8",s=n.document.createElement("textarea"),s.name="d",o.appendChild(s),n.document.body.appendChild(o)}var o,s,a=t("../../utils/random"),u=t("../../utils/url");e.exports=function(t,e,n){o||i();var l="a"+a.string(8);o.target=l,o.action=u.addQuery(u.addPath(t,"/jsonp_send"),"i="+l);var c=r(l);c.id=l,c.style.display="none",o.appendChild(c);try{s.value=e}catch(f){}o.submit();var h=function(t){c.onerror&&(c.onreadystatechange=c.onerror=c.onload=null,setTimeout(function(){c.parentNode.removeChild(c),c=null},500),s.value="",n(t))};return c.onerror=function(){h()},c.onload=function(){h()},c.onreadystatechange=function(t){"complete"===c.readyState&&h()},function(){h(new Error("Aborted"))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/random":50,"../../utils/url":52,debug:void 0}],34:[function(t,e){(function(n){"use strict";function r(t,e,n){var r=this;i.call(this),setTimeout(function(){r._start(t,e,n)},0)}var i=t("events").EventEmitter,o=t("inherits"),s=t("../../utils/event"),a=t("../../utils/browser"),u=t("../../utils/url");o(r,i),r.prototype._start=function(t,e,r){var i=this,o=new n.XDomainRequest;e=u.addQuery(e,"t="+ +new Date),o.onerror=function(){i._error()},o.ontimeout=function(){i._error()},o.onprogress=function(){i.emit("chunk",200,o.responseText)},o.onload=function(){i.emit("finish",200,o.responseText),i._cleanup(!1)},this.xdr=o,this.unloadRef=s.unloadAdd(function(){i._cleanup(!0)});try{this.xdr.open(t,e),this.timeout&&(this.xdr.timeout=this.timeout),this.xdr.send(r)}catch(a){this._error()}},r.prototype._error=function(){this.emit("finish",0,""),this._cleanup(!1)},r.prototype._cleanup=function(t){if(this.xdr){if(this.removeAllListeners(),s.unloadDel(this.unloadRef),this.xdr.ontimeout=this.xdr.onerror=this.xdr.onprogress=this.xdr.onload=null,t)try{this.xdr.abort()}catch(e){}this.unloadRef=this.xdr=null}},r.prototype.close=function(){this._cleanup(!0)},r.enabled=!(!n.XDomainRequest||!a.hasDomain()),e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/browser":44,"../../utils/event":46,"../../utils/url":52,debug:void 0,events:3,inherits:54}],35:[function(t,e){"use strict";function n(t,e,n,r){i.call(this,t,e,n,r)}var r=t("inherits"),i=t("../driver/xhr");r(n,i),n.enabled=i.enabled&&i.supportsCORS,e.exports=n},{"../driver/xhr":17,inherits:54}],36:[function(t,e){"use strict";function n(){var t=this;r.call(this),this.to=setTimeout(function(){t.emit("finish",200,"{}")},n.timeout)}var r=t("events").EventEmitter,i=t("inherits");i(n,r),n.prototype.close=function(){clearTimeout(this.to)},n.timeout=2e3,e.exports=n},{events:3,inherits:54}],37:[function(t,e){"use strict";function n(t,e,n){i.call(this,t,e,n,{noCredentials:!0})}var r=t("inherits"),i=t("../driver/xhr");r(n,i),n.enabled=i.enabled,e.exports=n},{"../driver/xhr":17,inherits:54}],38:[function(t,e){"use strict";function n(t,e,o){if(!n.enabled())throw new Error("Transport created when disabled");s.call(this);var u=this,l=i.addPath(t,"/websocket");l="https"===l.slice(0,5)?"wss"+l.slice(5):"ws"+l.slice(4),this.url=l,this.ws=new a(this.url,[],o),this.ws.onmessage=function(t){u.emit("message",t.data)},this.unloadRef=r.unloadAdd(function(){u.ws.close()}),this.ws.onclose=function(t){u.emit("close",t.code,t.reason),u._cleanup()},this.ws.onerror=function(t){u.emit("close",1006,"WebSocket connection broken"),u._cleanup()}}var r=t("../utils/event"),i=t("../utils/url"),o=t("inherits"),s=t("events").EventEmitter,a=t("./driver/websocket");o(n,s),n.prototype.send=function(t){var e="["+t+"]";this.ws.send(e)},n.prototype.close=function(){this.ws&&this.ws.close(),this._cleanup()},n.prototype._cleanup=function(){var t=this.ws;t&&(t.onmessage=t.onclose=t.onerror=null),r.unloadDel(this.unloadRef),this.unloadRef=this.ws=null,this.removeAllListeners()},n.enabled=function(){return!!a},n.transportName="websocket",n.roundTrips=2,e.exports=n},{"../utils/event":46,"../utils/url":52,"./driver/websocket":19,debug:void 0,events:3,inherits:54}],39:[function(t,e){"use strict";function n(t){if(!a.enabled)throw new Error("Transport created when disabled");i.call(this,t,"/xhr",s,a)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./xdr-streaming"),s=t("./receiver/xhr"),a=t("./sender/xdr");r(n,i),n.enabled=o.enabled,n.transportName="xdr-polling",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xdr":34,"./xdr-streaming":40,inherits:54}],40:[function(t,e){"use strict";function n(t){if(!s.enabled)throw new Error("Transport created when disabled");i.call(this,t,"/xhr_streaming",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/xhr"),s=t("./sender/xdr");r(n,i),n.enabled=function(t){return t.cookie_needed||t.nullOrigin?!1:s.enabled&&t.sameScheme},n.transportName="xdr-streaming",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xdr":34,inherits:54}],41:[function(t,e){"use strict";function n(t){if(!a.enabled&&!s.enabled)throw new Error("Transport created when disabled");i.call(this,t,"/xhr",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/xhr"),s=t("./sender/xhr-cors"),a=t("./sender/xhr-local");r(n,i),n.enabled=function(t){return t.nullOrigin?!1:a.enabled&&t.sameOrigin?!0:s.enabled},n.transportName="xhr-polling",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xhr-cors":35,"./sender/xhr-local":37,inherits:54}],42:[function(t,e){(function(n){"use strict";function r(t){if(!u.enabled&&!a.enabled)throw new Error("Transport created when disabled");o.call(this,t,"/xhr_streaming",s,a)}var i=t("inherits"),o=t("./lib/ajax-based"),s=t("./receiver/xhr"),a=t("./sender/xhr-cors"),u=t("./sender/xhr-local"),l=t("../utils/browser");i(r,o),r.enabled=function(t){return t.nullOrigin?!1:l.isOpera()?!1:a.enabled},r.transportName="xhr-streaming",r.roundTrips=2,r.needBody=!!n.document,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/browser":44,"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xhr-cors":35,"./sender/xhr-local":37,inherits:54}],43:[function(t,e){(function(t){"use strict";e.exports.randomBytes=t.crypto&&t.crypto.getRandomValues?function(e){var n=new Uint8Array(e);return t.crypto.getRandomValues(n),n}:function(t){for(var e=new Array(t),n=0;t>n;n++)e[n]=Math.floor(256*Math.random());return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],44:[function(t,e){(function(t){"use strict";e.exports={isOpera:function(){return t.navigator&&/opera/i.test(t.navigator.userAgent)},isKonqueror:function(){return t.navigator&&/konqueror/i.test(t.navigator.userAgent)},hasDomain:function(){if(!t.document)return!0;try{return!!t.document.domain}catch(e){return!1}}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],45:[function(t,e){"use strict";var n,r=t("json3"),i=/[\x00-\x1f\ud800-\udfff\ufffe\uffff\u0300-\u0333\u033d-\u0346\u034a-\u034c\u0350-\u0352\u0357-\u0358\u035c-\u0362\u0374\u037e\u0387\u0591-\u05af\u05c4\u0610-\u0617\u0653-\u0654\u0657-\u065b\u065d-\u065e\u06df-\u06e2\u06eb-\u06ec\u0730\u0732-\u0733\u0735-\u0736\u073a\u073d\u073f-\u0741\u0743\u0745\u0747\u07eb-\u07f1\u0951\u0958-\u095f\u09dc-\u09dd\u09df\u0a33\u0a36\u0a59-\u0a5b\u0a5e\u0b5c-\u0b5d\u0e38-\u0e39\u0f43\u0f4d\u0f52\u0f57\u0f5c\u0f69\u0f72-\u0f76\u0f78\u0f80-\u0f83\u0f93\u0f9d\u0fa2\u0fa7\u0fac\u0fb9\u1939-\u193a\u1a17\u1b6b\u1cda-\u1cdb\u1dc0-\u1dcf\u1dfc\u1dfe\u1f71\u1f73\u1f75\u1f77\u1f79\u1f7b\u1f7d\u1fbb\u1fbe\u1fc9\u1fcb\u1fd3\u1fdb\u1fe3\u1feb\u1fee-\u1fef\u1ff9\u1ffb\u1ffd\u2000-\u2001\u20d0-\u20d1\u20d4-\u20d7\u20e7-\u20e9\u2126\u212a-\u212b\u2329-\u232a\u2adc\u302b-\u302c\uaab2-\uaab3\uf900-\ufa0d\ufa10\ufa12\ufa15-\ufa1e\ufa20\ufa22\ufa25-\ufa26\ufa2a-\ufa2d\ufa30-\ufa6d\ufa70-\ufad9\ufb1d\ufb1f\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4e\ufff0-\uffff]/g,o=function(t){var e,n={},r=[];for(e=0;65536>e;e++)r.push(String.fromCharCode(e));return t.lastIndex=0,r.join("").replace(t,function(t){return n[t]="\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4),""}),t.lastIndex=0,n};e.exports={quote:function(t){var e=r.stringify(t);return i.lastIndex=0,i.test(e)?(n||(n=o(i)),e.replace(i,function(t){return n[t]})):e}}},{json3:55}],46:[function(t,e){(function(n){"use strict";var r=t("./random"),i={},o=!1,s=n.chrome&&n.chrome.app&&n.chrome.app.runtime;e.exports={attachEvent:function(t,e){"undefined"!=typeof n.addEventListener?n.addEventListener(t,e,!1):n.document&&n.attachEvent&&(n.document.attachEvent("on"+t,e),n.attachEvent("on"+t,e))},detachEvent:function(t,e){"undefined"!=typeof n.addEventListener?n.removeEventListener(t,e,!1):n.document&&n.detachEvent&&(n.document.detachEvent("on"+t,e),n.detachEvent("on"+t,e))},unloadAdd:function(t){if(s)return null;var e=r.string(8);return i[e]=t,o&&setTimeout(this.triggerUnloadCallbacks,0),e},unloadDel:function(t){t in i&&delete i[t]},triggerUnloadCallbacks:function(){for(var t in i)i[t](),delete i[t]}};var a=function(){o||(o=!0,e.exports.triggerUnloadCallbacks())};s||e.exports.attachEvent("unload",a)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./random":50}],47:[function(t,e){(function(n){"use strict";var r=t("./event"),i=t("json3"),o=t("./browser");e.exports={WPrefix:"_jp",currentWindowId:null,polluteGlobalNamespace:function(){e.exports.WPrefix in n||(n[e.exports.WPrefix]={})},postMessage:function(t,r){n.parent!==n&&n.parent.postMessage(i.stringify({windowId:e.exports.currentWindowId,type:t,data:r||""}),"*")},createIframe:function(t,e){var i,o,s=n.document.createElement("iframe"),a=function(){clearTimeout(i);try{s.onload=null}catch(t){}s.onerror=null},u=function(){s&&(a(),setTimeout(function(){s&&s.parentNode.removeChild(s),s=null},0),r.unloadDel(o))},l=function(t){s&&(u(),e(t))},c=function(t,e){try{setTimeout(function(){s&&s.contentWindow&&s.contentWindow.postMessage(t,e)},0)}catch(n){}};return s.src=t,s.style.display="none",s.style.position="absolute",s.onerror=function(){l("onerror")},s.onload=function(){clearTimeout(i),i=setTimeout(function(){l("onload timeout")},2e3)},n.document.body.appendChild(s),i=setTimeout(function(){l("timeout")},15e3),o=r.unloadAdd(u),{post:c,cleanup:u,loaded:a}},createHtmlfile:function(t,i){var o,s,a,u=["Active"].concat("Object").join("X"),l=new n[u]("htmlfile"),c=function(){clearTimeout(o),a.onerror=null},f=function(){l&&(c(),r.unloadDel(s),a.parentNode.removeChild(a),a=l=null,CollectGarbage())},h=function(t){l&&(f(),i(t))},d=function(t,e){try{setTimeout(function(){a&&a.contentWindow&&a.contentWindow.postMessage(t,e)},0)}catch(n){}};l.open(),l.write('<html><script>document.domain="'+n.document.domain+'";</script></html>'),l.close(),l.parentWindow[e.exports.WPrefix]=n[e.exports.WPrefix];var p=l.createElement("div");return l.body.appendChild(p),a=l.createElement("iframe"),p.appendChild(a),a.src=t,a.onerror=function(){h("onerror")},o=setTimeout(function(){h("timeout")},15e3),s=r.unloadAdd(f),{post:d,cleanup:f,loaded:c}}},e.exports.iframeEnabled=!1,n.document&&(e.exports.iframeEnabled=("function"==typeof n.postMessage||"object"==typeof n.postMessage)&&!o.isKonqueror())}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./browser":44,"./event":46,debug:void 0,json3:55}],48:[function(t,e){(function(t){"use strict";var n={};["log","debug","warn"].forEach(function(e){var r;try{r=t.console&&t.console[e]&&t.console[e].apply}catch(i){}n[e]=r?function(){return t.console[e].apply(t.console,arguments)}:"log"===e?function(){}:n.log}),e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],49:[function(t,e){"use strict";e.exports={isObject:function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},extend:function(t){if(!this.isObject(t))return t;for(var e,n,r=1,i=arguments.length;i>r;r++){e=arguments[r];for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}}},{}],50:[function(t,e){"use strict";var n=t("crypto"),r="abcdefghijklmnopqrstuvwxyz012345";e.exports={string:function(t){for(var e=r.length,i=n.randomBytes(t),o=[],s=0;t>s;s++)o.push(r.substr(i[s]%e,1));return o.join("")},number:function(t){return Math.floor(Math.random()*t)},numberString:function(t){var e=(""+(t-1)).length,n=new Array(e+1).join("0");return(n+this.number(t)).slice(-e)}}},{crypto:43}],51:[function(t,e){"use strict";e.exports=function(t){return{filterToEnabled:function(e,n){var r={main:[],facade:[]};return e?"string"==typeof e&&(e=[e]):e=[],t.forEach(function(t){t&&("websocket"!==t.transportName||n.websocket!==!1)&&(e.length&&-1===e.indexOf(t.transportName)||t.enabled(n)&&(r.main.push(t),t.facadeTransport&&r.facade.push(t.facadeTransport)))}),r}}}},{debug:void 0}],52:[function(t,e){"use strict";var n=t("url-parse");e.exports={getOrigin:function(t){if(!t)return null;var e=new n(t);if("file:"===e.protocol)return null;var r=e.port;return r||(r="https:"===e.protocol?"443":"80"),e.protocol+"//"+e.hostname+":"+r},isOriginEqual:function(t,e){var n=this.getOrigin(t)===this.getOrigin(e);return n},isSchemeEqual:function(t,e){return t.split(":")[0]===e.split(":")[0]},addPath:function(t,e){var n=t.split("?");return n[0]+e+(n[1]?"?"+n[1]:"")},addQuery:function(t,e){return t+(-1===t.indexOf("?")?"?"+e:"&"+e)}}},{debug:void 0,"url-parse":56}],53:[function(t,e){e.exports="1.1.1"},{}],54:[function(t,e){e.exports="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},{}],55:[function(e,n,r){(function(e){(function(){function i(t,e){function n(t){if(n[t]!==m)return n[t];var i;if("bug-string-char-index"==t)i="a"!="a"[0];else if("json"==t)i=n("json-stringify")&&n("json-parse");else{var s,a='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if("json-stringify"==t){var u=e.stringify,c="function"==typeof u&&g;if(c){(s=function(){return 1}).toJSON=s;try{c="0"===u(0)&&"0"===u(new r)&&'""'==u(new o)&&u(b)===m&&u(m)===m&&u()===m&&"1"===u(s)&&"[1]"==u([s])&&"[null]"==u([m])&&"null"==u(null)&&"[null,null,null]"==u([m,b,null])&&u({a:[s,!0,!1,null,"\x00\b\n\f\r "]})==a&&"1"===u(null,s)&&"[\n 1,\n 2\n]"==u([1,2],null,1)&&'"-271821-04-20T00:00:00.000Z"'==u(new l(-864e13))&&'"+275760-09-13T00:00:00.000Z"'==u(new l(864e13))&&'"-000001-01-01T00:00:00.000Z"'==u(new l(-621987552e5))&&'"1969-12-31T23:59:59.999Z"'==u(new l(-1))}catch(f){c=!1}}i=c}if("json-parse"==t){var h=e.parse;if("function"==typeof h)try{if(0===h("0")&&!h(!1)){s=h(a);var d=5==s.a.length&&1===s.a[0];if(d){try{d=!h('" "')}catch(f){}if(d)try{d=1!==h("01")}catch(f){}if(d)try{d=1!==h("1.")}catch(f){}}}}catch(f){d=!1}i=d}}return n[t]=!!i}t||(t=u.Object()),e||(e=u.Object());var r=t.Number||u.Number,o=t.String||u.String,a=t.Object||u.Object,l=t.Date||u.Date,c=t.SyntaxError||u.SyntaxError,f=t.TypeError||u.TypeError,h=t.Math||u.Math,d=t.JSON||u.JSON;"object"==typeof d&&d&&(e.stringify=d.stringify,e.parse=d.parse);var p,v,m,y=a.prototype,b=y.toString,g=new l(-0xc782b5b800cec);try{g=-109252==g.getUTCFullYear()&&0===g.getUTCMonth()&&1===g.getUTCDate()&&10==g.getUTCHours()&&37==g.getUTCMinutes()&&6==g.getUTCSeconds()&&708==g.getUTCMilliseconds()}catch(w){}if(!n("json")){var x="[object Function]",_="[object Date]",E="[object Number]",j="[object String]",T="[object Array]",S="[object Boolean]",O=n("bug-string-char-index");if(!g)var C=h.floor,A=[0,31,59,90,120,151,181,212,243,273,304,334],N=function(t,e){return A[e]+365*(t-1970)+C((t-1969+(e=+(e>1)))/4)-C((t-1901+e)/100)+C((t-1601+e)/400)};if((p=y.hasOwnProperty)||(p=function(t){var e,n={};return(n.__proto__=null,n.__proto__={toString:1},n).toString!=b?p=function(t){var e=this.__proto__,n=t in(this.__proto__=null,this);return this.__proto__=e,n}:(e=n.constructor,p=function(t){var n=(this.constructor||e).prototype;return t in this&&!(t in n&&this[t]===n[t])}),n=null,p.call(this,t)}),v=function(t,e){var n,r,i,o=0;(n=function(){this.valueOf=0}).prototype.valueOf=0,r=new n;for(i in r)p.call(r,i)&&o++;return n=r=null,o?v=2==o?function(t,e){var n,r={},i=b.call(t)==x;for(n in t)i&&"prototype"==n||p.call(r,n)||!(r[n]=1)||!p.call(t,n)||e(n)}:function(t,e){var n,r,i=b.call(t)==x;for(n in t)i&&"prototype"==n||!p.call(t,n)||(r="constructor"===n)||e(n);(r||p.call(t,n="constructor"))&&e(n)}:(r=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],v=function(t,e){var n,i,o=b.call(t)==x,a=!o&&"function"!=typeof t.constructor&&s[typeof t.hasOwnProperty]&&t.hasOwnProperty||p;for(n in t)o&&"prototype"==n||!a.call(t,n)||e(n);for(i=r.length;n=r[--i];a.call(t,n)&&e(n));}),v(t,e)},!n("json-stringify")){var k={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},I="000000",P=function(t,e){return(I+(e||0)).slice(-t)},L="\\u00",R=function(t){for(var e='"',n=0,r=t.length,i=!O||r>10,o=i&&(O?t.split(""):t);r>n;n++){var s=t.charCodeAt(n);switch(s){case 8:case 9:case 10:case 12:case 13:case 34:case 92:e+=k[s];break;default:if(32>s){e+=L+P(2,s.toString(16));break}e+=i?o[n]:t.charAt(n)}}return e+'"'},U=function(t,e,n,r,i,o,s){var a,u,l,c,h,d,y,g,w,x,O,A,k,I,L,M;try{a=e[t]}catch(q){}if("object"==typeof a&&a)if(u=b.call(a),u!=_||p.call(a,"toJSON"))"function"==typeof a.toJSON&&(u!=E&&u!=j&&u!=T||p.call(a,"toJSON"))&&(a=a.toJSON(t));else if(a>-1/0&&1/0>a){if(N){for(h=C(a/864e5),l=C(h/365.2425)+1970-1;N(l+1,0)<=h;l++);for(c=C((h-N(l,0))/30.42);N(l,c+1)<=h;c++);h=1+h-N(l,c),d=(a%864e5+864e5)%864e5,y=C(d/36e5)%24,g=C(d/6e4)%60,w=C(d/1e3)%60,x=d%1e3}else l=a.getUTCFullYear(),c=a.getUTCMonth(),h=a.getUTCDate(),y=a.getUTCHours(),g=a.getUTCMinutes(),w=a.getUTCSeconds(),x=a.getUTCMilliseconds();a=(0>=l||l>=1e4?(0>l?"-":"+")+P(6,0>l?-l:l):P(4,l))+"-"+P(2,c+1)+"-"+P(2,h)+"T"+P(2,y)+":"+P(2,g)+":"+P(2,w)+"."+P(3,x)+"Z"}else a=null;if(n&&(a=n.call(e,t,a)),null===a)return"null";if(u=b.call(a),u==S)return""+a;if(u==E)return a>-1/0&&1/0>a?""+a:"null";if(u==j)return R(""+a);if("object"==typeof a){for(I=s.length;I--;)if(s[I]===a)throw f();if(s.push(a),O=[],L=o,o+=i,u==T){for(k=0,I=a.length;I>k;k++)A=U(k,a,n,r,i,o,s),O.push(A===m?"null":A);M=O.length?i?"[\n"+o+O.join(",\n"+o)+"\n"+L+"]":"["+O.join(",")+"]":"[]"}else v(r||a,function(t){var e=U(t,a,n,r,i,o,s);e!==m&&O.push(R(t)+":"+(i?" ":"")+e)}),M=O.length?i?"{\n"+o+O.join(",\n"+o)+"\n"+L+"}":"{"+O.join(",")+"}":"{}";return s.pop(),M}};e.stringify=function(t,e,n){var r,i,o,a;if(s[typeof e]&&e)if((a=b.call(e))==x)i=e;else if(a==T){o={};for(var u,l=0,c=e.length;c>l;u=e[l++],a=b.call(u),(a==j||a==E)&&(o[u]=1));}if(n)if((a=b.call(n))==E){if((n-=n%1)>0)for(r="",n>10&&(n=10);r.length<n;r+=" ");}else a==j&&(r=n.length<=10?n:n.slice(0,10));return U("",(u={},u[""]=t,u),i,o,r,"",[])}}if(!n("json-parse")){var M,q,D=o.fromCharCode,W={92:"\\",34:'"',47:"/",98:"\b",116:" ",110:"\n",102:"\f",114:"\r"},J=function(){throw M=q=null,c()},B=function(){for(var t,e,n,r,i,o=q,s=o.length;s>M;)switch(i=o.charCodeAt(M)){case 9:case 10:case 13:case 32:M++;break;case 123:case 125:case 91:case 93:case 58:case 44:return t=O?o.charAt(M):o[M],M++,t;case 34:for(t="@",M++;s>M;)if(i=o.charCodeAt(M),32>i)J();else if(92==i)switch(i=o.charCodeAt(++M)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:t+=W[i],M++;break;case 117:for(e=++M,n=M+4;n>M;M++)i=o.charCodeAt(M),i>=48&&57>=i||i>=97&&102>=i||i>=65&&70>=i||J();t+=D("0x"+o.slice(e,M));break;default:J()}else{if(34==i)break;for(i=o.charCodeAt(M),e=M;i>=32&&92!=i&&34!=i;)i=o.charCodeAt(++M);t+=o.slice(e,M)}if(34==o.charCodeAt(M))return M++,t;J();default:if(e=M,45==i&&(r=!0,i=o.charCodeAt(++M)),i>=48&&57>=i){for(48==i&&(i=o.charCodeAt(M+1),i>=48&&57>=i)&&J(),r=!1;s>M&&(i=o.charCodeAt(M),i>=48&&57>=i);M++);if(46==o.charCodeAt(M)){for(n=++M;s>n&&(i=o.charCodeAt(n),i>=48&&57>=i);n++);n==M&&J(),M=n}if(i=o.charCodeAt(M),101==i||69==i){for(i=o.charCodeAt(++M),(43==i||45==i)&&M++,n=M;s>n&&(i=o.charCodeAt(n),i>=48&&57>=i);n++);n==M&&J(),M=n}return+o.slice(e,M)}if(r&&J(),"true"==o.slice(M,M+4))return M+=4,!0;if("false"==o.slice(M,M+5))return M+=5,!1;if("null"==o.slice(M,M+4))return M+=4,null;J()}return"$"},G=function(t){var e,n;if("$"==t&&J(),"string"==typeof t){if("@"==(O?t.charAt(0):t[0]))return t.slice(1);if("["==t){for(e=[];t=B(),"]"!=t;n||(n=!0))n&&(","==t?(t=B(),"]"==t&&J()):J()),","==t&&J(),e.push(G(t));return e}if("{"==t){for(e={};t=B(),"}"!=t;n||(n=!0))n&&(","==t?(t=B(),"}"==t&&J()):J()),(","==t||"string"!=typeof t||"@"!=(O?t.charAt(0):t[0])||":"!=B())&&J(),e[t.slice(1)]=G(B());return e}J()}return t},F=function(t,e,n){var r=H(t,e,n);r===m?delete t[e]:t[e]=r},H=function(t,e,n){var r,i=t[e];if("object"==typeof i&&i)if(b.call(i)==T)for(r=i.length;r--;)F(i,r,n);else v(i,function(t){F(i,t,n)});return n.call(t,e,i)};e.parse=function(t,e){var n,r;return M=0,q=""+t,n=G(B()),"$"!=B()&&J(),M=q=null,e&&b.call(e)==x?H((r={},r[""]=n,r),"",e):n}}}return e.runInContext=i,e}var o="function"==typeof t&&t.amd,s={"function":!0,object:!0},a=s[typeof r]&&r&&!r.nodeType&&r,u=s[typeof window]&&window||this,l=a&&s[typeof n]&&n&&!n.nodeType&&"object"==typeof e&&e;if(!l||l.global!==l&&l.window!==l&&l.self!==l||(u=l),a&&!o)i(u,a);else{var c=u.JSON,f=u.JSON3,h=!1,d=i(u,u.JSON3={noConflict:function(){return h||(h=!0,u.JSON=c,u.JSON3=f,c=f=null),d}});u.JSON={parse:d.parse,stringify:d.stringify}}o&&t(function(){return d})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],56:[function(t,e){"use strict";function n(t){var e=u.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],rest:e[3]?e[3]:""}}function r(t,e,u){if(!(this instanceof r))return new r(t,e,u);var c,f,h,d,p=a.test(t),v=typeof e,m=this,y=0;"object"!==v&&"string"!==v&&(u=e,e=null),u&&"function"!=typeof u&&(u=s.parse),e=o(e);var b=n(t);for(m.protocol=b.protocol||e.protocol||"",m.slashes=b.slashes||e.slashes,t=b.rest;y<l.length;y++)f=l[y],c=f[0],d=f[1],c!==c?m[d]=t:"string"==typeof c?~(h=t.indexOf(c))&&("number"==typeof f[2]?(m[d]=t.slice(0,h),t=t.slice(h+f[2])):(m[d]=t.slice(h),t=t.slice(0,h))):(h=c.exec(t))&&(m[d]=h[1],t=t.slice(0,t.length-h[0].length)),m[d]=m[d]||(f[3]||"port"===d&&p?e[d]||"":""),f[4]&&(m[d]=m[d].toLowerCase());u&&(m.query=u(m.query)),i(m.port,m.protocol)||(m.host=m.hostname,m.port=""),m.username=m.password="",m.auth&&(f=m.auth.split(":"),m.username=f[0]||"",m.password=f[1]||""),m.href=m.toString()}var i=t("requires-port"),o=t("./lolcation"),s=t("querystringify"),a=/^\/(?!\/)/,u=/^([a-z0-9.+-]+:)?(\/\/)?(.*)$/i,l=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[0/0,"host",void 0,1,1],[/\:(\d+)$/,"port"],[0/0,"hostname",void 0,1,1]];r.prototype.set=function(t,e,n){var r=this;return"query"===t?("string"==typeof e&&e.length&&(e=(n||s.parse)(e)),r[t]=e):"port"===t?(r[t]=e,i(e,r.protocol)?e&&(r.host=r.hostname+":"+e):(r.host=r.hostname,r[t]="")):"hostname"===t?(r[t]=e,r.port&&(e+=":"+r.port),r.host=e):"host"===t?(r[t]=e,/\:\d+/.test(e)&&(e=e.split(":"),r.hostname=e[0],r.port=e[1])):"protocol"===t?(r.protocol=e,r.slashes=!n):r[t]=e,r.href=r.toString(),r},r.prototype.toString=function(t){t&&"function"==typeof t||(t=s.stringify);var e,n=this,r=n.protocol;r&&":"!==r.charAt(r.length-1)&&(r+=":");var i=r+(n.slashes?"//":"");return n.username&&(i+=n.username,n.password&&(i+=":"+n.password),i+="@"),i+=n.hostname,n.port&&(i+=":"+n.port),i+=n.pathname,e="object"==typeof n.query?t(n.query):n.query,e&&(i+="?"!==e.charAt(0)?"?"+e:e),n.hash&&(i+=n.hash),i},r.qs=s,r.location=o,e.exports=r},{"./lolcation":57,querystringify:58,"requires-port":59}],57:[function(t,e){(function(n){"use strict";var r,i=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,o={hash:1,query:1};e.exports=function(e){e=e||n.location||{},r=r||t("./");var s,a={},u=typeof e;if("blob:"===e.protocol)a=new r(unescape(e.pathname),{});else if("string"===u){a=new r(e,{});for(s in o)delete a[s]}else if("object"===u){for(s in e)s in o||(a[s]=e[s]);void 0===a.slashes&&(a.slashes=i.test(e.href))}return a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./":56}],58:[function(t,e,n){"use strict";function r(t){for(var e,n=/([^=?&]+)=([^&]*)/g,r={};e=n.exec(t);r[decodeURIComponent(e[1])]=decodeURIComponent(e[2]));return r}function i(t,e){e=e||"";var n=[];"string"!=typeof e&&(e="?");for(var r in t)o.call(t,r)&&n.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return n.length?e+n.join("&"):""}var o=Object.prototype.hasOwnProperty;n.stringify=i,n.parse=r},{}],59:[function(t,e){"use strict";e.exports=function(t,e){if(e=e.split(":")[0],t=+t,!t)return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},{}]},{},[1])(1)}); | 3 | }},"undefined"==typeof i.async&&n.document.attachEvent)if(s.isOpera())e=this.script2=n.document.createElement("script"),e.text="try{var a = document.getElementById('"+i.id+"'); if(a)a.onerror();}catch(x){};",i.async=e.async=!1;else{try{i.htmlFor=i.id,i.event="onclick"}catch(a){}i.async=!0}"undefined"!=typeof i.async&&(i.async=!0);var u=n.document.getElementsByTagName("head")[0];u.insertBefore(i,u.firstChild),e&&u.insertBefore(e,u.firstChild)},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/browser":44,"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],32:[function(t,e){"use strict";function n(t,e){i.call(this);var n=this;this.bufferPosition=0,this.xo=new e("POST",t,null),this.xo.on("chunk",this._chunkHandler.bind(this)),this.xo.once("finish",function(t,e){n._chunkHandler(t,e),n.xo=null;var r=200===t?"network":"permanent";n.emit("close",null,r),n._cleanup()})}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype._chunkHandler=function(t,e){if(200===t&&e)for(var n=-1;;this.bufferPosition+=n+1){var r=e.slice(this.bufferPosition);if(n=r.indexOf("\n"),-1===n)break;var i=r.slice(0,n);i&&this.emit("message",i)}},n.prototype._cleanup=function(){this.removeAllListeners()},n.prototype.abort=function(){this.xo&&(this.xo.close(),this.emit("close",null,"user"),this.xo=null),this._cleanup()},e.exports=n},{debug:void 0,events:3,inherits:54}],33:[function(t,e){(function(n){"use strict";function r(t){try{return n.document.createElement('<iframe name="'+t+'">')}catch(e){var r=n.document.createElement("iframe");return r.name=t,r}}function i(){o=n.document.createElement("form"),o.style.display="none",o.style.position="absolute",o.method="POST",o.enctype="application/x-www-form-urlencoded",o.acceptCharset="UTF-8",s=n.document.createElement("textarea"),s.name="d",o.appendChild(s),n.document.body.appendChild(o)}var o,s,a=t("../../utils/random"),u=t("../../utils/url");e.exports=function(t,e,n){o||i();var l="a"+a.string(8);o.target=l,o.action=u.addQuery(u.addPath(t,"/jsonp_send"),"i="+l);var c=r(l);c.id=l,c.style.display="none",o.appendChild(c);try{s.value=e}catch(f){}o.submit();var h=function(t){c.onerror&&(c.onreadystatechange=c.onerror=c.onload=null,setTimeout(function(){c.parentNode.removeChild(c),c=null},500),s.value="",n(t))};return c.onerror=function(){h()},c.onload=function(){h()},c.onreadystatechange=function(t){"complete"===c.readyState&&h()},function(){h(new Error("Aborted"))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/random":50,"../../utils/url":52,debug:void 0}],34:[function(t,e){(function(n){"use strict";function r(t,e,n){var r=this;i.call(this),setTimeout(function(){r._start(t,e,n)},0)}var i=t("events").EventEmitter,o=t("inherits"),s=t("../../utils/event"),a=t("../../utils/browser"),u=t("../../utils/url");o(r,i),r.prototype._start=function(t,e,r){var i=this,o=new n.XDomainRequest;e=u.addQuery(e,"t="+ +new Date),o.onerror=function(){i._error()},o.ontimeout=function(){i._error()},o.onprogress=function(){i.emit("chunk",200,o.responseText)},o.onload=function(){i.emit("finish",200,o.responseText),i._cleanup(!1)},this.xdr=o,this.unloadRef=s.unloadAdd(function(){i._cleanup(!0)});try{this.xdr.open(t,e),this.timeout&&(this.xdr.timeout=this.timeout),this.xdr.send(r)}catch(a){this._error()}},r.prototype._error=function(){this.emit("finish",0,""),this._cleanup(!1)},r.prototype._cleanup=function(t){if(this.xdr){if(this.removeAllListeners(),s.unloadDel(this.unloadRef),this.xdr.ontimeout=this.xdr.onerror=this.xdr.onprogress=this.xdr.onload=null,t)try{this.xdr.abort()}catch(e){}this.unloadRef=this.xdr=null}},r.prototype.close=function(){this._cleanup(!0)},r.enabled=!(!n.XDomainRequest||!a.hasDomain()),e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/browser":44,"../../utils/event":46,"../../utils/url":52,debug:void 0,events:3,inherits:54}],35:[function(t,e){"use strict";function n(t,e,n,r){i.call(this,t,e,n,r)}var r=t("inherits"),i=t("../driver/xhr");r(n,i),n.enabled=i.enabled&&i.supportsCORS,e.exports=n},{"../driver/xhr":17,inherits:54}],36:[function(t,e){"use strict";function n(){var t=this;r.call(this),this.to=setTimeout(function(){t.emit("finish",200,"{}")},n.timeout)}var r=t("events").EventEmitter,i=t("inherits");i(n,r),n.prototype.close=function(){clearTimeout(this.to)},n.timeout=2e3,e.exports=n},{events:3,inherits:54}],37:[function(t,e){"use strict";function n(t,e,n){i.call(this,t,e,n,{noCredentials:!0})}var r=t("inherits"),i=t("../driver/xhr");r(n,i),n.enabled=i.enabled,e.exports=n},{"../driver/xhr":17,inherits:54}],38:[function(t,e){"use strict";function n(t,e,o){if(!n.enabled())throw new Error("Transport created when disabled");s.call(this);var u=this,l=i.addPath(t,"/websocket");l="https"===l.slice(0,5)?"wss"+l.slice(5):"ws"+l.slice(4),this.url=l,this.ws=new a(this.url,[],o),this.ws.onmessage=function(t){u.emit("message",t.data)},this.unloadRef=r.unloadAdd(function(){u.ws.close()}),this.ws.onclose=function(t){u.emit("close",t.code,t.reason),u._cleanup()},this.ws.onerror=function(t){u.emit("close",1006,"WebSocket connection broken"),u._cleanup()}}var r=t("../utils/event"),i=t("../utils/url"),o=t("inherits"),s=t("events").EventEmitter,a=t("./driver/websocket");o(n,s),n.prototype.send=function(t){var e="["+t+"]";this.ws.send(e)},n.prototype.close=function(){this.ws&&this.ws.close(),this._cleanup()},n.prototype._cleanup=function(){var t=this.ws;t&&(t.onmessage=t.onclose=t.onerror=null),r.unloadDel(this.unloadRef),this.unloadRef=this.ws=null,this.removeAllListeners()},n.enabled=function(){return!!a},n.transportName="websocket",n.roundTrips=2,e.exports=n},{"../utils/event":46,"../utils/url":52,"./driver/websocket":19,debug:void 0,events:3,inherits:54}],39:[function(t,e){"use strict";function n(t){if(!a.enabled)throw new Error("Transport created when disabled");i.call(this,t,"/xhr",s,a)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./xdr-streaming"),s=t("./receiver/xhr"),a=t("./sender/xdr");r(n,i),n.enabled=o.enabled,n.transportName="xdr-polling",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xdr":34,"./xdr-streaming":40,inherits:54}],40:[function(t,e){"use strict";function n(t){if(!s.enabled)throw new Error("Transport created when disabled");i.call(this,t,"/xhr_streaming",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/xhr"),s=t("./sender/xdr");r(n,i),n.enabled=function(t){return t.cookie_needed||t.nullOrigin?!1:s.enabled&&t.sameScheme},n.transportName="xdr-streaming",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xdr":34,inherits:54}],41:[function(t,e){"use strict";function n(t){if(!a.enabled&&!s.enabled)throw new Error("Transport created when disabled");i.call(this,t,"/xhr",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/xhr"),s=t("./sender/xhr-cors"),a=t("./sender/xhr-local");r(n,i),n.enabled=function(t){return t.nullOrigin?!1:a.enabled&&t.sameOrigin?!0:s.enabled},n.transportName="xhr-polling",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xhr-cors":35,"./sender/xhr-local":37,inherits:54}],42:[function(t,e){(function(n){"use strict";function r(t){if(!u.enabled&&!a.enabled)throw new Error("Transport created when disabled");o.call(this,t,"/xhr_streaming",s,a)}var i=t("inherits"),o=t("./lib/ajax-based"),s=t("./receiver/xhr"),a=t("./sender/xhr-cors"),u=t("./sender/xhr-local"),l=t("../utils/browser");i(r,o),r.enabled=function(t){return t.nullOrigin?!1:l.isOpera()?!1:a.enabled},r.transportName="xhr-streaming",r.roundTrips=2,r.needBody=!!n.document,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/browser":44,"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xhr-cors":35,"./sender/xhr-local":37,inherits:54}],43:[function(t,e){(function(t){"use strict";e.exports.randomBytes=t.crypto&&t.crypto.getRandomValues?function(e){var n=new Uint8Array(e);return t.crypto.getRandomValues(n),n}:function(t){for(var e=new Array(t),n=0;t>n;n++)e[n]=Math.floor(256*Math.random());return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],44:[function(t,e){(function(t){"use strict";e.exports={isOpera:function(){return t.navigator&&/opera/i.test(t.navigator.userAgent)},isKonqueror:function(){return t.navigator&&/konqueror/i.test(t.navigator.userAgent)},hasDomain:function(){if(!t.document)return!0;try{return!!t.document.domain}catch(e){return!1}}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],45:[function(t,e){"use strict";var n,r=t("json3"),i=/[\x00-\x1f\ud800-\udfff\ufffe\uffff\u0300-\u0333\u033d-\u0346\u034a-\u034c\u0350-\u0352\u0357-\u0358\u035c-\u0362\u0374\u037e\u0387\u0591-\u05af\u05c4\u0610-\u0617\u0653-\u0654\u0657-\u065b\u065d-\u065e\u06df-\u06e2\u06eb-\u06ec\u0730\u0732-\u0733\u0735-\u0736\u073a\u073d\u073f-\u0741\u0743\u0745\u0747\u07eb-\u07f1\u0951\u0958-\u095f\u09dc-\u09dd\u09df\u0a33\u0a36\u0a59-\u0a5b\u0a5e\u0b5c-\u0b5d\u0e38-\u0e39\u0f43\u0f4d\u0f52\u0f57\u0f5c\u0f69\u0f72-\u0f76\u0f78\u0f80-\u0f83\u0f93\u0f9d\u0fa2\u0fa7\u0fac\u0fb9\u1939-\u193a\u1a17\u1b6b\u1cda-\u1cdb\u1dc0-\u1dcf\u1dfc\u1dfe\u1f71\u1f73\u1f75\u1f77\u1f79\u1f7b\u1f7d\u1fbb\u1fbe\u1fc9\u1fcb\u1fd3\u1fdb\u1fe3\u1feb\u1fee-\u1fef\u1ff9\u1ffb\u1ffd\u2000-\u2001\u20d0-\u20d1\u20d4-\u20d7\u20e7-\u20e9\u2126\u212a-\u212b\u2329-\u232a\u2adc\u302b-\u302c\uaab2-\uaab3\uf900-\ufa0d\ufa10\ufa12\ufa15-\ufa1e\ufa20\ufa22\ufa25-\ufa26\ufa2a-\ufa2d\ufa30-\ufa6d\ufa70-\ufad9\ufb1d\ufb1f\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4e\ufff0-\uffff]/g,o=function(t){var e,n={},r=[];for(e=0;65536>e;e++)r.push(String.fromCharCode(e));return t.lastIndex=0,r.join("").replace(t,function(t){return n[t]="\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4),""}),t.lastIndex=0,n};e.exports={quote:function(t){var e=r.stringify(t);return i.lastIndex=0,i.test(e)?(n||(n=o(i)),e.replace(i,function(t){return n[t]})):e}}},{json3:55}],46:[function(t,e){(function(n){"use strict";var r=t("./random"),i={},o=!1,s=n.chrome&&n.chrome.app&&n.chrome.app.runtime;e.exports={attachEvent:function(t,e){"undefined"!=typeof n.addEventListener?n.addEventListener(t,e,!1):n.document&&n.attachEvent&&(n.document.attachEvent("on"+t,e),n.attachEvent("on"+t,e))},detachEvent:function(t,e){"undefined"!=typeof n.addEventListener?n.removeEventListener(t,e,!1):n.document&&n.detachEvent&&(n.document.detachEvent("on"+t,e),n.detachEvent("on"+t,e))},unloadAdd:function(t){if(s)return null;var e=r.string(8);return i[e]=t,o&&setTimeout(this.triggerUnloadCallbacks,0),e},unloadDel:function(t){t in i&&delete i[t]},triggerUnloadCallbacks:function(){for(var t in i)i[t](),delete i[t]}};var a=function(){o||(o=!0,e.exports.triggerUnloadCallbacks())};s||e.exports.attachEvent("unload",a)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./random":50}],47:[function(t,e){(function(n){"use strict";var r=t("./event"),i=t("json3"),o=t("./browser");e.exports={WPrefix:"_jp",currentWindowId:null,polluteGlobalNamespace:function(){e.exports.WPrefix in n||(n[e.exports.WPrefix]={})},postMessage:function(t,r){n.parent!==n&&n.parent.postMessage(i.stringify({windowId:e.exports.currentWindowId,type:t,data:r||""}),"*")},createIframe:function(t,e){var i,o,s=n.document.createElement("iframe"),a=function(){clearTimeout(i);try{s.onload=null}catch(t){}s.onerror=null},u=function(){s&&(a(),setTimeout(function(){s&&s.parentNode.removeChild(s),s=null},0),r.unloadDel(o))},l=function(t){s&&(u(),e(t))},c=function(t,e){try{setTimeout(function(){s&&s.contentWindow&&s.contentWindow.postMessage(t,e)},0)}catch(n){}};return s.src=t,s.style.display="none",s.style.position="absolute",s.onerror=function(){l("onerror")},s.onload=function(){clearTimeout(i),i=setTimeout(function(){l("onload timeout")},2e3)},n.document.body.appendChild(s),i=setTimeout(function(){l("timeout")},15e3),o=r.unloadAdd(u),{post:c,cleanup:u,loaded:a}},createHtmlfile:function(t,i){var o,s,a,u=["Active"].concat("Object").join("X"),l=new n[u]("htmlfile"),c=function(){clearTimeout(o),a.onerror=null},f=function(){l&&(c(),r.unloadDel(s),a.parentNode.removeChild(a),a=l=null,CollectGarbage())},h=function(t){l&&(f(),i(t))},d=function(t,e){try{setTimeout(function(){a&&a.contentWindow&&a.contentWindow.postMessage(t,e)},0)}catch(n){}};l.open(),l.write('<html><script>document.domain="'+n.document.domain+'";</script></html>'),l.close(),l.parentWindow[e.exports.WPrefix]=n[e.exports.WPrefix];var p=l.createElement("div");return l.body.appendChild(p),a=l.createElement("iframe"),p.appendChild(a),a.src=t,a.onerror=function(){h("onerror")},o=setTimeout(function(){h("timeout")},15e3),s=r.unloadAdd(f),{post:d,cleanup:f,loaded:c}}},e.exports.iframeEnabled=!1,n.document&&(e.exports.iframeEnabled=("function"==typeof n.postMessage||"object"==typeof n.postMessage)&&!o.isKonqueror())}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./browser":44,"./event":46,debug:void 0,json3:55}],48:[function(t,e){(function(t){"use strict";var n={};["log","debug","warn"].forEach(function(e){var r;try{r=t.console&&t.console[e]&&t.console[e].apply}catch(i){}n[e]=r?function(){return t.console[e].apply(t.console,arguments)}:"log"===e?function(){}:n.log}),e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],49:[function(t,e){"use strict";e.exports={isObject:function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},extend:function(t){if(!this.isObject(t))return t;for(var e,n,r=1,i=arguments.length;i>r;r++){e=arguments[r];for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}}},{}],50:[function(t,e){"use strict";var n=t("crypto"),r="abcdefghijklmnopqrstuvwxyz012345";e.exports={string:function(t){for(var e=r.length,i=n.randomBytes(t),o=[],s=0;t>s;s++)o.push(r.substr(i[s]%e,1));return o.join("")},number:function(t){return Math.floor(Math.random()*t)},numberString:function(t){var e=(""+(t-1)).length,n=new Array(e+1).join("0");return(n+this.number(t)).slice(-e)}}},{crypto:43}],51:[function(t,e){"use strict";e.exports=function(t){return{filterToEnabled:function(e,n){var r={main:[],facade:[]};return e?"string"==typeof e&&(e=[e]):e=[],t.forEach(function(t){t&&("websocket"!==t.transportName||n.websocket!==!1)&&(e.length&&-1===e.indexOf(t.transportName)||t.enabled(n)&&(r.main.push(t),t.facadeTransport&&r.facade.push(t.facadeTransport)))}),r}}}},{debug:void 0}],52:[function(t,e){"use strict";var n=t("url-parse");e.exports={getOrigin:function(t){if(!t)return null;var e=new n(t);if("file:"===e.protocol)return null;var r=e.port;return r||(r="https:"===e.protocol?"443":"80"),e.protocol+"//"+e.hostname+":"+r},isOriginEqual:function(t,e){var n=this.getOrigin(t)===this.getOrigin(e);return n},isSchemeEqual:function(t,e){return t.split(":")[0]===e.split(":")[0]},addPath:function(t,e){var n=t.split("?");return n[0]+e+(n[1]?"?"+n[1]:"")},addQuery:function(t,e){return t+(-1===t.indexOf("?")?"?"+e:"&"+e)}}},{debug:void 0,"url-parse":56}],53:[function(t,e){e.exports="1.1.1"},{}],54:[function(t,e){e.exports="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},{}],55:[function(e,n,r){(function(e){(function(){function i(t,e){function n(t){if(n[t]!==m)return n[t];var i;if("bug-string-char-index"==t)i="a"!="a"[0];else if("json"==t)i=n("json-stringify")&&n("json-parse");else{var s,a='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if("json-stringify"==t){var u=e.stringify,c="function"==typeof u&&g;if(c){(s=function(){return 1}).toJSON=s;try{c="0"===u(0)&&"0"===u(new r)&&'""'==u(new o)&&u(b)===m&&u(m)===m&&u()===m&&"1"===u(s)&&"[1]"==u([s])&&"[null]"==u([m])&&"null"==u(null)&&"[null,null,null]"==u([m,b,null])&&u({a:[s,!0,!1,null,"\x00\b\n\f\r "]})==a&&"1"===u(null,s)&&"[\n 1,\n 2\n]"==u([1,2],null,1)&&'"-271821-04-20T00:00:00.000Z"'==u(new l(-864e13))&&'"+275760-09-13T00:00:00.000Z"'==u(new l(864e13))&&'"-000001-01-01T00:00:00.000Z"'==u(new l(-621987552e5))&&'"1969-12-31T23:59:59.999Z"'==u(new l(-1))}catch(f){c=!1}}i=c}if("json-parse"==t){var h=e.parse;if("function"==typeof h)try{if(0===h("0")&&!h(!1)){s=h(a);var d=5==s.a.length&&1===s.a[0];if(d){try{d=!h('" "')}catch(f){}if(d)try{d=1!==h("01")}catch(f){}if(d)try{d=1!==h("1.")}catch(f){}}}}catch(f){d=!1}i=d}}return n[t]=!!i}t||(t=u.Object()),e||(e=u.Object());var r=t.Number||u.Number,o=t.String||u.String,a=t.Object||u.Object,l=t.Date||u.Date,c=t.SyntaxError||u.SyntaxError,f=t.TypeError||u.TypeError,h=t.Math||u.Math,d=t.JSON||u.JSON;"object"==typeof d&&d&&(e.stringify=d.stringify,e.parse=d.parse);var p,v,m,y=a.prototype,b=y.toString,g=new l(-0xc782b5b800cec);try{g=-109252==g.getUTCFullYear()&&0===g.getUTCMonth()&&1===g.getUTCDate()&&10==g.getUTCHours()&&37==g.getUTCMinutes()&&6==g.getUTCSeconds()&&708==g.getUTCMilliseconds()}catch(w){}if(!n("json")){var x="[object Function]",_="[object Date]",E="[object Number]",j="[object String]",T="[object Array]",S="[object Boolean]",O=n("bug-string-char-index");if(!g)var C=h.floor,A=[0,31,59,90,120,151,181,212,243,273,304,334],N=function(t,e){return A[e]+365*(t-1970)+C((t-1969+(e=+(e>1)))/4)-C((t-1901+e)/100)+C((t-1601+e)/400)};if((p=y.hasOwnProperty)||(p=function(t){var e,n={};return(n.__proto__=null,n.__proto__={toString:1},n).toString!=b?p=function(t){var e=this.__proto__,n=t in(this.__proto__=null,this);return this.__proto__=e,n}:(e=n.constructor,p=function(t){var n=(this.constructor||e).prototype;return t in this&&!(t in n&&this[t]===n[t])}),n=null,p.call(this,t)}),v=function(t,e){var n,r,i,o=0;(n=function(){this.valueOf=0}).prototype.valueOf=0,r=new n;for(i in r)p.call(r,i)&&o++;return n=r=null,o?v=2==o?function(t,e){var n,r={},i=b.call(t)==x;for(n in t)i&&"prototype"==n||p.call(r,n)||!(r[n]=1)||!p.call(t,n)||e(n)}:function(t,e){var n,r,i=b.call(t)==x;for(n in t)i&&"prototype"==n||!p.call(t,n)||(r="constructor"===n)||e(n);(r||p.call(t,n="constructor"))&&e(n)}:(r=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],v=function(t,e){var n,i,o=b.call(t)==x,a=!o&&"function"!=typeof t.constructor&&s[typeof t.hasOwnProperty]&&t.hasOwnProperty||p;for(n in t)o&&"prototype"==n||!a.call(t,n)||e(n);for(i=r.length;n=r[--i];a.call(t,n)&&e(n));}),v(t,e)},!n("json-stringify")){var k={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},I="000000",P=function(t,e){return(I+(e||0)).slice(-t)},L="\\u00",R=function(t){for(var e='"',n=0,r=t.length,i=!O||r>10,o=i&&(O?t.split(""):t);r>n;n++){var s=t.charCodeAt(n);switch(s){case 8:case 9:case 10:case 12:case 13:case 34:case 92:e+=k[s];break;default:if(32>s){e+=L+P(2,s.toString(16));break}e+=i?o[n]:t.charAt(n)}}return e+'"'},U=function(t,e,n,r,i,o,s){var a,u,l,c,h,d,y,g,w,x,O,A,k,I,L,M;try{a=e[t]}catch(q){}if("object"==typeof a&&a)if(u=b.call(a),u!=_||p.call(a,"toJSON"))"function"==typeof a.toJSON&&(u!=E&&u!=j&&u!=T||p.call(a,"toJSON"))&&(a=a.toJSON(t));else if(a>-1/0&&1/0>a){if(N){for(h=C(a/864e5),l=C(h/365.2425)+1970-1;N(l+1,0)<=h;l++);for(c=C((h-N(l,0))/30.42);N(l,c+1)<=h;c++);h=1+h-N(l,c),d=(a%864e5+864e5)%864e5,y=C(d/36e5)%24,g=C(d/6e4)%60,w=C(d/1e3)%60,x=d%1e3}else l=a.getUTCFullYear(),c=a.getUTCMonth(),h=a.getUTCDate(),y=a.getUTCHours(),g=a.getUTCMinutes(),w=a.getUTCSeconds(),x=a.getUTCMilliseconds();a=(0>=l||l>=1e4?(0>l?"-":"+")+P(6,0>l?-l:l):P(4,l))+"-"+P(2,c+1)+"-"+P(2,h)+"T"+P(2,y)+":"+P(2,g)+":"+P(2,w)+"."+P(3,x)+"Z"}else a=null;if(n&&(a=n.call(e,t,a)),null===a)return"null";if(u=b.call(a),u==S)return""+a;if(u==E)return a>-1/0&&1/0>a?""+a:"null";if(u==j)return R(""+a);if("object"==typeof a){for(I=s.length;I--;)if(s[I]===a)throw f();if(s.push(a),O=[],L=o,o+=i,u==T){for(k=0,I=a.length;I>k;k++)A=U(k,a,n,r,i,o,s),O.push(A===m?"null":A);M=O.length?i?"[\n"+o+O.join(",\n"+o)+"\n"+L+"]":"["+O.join(",")+"]":"[]"}else v(r||a,function(t){var e=U(t,a,n,r,i,o,s);e!==m&&O.push(R(t)+":"+(i?" ":"")+e)}),M=O.length?i?"{\n"+o+O.join(",\n"+o)+"\n"+L+"}":"{"+O.join(",")+"}":"{}";return s.pop(),M}};e.stringify=function(t,e,n){var r,i,o,a;if(s[typeof e]&&e)if((a=b.call(e))==x)i=e;else if(a==T){o={};for(var u,l=0,c=e.length;c>l;u=e[l++],a=b.call(u),(a==j||a==E)&&(o[u]=1));}if(n)if((a=b.call(n))==E){if((n-=n%1)>0)for(r="",n>10&&(n=10);r.length<n;r+=" ");}else a==j&&(r=n.length<=10?n:n.slice(0,10));return U("",(u={},u[""]=t,u),i,o,r,"",[])}}if(!n("json-parse")){var M,q,D=o.fromCharCode,W={92:"\\",34:'"',47:"/",98:"\b",116:" ",110:"\n",102:"\f",114:"\r"},J=function(){throw M=q=null,c()},B=function(){for(var t,e,n,r,i,o=q,s=o.length;s>M;)switch(i=o.charCodeAt(M)){case 9:case 10:case 13:case 32:M++;break;case 123:case 125:case 91:case 93:case 58:case 44:return t=O?o.charAt(M):o[M],M++,t;case 34:for(t="@",M++;s>M;)if(i=o.charCodeAt(M),32>i)J();else if(92==i)switch(i=o.charCodeAt(++M)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:t+=W[i],M++;break;case 117:for(e=++M,n=M+4;n>M;M++)i=o.charCodeAt(M),i>=48&&57>=i||i>=97&&102>=i||i>=65&&70>=i||J();t+=D("0x"+o.slice(e,M));break;default:J()}else{if(34==i)break;for(i=o.charCodeAt(M),e=M;i>=32&&92!=i&&34!=i;)i=o.charCodeAt(++M);t+=o.slice(e,M)}if(34==o.charCodeAt(M))return M++,t;J();default:if(e=M,45==i&&(r=!0,i=o.charCodeAt(++M)),i>=48&&57>=i){for(48==i&&(i=o.charCodeAt(M+1),i>=48&&57>=i)&&J(),r=!1;s>M&&(i=o.charCodeAt(M),i>=48&&57>=i);M++);if(46==o.charCodeAt(M)){for(n=++M;s>n&&(i=o.charCodeAt(n),i>=48&&57>=i);n++);n==M&&J(),M=n}if(i=o.charCodeAt(M),101==i||69==i){for(i=o.charCodeAt(++M),(43==i||45==i)&&M++,n=M;s>n&&(i=o.charCodeAt(n),i>=48&&57>=i);n++);n==M&&J(),M=n}return+o.slice(e,M)}if(r&&J(),"true"==o.slice(M,M+4))return M+=4,!0;if("false"==o.slice(M,M+5))return M+=5,!1;if("null"==o.slice(M,M+4))return M+=4,null;J()}return"$"},G=function(t){var e,n;if("$"==t&&J(),"string"==typeof t){if("@"==(O?t.charAt(0):t[0]))return t.slice(1);if("["==t){for(e=[];t=B(),"]"!=t;n||(n=!0))n&&(","==t?(t=B(),"]"==t&&J()):J()),","==t&&J(),e.push(G(t));return e}if("{"==t){for(e={};t=B(),"}"!=t;n||(n=!0))n&&(","==t?(t=B(),"}"==t&&J()):J()),(","==t||"string"!=typeof t||"@"!=(O?t.charAt(0):t[0])||":"!=B())&&J(),e[t.slice(1)]=G(B());return e}J()}return t},F=function(t,e,n){var r=H(t,e,n);r===m?delete t[e]:t[e]=r},H=function(t,e,n){var r,i=t[e];if("object"==typeof i&&i)if(b.call(i)==T)for(r=i.length;r--;)F(i,r,n);else v(i,function(t){F(i,t,n)});return n.call(t,e,i)};e.parse=function(t,e){var n,r;return M=0,q=""+t,n=G(B()),"$"!=B()&&J(),M=q=null,e&&b.call(e)==x?H((r={},r[""]=n,r),"",e):n}}}return e.runInContext=i,e}var o="function"==typeof t&&t.amd,s={"function":!0,object:!0},a=s[typeof r]&&r&&!r.nodeType&&r,u=s[typeof window]&&window||this,l=a&&s[typeof n]&&n&&!n.nodeType&&"object"==typeof e&&e;if(!l||l.global!==l&&l.window!==l&&l.self!==l||(u=l),a&&!o)i(u,a);else{var c=u.JSON,f=u.JSON3,h=!1,d=i(u,u.JSON3={noConflict:function(){return h||(h=!0,u.JSON=c,u.JSON3=f,c=f=null),d}});u.JSON={parse:d.parse,stringify:d.stringify}}o&&t(function(){return d})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],56:[function(t,e){"use strict";function n(t){var e=u.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],rest:e[3]?e[3]:""}}function r(t,e,u){if(!(this instanceof r))return new r(t,e,u);var c,f,h,d,p=a.test(t),v=typeof e,m=this,y=0;"object"!==v&&"string"!==v&&(u=e,e=null),u&&"function"!=typeof u&&(u=s.parse),e=o(e);var b=n(t);for(m.protocol=b.protocol||e.protocol||"",m.slashes=b.slashes||e.slashes,t=b.rest;y<l.length;y++)f=l[y],c=f[0],d=f[1],c!==c?m[d]=t:"string"==typeof c?~(h=t.indexOf(c))&&("number"==typeof f[2]?(m[d]=t.slice(0,h),t=t.slice(h+f[2])):(m[d]=t.slice(h),t=t.slice(0,h))):(h=c.exec(t))&&(m[d]=h[1],t=t.slice(0,t.length-h[0].length)),m[d]=m[d]||(f[3]||"port"===d&&p?e[d]||"":""),f[4]&&(m[d]=m[d].toLowerCase());u&&(m.query=u(m.query)),i(m.port,m.protocol)||(m.host=m.hostname,m.port=""),m.username=m.password="",m.auth&&(f=m.auth.split(":"),m.username=f[0]||"",m.password=f[1]||""),m.href=m.toString()}var i=t("requires-port"),o=t("./lolcation"),s=t("querystringify"),a=/^\/(?!\/)/,u=/^([a-z0-9.+-]+:)?(\/\/)?(.*)$/i,l=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[0/0,"host",void 0,1,1],[/\:(\d+)$/,"port"],[0/0,"hostname",void 0,1,1]];r.prototype.set=function(t,e,n){var r=this;return"query"===t?("string"==typeof e&&e.length&&(e=(n||s.parse)(e)),r[t]=e):"port"===t?(r[t]=e,i(e,r.protocol)?e&&(r.host=r.hostname+":"+e):(r.host=r.hostname,r[t]="")):"hostname"===t?(r[t]=e,r.port&&(e+=":"+r.port),r.host=e):"host"===t?(r[t]=e,/\:\d+/.test(e)&&(e=e.split(":"),r.hostname=e[0],r.port=e[1])):"protocol"===t?(r.protocol=e,r.slashes=!n):r[t]=e,r.href=r.toString(),r},r.prototype.toString=function(t){t&&"function"==typeof t||(t=s.stringify);var e,n=this,r=n.protocol;r&&":"!==r.charAt(r.length-1)&&(r+=":");var i=r+(n.slashes?"//":"");return n.username&&(i+=n.username,n.password&&(i+=":"+n.password),i+="@"),i+=n.hostname,n.port&&(i+=":"+n.port),i+=n.pathname,e="object"==typeof n.query?t(n.query):n.query,e&&(i+="?"!==e.charAt(0)?"?"+e:e),n.hash&&(i+=n.hash),i},r.qs=s,r.location=o,e.exports=r},{"./lolcation":57,querystringify:58,"requires-port":59}],57:[function(t,e){(function(n){"use strict";var r,i=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,o={hash:1,query:1};e.exports=function(e){e=e||n.location||{},r=r||t("./");var s,a={},u=typeof e;if("blob:"===e.protocol)a=new r(unescape(e.pathname),{});else if("string"===u){a=new r(e,{});for(s in o)delete a[s]}else if("object"===u){for(s in e)s in o||(a[s]=e[s]);void 0===a.slashes&&(a.slashes=i.test(e.href))}return a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./":56}],58:[function(t,e,n){"use strict";function r(t){for(var e,n=/([^=?&]+)=([^&]*)/g,r={};e=n.exec(t);r[decodeURIComponent(e[1])]=decodeURIComponent(e[2]));return r}function i(t,e){e=e||"";var n=[];"string"!=typeof e&&(e="?");for(var r in t)o.call(t,r)&&n.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return n.length?e+n.join("&"):""}var o=Object.prototype.hasOwnProperty;n.stringify=i,n.parse=r},{}],59:[function(t,e){"use strict";e.exports=function(t,e){if(e=e.split(":")[0],t=+t,!t)return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},{}]},{},[1])(1)}); |
| 4 | \ No newline at end of file | 4 | \ No newline at end of file |
src/main/resources/static/assets/plugins/layer-v2.4/demo.html
| 1 | -<!doctype html> | ||
| 2 | -<html> | ||
| 3 | -<head> | ||
| 4 | -<meta charset="utf-8"> | ||
| 5 | -<title>layer-更懂你的web弹窗解决方案</title> | ||
| 6 | -<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script> | ||
| 7 | -<script src="layer/layer.js"></script> | ||
| 8 | - | ||
| 9 | -<style> | ||
| 10 | -html{background-color:#E3E3E3; font-size:14px; color:#000; font-family:'微软雅黑'} | ||
| 11 | -a,a:hover{ text-decoration:none;} | ||
| 12 | -pre{font-family:'微软雅黑'} | ||
| 13 | -.box{padding:20px; background-color:#fff; margin:50px 100px; border-radius:5px;} | ||
| 14 | -.box a{padding-right:15px;} | ||
| 15 | -#about_hide{display:none} | ||
| 16 | -.layer_text{background-color:#fff; padding:20px;} | ||
| 17 | -.layer_text p{margin-bottom: 10px; text-indent: 2em; line-height: 23px;} | ||
| 18 | -.button{display:inline-block; *display:inline; *zoom:1; line-height:30px; padding:0 20px; background-color:#56B4DC; color:#fff; font-size:14px; border-radius:3px; cursor:pointer; font-weight:normal;} | ||
| 19 | -.photos-demo img{width:200px;} | ||
| 20 | -</style> | ||
| 21 | -</head> | ||
| 22 | -<body> | ||
| 23 | -<div class="box"> | ||
| 24 | -<pre> | ||
| 25 | - @Name:layer-v<script>document.write(layer.v)</script> 弹层组件说明 | ||
| 26 | - @Author:贤心 | ||
| 27 | - @Site:<a href="http://layer.layui.com/?form=local" target="_blank">http://layer.layui.com</a> | ||
| 28 | - @Github:<a href="https://github.com/sentsin/layer" target="_blank">https://github.com/sentsin/layer</a> | ||
| 29 | - | ||
| 30 | - | ||
| 31 | -<strong>【注意事项】</strong> | ||
| 32 | -一、使用时,请把文件夹layer整个放置在您站点的任何一个目录,只需引入layer.js即可,除jQuery外,其它文件无需再引入。 | ||
| 33 | -二、如果您的js引入是通过合并处理或者您不想采用layer自动获取的绝对路径,您可以通过layer.config()来配置(详见官网API页) | ||
| 34 | -三、jQuery最低要求1.8 | ||
| 35 | -四、更多使用说明与演示,请参见layer官网。 | ||
| 36 | -五、请勿用于虚假诈骗、及违反我国法律的Web平台。这一点非常重要非常的重要! | ||
| 37 | -六、layer遵循LGPL协议,将永久性提供无偿服务。版权最终解释权:贤心。 | ||
| 38 | -</pre> | ||
| 39 | -</div> | ||
| 40 | - | ||
| 41 | -<div class="box"> | ||
| 42 | - <h2 style="padding-bottom:20px;">扩展模块:图片查看器(相册层)</h2> | ||
| 43 | - <div id="photosDemo" class="photos-demo"> | ||
| 44 | - <!-- layer-src表示大图 layer-pid表示图片id src表示缩略图--> | ||
| 45 | - | ||
| 46 | - <img layer-src="http://static.oschina.net/uploads/space/2014/0516/012728_nAh8_1168184.jpg" layer-pid="" src="http://static.oschina.net/uploads/space/2014/0516/012728_nAh8_1168184.jpg" alt="layer宣传图"> | ||
| 47 | - <img layer-src="http://sentsin.qiniudn.com/sentsinmy5.jpg" layer-pid="" src="http://sentsin.qiniudn.com/sentsinmy5.jpg" alt="我入互联网这五年"> | ||
| 48 | - <img layer-src="" layer-pid="" src="http://sentsin.qiniudn.com/sentsin_39101a660cf4671b7ec297a74cc652c74152104f.jpg" alt="微摄影"> | ||
| 49 | - <img layer-src="http://sentsin.qiniudn.com/sentsinsan01.jpg" layer-pid="" src="http://sentsin.qiniudn.com/sentsinsan01.jpg" alt="三清山"> | ||
| 50 | - <img layer-src="http://ww2.sinaimg.cn/mw1024/5db11ff4jw1ehcyirr6quj20q00ex42w.jpg" layer-pid="" src="http://ww2.sinaimg.cn/mw1024/5db11ff4jw1ehcyirr6quj20q00ex42w.jpg" alt="国足"> | ||
| 51 | - </div> | ||
| 52 | - | ||
| 53 | -</div> | ||
| 54 | - | ||
| 55 | - | ||
| 56 | -<div class="box" style="text-align:center"> | ||
| 57 | - <a href="http://layer.layui.com/?form=local" target="_blank">更多示例</a> | ||
| 58 | - <a href="http://layer.layui.com/api.html" target="_blank">使用文档</a> | ||
| 59 | - <a href="http://fly.layui.com" target="_blank" title="Fly">交流反馈</a> | ||
| 60 | - <a href="javascript:;" id="about">关于</a> | ||
| 61 | -</div> | ||
| 62 | - | ||
| 63 | -<script> | ||
| 64 | -;!function(){ | ||
| 65 | - | ||
| 66 | -//页面一打开就执行,放入ready是为了layer所需配件(css、扩展模块)加载完毕 | ||
| 67 | -layer.ready(function(){ | ||
| 68 | - //官网欢迎页 | ||
| 69 | - layer.open({ | ||
| 70 | - type: 2, | ||
| 71 | - //skin: 'layui-layer-lan', | ||
| 72 | - title: 'layer弹层组件', | ||
| 73 | - fix: false, | ||
| 74 | - shadeClose: true, | ||
| 75 | - maxmin: true, | ||
| 76 | - area: ['1000px', '500px'], | ||
| 77 | - content: 'http://layer.layui.com/?form=local', | ||
| 78 | - end: function(){ | ||
| 79 | - layer.tips('试试相册模块?', '#photosDemo', {tips: 1}) | ||
| 80 | - } | ||
| 81 | - }); | ||
| 82 | - | ||
| 83 | - //layer.msg('欢迎使用layer'); | ||
| 84 | - | ||
| 85 | - //使用相册 | ||
| 86 | - layer.photos({ | ||
| 87 | - photos: '#photosDemo' | ||
| 88 | - }); | ||
| 89 | -}); | ||
| 90 | - | ||
| 91 | -//关于 | ||
| 92 | -$('#about').on('click', function(){ | ||
| 93 | - layer.alert(layer.v + ' - 贤心出品'); | ||
| 94 | -}); | ||
| 95 | - | ||
| 96 | -}(); | ||
| 97 | -</script> | ||
| 98 | -</body> | 1 | +<!doctype html> |
| 2 | +<html> | ||
| 3 | +<head> | ||
| 4 | +<meta charset="utf-8"> | ||
| 5 | +<title>layer-更懂你的web弹窗解决方案</title> | ||
| 6 | +<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script> | ||
| 7 | +<script src="layer/layer.js"></script> | ||
| 8 | + | ||
| 9 | +<style> | ||
| 10 | +html{background-color:#E3E3E3; font-size:14px; color:#000; font-family:'微软雅黑'} | ||
| 11 | +a,a:hover{ text-decoration:none;} | ||
| 12 | +pre{font-family:'微软雅黑'} | ||
| 13 | +.box{padding:20px; background-color:#fff; margin:50px 100px; border-radius:5px;} | ||
| 14 | +.box a{padding-right:15px;} | ||
| 15 | +#about_hide{display:none} | ||
| 16 | +.layer_text{background-color:#fff; padding:20px;} | ||
| 17 | +.layer_text p{margin-bottom: 10px; text-indent: 2em; line-height: 23px;} | ||
| 18 | +.button{display:inline-block; *display:inline; *zoom:1; line-height:30px; padding:0 20px; background-color:#56B4DC; color:#fff; font-size:14px; border-radius:3px; cursor:pointer; font-weight:normal;} | ||
| 19 | +.photos-demo img{width:200px;} | ||
| 20 | +</style> | ||
| 21 | +</head> | ||
| 22 | +<body> | ||
| 23 | +<div class="box"> | ||
| 24 | +<pre> | ||
| 25 | + @Name:layer-v<script>document.write(layer.v)</script> 弹层组件说明 | ||
| 26 | + @Author:贤心 | ||
| 27 | + @Site:<a href="http://layer.layui.com/?form=local" target="_blank">http://layer.layui.com</a> | ||
| 28 | + @Github:<a href="https://github.com/sentsin/layer" target="_blank">https://github.com/sentsin/layer</a> | ||
| 29 | + | ||
| 30 | + | ||
| 31 | +<strong>【注意事项】</strong> | ||
| 32 | +一、使用时,请把文件夹layer整个放置在您站点的任何一个目录,只需引入layer.js即可,除jQuery外,其它文件无需再引入。 | ||
| 33 | +二、如果您的js引入是通过合并处理或者您不想采用layer自动获取的绝对路径,您可以通过layer.config()来配置(详见官网API页) | ||
| 34 | +三、jQuery最低要求1.8 | ||
| 35 | +四、更多使用说明与演示,请参见layer官网。 | ||
| 36 | +五、请勿用于虚假诈骗、及违反我国法律的Web平台。这一点非常重要非常的重要! | ||
| 37 | +六、layer遵循LGPL协议,将永久性提供无偿服务。版权最终解释权:贤心。 | ||
| 38 | +</pre> | ||
| 39 | +</div> | ||
| 40 | + | ||
| 41 | +<div class="box"> | ||
| 42 | + <h2 style="padding-bottom:20px;">扩展模块:图片查看器(相册层)</h2> | ||
| 43 | + <div id="photosDemo" class="photos-demo"> | ||
| 44 | + <!-- layer-src表示大图 layer-pid表示图片id src表示缩略图--> | ||
| 45 | + | ||
| 46 | + <img layer-src="http://static.oschina.net/uploads/space/2014/0516/012728_nAh8_1168184.jpg" layer-pid="" src="http://static.oschina.net/uploads/space/2014/0516/012728_nAh8_1168184.jpg" alt="layer宣传图"> | ||
| 47 | + <img layer-src="http://sentsin.qiniudn.com/sentsinmy5.jpg" layer-pid="" src="http://sentsin.qiniudn.com/sentsinmy5.jpg" alt="我入互联网这五年"> | ||
| 48 | + <img layer-src="" layer-pid="" src="http://sentsin.qiniudn.com/sentsin_39101a660cf4671b7ec297a74cc652c74152104f.jpg" alt="微摄影"> | ||
| 49 | + <img layer-src="http://sentsin.qiniudn.com/sentsinsan01.jpg" layer-pid="" src="http://sentsin.qiniudn.com/sentsinsan01.jpg" alt="三清山"> | ||
| 50 | + <img layer-src="http://ww2.sinaimg.cn/mw1024/5db11ff4jw1ehcyirr6quj20q00ex42w.jpg" layer-pid="" src="http://ww2.sinaimg.cn/mw1024/5db11ff4jw1ehcyirr6quj20q00ex42w.jpg" alt="国足"> | ||
| 51 | + </div> | ||
| 52 | + | ||
| 53 | +</div> | ||
| 54 | + | ||
| 55 | + | ||
| 56 | +<div class="box" style="text-align:center"> | ||
| 57 | + <a href="http://layer.layui.com/?form=local" target="_blank">更多示例</a> | ||
| 58 | + <a href="http://layer.layui.com/api.html" target="_blank">使用文档</a> | ||
| 59 | + <a href="http://fly.layui.com" target="_blank" title="Fly">交流反馈</a> | ||
| 60 | + <a href="javascript:;" id="about">关于</a> | ||
| 61 | +</div> | ||
| 62 | + | ||
| 63 | +<script> | ||
| 64 | +;!function(){ | ||
| 65 | + | ||
| 66 | +//页面一打开就执行,放入ready是为了layer所需配件(css、扩展模块)加载完毕 | ||
| 67 | +layer.ready(function(){ | ||
| 68 | + //官网欢迎页 | ||
| 69 | + layer.open({ | ||
| 70 | + type: 2, | ||
| 71 | + //skin: 'layui-layer-lan', | ||
| 72 | + title: 'layer弹层组件', | ||
| 73 | + fix: false, | ||
| 74 | + shadeClose: true, | ||
| 75 | + maxmin: true, | ||
| 76 | + area: ['1000px', '500px'], | ||
| 77 | + content: 'http://layer.layui.com/?form=local', | ||
| 78 | + end: function(){ | ||
| 79 | + layer.tips('试试相册模块?', '#photosDemo', {tips: 1}) | ||
| 80 | + } | ||
| 81 | + }); | ||
| 82 | + | ||
| 83 | + //layer.msg('欢迎使用layer'); | ||
| 84 | + | ||
| 85 | + //使用相册 | ||
| 86 | + layer.photos({ | ||
| 87 | + photos: '#photosDemo' | ||
| 88 | + }); | ||
| 89 | +}); | ||
| 90 | + | ||
| 91 | +//关于 | ||
| 92 | +$('#about').on('click', function(){ | ||
| 93 | + layer.alert(layer.v + ' - 贤心出品'); | ||
| 94 | +}); | ||
| 95 | + | ||
| 96 | +}(); | ||
| 97 | +</script> | ||
| 98 | +</body> | ||
| 99 | </html> | 99 | </html> |
| 100 | \ No newline at end of file | 100 | \ No newline at end of file |
src/main/resources/static/assets/plugins/layer-v2.4/layer/layer.js
| 1 | -/*! layer-v2.4 弹层组件 License LGPL http://layer.layui.com/ By 贤心 */ | 1 | +/*! layer-v2.4 弹层组件 License LGPL http://layer.layui.com/ By 贤心 */ |
| 2 | ;!function(a,b){"use strict";var c,d,e={getPath:function(){var a=document.scripts,b=a[a.length-1],c=b.src;if(!b.getAttribute("merge"))return c.substring(0,c.lastIndexOf("/")+1)}(),enter:function(a){13===a.keyCode&&a.preventDefault()},config:{},end:{},btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"]},f={v:"2.4",ie6:!!a.ActiveXObject&&!a.XMLHttpRequest,index:0,path:e.getPath,config:function(a,b){var d=0;return a=a||{},f.cache=e.config=c.extend(e.config,a),f.path=e.config.path||f.path,"string"==typeof a.extend&&(a.extend=[a.extend]),f.use("skin/layer.css",a.extend&&a.extend.length>0?function g(){var c=a.extend;f.use(c[c[d]?d:d-1],d<c.length?function(){return++d,g}():b)}():b),this},use:function(a,b,d){var e=c("head")[0],a=a.replace(/\s/g,""),g=/\.css$/.test(a),h=document.createElement(g?"link":"script"),i="layui_layer_"+a.replace(/\.|\//g,"");return f.path?(g&&(h.rel="stylesheet"),h[g?"href":"src"]=/^http:\/\//.test(a)?a:f.path+a,h.id=i,c("#"+i)[0]||e.appendChild(h),function j(){(g?1989===parseInt(c("#"+i).css("width")):f[d||i])?function(){b&&b();try{g||e.removeChild(h)}catch(a){}}():setTimeout(j,100)}(),this):void 0},ready:function(a,b){var d="function"==typeof a;return d&&(b=a),f.config(c.extend(e.config,function(){return d?{}:{path:a}}()),b),this},alert:function(a,b,d){var e="function"==typeof b;return e&&(d=b),f.open(c.extend({content:a,yes:d},e?{}:b))},confirm:function(a,b,d,g){var h="function"==typeof b;return h&&(g=d,d=b),f.open(c.extend({content:a,btn:e.btn,yes:d,btn2:g},h?{}:b))},msg:function(a,d,g){var i="function"==typeof d,j=e.config.skin,k=(j?j+" "+j+"-msg":"")||"layui-layer-msg",l=h.anim.length-1;return i&&(g=d),f.open(c.extend({content:a,time:3e3,shade:!1,skin:k,title:!1,closeBtn:!1,btn:!1,end:g},i&&!e.config.skin?{skin:k+" layui-layer-hui",shift:l}:function(){return d=d||{},(-1===d.icon||d.icon===b&&!e.config.skin)&&(d.skin=k+" "+(d.skin||"layui-layer-hui")),d}()))},load:function(a,b){return f.open(c.extend({type:3,icon:a||0,shade:.01},b))},tips:function(a,b,d){return f.open(c.extend({type:4,content:[a,b],closeBtn:!1,time:3e3,shade:!1,fix:!1,maxWidth:210},d))}},g=function(a){var b=this;b.index=++f.index,b.config=c.extend({},b.config,e.config,a),b.creat()};g.pt=g.prototype;var h=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];h.anim=["layer-anim","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],g.pt.config={type:0,shade:.3,fix:!0,move:h[1],title:"信息",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,shift:0,icon:-1,scrollbar:!0,tips:2},g.pt.vessel=function(a,b){var c=this,d=c.index,f=c.config,g=f.zIndex+d,i="object"==typeof f.title,j=f.maxmin&&(1===f.type||2===f.type),k=f.title?'<div class="layui-layer-title" style="'+(i?f.title[1]:"")+'">'+(i?f.title[0]:f.title)+"</div>":"";return f.zIndex=g,b([f.shade?'<div class="layui-layer-shade" id="layui-layer-shade'+d+'" times="'+d+'" style="'+("z-index:"+(g-1)+"; background-color:"+(f.shade[1]||"#000")+"; opacity:"+(f.shade[0]||f.shade)+"; filter:alpha(opacity="+(100*f.shade[0]||100*f.shade)+");")+'"></div>':"",'<div class="'+h[0]+(" layui-layer-"+e.type[f.type])+(0!=f.type&&2!=f.type||f.shade?"":" layui-layer-border")+" "+(f.skin||"")+'" id="'+h[0]+d+'" type="'+e.type[f.type]+'" times="'+d+'" showtime="'+f.time+'" conType="'+(a?"object":"string")+'" style="z-index: '+g+"; width:"+f.area[0]+";height:"+f.area[1]+(f.fix?"":";position:absolute;")+'">'+(a&&2!=f.type?"":k)+'<div id="'+(f.id||"")+'" class="layui-layer-content'+(0==f.type&&-1!==f.icon?" layui-layer-padding":"")+(3==f.type?" layui-layer-loading"+f.icon:"")+'">'+(0==f.type&&-1!==f.icon?'<i class="layui-layer-ico layui-layer-ico'+f.icon+'"></i>':"")+(1==f.type&&a?"":f.content||"")+'</div><span class="layui-layer-setwin">'+function(){var a=j?'<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>':"";return f.closeBtn&&(a+='<a class="layui-layer-ico '+h[7]+" "+h[7]+(f.title?f.closeBtn:4==f.type?"1":"2")+'" href="javascript:;"></a>'),a}()+"</span>"+(f.btn?function(){var a="";"string"==typeof f.btn&&(f.btn=[f.btn]);for(var b=0,c=f.btn.length;c>b;b++)a+='<a class="'+h[6]+b+'">'+f.btn[b]+"</a>";return'<div class="'+h[6]+'">'+a+"</div>"}():"")+"</div>"],k),c},g.pt.creat=function(){var a=this,b=a.config,g=a.index,i=b.content,j="object"==typeof i;if(!c("#"+b.id)[0]){switch("string"==typeof b.area&&(b.area="auto"===b.area?["",""]:[b.area,""]),b.type){case 0:b.btn="btn"in b?b.btn:e.btn[0],f.closeAll("dialog");break;case 2:var i=b.content=j?b.content:[b.content||"http://layer.layui.com","auto"];b.content='<iframe scrolling="'+(b.content[1]||"auto")+'" allowtransparency="true" id="'+h[4]+g+'" name="'+h[4]+g+'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="'+b.content[0]+'"></iframe>';break;case 3:b.title=!1,b.closeBtn=!1,-1===b.icon&&0===b.icon,f.closeAll("loading");break;case 4:j||(b.content=[b.content,"body"]),b.follow=b.content[1],b.content=b.content[0]+'<i class="layui-layer-TipsG"></i>',b.title=!1,b.tips="object"==typeof b.tips?b.tips:[b.tips,!0],b.tipsMore||f.closeAll("tips")}a.vessel(j,function(d,e){c("body").append(d[0]),j?function(){2==b.type||4==b.type?function(){c("body").append(d[1])}():function(){i.parents("."+h[0])[0]||(i.show().addClass("layui-layer-wrap").wrap(d[1]),c("#"+h[0]+g).find("."+h[5]).before(e))}()}():c("body").append(d[1]),a.layero=c("#"+h[0]+g),b.scrollbar||h.html.css("overflow","hidden").attr("layer-full",g)}).auto(g),2==b.type&&f.ie6&&a.layero.find("iframe").attr("src",i[0]),c(document).off("keydown",e.enter).on("keydown",e.enter),a.layero.on("keydown",function(a){c(document).off("keydown",e.enter)}),4==b.type?a.tips():a.offset(),b.fix&&d.on("resize",function(){a.offset(),(/^\d+%$/.test(b.area[0])||/^\d+%$/.test(b.area[1]))&&a.auto(g),4==b.type&&a.tips()}),b.time<=0||setTimeout(function(){f.close(a.index)},b.time),a.move().callback(),h.anim[b.shift]&&a.layero.addClass(h.anim[b.shift])}},g.pt.auto=function(a){function b(a){a=g.find(a),a.height(i[1]-j-k-2*(0|parseFloat(a.css("padding"))))}var e=this,f=e.config,g=c("#"+h[0]+a);""===f.area[0]&&f.maxWidth>0&&(/MSIE 7/.test(navigator.userAgent)&&f.btn&&g.width(g.innerWidth()),g.outerWidth()>f.maxWidth&&g.width(f.maxWidth));var i=[g.innerWidth(),g.innerHeight()],j=g.find(h[1]).outerHeight()||0,k=g.find("."+h[6]).outerHeight()||0;switch(f.type){case 2:b("iframe");break;default:""===f.area[1]?f.fix&&i[1]>=d.height()&&(i[1]=d.height(),b("."+h[5])):b("."+h[5])}return e},g.pt.offset=function(){var a=this,b=a.config,c=a.layero,e=[c.outerWidth(),c.outerHeight()],f="object"==typeof b.offset;a.offsetTop=(d.height()-e[1])/2,a.offsetLeft=(d.width()-e[0])/2,f?(a.offsetTop=b.offset[0],a.offsetLeft=b.offset[1]||a.offsetLeft):"auto"!==b.offset&&(a.offsetTop=b.offset,"rb"===b.offset&&(a.offsetTop=d.height()-e[1],a.offsetLeft=d.width()-e[0])),b.fix||(a.offsetTop=/%$/.test(a.offsetTop)?d.height()*parseFloat(a.offsetTop)/100:parseFloat(a.offsetTop),a.offsetLeft=/%$/.test(a.offsetLeft)?d.width()*parseFloat(a.offsetLeft)/100:parseFloat(a.offsetLeft),a.offsetTop+=d.scrollTop(),a.offsetLeft+=d.scrollLeft()),c.css({top:a.offsetTop,left:a.offsetLeft})},g.pt.tips=function(){var a=this,b=a.config,e=a.layero,f=[e.outerWidth(),e.outerHeight()],g=c(b.follow);g[0]||(g=c("body"));var i={width:g.outerWidth(),height:g.outerHeight(),top:g.offset().top,left:g.offset().left},j=e.find(".layui-layer-TipsG"),k=b.tips[0];b.tips[1]||j.remove(),i.autoLeft=function(){i.left+f[0]-d.width()>0?(i.tipLeft=i.left+i.width-f[0],j.css({right:12,left:"auto"})):i.tipLeft=i.left},i.where=[function(){i.autoLeft(),i.tipTop=i.top-f[1]-10,j.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",b.tips[1])},function(){i.tipLeft=i.left+i.width+10,i.tipTop=i.top,j.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",b.tips[1])},function(){i.autoLeft(),i.tipTop=i.top+i.height+10,j.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",b.tips[1])},function(){i.tipLeft=i.left-f[0]-10,i.tipTop=i.top,j.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",b.tips[1])}],i.where[k-1](),1===k?i.top-(d.scrollTop()+f[1]+16)<0&&i.where[2]():2===k?d.width()-(i.left+i.width+f[0]+16)>0||i.where[3]():3===k?i.top-d.scrollTop()+i.height+f[1]+16-d.height()>0&&i.where[0]():4===k&&f[0]+16-i.left>0&&i.where[1](),e.find("."+h[5]).css({"background-color":b.tips[1],"padding-right":b.closeBtn?"30px":""}),e.css({left:i.tipLeft-(b.fix?d.scrollLeft():0),top:i.tipTop-(b.fix?d.scrollTop():0)})},g.pt.move=function(){var a=this,b=a.config,e={setY:0,moveLayer:function(){var a=e.layero,b=parseInt(a.css("margin-left")),c=parseInt(e.move.css("left"));0===b||(c-=b),"fixed"!==a.css("position")&&(c-=a.parent().offset().left,e.setY=0),a.css({left:c,top:parseInt(e.move.css("top"))-e.setY})}},f=a.layero.find(b.move);return b.move&&f.attr("move","ok"),f.css({cursor:b.move?"move":"auto"}),c(b.move).on("mousedown",function(a){if(a.preventDefault(),"ok"===c(this).attr("move")){e.ismove=!0,e.layero=c(this).parents("."+h[0]);var f=e.layero.offset().left,g=e.layero.offset().top,i=e.layero.outerWidth()-6,j=e.layero.outerHeight()-6;c("#layui-layer-moves")[0]||c("body").append('<div id="layui-layer-moves" class="layui-layer-moves" style="left:'+f+"px; top:"+g+"px; width:"+i+"px; height:"+j+'px; z-index:2147483584"></div>'),e.move=c("#layui-layer-moves"),b.moveType&&e.move.css({visibility:"hidden"}),e.moveX=a.pageX-e.move.position().left,e.moveY=a.pageY-e.move.position().top,"fixed"!==e.layero.css("position")||(e.setY=d.scrollTop())}}),c(document).mousemove(function(a){if(e.ismove){var c=a.pageX-e.moveX,f=a.pageY-e.moveY;if(a.preventDefault(),!b.moveOut){e.setY=d.scrollTop();var g=d.width()-e.move.outerWidth(),h=e.setY;0>c&&(c=0),c>g&&(c=g),h>f&&(f=h),f>d.height()-e.move.outerHeight()+e.setY&&(f=d.height()-e.move.outerHeight()+e.setY)}e.move.css({left:c,top:f}),b.moveType&&e.moveLayer(),c=f=g=h=null}}).mouseup(function(){try{e.ismove&&(e.moveLayer(),e.move.remove(),b.moveEnd&&b.moveEnd()),e.ismove=!1}catch(a){e.ismove=!1}}),a},g.pt.callback=function(){function a(){var a=g.cancel&&g.cancel(b.index,d);a===!1||f.close(b.index)}var b=this,d=b.layero,g=b.config;b.openLayer(),g.success&&(2==g.type?d.find("iframe").on("load",function(){g.success(d,b.index)}):g.success(d,b.index)),f.ie6&&b.IE6(d),d.find("."+h[6]).children("a").on("click",function(){var a=c(this).index();if(0===a)g.yes?g.yes(b.index,d):g.btn1?g.btn1(b.index,d):f.close(b.index);else{var e=g["btn"+(a+1)]&&g["btn"+(a+1)](b.index,d);e===!1||f.close(b.index)}}),d.find("."+h[7]).on("click",a),g.shadeClose&&c("#layui-layer-shade"+b.index).on("click",function(){f.close(b.index)}),d.find(".layui-layer-min").on("click",function(){var a=g.min&&g.min(d);a===!1||f.min(b.index,g)}),d.find(".layui-layer-max").on("click",function(){c(this).hasClass("layui-layer-maxmin")?(f.restore(b.index),g.restore&&g.restore(d)):(f.full(b.index,g),setTimeout(function(){g.full&&g.full(d)},100))}),g.end&&(e.end[b.index]=g.end)},e.reselect=function(){c.each(c("select"),function(a,b){var d=c(this);d.parents("."+h[0])[0]||1==d.attr("layer")&&c("."+h[0]).length<1&&d.removeAttr("layer").show(),d=null})},g.pt.IE6=function(a){function b(){a.css({top:f+(e.config.fix?d.scrollTop():0)})}var e=this,f=a.offset().top;b(),d.scroll(b),c("select").each(function(a,b){var d=c(this);d.parents("."+h[0])[0]||"none"===d.css("display")||d.attr({layer:"1"}).hide(),d=null})},g.pt.openLayer=function(){var a=this;f.zIndex=a.config.zIndex,f.setTop=function(a){var b=function(){f.zIndex++,a.css("z-index",f.zIndex+1)};return f.zIndex=parseInt(a[0].style.zIndex),a.on("mousedown",b),f.zIndex}},e.record=function(a){var b=[a.width(),a.height(),a.position().top,a.position().left+parseFloat(a.css("margin-left"))];a.find(".layui-layer-max").addClass("layui-layer-maxmin"),a.attr({area:b})},e.rescollbar=function(a){h.html.attr("layer-full")==a&&(h.html[0].style.removeProperty?h.html[0].style.removeProperty("overflow"):h.html[0].style.removeAttribute("overflow"),h.html.removeAttr("layer-full"))},a.layer=f,f.getChildFrame=function(a,b){return b=b||c("."+h[4]).attr("times"),c("#"+h[0]+b).find("iframe").contents().find(a)},f.getFrameIndex=function(a){return c("#"+a).parents("."+h[4]).attr("times")},f.iframeAuto=function(a){if(a){var b=f.getChildFrame("html",a).outerHeight(),d=c("#"+h[0]+a),e=d.find(h[1]).outerHeight()||0,g=d.find("."+h[6]).outerHeight()||0;d.css({height:b+e+g}),d.find("iframe").css({height:b})}},f.iframeSrc=function(a,b){c("#"+h[0]+a).find("iframe").attr("src",b)},f.style=function(a,b){var d=c("#"+h[0]+a),f=d.attr("type"),g=d.find(h[1]).outerHeight()||0,i=d.find("."+h[6]).outerHeight()||0;(f===e.type[1]||f===e.type[2])&&(d.css(b),f===e.type[2]&&d.find("iframe").css({height:parseFloat(b.height)-g-i}))},f.min=function(a,b){var d=c("#"+h[0]+a),g=d.find(h[1]).outerHeight()||0;e.record(d),f.style(a,{width:180,height:g,overflow:"hidden"}),d.find(".layui-layer-min").hide(),"page"===d.attr("type")&&d.find(h[4]).hide(),e.rescollbar(a)},f.restore=function(a){var b=c("#"+h[0]+a),d=b.attr("area").split(",");b.attr("type");f.style(a,{width:parseFloat(d[0]),height:parseFloat(d[1]),top:parseFloat(d[2]),left:parseFloat(d[3]),overflow:"visible"}),b.find(".layui-layer-max").removeClass("layui-layer-maxmin"),b.find(".layui-layer-min").show(),"page"===b.attr("type")&&b.find(h[4]).show(),e.rescollbar(a)},f.full=function(a){var b,g=c("#"+h[0]+a);e.record(g),h.html.attr("layer-full")||h.html.css("overflow","hidden").attr("layer-full",a),clearTimeout(b),b=setTimeout(function(){var b="fixed"===g.css("position");f.style(a,{top:b?0:d.scrollTop(),left:b?0:d.scrollLeft(),width:d.width(),height:d.height()}),g.find(".layui-layer-min").hide()},100)},f.title=function(a,b){var d=c("#"+h[0]+(b||f.index)).find(h[1]);d.html(a)},f.close=function(a){var b=c("#"+h[0]+a),d=b.attr("type");if(b[0]){if(d===e.type[1]&&"object"===b.attr("conType")){b.children(":not(."+h[5]+")").remove();for(var g=0;2>g;g++)b.find(".layui-layer-wrap").unwrap().hide()}else{if(d===e.type[2])try{var i=c("#"+h[4]+a)[0];i.contentWindow.document.write(""),i.contentWindow.close(),b.find("."+h[5])[0].removeChild(i)}catch(j){}b[0].innerHTML="",b.remove()}c("#layui-layer-moves, #layui-layer-shade"+a).remove(),f.ie6&&e.reselect(),e.rescollbar(a),c(document).off("keydown",e.enter),"function"==typeof e.end[a]&&e.end[a](),delete e.end[a]}},f.closeAll=function(a){c.each(c("."+h[0]),function(){var b=c(this),d=a?b.attr("type")===a:1;d&&f.close(b.attr("times")),d=null})};var i=f.cache||{},j=function(a){return i.skin?" "+i.skin+" "+i.skin+"-"+a:""};f.prompt=function(a,b){a=a||{},"function"==typeof a&&(b=a);var d,e=2==a.formType?'<textarea class="layui-layer-input">'+(a.value||"")+"</textarea>":function(){return'<input type="'+(1==a.formType?"password":"text")+'" class="layui-layer-input" value="'+(a.value||"")+'">'}();return f.open(c.extend({btn:["确定","取消"],content:e,skin:"layui-layer-prompt"+j("prompt"),success:function(a){d=a.find(".layui-layer-input"),d.focus()},yes:function(c){var e=d.val();""===e?d.focus():e.length>(a.maxlength||500)?f.tips("最多输入"+(a.maxlength||500)+"个字数",d,{tips:1}):b&&b(e,c,d)}},a))},f.tab=function(a){a=a||{};var b=a.tab||{};return f.open(c.extend({type:1,skin:"layui-layer-tab"+j("tab"),title:function(){var a=b.length,c=1,d="";if(a>0)for(d='<span class="layui-layer-tabnow">'+b[0].title+"</span>";a>c;c++)d+="<span>"+b[c].title+"</span>";return d}(),content:'<ul class="layui-layer-tabmain">'+function(){var a=b.length,c=1,d="";if(a>0)for(d='<li class="layui-layer-tabli xubox_tab_layer">'+(b[0].content||"no content")+"</li>";a>c;c++)d+='<li class="layui-layer-tabli">'+(b[c].content||"no content")+"</li>";return d}()+"</ul>",success:function(b){var d=b.find(".layui-layer-title").children(),e=b.find(".layui-layer-tabmain").children();d.on("mousedown",function(b){b.stopPropagation?b.stopPropagation():b.cancelBubble=!0;var d=c(this),f=d.index();d.addClass("layui-layer-tabnow").siblings().removeClass("layui-layer-tabnow"),e.eq(f).show().siblings().hide(),"function"==typeof a.change&&a.change(f)})}},a))},f.photos=function(b,d,e){function g(a,b,c){var d=new Image;return d.src=a,d.complete?b(d):(d.onload=function(){d.onload=null,b(d)},void(d.onerror=function(a){d.onerror=null,c(a)}))}var h={};if(b=b||{},b.photos){var i=b.photos.constructor===Object,k=i?b.photos:{},l=k.data||[],m=k.start||0;if(h.imgIndex=(0|m)+1,b.img=b.img||"img",i){if(0===l.length)return f.msg("没有图片")}else{var n=c(b.photos),o=function(){l=[],n.find(b.img).each(function(a){var b=c(this);b.attr("layer-index",a),l.push({alt:b.attr("alt"),pid:b.attr("layer-pid"),src:b.attr("layer-src")||b.attr("src"),thumb:b.attr("src")})})};if(o(),0===l.length)return;if(d||n.on("click",b.img,function(){var a=c(this),d=a.attr("layer-index");f.photos(c.extend(b,{photos:{start:d,data:l,tab:b.tab},full:b.full}),!0),o()}),!d)return}h.imgprev=function(a){h.imgIndex--,h.imgIndex<1&&(h.imgIndex=l.length),h.tabimg(a)},h.imgnext=function(a,b){h.imgIndex++,h.imgIndex>l.length&&(h.imgIndex=1,b)||h.tabimg(a)},h.keyup=function(a){if(!h.end){var b=a.keyCode;a.preventDefault(),37===b?h.imgprev(!0):39===b?h.imgnext(!0):27===b&&f.close(h.index)}},h.tabimg=function(a){l.length<=1||(k.start=h.imgIndex-1,f.close(h.index),f.photos(b,!0,a))},h.event=function(){h.bigimg.hover(function(){h.imgsee.show()},function(){h.imgsee.hide()}),h.bigimg.find(".layui-layer-imgprev").on("click",function(a){a.preventDefault(),h.imgprev()}),h.bigimg.find(".layui-layer-imgnext").on("click",function(a){a.preventDefault(),h.imgnext()}),c(document).on("keyup",h.keyup)},h.loadi=f.load(1,{shade:"shade"in b?!1:.9,scrollbar:!1}),g(l[m].src,function(d){f.close(h.loadi),h.index=f.open(c.extend({type:1,area:function(){var e=[d.width,d.height],f=[c(a).width()-50,c(a).height()-50];return!b.full&&e[0]>f[0]&&(e[0]=f[0],e[1]=e[0]*d.height/d.width),[e[0]+"px",e[1]+"px"]}(),title:!1,shade:.9,shadeClose:!0,closeBtn:!1,move:".layui-layer-phimg img",moveType:1,scrollbar:!1,moveOut:!0,shift:5*Math.random()|0,skin:"layui-layer-photos"+j("photos"),content:'<div class="layui-layer-phimg"><img src="'+l[m].src+'" alt="'+(l[m].alt||"")+'" layer-pid="'+l[m].pid+'"><div class="layui-layer-imgsee">'+(l.length>1?'<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>':"")+'<div class="layui-layer-imgbar" style="display:'+(e?"block":"")+'"><span class="layui-layer-imgtit"><a href="javascript:;">'+(l[m].alt||"")+"</a><em>"+h.imgIndex+"/"+l.length+"</em></span></div></div></div>",success:function(a,c){h.bigimg=a.find(".layui-layer-phimg"),h.imgsee=a.find(".layui-layer-imguide,.layui-layer-imgbar"),h.event(a),b.tab&&b.tab(l[m],a)},end:function(){h.end=!0,c(document).off("keyup",h.keyup)}},b))},function(){f.close(h.loadi),f.msg("当前图片地址异常<br>是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){l.length>1&&h.imgnext(!0,!0)}})})}},e.run=function(){c=jQuery,d=c(a),h.html=c("html"),f.open=function(a){var b=new g(a);return b.index}},"function"==typeof define?define(function(){return e.run(),f}):function(){e.run(),f.use("skin/layer.css")}()}(window); | 2 | ;!function(a,b){"use strict";var c,d,e={getPath:function(){var a=document.scripts,b=a[a.length-1],c=b.src;if(!b.getAttribute("merge"))return c.substring(0,c.lastIndexOf("/")+1)}(),enter:function(a){13===a.keyCode&&a.preventDefault()},config:{},end:{},btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"]},f={v:"2.4",ie6:!!a.ActiveXObject&&!a.XMLHttpRequest,index:0,path:e.getPath,config:function(a,b){var d=0;return a=a||{},f.cache=e.config=c.extend(e.config,a),f.path=e.config.path||f.path,"string"==typeof a.extend&&(a.extend=[a.extend]),f.use("skin/layer.css",a.extend&&a.extend.length>0?function g(){var c=a.extend;f.use(c[c[d]?d:d-1],d<c.length?function(){return++d,g}():b)}():b),this},use:function(a,b,d){var e=c("head")[0],a=a.replace(/\s/g,""),g=/\.css$/.test(a),h=document.createElement(g?"link":"script"),i="layui_layer_"+a.replace(/\.|\//g,"");return f.path?(g&&(h.rel="stylesheet"),h[g?"href":"src"]=/^http:\/\//.test(a)?a:f.path+a,h.id=i,c("#"+i)[0]||e.appendChild(h),function j(){(g?1989===parseInt(c("#"+i).css("width")):f[d||i])?function(){b&&b();try{g||e.removeChild(h)}catch(a){}}():setTimeout(j,100)}(),this):void 0},ready:function(a,b){var d="function"==typeof a;return d&&(b=a),f.config(c.extend(e.config,function(){return d?{}:{path:a}}()),b),this},alert:function(a,b,d){var e="function"==typeof b;return e&&(d=b),f.open(c.extend({content:a,yes:d},e?{}:b))},confirm:function(a,b,d,g){var h="function"==typeof b;return h&&(g=d,d=b),f.open(c.extend({content:a,btn:e.btn,yes:d,btn2:g},h?{}:b))},msg:function(a,d,g){var i="function"==typeof d,j=e.config.skin,k=(j?j+" "+j+"-msg":"")||"layui-layer-msg",l=h.anim.length-1;return i&&(g=d),f.open(c.extend({content:a,time:3e3,shade:!1,skin:k,title:!1,closeBtn:!1,btn:!1,end:g},i&&!e.config.skin?{skin:k+" layui-layer-hui",shift:l}:function(){return d=d||{},(-1===d.icon||d.icon===b&&!e.config.skin)&&(d.skin=k+" "+(d.skin||"layui-layer-hui")),d}()))},load:function(a,b){return f.open(c.extend({type:3,icon:a||0,shade:.01},b))},tips:function(a,b,d){return f.open(c.extend({type:4,content:[a,b],closeBtn:!1,time:3e3,shade:!1,fix:!1,maxWidth:210},d))}},g=function(a){var b=this;b.index=++f.index,b.config=c.extend({},b.config,e.config,a),b.creat()};g.pt=g.prototype;var h=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];h.anim=["layer-anim","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],g.pt.config={type:0,shade:.3,fix:!0,move:h[1],title:"信息",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,shift:0,icon:-1,scrollbar:!0,tips:2},g.pt.vessel=function(a,b){var c=this,d=c.index,f=c.config,g=f.zIndex+d,i="object"==typeof f.title,j=f.maxmin&&(1===f.type||2===f.type),k=f.title?'<div class="layui-layer-title" style="'+(i?f.title[1]:"")+'">'+(i?f.title[0]:f.title)+"</div>":"";return f.zIndex=g,b([f.shade?'<div class="layui-layer-shade" id="layui-layer-shade'+d+'" times="'+d+'" style="'+("z-index:"+(g-1)+"; background-color:"+(f.shade[1]||"#000")+"; opacity:"+(f.shade[0]||f.shade)+"; filter:alpha(opacity="+(100*f.shade[0]||100*f.shade)+");")+'"></div>':"",'<div class="'+h[0]+(" layui-layer-"+e.type[f.type])+(0!=f.type&&2!=f.type||f.shade?"":" layui-layer-border")+" "+(f.skin||"")+'" id="'+h[0]+d+'" type="'+e.type[f.type]+'" times="'+d+'" showtime="'+f.time+'" conType="'+(a?"object":"string")+'" style="z-index: '+g+"; width:"+f.area[0]+";height:"+f.area[1]+(f.fix?"":";position:absolute;")+'">'+(a&&2!=f.type?"":k)+'<div id="'+(f.id||"")+'" class="layui-layer-content'+(0==f.type&&-1!==f.icon?" layui-layer-padding":"")+(3==f.type?" layui-layer-loading"+f.icon:"")+'">'+(0==f.type&&-1!==f.icon?'<i class="layui-layer-ico layui-layer-ico'+f.icon+'"></i>':"")+(1==f.type&&a?"":f.content||"")+'</div><span class="layui-layer-setwin">'+function(){var a=j?'<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>':"";return f.closeBtn&&(a+='<a class="layui-layer-ico '+h[7]+" "+h[7]+(f.title?f.closeBtn:4==f.type?"1":"2")+'" href="javascript:;"></a>'),a}()+"</span>"+(f.btn?function(){var a="";"string"==typeof f.btn&&(f.btn=[f.btn]);for(var b=0,c=f.btn.length;c>b;b++)a+='<a class="'+h[6]+b+'">'+f.btn[b]+"</a>";return'<div class="'+h[6]+'">'+a+"</div>"}():"")+"</div>"],k),c},g.pt.creat=function(){var a=this,b=a.config,g=a.index,i=b.content,j="object"==typeof i;if(!c("#"+b.id)[0]){switch("string"==typeof b.area&&(b.area="auto"===b.area?["",""]:[b.area,""]),b.type){case 0:b.btn="btn"in b?b.btn:e.btn[0],f.closeAll("dialog");break;case 2:var i=b.content=j?b.content:[b.content||"http://layer.layui.com","auto"];b.content='<iframe scrolling="'+(b.content[1]||"auto")+'" allowtransparency="true" id="'+h[4]+g+'" name="'+h[4]+g+'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="'+b.content[0]+'"></iframe>';break;case 3:b.title=!1,b.closeBtn=!1,-1===b.icon&&0===b.icon,f.closeAll("loading");break;case 4:j||(b.content=[b.content,"body"]),b.follow=b.content[1],b.content=b.content[0]+'<i class="layui-layer-TipsG"></i>',b.title=!1,b.tips="object"==typeof b.tips?b.tips:[b.tips,!0],b.tipsMore||f.closeAll("tips")}a.vessel(j,function(d,e){c("body").append(d[0]),j?function(){2==b.type||4==b.type?function(){c("body").append(d[1])}():function(){i.parents("."+h[0])[0]||(i.show().addClass("layui-layer-wrap").wrap(d[1]),c("#"+h[0]+g).find("."+h[5]).before(e))}()}():c("body").append(d[1]),a.layero=c("#"+h[0]+g),b.scrollbar||h.html.css("overflow","hidden").attr("layer-full",g)}).auto(g),2==b.type&&f.ie6&&a.layero.find("iframe").attr("src",i[0]),c(document).off("keydown",e.enter).on("keydown",e.enter),a.layero.on("keydown",function(a){c(document).off("keydown",e.enter)}),4==b.type?a.tips():a.offset(),b.fix&&d.on("resize",function(){a.offset(),(/^\d+%$/.test(b.area[0])||/^\d+%$/.test(b.area[1]))&&a.auto(g),4==b.type&&a.tips()}),b.time<=0||setTimeout(function(){f.close(a.index)},b.time),a.move().callback(),h.anim[b.shift]&&a.layero.addClass(h.anim[b.shift])}},g.pt.auto=function(a){function b(a){a=g.find(a),a.height(i[1]-j-k-2*(0|parseFloat(a.css("padding"))))}var e=this,f=e.config,g=c("#"+h[0]+a);""===f.area[0]&&f.maxWidth>0&&(/MSIE 7/.test(navigator.userAgent)&&f.btn&&g.width(g.innerWidth()),g.outerWidth()>f.maxWidth&&g.width(f.maxWidth));var i=[g.innerWidth(),g.innerHeight()],j=g.find(h[1]).outerHeight()||0,k=g.find("."+h[6]).outerHeight()||0;switch(f.type){case 2:b("iframe");break;default:""===f.area[1]?f.fix&&i[1]>=d.height()&&(i[1]=d.height(),b("."+h[5])):b("."+h[5])}return e},g.pt.offset=function(){var a=this,b=a.config,c=a.layero,e=[c.outerWidth(),c.outerHeight()],f="object"==typeof b.offset;a.offsetTop=(d.height()-e[1])/2,a.offsetLeft=(d.width()-e[0])/2,f?(a.offsetTop=b.offset[0],a.offsetLeft=b.offset[1]||a.offsetLeft):"auto"!==b.offset&&(a.offsetTop=b.offset,"rb"===b.offset&&(a.offsetTop=d.height()-e[1],a.offsetLeft=d.width()-e[0])),b.fix||(a.offsetTop=/%$/.test(a.offsetTop)?d.height()*parseFloat(a.offsetTop)/100:parseFloat(a.offsetTop),a.offsetLeft=/%$/.test(a.offsetLeft)?d.width()*parseFloat(a.offsetLeft)/100:parseFloat(a.offsetLeft),a.offsetTop+=d.scrollTop(),a.offsetLeft+=d.scrollLeft()),c.css({top:a.offsetTop,left:a.offsetLeft})},g.pt.tips=function(){var a=this,b=a.config,e=a.layero,f=[e.outerWidth(),e.outerHeight()],g=c(b.follow);g[0]||(g=c("body"));var i={width:g.outerWidth(),height:g.outerHeight(),top:g.offset().top,left:g.offset().left},j=e.find(".layui-layer-TipsG"),k=b.tips[0];b.tips[1]||j.remove(),i.autoLeft=function(){i.left+f[0]-d.width()>0?(i.tipLeft=i.left+i.width-f[0],j.css({right:12,left:"auto"})):i.tipLeft=i.left},i.where=[function(){i.autoLeft(),i.tipTop=i.top-f[1]-10,j.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",b.tips[1])},function(){i.tipLeft=i.left+i.width+10,i.tipTop=i.top,j.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",b.tips[1])},function(){i.autoLeft(),i.tipTop=i.top+i.height+10,j.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",b.tips[1])},function(){i.tipLeft=i.left-f[0]-10,i.tipTop=i.top,j.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",b.tips[1])}],i.where[k-1](),1===k?i.top-(d.scrollTop()+f[1]+16)<0&&i.where[2]():2===k?d.width()-(i.left+i.width+f[0]+16)>0||i.where[3]():3===k?i.top-d.scrollTop()+i.height+f[1]+16-d.height()>0&&i.where[0]():4===k&&f[0]+16-i.left>0&&i.where[1](),e.find("."+h[5]).css({"background-color":b.tips[1],"padding-right":b.closeBtn?"30px":""}),e.css({left:i.tipLeft-(b.fix?d.scrollLeft():0),top:i.tipTop-(b.fix?d.scrollTop():0)})},g.pt.move=function(){var a=this,b=a.config,e={setY:0,moveLayer:function(){var a=e.layero,b=parseInt(a.css("margin-left")),c=parseInt(e.move.css("left"));0===b||(c-=b),"fixed"!==a.css("position")&&(c-=a.parent().offset().left,e.setY=0),a.css({left:c,top:parseInt(e.move.css("top"))-e.setY})}},f=a.layero.find(b.move);return b.move&&f.attr("move","ok"),f.css({cursor:b.move?"move":"auto"}),c(b.move).on("mousedown",function(a){if(a.preventDefault(),"ok"===c(this).attr("move")){e.ismove=!0,e.layero=c(this).parents("."+h[0]);var f=e.layero.offset().left,g=e.layero.offset().top,i=e.layero.outerWidth()-6,j=e.layero.outerHeight()-6;c("#layui-layer-moves")[0]||c("body").append('<div id="layui-layer-moves" class="layui-layer-moves" style="left:'+f+"px; top:"+g+"px; width:"+i+"px; height:"+j+'px; z-index:2147483584"></div>'),e.move=c("#layui-layer-moves"),b.moveType&&e.move.css({visibility:"hidden"}),e.moveX=a.pageX-e.move.position().left,e.moveY=a.pageY-e.move.position().top,"fixed"!==e.layero.css("position")||(e.setY=d.scrollTop())}}),c(document).mousemove(function(a){if(e.ismove){var c=a.pageX-e.moveX,f=a.pageY-e.moveY;if(a.preventDefault(),!b.moveOut){e.setY=d.scrollTop();var g=d.width()-e.move.outerWidth(),h=e.setY;0>c&&(c=0),c>g&&(c=g),h>f&&(f=h),f>d.height()-e.move.outerHeight()+e.setY&&(f=d.height()-e.move.outerHeight()+e.setY)}e.move.css({left:c,top:f}),b.moveType&&e.moveLayer(),c=f=g=h=null}}).mouseup(function(){try{e.ismove&&(e.moveLayer(),e.move.remove(),b.moveEnd&&b.moveEnd()),e.ismove=!1}catch(a){e.ismove=!1}}),a},g.pt.callback=function(){function a(){var a=g.cancel&&g.cancel(b.index,d);a===!1||f.close(b.index)}var b=this,d=b.layero,g=b.config;b.openLayer(),g.success&&(2==g.type?d.find("iframe").on("load",function(){g.success(d,b.index)}):g.success(d,b.index)),f.ie6&&b.IE6(d),d.find("."+h[6]).children("a").on("click",function(){var a=c(this).index();if(0===a)g.yes?g.yes(b.index,d):g.btn1?g.btn1(b.index,d):f.close(b.index);else{var e=g["btn"+(a+1)]&&g["btn"+(a+1)](b.index,d);e===!1||f.close(b.index)}}),d.find("."+h[7]).on("click",a),g.shadeClose&&c("#layui-layer-shade"+b.index).on("click",function(){f.close(b.index)}),d.find(".layui-layer-min").on("click",function(){var a=g.min&&g.min(d);a===!1||f.min(b.index,g)}),d.find(".layui-layer-max").on("click",function(){c(this).hasClass("layui-layer-maxmin")?(f.restore(b.index),g.restore&&g.restore(d)):(f.full(b.index,g),setTimeout(function(){g.full&&g.full(d)},100))}),g.end&&(e.end[b.index]=g.end)},e.reselect=function(){c.each(c("select"),function(a,b){var d=c(this);d.parents("."+h[0])[0]||1==d.attr("layer")&&c("."+h[0]).length<1&&d.removeAttr("layer").show(),d=null})},g.pt.IE6=function(a){function b(){a.css({top:f+(e.config.fix?d.scrollTop():0)})}var e=this,f=a.offset().top;b(),d.scroll(b),c("select").each(function(a,b){var d=c(this);d.parents("."+h[0])[0]||"none"===d.css("display")||d.attr({layer:"1"}).hide(),d=null})},g.pt.openLayer=function(){var a=this;f.zIndex=a.config.zIndex,f.setTop=function(a){var b=function(){f.zIndex++,a.css("z-index",f.zIndex+1)};return f.zIndex=parseInt(a[0].style.zIndex),a.on("mousedown",b),f.zIndex}},e.record=function(a){var b=[a.width(),a.height(),a.position().top,a.position().left+parseFloat(a.css("margin-left"))];a.find(".layui-layer-max").addClass("layui-layer-maxmin"),a.attr({area:b})},e.rescollbar=function(a){h.html.attr("layer-full")==a&&(h.html[0].style.removeProperty?h.html[0].style.removeProperty("overflow"):h.html[0].style.removeAttribute("overflow"),h.html.removeAttr("layer-full"))},a.layer=f,f.getChildFrame=function(a,b){return b=b||c("."+h[4]).attr("times"),c("#"+h[0]+b).find("iframe").contents().find(a)},f.getFrameIndex=function(a){return c("#"+a).parents("."+h[4]).attr("times")},f.iframeAuto=function(a){if(a){var b=f.getChildFrame("html",a).outerHeight(),d=c("#"+h[0]+a),e=d.find(h[1]).outerHeight()||0,g=d.find("."+h[6]).outerHeight()||0;d.css({height:b+e+g}),d.find("iframe").css({height:b})}},f.iframeSrc=function(a,b){c("#"+h[0]+a).find("iframe").attr("src",b)},f.style=function(a,b){var d=c("#"+h[0]+a),f=d.attr("type"),g=d.find(h[1]).outerHeight()||0,i=d.find("."+h[6]).outerHeight()||0;(f===e.type[1]||f===e.type[2])&&(d.css(b),f===e.type[2]&&d.find("iframe").css({height:parseFloat(b.height)-g-i}))},f.min=function(a,b){var d=c("#"+h[0]+a),g=d.find(h[1]).outerHeight()||0;e.record(d),f.style(a,{width:180,height:g,overflow:"hidden"}),d.find(".layui-layer-min").hide(),"page"===d.attr("type")&&d.find(h[4]).hide(),e.rescollbar(a)},f.restore=function(a){var b=c("#"+h[0]+a),d=b.attr("area").split(",");b.attr("type");f.style(a,{width:parseFloat(d[0]),height:parseFloat(d[1]),top:parseFloat(d[2]),left:parseFloat(d[3]),overflow:"visible"}),b.find(".layui-layer-max").removeClass("layui-layer-maxmin"),b.find(".layui-layer-min").show(),"page"===b.attr("type")&&b.find(h[4]).show(),e.rescollbar(a)},f.full=function(a){var b,g=c("#"+h[0]+a);e.record(g),h.html.attr("layer-full")||h.html.css("overflow","hidden").attr("layer-full",a),clearTimeout(b),b=setTimeout(function(){var b="fixed"===g.css("position");f.style(a,{top:b?0:d.scrollTop(),left:b?0:d.scrollLeft(),width:d.width(),height:d.height()}),g.find(".layui-layer-min").hide()},100)},f.title=function(a,b){var d=c("#"+h[0]+(b||f.index)).find(h[1]);d.html(a)},f.close=function(a){var b=c("#"+h[0]+a),d=b.attr("type");if(b[0]){if(d===e.type[1]&&"object"===b.attr("conType")){b.children(":not(."+h[5]+")").remove();for(var g=0;2>g;g++)b.find(".layui-layer-wrap").unwrap().hide()}else{if(d===e.type[2])try{var i=c("#"+h[4]+a)[0];i.contentWindow.document.write(""),i.contentWindow.close(),b.find("."+h[5])[0].removeChild(i)}catch(j){}b[0].innerHTML="",b.remove()}c("#layui-layer-moves, #layui-layer-shade"+a).remove(),f.ie6&&e.reselect(),e.rescollbar(a),c(document).off("keydown",e.enter),"function"==typeof e.end[a]&&e.end[a](),delete e.end[a]}},f.closeAll=function(a){c.each(c("."+h[0]),function(){var b=c(this),d=a?b.attr("type")===a:1;d&&f.close(b.attr("times")),d=null})};var i=f.cache||{},j=function(a){return i.skin?" "+i.skin+" "+i.skin+"-"+a:""};f.prompt=function(a,b){a=a||{},"function"==typeof a&&(b=a);var d,e=2==a.formType?'<textarea class="layui-layer-input">'+(a.value||"")+"</textarea>":function(){return'<input type="'+(1==a.formType?"password":"text")+'" class="layui-layer-input" value="'+(a.value||"")+'">'}();return f.open(c.extend({btn:["确定","取消"],content:e,skin:"layui-layer-prompt"+j("prompt"),success:function(a){d=a.find(".layui-layer-input"),d.focus()},yes:function(c){var e=d.val();""===e?d.focus():e.length>(a.maxlength||500)?f.tips("最多输入"+(a.maxlength||500)+"个字数",d,{tips:1}):b&&b(e,c,d)}},a))},f.tab=function(a){a=a||{};var b=a.tab||{};return f.open(c.extend({type:1,skin:"layui-layer-tab"+j("tab"),title:function(){var a=b.length,c=1,d="";if(a>0)for(d='<span class="layui-layer-tabnow">'+b[0].title+"</span>";a>c;c++)d+="<span>"+b[c].title+"</span>";return d}(),content:'<ul class="layui-layer-tabmain">'+function(){var a=b.length,c=1,d="";if(a>0)for(d='<li class="layui-layer-tabli xubox_tab_layer">'+(b[0].content||"no content")+"</li>";a>c;c++)d+='<li class="layui-layer-tabli">'+(b[c].content||"no content")+"</li>";return d}()+"</ul>",success:function(b){var d=b.find(".layui-layer-title").children(),e=b.find(".layui-layer-tabmain").children();d.on("mousedown",function(b){b.stopPropagation?b.stopPropagation():b.cancelBubble=!0;var d=c(this),f=d.index();d.addClass("layui-layer-tabnow").siblings().removeClass("layui-layer-tabnow"),e.eq(f).show().siblings().hide(),"function"==typeof a.change&&a.change(f)})}},a))},f.photos=function(b,d,e){function g(a,b,c){var d=new Image;return d.src=a,d.complete?b(d):(d.onload=function(){d.onload=null,b(d)},void(d.onerror=function(a){d.onerror=null,c(a)}))}var h={};if(b=b||{},b.photos){var i=b.photos.constructor===Object,k=i?b.photos:{},l=k.data||[],m=k.start||0;if(h.imgIndex=(0|m)+1,b.img=b.img||"img",i){if(0===l.length)return f.msg("没有图片")}else{var n=c(b.photos),o=function(){l=[],n.find(b.img).each(function(a){var b=c(this);b.attr("layer-index",a),l.push({alt:b.attr("alt"),pid:b.attr("layer-pid"),src:b.attr("layer-src")||b.attr("src"),thumb:b.attr("src")})})};if(o(),0===l.length)return;if(d||n.on("click",b.img,function(){var a=c(this),d=a.attr("layer-index");f.photos(c.extend(b,{photos:{start:d,data:l,tab:b.tab},full:b.full}),!0),o()}),!d)return}h.imgprev=function(a){h.imgIndex--,h.imgIndex<1&&(h.imgIndex=l.length),h.tabimg(a)},h.imgnext=function(a,b){h.imgIndex++,h.imgIndex>l.length&&(h.imgIndex=1,b)||h.tabimg(a)},h.keyup=function(a){if(!h.end){var b=a.keyCode;a.preventDefault(),37===b?h.imgprev(!0):39===b?h.imgnext(!0):27===b&&f.close(h.index)}},h.tabimg=function(a){l.length<=1||(k.start=h.imgIndex-1,f.close(h.index),f.photos(b,!0,a))},h.event=function(){h.bigimg.hover(function(){h.imgsee.show()},function(){h.imgsee.hide()}),h.bigimg.find(".layui-layer-imgprev").on("click",function(a){a.preventDefault(),h.imgprev()}),h.bigimg.find(".layui-layer-imgnext").on("click",function(a){a.preventDefault(),h.imgnext()}),c(document).on("keyup",h.keyup)},h.loadi=f.load(1,{shade:"shade"in b?!1:.9,scrollbar:!1}),g(l[m].src,function(d){f.close(h.loadi),h.index=f.open(c.extend({type:1,area:function(){var e=[d.width,d.height],f=[c(a).width()-50,c(a).height()-50];return!b.full&&e[0]>f[0]&&(e[0]=f[0],e[1]=e[0]*d.height/d.width),[e[0]+"px",e[1]+"px"]}(),title:!1,shade:.9,shadeClose:!0,closeBtn:!1,move:".layui-layer-phimg img",moveType:1,scrollbar:!1,moveOut:!0,shift:5*Math.random()|0,skin:"layui-layer-photos"+j("photos"),content:'<div class="layui-layer-phimg"><img src="'+l[m].src+'" alt="'+(l[m].alt||"")+'" layer-pid="'+l[m].pid+'"><div class="layui-layer-imgsee">'+(l.length>1?'<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>':"")+'<div class="layui-layer-imgbar" style="display:'+(e?"block":"")+'"><span class="layui-layer-imgtit"><a href="javascript:;">'+(l[m].alt||"")+"</a><em>"+h.imgIndex+"/"+l.length+"</em></span></div></div></div>",success:function(a,c){h.bigimg=a.find(".layui-layer-phimg"),h.imgsee=a.find(".layui-layer-imguide,.layui-layer-imgbar"),h.event(a),b.tab&&b.tab(l[m],a)},end:function(){h.end=!0,c(document).off("keyup",h.keyup)}},b))},function(){f.close(h.loadi),f.msg("当前图片地址异常<br>是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){l.length>1&&h.imgnext(!0,!0)}})})}},e.run=function(){c=jQuery,d=c(a),h.html=c("html"),f.open=function(a){var b=new g(a);return b.index}},"function"==typeof define?define(function(){return e.run(),f}):function(){e.run(),f.use("skin/layer.css")}()}(window); |
| 3 | \ No newline at end of file | 3 | \ No newline at end of file |
src/main/resources/static/metronic_v4.5.4/plugins/select2/css/select2.min.css
| 1 | -.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle;}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none;}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px;}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none;}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap;}.select2-container .select2-search--inline{float:left;}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none;}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051;}.select2-results{display:block;}.select2-results__options{list-style:none;margin:0;padding:0;}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none;}.select2-results__option[aria-selected]{cursor:pointer;}.select2-container--open .select2-dropdown{left:0;}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0;}.select2-search--dropdown{display:block;padding:4px;}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box;}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none;}.select2-search--dropdown.select2-search--hide{display:none;}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0);}.select2-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px;}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px;}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999;}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px;}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0;}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left;}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto;}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default;}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none;}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px;}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%;}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left;}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px;}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px;}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px;}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder{float:right;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto;}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0;}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default;}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none;}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0;}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa;}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto;}.select2-container--default .select2-results__option[role=group]{padding:0;}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999;}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd;}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em;}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white;}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px;}.select2-container--classic .select2-selection--single{background-color:#f6f6f6;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #ffffff 50%, #eeeeee 100%);background-image:-o-linear-gradient(top, #ffffff 50%, #eeeeee 100%);background-image:linear-gradient(to bottom, #ffffff 50%, #eeeeee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb;}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px;}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px;}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999;}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);background-image:-o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);background-image:linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#cccccc', GradientType=0);}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0;}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left;}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto;}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb;}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none;}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px;}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #ffffff 0%, #eeeeee 50%);background-image:-o-linear-gradient(top, #ffffff 0%, #eeeeee 50%);background-image:linear-gradient(to bottom, #ffffff 0%, #eeeeee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eeeeee 50%, #ffffff 100%);background-image:-o-linear-gradient(top, #eeeeee 50%, #ffffff 100%);background-image:linear-gradient(to bottom, #eeeeee 50%, #ffffff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0;}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb;}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px;}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none;}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px;}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px;}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto;}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb;}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0;}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0;}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;}.select2-container--classic .select2-dropdown{background-color:white;border:1px solid transparent;}.select2-container--classic .select2-dropdown--above{border-bottom:none;}.select2-container--classic .select2-dropdown--below{border-top:none;}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto;}.select2-container--classic .select2-results__option[role=group]{padding:0;}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey;}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:white;}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px;}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb;} | ||
| 2 | \ No newline at end of file | 1 | \ No newline at end of file |
| 2 | +.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle;}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none;}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px;}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none;}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap;}.select2-container .select2-search--inline{float:left;}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none;}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:10510;}.select2-results{display:block;}.select2-results__options{list-style:none;margin:0;padding:0;}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none;}.select2-results__option[aria-selected]{cursor:pointer;}.select2-container--open .select2-dropdown{left:0;}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0;}.select2-search--dropdown{display:block;padding:4px;}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box;}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none;}.select2-search--dropdown.select2-search--hide{display:none;}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0);}.select2-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px;}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px;}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999;}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px;}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0;}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left;}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto;}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default;}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none;}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px;}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%;}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left;}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px;}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px;}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px;}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder{float:right;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto;}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0;}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default;}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none;}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0;}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa;}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto;}.select2-container--default .select2-results__option[role=group]{padding:0;}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999;}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd;}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em;}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white;}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px;}.select2-container--classic .select2-selection--single{background-color:#f6f6f6;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #ffffff 50%, #eeeeee 100%);background-image:-o-linear-gradient(top, #ffffff 50%, #eeeeee 100%);background-image:linear-gradient(to bottom, #ffffff 50%, #eeeeee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb;}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px;}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px;}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999;}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);background-image:-o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);background-image:linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#cccccc', GradientType=0);}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0;}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left;}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto;}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb;}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none;}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px;}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #ffffff 0%, #eeeeee 50%);background-image:-o-linear-gradient(top, #ffffff 0%, #eeeeee 50%);background-image:linear-gradient(to bottom, #ffffff 0%, #eeeeee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eeeeee 50%, #ffffff 100%);background-image:-o-linear-gradient(top, #eeeeee 50%, #ffffff 100%);background-image:linear-gradient(to bottom, #eeeeee 50%, #ffffff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0;}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb;}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px;}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none;}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px;}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px;}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto;}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb;}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0;}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0;}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;}.select2-container--classic .select2-dropdown{background-color:white;border:1px solid transparent;}.select2-container--classic .select2-dropdown--above{border-bottom:none;}.select2-container--classic .select2-dropdown--below{border-top:none;}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto;}.select2-container--classic .select2-results__option[role=group]{padding:0;}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey;}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:white;}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px;}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb;} | ||
| 3 | \ No newline at end of file | 3 | \ No newline at end of file |
src/main/resources/static/pages/forms/statement/waybill.html
| @@ -158,9 +158,11 @@ | @@ -158,9 +158,11 @@ | ||
| 158 | $(this).children().each(function(index){ | 158 | $(this).children().each(function(index){ |
| 159 | params[index] = $(this).text(); | 159 | params[index] = $(this).text(); |
| 160 | }); | 160 | }); |
| 161 | + console.log(params); | ||
| 161 | jName = params[0].split("\\")[0]; | 162 | jName = params[0].split("\\")[0]; |
| 162 | var id = $("#"+params[1]).val(); | 163 | var id = $("#"+params[1]).val(); |
| 163 | $get('/realSchedule/'+id,null,function(result){ | 164 | $get('/realSchedule/'+id,null,function(result){ |
| 165 | + console.log(result); | ||
| 164 | result.scheduleDate = moment(result.scheduleDate).format("YYYY/MM/DD"); | 166 | result.scheduleDate = moment(result.scheduleDate).format("YYYY/MM/DD"); |
| 165 | var ludan_1 = template('ludan_1',result); | 167 | var ludan_1 = template('ludan_1',result); |
| 166 | //var ludan_4 = template('ludan_4',result); | 168 | //var ludan_4 = template('ludan_4',result); |
| @@ -220,9 +222,9 @@ | @@ -220,9 +222,9 @@ | ||
| 220 | <script type="text/html" id="list_info"> | 222 | <script type="text/html" id="list_info"> |
| 221 | {{each list as obj i}} | 223 | {{each list as obj i}} |
| 222 | <tr> | 224 | <tr> |
| 223 | - <td width="45%">{{obj.jName}}\{{obj.jGh}}</td> | ||
| 224 | - <td width="32%">{{obj.clZbh}}</td> | ||
| 225 | - <td width="23%">{{obj.lpName}}<input type="hidden" id="{{obj.clZbh}}" value="{{obj.id}}"></td> | 225 | + <td width="45%">{{obj[4]}}\{{obj[1]}}</td> |
| 226 | + <td width="32%">{{obj[2]}}</td> | ||
| 227 | + <td width="23%">{{obj[3]}}<input type="hidden" id="{{obj[2]}}" value="{{obj[0]}}"></td> | ||
| 226 | </tr> | 228 | </tr> |
| 227 | {{/each}} | 229 | {{/each}} |
| 228 | {{if list.length == 0}} | 230 | {{if list.length == 0}} |
src/main/resources/static/pages/oil/cylList.html
| @@ -56,8 +56,8 @@ | @@ -56,8 +56,8 @@ | ||
| 56 | <th width="3%">#</th> | 56 | <th width="3%">#</th> |
| 57 | <th width="15%">公司</th> | 57 | <th width="15%">公司</th> |
| 58 | <th width="15%">车辆编码</th> | 58 | <th width="15%">车辆编码</th> |
| 59 | - <th width="15%">油箱容量</th> | ||
| 60 | - <th width="15%">车辆存油</th> | 59 | + <th width="15%">油箱存油</th> |
| 60 | + <th width="15%">车辆容量</th> | ||
| 61 | <th width="18%">最后更新时间</th> | 61 | <th width="18%">最后更新时间</th> |
| 62 | <th width="19%">操作</th> | 62 | <th width="19%">操作</th> |
| 63 | </tr> | 63 | </tr> |
src/main/resources/static/pages/oil/list.html
| @@ -21,8 +21,8 @@ | @@ -21,8 +21,8 @@ | ||
| 21 | </div> | 21 | </div> |
| 22 | <div class="actions"> | 22 | <div class="actions"> |
| 23 | <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加</a> | 23 | <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加</a> |
| 24 | - <button type="button" class="btn btn-circle blue" id="removeButton"><i class="fa fa-trash-o"></i> 删除</button> | ||
| 25 | - <button type="button" class="btn btn-circle blue" id="sortButton"><i class="fa fa-minus-square"></i> 拆分</button> | 24 | +<!-- <button type="button" class="btn btn-circle blue" id="removeButton"><i class="fa fa-trash-o"></i> 删除</button> --> |
| 25 | + <button type="button" class="btn btn-circle blue" id="sortButton"><i class="fa fa-minus-square"></i> 拆分/保存</button> | ||
| 26 | <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除用户</button> --> | 26 | <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除用户</button> --> |
| 27 | <div class="btn-group"> | 27 | <div class="btn-group"> |
| 28 | <a class="btn red btn-outline btn-circle" href="javascript:;" | 28 | <a class="btn red btn-outline btn-circle" href="javascript:;" |
| @@ -34,9 +34,9 @@ | @@ -34,9 +34,9 @@ | ||
| 34 | class="tool-action" id="obtain"> <i class="fa fa-hourglass-half"></i> 获取加/存油信息 | 34 | class="tool-action" id="obtain"> <i class="fa fa-hourglass-half"></i> 获取加/存油信息 |
| 35 | </a></li> | 35 | </a></li> |
| 36 | <li><a href="javascript:;" data-action="1" | 36 | <li><a href="javascript:;" data-action="1" |
| 37 | - class="tool-action"> <i class="fa fa-pencil"></i> 油耗计算(进场=出场) | 37 | + class="tool-action" id="outAndIn"> <i class="fa fa-pencil"></i> 油耗计算(进场=出场) |
| 38 | </a></li> | 38 | </a></li> |
| 39 | - <li><a href="javascript:;" data-action="3" | 39 | + <li><a href="javascript:;" id="checkYl" data-action="3" |
| 40 | class="tool-action"> <i class="fa fa-gg-circle"></i> | 40 | class="tool-action"> <i class="fa fa-gg-circle"></i> |
| 41 | 核对加注量(有加油无里程) | 41 | 核对加注量(有加油无里程) |
| 42 | </a></li> | 42 | </a></li> |
| @@ -86,7 +86,7 @@ | @@ -86,7 +86,7 @@ | ||
| 86 | 内部编码: | 86 | 内部编码: |
| 87 | </td> | 87 | </td> |
| 88 | <td colspan="3"> | 88 | <td colspan="3"> |
| 89 | - <select class="form-control" name="nbbm" id="nbbm" style="width: 120px;" ></select> | 89 | + <select class="form-control" name="nbbm_eq" id="nbbm" style="width: 120px;" ></select> |
| 90 | </td> | 90 | </td> |
| 91 | <td colspan="4"> | 91 | <td colspan="4"> |
| 92 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" > | 92 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" > |
| @@ -101,14 +101,14 @@ | @@ -101,14 +101,14 @@ | ||
| 101 | <th width="2%">#</th> | 101 | <th width="2%">#</th> |
| 102 | <th width="8%">日期</th> | 102 | <th width="8%">日期</th> |
| 103 | <th width="5%">公司</th> | 103 | <th width="5%">公司</th> |
| 104 | - <th width="5%">分公司</th> | 104 | + <th width="8%">线路</th> |
| 105 | <th width="5%">自编号</th> | 105 | <th width="5%">自编号</th> |
| 106 | <th width="6%">驾驶员</th> | 106 | <th width="6%">驾驶员</th> |
| 107 | - <th width="5%">加油量</th> | 107 | + <th width="4%">加油量</th> |
| 108 | <th width="5%">出场公里</th> | 108 | <th width="5%">出场公里</th> |
| 109 | - <th width="5%">进场公里</th> | ||
| 110 | - <th width="5%">出场存油</th> | ||
| 111 | - <th width="5%">进场存油</th> | 109 | + <th width="4%">进场公里</th> |
| 110 | + <th width="4%">出场存油</th> | ||
| 111 | + <th width="4%">进场存油</th> | ||
| 112 | <th width="5%">油耗</th> | 112 | <th width="5%">油耗</th> |
| 113 | <th width="5%">燃油类型</th> | 113 | <th width="5%">燃油类型</th> |
| 114 | <th width="4%">尿素</th> | 114 | <th width="4%">尿素</th> |
| @@ -135,17 +135,17 @@ | @@ -135,17 +135,17 @@ | ||
| 135 | {{each list as obj i}} | 135 | {{each list as obj i}} |
| 136 | <tr> | 136 | <tr> |
| 137 | <td style="vertical-align: middle;"> | 137 | <td style="vertical-align: middle;"> |
| 138 | - <input type="radio" class="group-checkable icheck" data-id="{{obj.id}}"> | 138 | + <input type="radio" name="id" class="group-checkable icheck" data-id="{{obj.id}}"> |
| 139 | </td> | 139 | </td> |
| 140 | + | ||
| 140 | <td> | 141 | <td> |
| 141 | - | ||
| 142 | {{obj.rq}} | 142 | {{obj.rq}} |
| 143 | </td> | 143 | </td> |
| 144 | <td> | 144 | <td> |
| 145 | - {{obj.ssgsdm}} | 145 | + {{obj.gsname}} |
| 146 | </td> | 146 | </td> |
| 147 | <td> | 147 | <td> |
| 148 | - {{obj.fgsdm}} | 148 | + {{obj.xlname}} |
| 149 | </td> | 149 | </td> |
| 150 | <td> | 150 | <td> |
| 151 | {{obj.nbbm}} | 151 | {{obj.nbbm}} |
| @@ -192,7 +192,7 @@ | @@ -192,7 +192,7 @@ | ||
| 192 | {{obj.yhlx}} | 192 | {{obj.yhlx}} |
| 193 | </td> | 193 | </td> |
| 194 | <td> | 194 | <td> |
| 195 | - {{(obj.yh/obj.zlc)}} | 195 | + {{obj.bglyh}} |
| 196 | </td> | 196 | </td> |
| 197 | <td> | 197 | <td> |
| 198 | <a class="btn btn-sm blue btn-outline" href="edit.html?no={{obj.id}}" data-pjax><i class="fa fa-edit"></i> 编辑</a> | 198 | <a class="btn btn-sm blue btn-outline" href="edit.html?no={{obj.id}}" data-pjax><i class="fa fa-edit"></i> 编辑</a> |
| @@ -208,11 +208,70 @@ | @@ -208,11 +208,70 @@ | ||
| 208 | 208 | ||
| 209 | <script> | 209 | <script> |
| 210 | $(function(){ | 210 | $(function(){ |
| 211 | + $("#checkYl").on('click',function(){ | ||
| 212 | + console.log("核对加注量"); | ||
| 213 | + if($("#rq").val()!=""){ | ||
| 214 | + var cells = $('tr.filter')[0].cells | ||
| 215 | + ,params = {} | ||
| 216 | + ,name; | ||
| 217 | + $.each(cells, function(i, cell){ | ||
| 218 | + var items = $('input,select', cell); | ||
| 219 | + for(var j = 0, item; item = items[j++];){ | ||
| 220 | + name = $(item).attr('name'); | ||
| 221 | + if(name){ | ||
| 222 | + params[name] = $(item).val(); | ||
| 223 | + } | ||
| 224 | + } | ||
| 225 | + }); | ||
| 226 | + $get('/ylb/checkYl', params, function(){ | ||
| 227 | + jsDoQuery(null,true); | ||
| 228 | + }); | ||
| 229 | + }else{ | ||
| 230 | + layer.msg('请选择日期.'); | ||
| 231 | + } | ||
| 232 | + }) | ||
| 233 | + | ||
| 234 | + //进场等于出场 | ||
| 235 | + $("#outAndIn").on('click',function(){ | ||
| 236 | + console.log("进场油量等于出场油量"); | ||
| 237 | + if($("#rq").val()!=""){ | ||
| 238 | + var cells = $('tr.filter')[0].cells | ||
| 239 | + ,params = {} | ||
| 240 | + ,name; | ||
| 241 | + $.each(cells, function(i, cell){ | ||
| 242 | + var items = $('input,select', cell); | ||
| 243 | + for(var j = 0, item; item = items[j++];){ | ||
| 244 | + name = $(item).attr('name'); | ||
| 245 | + if(name){ | ||
| 246 | + params[name] = $(item).val(); | ||
| 247 | + } | ||
| 248 | + } | ||
| 249 | + }); | ||
| 250 | + $get('/ylb/outAndIn', params, function(){ | ||
| 251 | + jsDoQuery(null,true); | ||
| 252 | + }); | ||
| 253 | + }else{ | ||
| 254 | + layer.msg('请选择日期.'); | ||
| 255 | + } | ||
| 256 | + }) | ||
| 211 | //拆分 | 257 | //拆分 |
| 212 | $("#sortButton").on('click',function(){ | 258 | $("#sortButton").on('click',function(){ |
| 213 | console.log("拆分油量"); | 259 | console.log("拆分油量"); |
| 214 | if($("#rq").val()!=""){ | 260 | if($("#rq").val()!=""){ |
| 215 | - | 261 | + var id = $('input.icheck:checked').data('id'); |
| 262 | + if(typeof(id)=='undefined'){ | ||
| 263 | + layer.msg("请选择一行进行拆分"); | ||
| 264 | + }else{ | ||
| 265 | + //获取输入的进场存油 | ||
| 266 | + var jzyl=$("#jzyl"+id).html(); | ||
| 267 | + var params = {}; | ||
| 268 | + params['jzyl']=jzyl; | ||
| 269 | + params['id']=id; | ||
| 270 | + $get('/ylb/sort', params, function(){ | ||
| 271 | + jsDoQuery(null,true); | ||
| 272 | + }); | ||
| 273 | + | ||
| 274 | + } | ||
| 216 | }else{ | 275 | }else{ |
| 217 | layer.msg('请选择日期.'); | 276 | layer.msg('请选择日期.'); |
| 218 | } | 277 | } |
| @@ -234,6 +293,7 @@ $(function(){ | @@ -234,6 +293,7 @@ $(function(){ | ||
| 234 | } | 293 | } |
| 235 | }); | 294 | }); |
| 236 | $get('/ylb/obtain', params, function(){ | 295 | $get('/ylb/obtain', params, function(){ |
| 296 | + console.log("----------------------"); | ||
| 237 | jsDoQuery(null,true); | 297 | jsDoQuery(null,true); |
| 238 | }); | 298 | }); |
| 239 | }else{ | 299 | }else{ |
| @@ -251,7 +311,7 @@ $(function(){ | @@ -251,7 +311,7 @@ $(function(){ | ||
| 251 | } | 311 | } |
| 252 | var page = 0, initPagination; | 312 | var page = 0, initPagination; |
| 253 | var icheckOptions = { | 313 | var icheckOptions = { |
| 254 | - checkboxClass: 'icheckbox_flat-blue', | 314 | + radioClass: 'iradio_square-blue icheck', |
| 255 | increaseArea: '20%' | 315 | increaseArea: '20%' |
| 256 | } | 316 | } |
| 257 | 317 | ||
| @@ -315,16 +375,16 @@ $(function(){ | @@ -315,16 +375,16 @@ $(function(){ | ||
| 315 | } | 375 | } |
| 316 | 376 | ||
| 317 | function iCheckChange(){ | 377 | function iCheckChange(){ |
| 318 | - var tr = $(this).parents('tr'); | 378 | + var tr = $(this).parents('tr'); |
| 319 | if(this.checked) | 379 | if(this.checked) |
| 320 | tr.addClass('row-active'); | 380 | tr.addClass('row-active'); |
| 321 | else | 381 | else |
| 322 | - tr.removeClass('row-active'); | ||
| 323 | - | ||
| 324 | - if($('#datatable_resource input.icheck:checked').length == 1) | 382 | + tr.removeClass('row-active'); |
| 383 | + | ||
| 384 | + /* if($('#datatable_resource input.icheck:checked').length == 1) | ||
| 325 | $('#removeButton').removeAttr('disabled'); | 385 | $('#removeButton').removeAttr('disabled'); |
| 326 | else | 386 | else |
| 327 | - $('#removeButton').attr('disabled', 'disabled'); | 387 | + $('#removeButton').attr('disabled', 'disabled'); */ |
| 328 | } | 388 | } |
| 329 | 389 | ||
| 330 | function showPagination(data){ | 390 | function showPagination(data){ |
| @@ -357,8 +417,7 @@ $(function(){ | @@ -357,8 +417,7 @@ $(function(){ | ||
| 357 | if($(this).attr('disabled')) | 417 | if($(this).attr('disabled')) |
| 358 | return; | 418 | return; |
| 359 | 419 | ||
| 360 | - var id = $('#datatable_resource input.icheck:checked').data('id'); | ||
| 361 | - | 420 | + var id = $('input.icheck:checked').data('id'); |
| 362 | removeConfirm('确定要删除选中的数据?', '/resource/' + id ,function(){ | 421 | removeConfirm('确定要删除选中的数据?', '/resource/' + id ,function(){ |
| 363 | $('tr.filter .filter-submit').click(); | 422 | $('tr.filter .filter-submit').click(); |
| 364 | }); | 423 | }); |
src/main/resources/static/pages/permission/resource/edit.html
| 1 | -<div class="page-head"> | ||
| 2 | - <div class="page-title"> | ||
| 3 | - <h1>编辑资源</h1> | ||
| 4 | - </div> | ||
| 5 | -</div> | ||
| 6 | - | ||
| 7 | -<ul class="page-breadcrumb breadcrumb"> | ||
| 8 | - <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> | ||
| 9 | - <li><span class="active">权限管理</span> <i class="fa fa-circle"></i></li> | ||
| 10 | - <li><a href="javascript:;" class="back" data-pjax>资源管理</a> <i class="fa fa-circle"></i></li> | ||
| 11 | - <li><span class="active">编辑资源</span></li> | ||
| 12 | -</ul> | ||
| 13 | - | ||
| 14 | -<div class="portlet light bordered"> | ||
| 15 | - <div class="portlet-title"> | ||
| 16 | - <div class="caption"> | ||
| 17 | - <i class="icon-equalizer font-red-sunglo"></i> <span | ||
| 18 | - class="caption-subject font-red-sunglo bold uppercase">表单</span> | ||
| 19 | - </div> | ||
| 20 | - </div> | ||
| 21 | - <div class="portlet-body form"> | ||
| 22 | - <form action="/resource" class="form-horizontal" id="resource_edit_form" > | ||
| 23 | - <div class="alert alert-danger display-hide"> | ||
| 24 | - <button class="close" data-close="alert"></button> | ||
| 25 | - 您的输入有误,请检查下面的输入项 | ||
| 26 | - </div> | ||
| 27 | - <div class="form-body"> | ||
| 28 | - <input type="hidden" name="id"> | ||
| 29 | - <div class="form-group"> | ||
| 30 | - <label class="col-md-3 control-label">所属模块</label> | ||
| 31 | - <div class="col-md-4"> | ||
| 32 | - <div class="input-group"> | ||
| 33 | - <select class="form-control" name="module.id" id="moduleSelect"> | ||
| 34 | - </select> | ||
| 35 | - </div> | ||
| 36 | - </div> | ||
| 37 | - </div> | ||
| 38 | - <div class="form-group"> | ||
| 39 | - <label class="col-md-3 control-label">资源名称</label> | ||
| 40 | - <div class="col-md-4"> | ||
| 41 | - <input type="text" class="form-control" name="name"> | ||
| 42 | - </div> | ||
| 43 | - </div> | ||
| 44 | - <div class="form-group"> | ||
| 45 | - <label class="col-md-3 control-label">映射地址</label> | ||
| 46 | - <div class="col-md-4"> | ||
| 47 | - <input type="text" class="form-control" name="url"> | ||
| 48 | - <span class="help-block"> 例(新增资源):/resource/add</span> | ||
| 49 | - </div> | ||
| 50 | - </div> | ||
| 51 | - <div class="form-group"> | ||
| 52 | - <label class="col-md-3 control-label">请求方式</label> | ||
| 53 | - <div class="col-md-4"> | ||
| 54 | - <div class="input-group"> | ||
| 55 | - <select class="form-control" name="method" style="width: 160px;"> | ||
| 56 | - <option value="get">get</option> | ||
| 57 | - <option value="post">post</option> | ||
| 58 | - <option value="delete">delete</option> | ||
| 59 | - </select> | ||
| 60 | - </div> | ||
| 61 | - </div> | ||
| 62 | - </div> | ||
| 63 | - <div class="form-group"> | ||
| 64 | - <label class="col-md-3 control-label">是否启用</label> | ||
| 65 | - <div class="col-md-4"> | ||
| 66 | - <div class="input-group"> | ||
| 67 | - <select class="form-control" name="enable" style="width: 160px;"> | ||
| 68 | - <option value="1">可用</option> | ||
| 69 | - <option value="0">禁用</option> | ||
| 70 | - </select> | ||
| 71 | - </div> | ||
| 72 | - </div> | ||
| 73 | - </div> | ||
| 74 | - <div class="form-group"> | ||
| 75 | - <label class="col-md-3 control-label">备注/描述</label> | ||
| 76 | - <div class="col-md-4"> | ||
| 77 | - <textarea class="form-control" rows="3" name="descriptions"></textarea> | ||
| 78 | - </div> | ||
| 79 | - </div> | ||
| 80 | - </div> | ||
| 81 | - <div class="form-actions"> | ||
| 82 | - <div class="row"> | ||
| 83 | - <div class="col-md-offset-3 col-md-4"> | ||
| 84 | - <button type="submit" class="btn green" ><i class="fa fa-check"></i> 保存</button> | ||
| 85 | - <a type="button" class="btn default back" href="javascript:;" ><i class="fa fa-times"></i> 取消</a> | ||
| 86 | - </div> | ||
| 87 | - </div> | ||
| 88 | - </div> | ||
| 89 | - </form> | ||
| 90 | - <!-- END FORM--> | ||
| 91 | - </div> | ||
| 92 | -</div> | ||
| 93 | - | ||
| 94 | -<script> | ||
| 95 | -$(function(){ | ||
| 96 | - $('a.back').on('click', function(){ | ||
| 97 | - history.back(); | ||
| 98 | - }); | ||
| 99 | - | ||
| 100 | - var id = $.url().param('no'); | ||
| 101 | - | ||
| 102 | - if(!id){ | ||
| 103 | - alert('缺少主键'); | ||
| 104 | - } | ||
| 105 | - else{ | ||
| 106 | - renderModuleSelect(function(){ | ||
| 107 | - $get('/resource/' + id ,null, function(obj){ | ||
| 108 | - putFormData(obj, '#resource_edit_form'); | ||
| 109 | - $('#moduleSelect').val(obj.module.id).change(); | ||
| 110 | - }); | ||
| 111 | - }); | ||
| 112 | - } | ||
| 113 | - | ||
| 114 | - var form = $('#resource_edit_form'); | ||
| 115 | - var error = $('.alert-danger', form); | ||
| 116 | - | ||
| 117 | - //form validate | ||
| 118 | - form.validate({ | ||
| 119 | - errorElement : 'span', | ||
| 120 | - errorClass : 'help-block help-block-error', | ||
| 121 | - focusInvalid : false, | ||
| 122 | - rules : { | ||
| 123 | - 'name' : { | ||
| 124 | - required : true | ||
| 125 | - }, | ||
| 126 | - 'url' : { | ||
| 127 | - required : true | ||
| 128 | - }, | ||
| 129 | - 'module.id': { | ||
| 130 | - required : true | ||
| 131 | - } | ||
| 132 | - }, | ||
| 133 | - invalidHandler : function(event, validator) { | ||
| 134 | - error.show(); | ||
| 135 | - App.scrollTo(error, -200); | ||
| 136 | - }, | ||
| 137 | - | ||
| 138 | - highlight : function(element) { | ||
| 139 | - $(element).closest('.form-group').addClass('has-error'); | ||
| 140 | - }, | ||
| 141 | - | ||
| 142 | - unhighlight : function(element) { | ||
| 143 | - $(element).closest('.form-group').removeClass('has-error'); | ||
| 144 | - }, | ||
| 145 | - | ||
| 146 | - success : function(label) { | ||
| 147 | - label.closest('.form-group').removeClass('has-error'); | ||
| 148 | - }, | ||
| 149 | - | ||
| 150 | - submitHandler : function(f) { | ||
| 151 | - var params = form.serializeJSON(); | ||
| 152 | - error.hide(); | ||
| 153 | - | ||
| 154 | - $post('/resource', params, function(res){ | ||
| 155 | - layer.msg('修改资源成功.'); | ||
| 156 | - }); | ||
| 157 | - } | ||
| 158 | - }); | ||
| 159 | - | ||
| 160 | - //模块下拉框 | ||
| 161 | - function renderModuleSelect(callback){ | ||
| 162 | - getModuleTreeData(function(treeData){ | ||
| 163 | - var options = '<option value="">请选择...</option>'; | ||
| 164 | - $.each(treeData, function(i, g){ | ||
| 165 | - var dArray = g.children; | ||
| 166 | - | ||
| 167 | - for(var i = 0,d; d = dArray[i++];){ | ||
| 168 | - options += '<optgroup label="'+d.name+'">'; | ||
| 169 | - if(!d.children) | ||
| 170 | - continue; | ||
| 171 | - | ||
| 172 | - $.each(d.children, function(i, m){ | ||
| 173 | - options += '<option value="'+m.id+'">'+m.name+'</option>' | ||
| 174 | - }); | ||
| 175 | - options += '</optgroup>'; | ||
| 176 | - } | ||
| 177 | - }); | ||
| 178 | - $('#moduleSelect').html(options).select2(); | ||
| 179 | - callback && callback(); | ||
| 180 | - }); | ||
| 181 | - } | ||
| 182 | - | ||
| 183 | - function getModuleTreeData(cb){ | ||
| 184 | - var treeData = []; | ||
| 185 | - $get('/module/all',null, function(arr){ | ||
| 186 | - treeData = createTreeData(arr); | ||
| 187 | - cb && cb(treeData) | ||
| 188 | - }); | ||
| 189 | - } | ||
| 190 | -}); | 1 | +<div class="page-head"> |
| 2 | + <div class="page-title"> | ||
| 3 | + <h1>编辑资源</h1> | ||
| 4 | + </div> | ||
| 5 | +</div> | ||
| 6 | + | ||
| 7 | +<ul class="page-breadcrumb breadcrumb"> | ||
| 8 | + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> | ||
| 9 | + <li><span class="active">权限管理</span> <i class="fa fa-circle"></i></li> | ||
| 10 | + <li><a href="javascript:;" class="back" data-pjax>资源管理</a> <i class="fa fa-circle"></i></li> | ||
| 11 | + <li><span class="active">编辑资源</span></li> | ||
| 12 | +</ul> | ||
| 13 | + | ||
| 14 | +<div class="portlet light bordered"> | ||
| 15 | + <div class="portlet-title"> | ||
| 16 | + <div class="caption"> | ||
| 17 | + <i class="icon-equalizer font-red-sunglo"></i> <span | ||
| 18 | + class="caption-subject font-red-sunglo bold uppercase">表单</span> | ||
| 19 | + </div> | ||
| 20 | + </div> | ||
| 21 | + <div class="portlet-body form"> | ||
| 22 | + <form action="/resource" class="form-horizontal" id="resource_edit_form" > | ||
| 23 | + <div class="alert alert-danger display-hide"> | ||
| 24 | + <button class="close" data-close="alert"></button> | ||
| 25 | + 您的输入有误,请检查下面的输入项 | ||
| 26 | + </div> | ||
| 27 | + <div class="form-body"> | ||
| 28 | + <input type="hidden" name="id"> | ||
| 29 | + <div class="form-group"> | ||
| 30 | + <label class="col-md-3 control-label">所属模块</label> | ||
| 31 | + <div class="col-md-4"> | ||
| 32 | + <div class="input-group"> | ||
| 33 | + <select class="form-control" name="module.id" id="moduleSelect"> | ||
| 34 | + </select> | ||
| 35 | + </div> | ||
| 36 | + </div> | ||
| 37 | + </div> | ||
| 38 | + <div class="form-group"> | ||
| 39 | + <label class="col-md-3 control-label">资源名称</label> | ||
| 40 | + <div class="col-md-4"> | ||
| 41 | + <input type="text" class="form-control" name="name"> | ||
| 42 | + </div> | ||
| 43 | + </div> | ||
| 44 | + <div class="form-group"> | ||
| 45 | + <label class="col-md-3 control-label">映射地址</label> | ||
| 46 | + <div class="col-md-4"> | ||
| 47 | + <input type="text" class="form-control" name="url"> | ||
| 48 | + <span class="help-block"> 例(新增资源):/resource/add</span> | ||
| 49 | + </div> | ||
| 50 | + </div> | ||
| 51 | + <div class="form-group"> | ||
| 52 | + <label class="col-md-3 control-label">请求方式</label> | ||
| 53 | + <div class="col-md-4"> | ||
| 54 | + <div class="input-group"> | ||
| 55 | + <select class="form-control" name="method" style="width: 160px;"> | ||
| 56 | + <option value="get">get</option> | ||
| 57 | + <option value="post">post</option> | ||
| 58 | + <option value="delete">delete</option> | ||
| 59 | + </select> | ||
| 60 | + </div> | ||
| 61 | + </div> | ||
| 62 | + </div> | ||
| 63 | + <div class="form-group"> | ||
| 64 | + <label class="col-md-3 control-label">是否启用</label> | ||
| 65 | + <div class="col-md-4"> | ||
| 66 | + <div class="input-group"> | ||
| 67 | + <select class="form-control" name="enable" style="width: 160px;"> | ||
| 68 | + <option value="1">可用</option> | ||
| 69 | + <option value="0">禁用</option> | ||
| 70 | + </select> | ||
| 71 | + </div> | ||
| 72 | + </div> | ||
| 73 | + </div> | ||
| 74 | + <div class="form-group"> | ||
| 75 | + <label class="col-md-3 control-label">备注/描述</label> | ||
| 76 | + <div class="col-md-4"> | ||
| 77 | + <textarea class="form-control" rows="3" name="descriptions"></textarea> | ||
| 78 | + </div> | ||
| 79 | + </div> | ||
| 80 | + </div> | ||
| 81 | + <div class="form-actions"> | ||
| 82 | + <div class="row"> | ||
| 83 | + <div class="col-md-offset-3 col-md-4"> | ||
| 84 | + <button type="submit" class="btn green" ><i class="fa fa-check"></i> 保存</button> | ||
| 85 | + <a type="button" class="btn default back" href="javascript:;" ><i class="fa fa-times"></i> 取消</a> | ||
| 86 | + </div> | ||
| 87 | + </div> | ||
| 88 | + </div> | ||
| 89 | + </form> | ||
| 90 | + <!-- END FORM--> | ||
| 91 | + </div> | ||
| 92 | +</div> | ||
| 93 | + | ||
| 94 | +<script> | ||
| 95 | +$(function(){ | ||
| 96 | + $('a.back').on('click', function(){ | ||
| 97 | + history.back(); | ||
| 98 | + }); | ||
| 99 | + | ||
| 100 | + var id = $.url().param('no'); | ||
| 101 | + | ||
| 102 | + if(!id){ | ||
| 103 | + alert('缺少主键'); | ||
| 104 | + } | ||
| 105 | + else{ | ||
| 106 | + renderModuleSelect(function(){ | ||
| 107 | + $get('/resource/' + id ,null, function(obj){ | ||
| 108 | + putFormData(obj, '#resource_edit_form'); | ||
| 109 | + $('#moduleSelect').val(obj.module.id).change(); | ||
| 110 | + }); | ||
| 111 | + }); | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + var form = $('#resource_edit_form'); | ||
| 115 | + var error = $('.alert-danger', form); | ||
| 116 | + | ||
| 117 | + //form validate | ||
| 118 | + form.validate({ | ||
| 119 | + errorElement : 'span', | ||
| 120 | + errorClass : 'help-block help-block-error', | ||
| 121 | + focusInvalid : false, | ||
| 122 | + rules : { | ||
| 123 | + 'name' : { | ||
| 124 | + required : true | ||
| 125 | + }, | ||
| 126 | + 'url' : { | ||
| 127 | + required : true | ||
| 128 | + }, | ||
| 129 | + 'module.id': { | ||
| 130 | + required : true | ||
| 131 | + } | ||
| 132 | + }, | ||
| 133 | + invalidHandler : function(event, validator) { | ||
| 134 | + error.show(); | ||
| 135 | + App.scrollTo(error, -200); | ||
| 136 | + }, | ||
| 137 | + | ||
| 138 | + highlight : function(element) { | ||
| 139 | + $(element).closest('.form-group').addClass('has-error'); | ||
| 140 | + }, | ||
| 141 | + | ||
| 142 | + unhighlight : function(element) { | ||
| 143 | + $(element).closest('.form-group').removeClass('has-error'); | ||
| 144 | + }, | ||
| 145 | + | ||
| 146 | + success : function(label) { | ||
| 147 | + label.closest('.form-group').removeClass('has-error'); | ||
| 148 | + }, | ||
| 149 | + | ||
| 150 | + submitHandler : function(f) { | ||
| 151 | + var params = form.serializeJSON(); | ||
| 152 | + error.hide(); | ||
| 153 | + | ||
| 154 | + $post('/resource', params, function(res){ | ||
| 155 | + layer.msg('修改资源成功.'); | ||
| 156 | + }); | ||
| 157 | + } | ||
| 158 | + }); | ||
| 159 | + | ||
| 160 | + //模块下拉框 | ||
| 161 | + function renderModuleSelect(callback){ | ||
| 162 | + getModuleTreeData(function(treeData){ | ||
| 163 | + var options = '<option value="">请选择...</option>'; | ||
| 164 | + $.each(treeData, function(i, g){ | ||
| 165 | + var dArray = g.children; | ||
| 166 | + | ||
| 167 | + for(var i = 0,d; d = dArray[i++];){ | ||
| 168 | + options += '<optgroup label="'+d.name+'">'; | ||
| 169 | + if(!d.children) | ||
| 170 | + continue; | ||
| 171 | + | ||
| 172 | + $.each(d.children, function(i, m){ | ||
| 173 | + options += '<option value="'+m.id+'">'+m.name+'</option>' | ||
| 174 | + }); | ||
| 175 | + options += '</optgroup>'; | ||
| 176 | + } | ||
| 177 | + }); | ||
| 178 | + $('#moduleSelect').html(options).select2(); | ||
| 179 | + callback && callback(); | ||
| 180 | + }); | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + function getModuleTreeData(cb){ | ||
| 184 | + var treeData = []; | ||
| 185 | + $get('/module/all',null, function(arr){ | ||
| 186 | + treeData = createTreeData(arr); | ||
| 187 | + cb && cb(treeData) | ||
| 188 | + }); | ||
| 189 | + } | ||
| 190 | +}); | ||
| 191 | </script> | 191 | </script> |
| 192 | \ No newline at end of file | 192 | \ No newline at end of file |
src/main/resources/static/pages/permission/resource/list.html
| 1 | -<div class="page-head"> | ||
| 2 | - <div class="page-title"> | ||
| 3 | - <h1>资源管理</h1> | ||
| 4 | - </div> | ||
| 5 | -</div> | ||
| 6 | - | ||
| 7 | -<ul class="page-breadcrumb breadcrumb"> | ||
| 8 | - <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> | ||
| 9 | - <li><span class="active">权限管理</span> <i class="fa fa-circle"></i></li> | ||
| 10 | - <li><span class="active">资源管理</span></li> | ||
| 11 | -</ul> | ||
| 12 | - | ||
| 13 | -<div class="row"> | ||
| 14 | - <div class="col-md-12"> | ||
| 15 | - <!-- Begin: life time stats --> | ||
| 16 | - <div class="portlet light portlet-fit portlet-datatable bordered"> | ||
| 17 | - <div class="portlet-title"> | ||
| 18 | - <div class="caption"> | ||
| 19 | - <i class="fa fa-database font-dark"></i> <span | ||
| 20 | - class="caption-subject font-dark sbold uppercase">资源数据表</span> | ||
| 21 | - </div> | ||
| 22 | - <div class="actions"> | ||
| 23 | - <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加资源</a> | ||
| 24 | - <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除资源</button> | ||
| 25 | - <div class="btn-group"> | ||
| 26 | - <a class="btn red btn-outline btn-circle" href="javascript:;" | ||
| 27 | - data-toggle="dropdown"> <i class="fa fa-share"></i> <span | ||
| 28 | - class="hidden-xs"> 系统工具 </span> <i class="fa fa-angle-down"></i> | ||
| 29 | - </a> | ||
| 30 | - <ul class="dropdown-menu pull-right" id="datatable_ajax_tools"> | ||
| 31 | - <li><a href="javascript:;" data-action="0" | ||
| 32 | - class="tool-action"> <i class="fa fa-print"></i> 打印 | ||
| 33 | - </a></li> | ||
| 34 | - <li><a href="javascript:;" data-action="1" | ||
| 35 | - class="tool-action"> <i class="fa fa-copy"></i> 复制 | ||
| 36 | - </a></li> | ||
| 37 | - <li><a href="javascript:;" data-action="3" | ||
| 38 | - class="tool-action"> <i class="fa fa-file-excel-o"></i> | ||
| 39 | - 导出Excel | ||
| 40 | - </a></li> | ||
| 41 | - <li class="divider"></li> | ||
| 42 | - <li><a href="javascript:;" data-action="5" | ||
| 43 | - class="tool-action"> <i class="fa fa-refresh"></i> 刷新数据 | ||
| 44 | - </a></li> | ||
| 45 | - </ul> | ||
| 46 | - </div> | ||
| 47 | - </div> | ||
| 48 | - </div> | ||
| 49 | - <div class="portlet-body"> | ||
| 50 | - <div class="table-container" style="margin-top: 10px"> | ||
| 51 | - <table | ||
| 52 | - class="table table-striped table-bordered table-hover table-checkable" | ||
| 53 | - id="datatable_resource"> | ||
| 54 | - <thead> | ||
| 55 | - <tr role="row" class="heading"> | ||
| 56 | - <th width="3%">#</th> | ||
| 57 | - <th width="15%">所属模块</th> | ||
| 58 | - <th width="13%">资源名</th> | ||
| 59 | - <th width="100">链接</th> | ||
| 60 | - <th width="11%">请求方式</th> | ||
| 61 | - <th width="18%">描述</th> | ||
| 62 | - <th width="10%">状态</th> | ||
| 63 | - <th width="18%">操作</th> | ||
| 64 | - </tr> | ||
| 65 | - <tr role="row" class="filter"> | ||
| 66 | - <td></td> | ||
| 67 | - <td> | ||
| 68 | - <select name="module.id_eq" class="form-control form-filter input-sm" id="moduleSelect"></select> | ||
| 69 | - </td> | ||
| 70 | - <td> | ||
| 71 | - <input type="text" class="form-control form-filter input-sm" name="name_like"> | ||
| 72 | - </td> | ||
| 73 | - <td> | ||
| 74 | - <input type="text" class="form-control form-filter input-sm" name="url_like"> | ||
| 75 | - </td> | ||
| 76 | - <td> | ||
| 77 | - <select class="form-control form-filter " name="method_eq"> | ||
| 78 | - <option value="">请选择...</option> | ||
| 79 | - <option value="get">get</option> | ||
| 80 | - <option value="post">post</option> | ||
| 81 | - <option value="delete">delete</option> | ||
| 82 | - </select> | ||
| 83 | - </td> | ||
| 84 | - <td> | ||
| 85 | - <input type="text" class="form-control form-filter input-sm" disabled="disabled"> | ||
| 86 | - </td> | ||
| 87 | - <td> | ||
| 88 | - <select class="form-control form-filter " name="enable_eq"> | ||
| 89 | - <option value="">请选择...</option> | ||
| 90 | - <option value="1">可用</option> | ||
| 91 | - <option value="0">禁用</option> | ||
| 92 | - </select> | ||
| 93 | - </td> | ||
| 94 | - <td> | ||
| 95 | - <button class="btn btn-sm green btn-outline filter-submit margin-bottom" > | ||
| 96 | - <i class="fa fa-search"></i> 搜索</button> | ||
| 97 | - | ||
| 98 | - <button class="btn btn-sm red btn-outline filter-cancel"> | ||
| 99 | - <i class="fa fa-times"></i> 重置</button> | ||
| 100 | - </td> | ||
| 101 | - </tr> | ||
| 102 | - </thead> | ||
| 103 | - <tbody></tbody> | ||
| 104 | - </table> | ||
| 105 | - <div style="text-align: right;"> | ||
| 106 | - <ul id="pagination" class="pagination"></ul> | ||
| 107 | - </div> | ||
| 108 | - </div> | ||
| 109 | - </div> | ||
| 110 | - </div> | ||
| 111 | - </div> | ||
| 112 | -</div> | ||
| 113 | - | ||
| 114 | -<script id="resource_list_temp" type="text/html"> | ||
| 115 | -{{each list as obj i}} | ||
| 116 | -<tr> | ||
| 117 | - <td style="vertical-align: middle;"> | ||
| 118 | - <input type="checkbox" class="group-checkable icheck" data-id="{{obj.id}}"> | ||
| 119 | - </td> | ||
| 120 | - <td> | ||
| 121 | - {{obj.module.name}} | ||
| 122 | - </td> | ||
| 123 | - <td> | ||
| 124 | - {{obj.name}} | ||
| 125 | - </td> | ||
| 126 | - <td> | ||
| 127 | - {{obj.url}} | ||
| 128 | - </td> | ||
| 129 | - <td> | ||
| 130 | - {{obj.method}} | ||
| 131 | - </td> | ||
| 132 | - <td> | ||
| 133 | - {{obj.descriptions}} | ||
| 134 | - </td> | ||
| 135 | - <td> | ||
| 136 | - {{if obj.enable}} | ||
| 137 | - 可用 | ||
| 138 | - {{else}} | ||
| 139 | - 禁用 | ||
| 140 | - {{/if}} | ||
| 141 | - </td> | ||
| 142 | - <td><a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 详细 </a></td> | ||
| 143 | -</tr> | ||
| 144 | -{{/each}} | ||
| 145 | -{{if list.length == 0}} | ||
| 146 | -<tr> | ||
| 147 | - <td colspan=8><h6 class="muted">没有找到相关数据</h6></td> | ||
| 148 | -</tr> | ||
| 149 | -{{/if}} | ||
| 150 | -</script> | ||
| 151 | - | ||
| 152 | -<script type="text/javascript"> | ||
| 153 | -$(function(){ | ||
| 154 | - var page = 0, initPagination; | ||
| 155 | - var icheckOptions = { | ||
| 156 | - checkboxClass: 'icheckbox_flat-blue', | ||
| 157 | - increaseArea: '20%' | ||
| 158 | - } | ||
| 159 | - | ||
| 160 | - var init = function(){ | ||
| 161 | - jsDoQuery(null,true); | ||
| 162 | - | ||
| 163 | - //模块下拉框 | ||
| 164 | - getModuleTreeData(function(treeData){ | ||
| 165 | - var options = '<option value="">请选择...</option>'; | ||
| 166 | - $.each(treeData, function(i, g){ | ||
| 167 | - var dArray = g.children; | ||
| 168 | - | ||
| 169 | - for(var i = 0,d; d = dArray[i++];){ | ||
| 170 | - options += '<optgroup label="'+d.name+'">'; | ||
| 171 | - if(!d.children) | ||
| 172 | - continue; | ||
| 173 | - | ||
| 174 | - $.each(d.children, function(i, m){ | ||
| 175 | - options += '<option value="'+m.id+'">'+m.name+'</option>' | ||
| 176 | - }); | ||
| 177 | - options += '</optgroup>'; | ||
| 178 | - } | ||
| 179 | - }); | ||
| 180 | - $('#moduleSelect').html(options)/* .select2() */; | ||
| 181 | - }); | ||
| 182 | - } | ||
| 183 | - | ||
| 184 | - //if($('#historyCache').length == 0){ | ||
| 185 | - init(); | ||
| 186 | - //} | ||
| 187 | - | ||
| 188 | - | ||
| 189 | - //重置 | ||
| 190 | - $('tr.filter .filter-cancel').on('click', function(){ | ||
| 191 | - $('tr.filter input, select').val('').change(); | ||
| 192 | - jsDoQuery(null, true); | ||
| 193 | - }); | ||
| 194 | - | ||
| 195 | - //提交 | ||
| 196 | - $('tr.filter .filter-submit').on('click', function(){ | ||
| 197 | - var cells = $('tr.filter')[0].cells | ||
| 198 | - ,params = {} | ||
| 199 | - ,name; | ||
| 200 | - $.each(cells, function(i, cell){ | ||
| 201 | - var items = $('input,select', cell); | ||
| 202 | - for(var j = 0, item; item = items[j++];){ | ||
| 203 | - name = $(item).attr('name'); | ||
| 204 | - if(name){ | ||
| 205 | - params[name] = $(item).val(); | ||
| 206 | - } | ||
| 207 | - } | ||
| 208 | - }); | ||
| 209 | - page = 0; | ||
| 210 | - jsDoQuery(params, true); | ||
| 211 | - }); | ||
| 212 | - | ||
| 213 | - /* | ||
| 214 | - * 获取数据 p: 要提交的参数, pagination: 是否重新分页 | ||
| 215 | - */ | ||
| 216 | - function jsDoQuery(p, pagination){ | ||
| 217 | - var params = {}; | ||
| 218 | - if(p) | ||
| 219 | - params = p; | ||
| 220 | - //更新时间排序 | ||
| 221 | - params['order'] = 'updateDate'; | ||
| 222 | - params['page'] = page; | ||
| 223 | - var i = layer.load(2); | ||
| 224 | - $get('/resource' ,params, function(data){ | ||
| 225 | - var bodyHtm = template('resource_list_temp', {list: data.content}); | ||
| 226 | - | ||
| 227 | - $('#datatable_resource tbody').html(bodyHtm) | ||
| 228 | - .find('.icheck').iCheck(icheckOptions) | ||
| 229 | - .on('ifChanged', iCheckChange); | ||
| 230 | - if(pagination && data.content.length > 0){ | ||
| 231 | - //重新分页 | ||
| 232 | - initPagination = true; | ||
| 233 | - showPagination(data); | ||
| 234 | - } | ||
| 235 | - layer.close(i); | ||
| 236 | - }); | ||
| 237 | - } | ||
| 238 | - | ||
| 239 | - function iCheckChange(){ | ||
| 240 | - var tr = $(this).parents('tr'); | ||
| 241 | - if(this.checked) | ||
| 242 | - tr.addClass('row-active'); | ||
| 243 | - else | ||
| 244 | - tr.removeClass('row-active'); | ||
| 245 | - | ||
| 246 | - if($('#datatable_resource input.icheck:checked').length == 1) | ||
| 247 | - $('#removeButton').removeAttr('disabled'); | ||
| 248 | - else | ||
| 249 | - $('#removeButton').attr('disabled', 'disabled'); | ||
| 250 | - } | ||
| 251 | - | ||
| 252 | - function showPagination(data){ | ||
| 253 | - //分页 | ||
| 254 | - $('#pagination').jqPaginator({ | ||
| 255 | - totalPages: data.totalPages, | ||
| 256 | - visiblePages: 6, | ||
| 257 | - currentPage: page + 1, | ||
| 258 | - first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>', | ||
| 259 | - prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>', | ||
| 260 | - next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>', | ||
| 261 | - last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>', | ||
| 262 | - page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>', | ||
| 263 | - onPageChange: function (num, type) { | ||
| 264 | - if(initPagination){ | ||
| 265 | - initPagination = false; | ||
| 266 | - return; | ||
| 267 | - } | ||
| 268 | - | ||
| 269 | - | ||
| 270 | - page = num - 1; | ||
| 271 | - jsDoQuery(null, false); | ||
| 272 | - } | ||
| 273 | - }); | ||
| 274 | - } | ||
| 275 | - | ||
| 276 | - function getModuleTreeData(cb){ | ||
| 277 | - var treeData = []; | ||
| 278 | - $get('/module/all',null, function(arr){ | ||
| 279 | - treeData = createTreeData(arr); | ||
| 280 | - cb && cb(treeData) | ||
| 281 | - }); | ||
| 282 | - } | ||
| 283 | - | ||
| 284 | - //删除 | ||
| 285 | - $('#removeButton').on('click', function(){ | ||
| 286 | - if($(this).attr('disabled')) | ||
| 287 | - return; | ||
| 288 | - | ||
| 289 | - var id = $('#datatable_resource input.icheck:checked').data('id'); | ||
| 290 | - | ||
| 291 | - removeConfirm('确定要删除选中的数据?', '/resource/' + id ,function(){ | ||
| 292 | - $('tr.filter .filter-submit').click(); | ||
| 293 | - }); | ||
| 294 | - }); | ||
| 295 | -}); | ||
| 296 | -</script> | 1 | +<div class="page-head"> |
| 2 | + <div class="page-title"> | ||
| 3 | + <h1>资源管理</h1> | ||
| 4 | + </div> | ||
| 5 | +</div> | ||
| 6 | + | ||
| 7 | +<ul class="page-breadcrumb breadcrumb"> | ||
| 8 | + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> | ||
| 9 | + <li><span class="active">权限管理</span> <i class="fa fa-circle"></i></li> | ||
| 10 | + <li><span class="active">资源管理</span></li> | ||
| 11 | +</ul> | ||
| 12 | + | ||
| 13 | +<div class="row"> | ||
| 14 | + <div class="col-md-12"> | ||
| 15 | + <!-- Begin: life time stats --> | ||
| 16 | + <div class="portlet light portlet-fit portlet-datatable bordered"> | ||
| 17 | + <div class="portlet-title"> | ||
| 18 | + <div class="caption"> | ||
| 19 | + <i class="fa fa-database font-dark"></i> <span | ||
| 20 | + class="caption-subject font-dark sbold uppercase">资源数据表</span> | ||
| 21 | + </div> | ||
| 22 | + <div class="actions"> | ||
| 23 | + <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加资源</a> | ||
| 24 | + <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除资源</button> | ||
| 25 | + <div class="btn-group"> | ||
| 26 | + <a class="btn red btn-outline btn-circle" href="javascript:;" | ||
| 27 | + data-toggle="dropdown"> <i class="fa fa-share"></i> <span | ||
| 28 | + class="hidden-xs"> 系统工具 </span> <i class="fa fa-angle-down"></i> | ||
| 29 | + </a> | ||
| 30 | + <ul class="dropdown-menu pull-right" id="datatable_ajax_tools"> | ||
| 31 | + <li><a href="javascript:;" data-action="0" | ||
| 32 | + class="tool-action"> <i class="fa fa-print"></i> 打印 | ||
| 33 | + </a></li> | ||
| 34 | + <li><a href="javascript:;" data-action="1" | ||
| 35 | + class="tool-action"> <i class="fa fa-copy"></i> 复制 | ||
| 36 | + </a></li> | ||
| 37 | + <li><a href="javascript:;" data-action="3" | ||
| 38 | + class="tool-action"> <i class="fa fa-file-excel-o"></i> | ||
| 39 | + 导出Excel | ||
| 40 | + </a></li> | ||
| 41 | + <li class="divider"></li> | ||
| 42 | + <li><a href="javascript:;" data-action="5" | ||
| 43 | + class="tool-action"> <i class="fa fa-refresh"></i> 刷新数据 | ||
| 44 | + </a></li> | ||
| 45 | + </ul> | ||
| 46 | + </div> | ||
| 47 | + </div> | ||
| 48 | + </div> | ||
| 49 | + <div class="portlet-body"> | ||
| 50 | + <div class="table-container" style="margin-top: 10px"> | ||
| 51 | + <table | ||
| 52 | + class="table table-striped table-bordered table-hover table-checkable" | ||
| 53 | + id="datatable_resource"> | ||
| 54 | + <thead> | ||
| 55 | + <tr role="row" class="heading"> | ||
| 56 | + <th width="3%">#</th> | ||
| 57 | + <th width="15%">所属模块</th> | ||
| 58 | + <th width="13%">资源名</th> | ||
| 59 | + <th width="100">链接</th> | ||
| 60 | + <th width="11%">请求方式</th> | ||
| 61 | + <th width="18%">描述</th> | ||
| 62 | + <th width="10%">状态</th> | ||
| 63 | + <th width="18%">操作</th> | ||
| 64 | + </tr> | ||
| 65 | + <tr role="row" class="filter"> | ||
| 66 | + <td></td> | ||
| 67 | + <td> | ||
| 68 | + <select name="module.id_eq" class="form-control form-filter input-sm" id="moduleSelect"></select> | ||
| 69 | + </td> | ||
| 70 | + <td> | ||
| 71 | + <input type="text" class="form-control form-filter input-sm" name="name_like"> | ||
| 72 | + </td> | ||
| 73 | + <td> | ||
| 74 | + <input type="text" class="form-control form-filter input-sm" name="url_like"> | ||
| 75 | + </td> | ||
| 76 | + <td> | ||
| 77 | + <select class="form-control form-filter " name="method_eq"> | ||
| 78 | + <option value="">请选择...</option> | ||
| 79 | + <option value="get">get</option> | ||
| 80 | + <option value="post">post</option> | ||
| 81 | + <option value="delete">delete</option> | ||
| 82 | + </select> | ||
| 83 | + </td> | ||
| 84 | + <td> | ||
| 85 | + <input type="text" class="form-control form-filter input-sm" disabled="disabled"> | ||
| 86 | + </td> | ||
| 87 | + <td> | ||
| 88 | + <select class="form-control form-filter " name="enable_eq"> | ||
| 89 | + <option value="">请选择...</option> | ||
| 90 | + <option value="1">可用</option> | ||
| 91 | + <option value="0">禁用</option> | ||
| 92 | + </select> | ||
| 93 | + </td> | ||
| 94 | + <td> | ||
| 95 | + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" > | ||
| 96 | + <i class="fa fa-search"></i> 搜索</button> | ||
| 97 | + | ||
| 98 | + <button class="btn btn-sm red btn-outline filter-cancel"> | ||
| 99 | + <i class="fa fa-times"></i> 重置</button> | ||
| 100 | + </td> | ||
| 101 | + </tr> | ||
| 102 | + </thead> | ||
| 103 | + <tbody></tbody> | ||
| 104 | + </table> | ||
| 105 | + <div style="text-align: right;"> | ||
| 106 | + <ul id="pagination" class="pagination"></ul> | ||
| 107 | + </div> | ||
| 108 | + </div> | ||
| 109 | + </div> | ||
| 110 | + </div> | ||
| 111 | + </div> | ||
| 112 | +</div> | ||
| 113 | + | ||
| 114 | +<script id="resource_list_temp" type="text/html"> | ||
| 115 | +{{each list as obj i}} | ||
| 116 | +<tr> | ||
| 117 | + <td style="vertical-align: middle;"> | ||
| 118 | + <input type="checkbox" class="group-checkable icheck" data-id="{{obj.id}}"> | ||
| 119 | + </td> | ||
| 120 | + <td> | ||
| 121 | + {{obj.module.name}} | ||
| 122 | + </td> | ||
| 123 | + <td> | ||
| 124 | + {{obj.name}} | ||
| 125 | + </td> | ||
| 126 | + <td> | ||
| 127 | + {{obj.url}} | ||
| 128 | + </td> | ||
| 129 | + <td> | ||
| 130 | + {{obj.method}} | ||
| 131 | + </td> | ||
| 132 | + <td> | ||
| 133 | + {{obj.descriptions}} | ||
| 134 | + </td> | ||
| 135 | + <td> | ||
| 136 | + {{if obj.enable}} | ||
| 137 | + 可用 | ||
| 138 | + {{else}} | ||
| 139 | + 禁用 | ||
| 140 | + {{/if}} | ||
| 141 | + </td> | ||
| 142 | + <td><a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 详细 </a></td> | ||
| 143 | +</tr> | ||
| 144 | +{{/each}} | ||
| 145 | +{{if list.length == 0}} | ||
| 146 | +<tr> | ||
| 147 | + <td colspan=8><h6 class="muted">没有找到相关数据</h6></td> | ||
| 148 | +</tr> | ||
| 149 | +{{/if}} | ||
| 150 | +</script> | ||
| 151 | + | ||
| 152 | +<script type="text/javascript"> | ||
| 153 | +$(function(){ | ||
| 154 | + var page = 0, initPagination; | ||
| 155 | + var icheckOptions = { | ||
| 156 | + checkboxClass: 'icheckbox_flat-blue', | ||
| 157 | + increaseArea: '20%' | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + var init = function(){ | ||
| 161 | + jsDoQuery(null,true); | ||
| 162 | + | ||
| 163 | + //模块下拉框 | ||
| 164 | + getModuleTreeData(function(treeData){ | ||
| 165 | + var options = '<option value="">请选择...</option>'; | ||
| 166 | + $.each(treeData, function(i, g){ | ||
| 167 | + var dArray = g.children; | ||
| 168 | + | ||
| 169 | + for(var i = 0,d; d = dArray[i++];){ | ||
| 170 | + options += '<optgroup label="'+d.name+'">'; | ||
| 171 | + if(!d.children) | ||
| 172 | + continue; | ||
| 173 | + | ||
| 174 | + $.each(d.children, function(i, m){ | ||
| 175 | + options += '<option value="'+m.id+'">'+m.name+'</option>' | ||
| 176 | + }); | ||
| 177 | + options += '</optgroup>'; | ||
| 178 | + } | ||
| 179 | + }); | ||
| 180 | + $('#moduleSelect').html(options)/* .select2() */; | ||
| 181 | + }); | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + //if($('#historyCache').length == 0){ | ||
| 185 | + init(); | ||
| 186 | + //} | ||
| 187 | + | ||
| 188 | + | ||
| 189 | + //重置 | ||
| 190 | + $('tr.filter .filter-cancel').on('click', function(){ | ||
| 191 | + $('tr.filter input, select').val('').change(); | ||
| 192 | + jsDoQuery(null, true); | ||
| 193 | + }); | ||
| 194 | + | ||
| 195 | + //提交 | ||
| 196 | + $('tr.filter .filter-submit').on('click', function(){ | ||
| 197 | + var cells = $('tr.filter')[0].cells | ||
| 198 | + ,params = {} | ||
| 199 | + ,name; | ||
| 200 | + $.each(cells, function(i, cell){ | ||
| 201 | + var items = $('input,select', cell); | ||
| 202 | + for(var j = 0, item; item = items[j++];){ | ||
| 203 | + name = $(item).attr('name'); | ||
| 204 | + if(name){ | ||
| 205 | + params[name] = $(item).val(); | ||
| 206 | + } | ||
| 207 | + } | ||
| 208 | + }); | ||
| 209 | + page = 0; | ||
| 210 | + jsDoQuery(params, true); | ||
| 211 | + }); | ||
| 212 | + | ||
| 213 | + /* | ||
| 214 | + * 获取数据 p: 要提交的参数, pagination: 是否重新分页 | ||
| 215 | + */ | ||
| 216 | + function jsDoQuery(p, pagination){ | ||
| 217 | + var params = {}; | ||
| 218 | + if(p) | ||
| 219 | + params = p; | ||
| 220 | + //更新时间排序 | ||
| 221 | + params['order'] = 'updateDate'; | ||
| 222 | + params['page'] = page; | ||
| 223 | + var i = layer.load(2); | ||
| 224 | + $get('/resource' ,params, function(data){ | ||
| 225 | + var bodyHtm = template('resource_list_temp', {list: data.content}); | ||
| 226 | + | ||
| 227 | + $('#datatable_resource tbody').html(bodyHtm) | ||
| 228 | + .find('.icheck').iCheck(icheckOptions) | ||
| 229 | + .on('ifChanged', iCheckChange); | ||
| 230 | + if(pagination && data.content.length > 0){ | ||
| 231 | + //重新分页 | ||
| 232 | + initPagination = true; | ||
| 233 | + showPagination(data); | ||
| 234 | + } | ||
| 235 | + layer.close(i); | ||
| 236 | + }); | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + function iCheckChange(){ | ||
| 240 | + var tr = $(this).parents('tr'); | ||
| 241 | + if(this.checked) | ||
| 242 | + tr.addClass('row-active'); | ||
| 243 | + else | ||
| 244 | + tr.removeClass('row-active'); | ||
| 245 | + | ||
| 246 | + if($('#datatable_resource input.icheck:checked').length == 1) | ||
| 247 | + $('#removeButton').removeAttr('disabled'); | ||
| 248 | + else | ||
| 249 | + $('#removeButton').attr('disabled', 'disabled'); | ||
| 250 | + } | ||
| 251 | + | ||
| 252 | + function showPagination(data){ | ||
| 253 | + //分页 | ||
| 254 | + $('#pagination').jqPaginator({ | ||
| 255 | + totalPages: data.totalPages, | ||
| 256 | + visiblePages: 6, | ||
| 257 | + currentPage: page + 1, | ||
| 258 | + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>', | ||
| 259 | + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>', | ||
| 260 | + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>', | ||
| 261 | + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>', | ||
| 262 | + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>', | ||
| 263 | + onPageChange: function (num, type) { | ||
| 264 | + if(initPagination){ | ||
| 265 | + initPagination = false; | ||
| 266 | + return; | ||
| 267 | + } | ||
| 268 | + | ||
| 269 | + | ||
| 270 | + page = num - 1; | ||
| 271 | + jsDoQuery(null, false); | ||
| 272 | + } | ||
| 273 | + }); | ||
| 274 | + } | ||
| 275 | + | ||
| 276 | + function getModuleTreeData(cb){ | ||
| 277 | + var treeData = []; | ||
| 278 | + $get('/module/all',null, function(arr){ | ||
| 279 | + treeData = createTreeData(arr); | ||
| 280 | + cb && cb(treeData) | ||
| 281 | + }); | ||
| 282 | + } | ||
| 283 | + | ||
| 284 | + //删除 | ||
| 285 | + $('#removeButton').on('click', function(){ | ||
| 286 | + if($(this).attr('disabled')) | ||
| 287 | + return; | ||
| 288 | + | ||
| 289 | + var id = $('#datatable_resource input.icheck:checked').data('id'); | ||
| 290 | + | ||
| 291 | + removeConfirm('确定要删除选中的数据?', '/resource/' + id ,function(){ | ||
| 292 | + $('tr.filter .filter-submit').click(); | ||
| 293 | + }); | ||
| 294 | + }); | ||
| 295 | +}); | ||
| 296 | +</script> |