PageSourceSearch

https://www.shipfinder.com/Content/js/elane/elane.weaher.js?v=22

js shipfinder.com collected 2026-10-03 23:58:08 UTC 33,743 bytes, 777 lines download raw bytes

1/// <reference path="elane.js" /> 
2/// <reference path="../jquery-1.8.2.min.js" />
3/// <reference path="../layer/layer.js" />
4//气象
5var weather;
6var doMain = window.location.origin + "";
7// 全局参数覆盖
8ShipxyOptions.weather.icon_base_url = doMain + "/Content/js/elanemap/images";// 气象图标存放URL
9
10elane.weather = {
11    //气象图层
12    areaViewSymbol: {},
13    lyGroup: L.layerGroup(),
14    clickLatLng: null,
15    weathrBounds: [],
16    showDetail: true,
17    hash: {},
18    //初始化
19    init: function () {
20        var _ = this;
21        var options = {
22            gsea_url: doMain + "/Resource/GetFile?fileName=globalSeaAreaSymbol_area.json",
23            typ_url: doMain + "/Resource/GetFile?fileName=ECA-v2.json",
24            //typ_url: doMain + "/Resource/GetFile?fileName=typhoon_area.json",
25            //ctyp_url: doMain + "/Resource/GetFile?fileName=chinaDischargeAreaSymbol_area.json",
26            eez_url: doMain + "/Resource/GetFile?fileName=exclusiveEconomicZoneSymbol_area.json",
27            time_url: doMain + "/Resource/GetFile?fileName=timezones.json",
28            bline_url: doMain + "/Resource/GetFile?fileName=baseline.json",
29            showName: true
30        };
31        _.areaViewSymbol = ShipxyAPI.areaViewSymbol(map, options);
32        weather = ShipxyAPI.WeatherService(map); // map.weatherService 也会被实例化
33        //测试 
34        _.createTime(_.formatDate(new Date(), 'yyyy-MM-dd'));
35        //显示实时气象信息
36
37        map.on('mousemove', function (e) {
38            // return;  
39            if (_.getPointPostTime() < 1000 || layer.getlayerid('seameteInfoBox') == "") { return; } else { _.setPointPostTime() }
40            elane.weather._getPointWeather(e.latlng);
41        });
42        //地图点击事件
43        map.on('click', function (e) {
44            // return;  
45            var isClick = true;
46            for (var i = 0; i < _.weathrBounds.length; i++) {
47                var b = _.weathrBounds[i];
48                if (b && b.contains && b.contains(e.latlng)) {
49                    isClick = false;
50                    break;
51                }
52            }
53            if (isClick) {
54                _.clickLatLng = e.latlng;
55                _.hash = {};
56                elane.weather.showClickWeather(e.latlng);
57                //右侧气象
58                elane.weather._getPointWeather(e.latlng);
59            }
60        });
61        map.on('zoomend', function (e) {
62            _.clickLatLng && elane.weather.showClickWeather(_.clickLatLng);
63        });
64        layerManager.setOptions('QX', '');
65        //加载历史
66        var _history = layerManager.getOptions('QX');
67        if (_history) {
68            $.each(_history.split(','), function (i, item) {
69                var v = _.getCurDate(new Date(), false);//_.timeHash[0];
70                //显示气象
71                switch (item) {
72                    case "QY":
73                        weather.showPressureTile(v);
74
75                        break;
76                    case "QW":
77                        weather.showTempTile(v);
78
79                        break;
80                    case "HF":
81                        weather.showSeaBreezes(v);
82
83                        break;
84                    case "HL":
85                        weather.showSeaWaves(v);
86
87                        break;
88                    case "FC":
89                        weather.showWindFiel(v);
90                        Menu.seameteInfoBox('');
91                        break;
92                    case "HAL":
93                        weather.showSeaWater(v);
94
95                        break;
96                    case "LC":
97                        weather.showOceanCurrentFiel(v);
98                        break;
99                    case "TF":
100                        //var opt = {};
101                        //opt.showWarningLine = true;// 是否显示,警戒线,默认:true;
102                        //opt.autoLocation = true;// 是否自动定位,显示台风时,默认:true;
103                        //opt.showTimeTipMinZoom = 3;// 是否显示时间tip最小缩放级别,默认:9
104
105                        weather.showTyphoonInfoList(function () { $("#ocenWeather .typhoon_ico").click() }, true, null, { showWarningLine: true, autoLocation: true, showTimeTipMinZoom: 6 });
106                        //隐藏海运圈
107                        $("#talent_person").hide();
108                        $("#talent_me").hide();
109                        $("#talent_close").hide();
110                        //
111                        setTimeout(function () {
112                            $(".typhoonListTitle").append('<div class="typhhoon_adv" onclick="AvoidTyphoon.showWin()" style="left: -179px;width: 169px;height: 38px;line-height: 21px;background: #2770d4;position: absolute;border-radius: 5px 5px 5px 5px;color: #fff;padding: 6px 0 0 6px;cursor: pointer;"><img style="margin-left: -7px;" src="/Content/images/typhoon.png">' + $.common.lang.avoidtyphoon+'</div>');
113                            $("#typhoonListWin1").attr("style", "overflow:unset");
114                        }, 500);
115                        break;
116                    case "CX":
117                        weather.showTides(); //潮汐
118                        break;
119                    case "HQ":
120                        weather.showSeaAreaForecasts(); //海区
121                        break;
122                    default:
123                        break;
124                }
125            });
126
127        }
128    },
129    closeClickWeather: function () {
130        var _ = this;
131        _.lyGroup && _.lyGroup.clearLayers();
132        _.clickLatLng = null;
133        _.hash = {};
134    },
135    showClickWeather: function (latlng) {
136        var _ = this;
137        _.lyGroup && _.lyGroup.clearLayers();
138        _.weathrBounds = [];
139        var type = $("#ocenWeather a.chose").attr('data-type');
140        //打开气象且有选中
141        if (window.seaMete1 && type) {
142            if (('QY,QW,HF,HL,FC,HAL,LC').indexOf(type) > -1) {
143                var val = $.trim($(".MeteoTime").val());
144                var hasData = _.hash[[type, latlng.lat, latlng.lng, val].join('_')];
145                if (!hasData && val) {
146                    var r = map.weatherService.getLatLngWeather("11,12,13,14", latlng, val, function (r) {
147                        var toolTip = ""
148                        if (!r.status && r.data) {
149                            var d = r.data[0];
150                            for (var i in d) {
151                                d[i] = "" + d[i];
152                                if (d[i] == "-32767") d[i] = '';
153                            }
154                        }
155                        _.hash[[latlng.lat, latlng.lng, val].join('_')] = d;
156                        _.showWeatherLayer();
157                    });
158
159                } else {
160                    _.showWeatherLayer();
161                }
162            }
163        }
164    },
165    showWeatherLayer: function () {
166        var _ = this;
167        var d = Object.values(_.hash)[0];
168        var latlng = _.clickLatLng;
169        _.weathrBounds.length = 0;
170
171        if (d && latlng) {
172            //添加一个120px
173            var point = map.latLngToLayerPoint(latlng);
174            var start = L.point(point.x, point.y - 7);
175            var end = L.point(point.x, point.y - 120);
176            var startLatLng = map.layerPointToLatLng(start);
177            var endLatLng = map.layerPointToLatLng(end);
178            var polyline = L.polyline([startLatLng, endLatLng], {
179                color: '#1d374c',
180                weight: 2
181            });
182            var marker = L.circleMarker(latlng, {
183                radius: 6,
184                color: '#fff',
185                weight: 2,
186                fillOpacity: 1
187            }).addTo(map);
188            var type = $("#ocenWeather a.chose").attr('data-type');
189            var html = '<i class="layui-icon layui-icon-close-fill weather-shuiwen-close"></i>';
190            html += '<div  class="weather-shuiwen-container">';
191            var type = $("#ocenWeather a.chose").attr('data-type');
192            switch (type) {
193                case "QY":
194                    html += '<div class="field short">' + $.common.lang.atmos + ': ' + (d.pressure || '--') + '(hPa) <i class="layui-icon layui-icon-down" ></i></div>';
195                    html += '<div class="other"><div class="field">' + $.common.lang.wind + ':<label style="display: inline-block;width:46px;"> ' + (d.winddir || '--') + '°</label>' + (shipInfoLayer.changeWind(d.windspeed) || '--') + '</div>';
196                    html += '<div class="field">' + $.common.lang.flow + ':<label style="display: inline-block;width:45px;"> ' + (d.oceandir || '--') + '°</label>' + (d.oceanspeed || '--') + $.common.lang.ms + '</div>';
197                    html += '<div class="field">' + $.common.lang.wave + ': <label style="display: inline-block;width:45px;"> ' + (d.waveheight || '--') + $.common.lang.m + '</label>' + $.common.lang.temp+': ' + (d.temperature || '--') + '℃</div></div>';
198                    break;
199                case "QW":
200                    html += '<div class="field short">' + $.common.lang.temp + ': ' + (d.temperature || '--') + '℃ <i class="layui-icon layui-icon-down" ></i></div>';
201                    html += '<div class="other"><div class="field">' + $.common.lang.wind + ':<label style="display: inline-block;width:46px;"> ' + (d.winddir || '--') + '°</label>' + (shipInfoLayer.changeWind(d.windspeed) || '--') + '</div>';
202                    html += '<div class="field">' + $.common.lang.flow + ':<label style="display: inline-block;width:45px;"> ' + (d.oceandir || '--') + '°</label>' + (d.oceanspeed || '--') + $.common.lang.ms+'</div>';
203                    html += '<div class="field">' + $.common.lang.wave + ': <label style="display: inline-block;width:45px;"> ' + (d.waveheight || '--') + $.common.lang.m + '</label>' + $.common.lang.atmos +': ' + (d.pressure || '--') + '(hPa)</div></div>';
204                    break;
205                case "HF":
206                case "FC":
207                    html += '<div class="field short">' + $.common.lang.wind + ':<label style="display: inline-block;width:45px;"> ' + (d.winddir || '--') + '°</label>' + (shipInfoLayer.changeWind(d.windspeed) || '--') + '<i class="layui-icon layui-icon-down" ></i></div>';
208                    html += '<div class="other">';
209                    html += '<div class="field">' + $.common.lang.flow + ':<label style="display: inline-block;width:45px;"> ' + (d.oceandir || '--') + '°</label>' + (d.oceanspeed || '--') + $.common.lang.ms+'</div>';
210                    html += '<div class="field">' + $.common.lang.wave + ': <label style="display: inline-block;width:45px;"> ' + (d.waveheight || '--') + $.common.lang.m + '</label>' + $.common.lang.temp +': ' + (d.temperature || '--') + '℃</div>';
211                    html += '<div class="field">' + $.common.lang.atmos + ': ' + (d.pressure || '--') + '(hPa)</div></div>';
212                    break;
213                case "HL":
214                    html += '<div class="field short">' + $.common.lang.wave + ': ' + (d.waveheight || '--') + $.common.lang.m+'<i class="layui-icon layui-icon-down" ></i></div>';
215                    html += '<div class="other"><div class="field">' + $.common.lang.wind + ':<label style="display: inline-block;width:46px;"> ' + (d.winddir || '--') + '°</label>' + (shipInfoLayer.changeWind(d.windspeed) || '--') + '</div>';
216                    html += '<div class="field">' + $.common.lang.flow + ':<label style="display: inline-block;width:45px;"> ' + (d.oceandir || '--') + '°</label>' + (d.oceanspeed || '--') + $.common.lang.ms+'</div>';
217                    html += '<div class="field">' + $.common.lang.temp + ': <label style="display: inline-block;width:45px;"> ' + (d.temperature || '--') + '℃</label>' + $.common.lang.atmos +': ' + (d.pressure || '--') + '(hPa)</div></div>';
218                    break;
219                case "HAL":
220                case "LC":
221                    html += '<div class="field short">' + $.common.lang.flow + ':<label style="display: inline-block;width:45px;"> ' + (d.oceandir || '--') + '°</label>' + (d.oceanspeed || '--') + $.common.lang.ms+'<i class="layui-icon layui-icon-down" ></i></div>';
222                    html += '<div class="other"><div class="field">' + $.common.lang.wind + ':<label style="display: inline-block;width:45px;"> ' + (d.winddir || '--') + '°</label>' + (shipInfoLayer.changeWind(d.windspeed) || '--') + '</div>';
223                    html += '<div class="field">' + $.common.lang.wave + ': <label style="display: inline-block;width:46px;"> ' + (d.waveheight || '--') + $.common.lang.m + '</label>' + $.common.lang.temp +': ' + (d.temperature || '--') + '℃</div>';
224                    html += '<div class="field">' + $.common.lang.atmos + ': ' + (d.pressure || '--') + '(hPa)</div></div>';
225                    break;
226            }
227            //html += '<i class="layui-icon layui-icon-up"></i>';
228            html += '</div>';
229            marker.bindTooltip(html, {
230                direction: 'right',
231                offset: [-7, -10],
232                opacity: 1,
233                className: "weather-shuiwen-tooltip",
234                permanent: true,
235                interactive: true,
236            });
237            if (_.showDetail) {
238                $(".short .layui-icon-down").hide();
239                $(".weather-shuiwen-container .other").show();
240                $(".weather-shuiwen-tooltip .layui-icon-up").show();
241            }
242            $(".weather-shuiwen-close").unbind('click').bind('click', function (e) {
243                e.stopPropagation();
244                _.closeClickWeather();
245            });
246            $(".short .layui-icon-down").unbind('click').bind('click', function (e) {
247                e.stopPropagation();
248                $(this).hide();
249                _.showDetail = true;
250                $(".weather-shuiwen-container .other").show();
251                $(".weather-shuiwen-tooltip .layui-icon-up").show();
252            });
253            $(".weather-shuiwen-tooltip .layui-icon-up").unbind('click').bind('click', function (e) {
254                e.stopPropagation();
255                $(this).hide();
256                _.showDetail = false;
257                $(".short .layui-icon-down").show();
258                $(".weather-shuiwen-container .other").hide();
259            });
260            $(".weather-shuiwen-tooltip").unbind('click').bind('click', function (e) {
261                e.stopPropagation();
262            });
263            _.markerTip = marker;
264            _.lyGroup.addLayer(polyline);
265            _.lyGroup.addLayer(marker);
266            _.lyGroup.addTo(map);
267            marker.addTo(map);
268            var width = $(".weather-shuiwen-tooltip").width(), height = $(".weather-shuiwen-tooltip").height();
269            _.weathrBounds.push(L.latLngBounds(map.layerPointToLatLng(L.point(point.x - 6, point.y + 6)), map.layerPointToLatLng(L.point(point.x + 6, point.y - 6))));
270            //xian
271            _.weathrBounds.push(polyline.getBounds());
272        }
273    },
274    _getPointWeather: function (latlng) {
275        var _ = this;
276        var val = $.trim($(".MeteoTime").val());
277        if (val) {
278            var r = map.weatherService.getLatLngWeather("11,12,13,14", latlng, val, function (r) {
279                if (!r.status && r.data) {
280                    var d = r.data[0];
281                    for (var i in d) {
282                        d[i] = "" + d[i];
283                        if (d[i] == "-32767") d[i] = '';
284                    }
285                    $(".seamete_info_box #WindSpeed").html(shipInfoLayer.changeWind(d.windspeed) || '--');
286                    //$(".seamete_info_box #WindSpeed_class").html(shipInfoLayer.changeWind(d.windspeed) || ''); 
287                    $(".seamete_info_box #WindDir").html(d.winddir || '--');
288                    $(".seamete_info_box #WaveHeght").html(d.waveheight || '--');
289                    $(".seamete_info_box #WaveDir").html(d.swelldir || '--');
290                    $(".seamete_info_box #Temprature").html(d.temperature || '
290--');
291                    $(".seamete_info_box #Pressure").html(d.pressure || '--');
292                    $(".seamete_info_box #OceanSpeed").html(d.oceanspeed || '--');
293                    $(".seamete_info_box #OceanDir").html(d.oceandir || '--');
294                }
295                _.setPointPostTime()
296            });
297
298        }
299    },
300    //获取拾取气象时间间隔
301
302    getPointPostTime: function () {
303        return (new Date()).getTime() - elane.weather['pointPostTime'] * 1;
304    },
305
306    setPointPostTime: function () {
307        elane.weather.pointPostTime = (new Date()).getTime();
308
309    },
310    pointPostTime: (new Date()).getTime(),
311    showInit: function () {
312
313    },
314    //显示指定类型气象
315    show: function (type) {
316        var _ = this;
317        switch (type) {
318            case "QY":
319                Menu.seameteInfoBox('气压');
320                break;
321            case "QW":
322                Menu.seameteInfoBox('气温');
323                break;
324            case "HF":
325                Menu.seameteInfoBox('海风');
326                break;
327            case "HL":
328                Menu.seameteInfoBox('海浪');
329            case "FC":
330                Menu.seameteInfoBox('风场');
331                break;
332            case "HAL":
333                Menu.seameteInfoBox('海流');
334                break;
335            case "LC":
336                Menu.seameteInfoBox('流场');
337                break;
338            case "TF":
339                weather.showTyphoonInfoList(function () { $("#ocenWeather .typhoon_ico").click() }, true, null, { showWarningLine: true, autoLocation: true, showTimeTipMinZoom: 6 });
340                $("#talent_person").hide();
341                $("#talent_me").hide();
342                $("#talent_close").hide();
343                setTimeout(function () {
344                    if (getCookie('culture') =='en-US') {
345                        $(".typhoonListTitle").append('<div class="typhhoon_adv" onclick="AvoidTyphoon.showWin()" style="left: -179px;width: 169px;height: 38px;line-height: 21px;background: #2770d4;position: absolute;border-radius: 5px 5px 5px 5px;color: #fff;padding: 6px 0 0 6px;cursor: pointer;"><img style="margin-left: -7px;" src="/Content/images/typhoon.png">' + $.common.lang.avoidtyphoon + '</div>');
346                    } else {
347                        $(".typhoonListTitle").append('<div class="typhhoon_adv" onclick="AvoidTyphoon.showWin()" style="left: -179px;width: 169px;height: 38px;line-height: 21px;background: #2770d4;position: absolute;border-radius: 5px 5px 5px 5px;color: #fff;padding: 6px 0 0 6px;cursor: pointer;"><img style="margin-left: -7px;" src="/Content/images/typhoon.png">' + $.common.lang.avoidtyphoon + '</div>');
348                    }
349                    $("#typhoonListWin1").attr("style", "overflow:unset");
350                }, 500);
351                break;
352            case "CX":
353                weather.showTides(); //潮汐
354                break;
355            case "HQ":
356                weather.showSeaAreaForecasts(); //海区
357                break;
358            default:
359                break;
360        }
361    },
362    showTime: function () {
363        var _ = this,
364			htm = '';
365        var _cur = _.getCurDate(new Date(), false);
366        if (_.timeHash && _.timeHash.length > 0) {
367            $.each(_.timeHash, function (i, item) {
368
369                if (_cur == item) {
370                    htm += '<option value="' + item + '" selected>' + item + '</option>'
371                } else {
372                    htm += '<option value="' + item + '">' + item + '</option>'
373                }
374            })
375        } else {
376            htm += '<option value="">未获取到气象时间</option>'
377        }
378        $(".MeteoTime").html(htm);
379    },
380    //隐藏指定类型气象
381    hide: function (type) {
382        switch (type) {
383            case "QY":
384                weather.hidePressureTile();//等压图层
385                map.weatherChoroplethServer.hide();//等压线
386                break;
387            case "QW":
388                weather.hideTempTile();
389                break;
390            case "HF":
391                weather.hideSeaBreezes();//海风
392                break;
393            case "HL":
394                weather.hideSeaWaves(); //海浪
395                break;
396            case "FC":
397                weather.hideWindFiel() //风场
398                break;
399            case "TF":
400                weather.hideTyphoonInfoList(); //台风
401                $("#talent_person").show();
402                $("#talent_me").show();
403                $("#talent_close").show();
404                break;
405            case "CX":
406                weather.hideTides(); //潮汐
407                break;
408            case "HQ":
409                weather.hideSeaAreaForecasts(); //海区
410                break;
411            case "HAL":
412                weather.hideSeaWater(); //海流
413                break;
414            case "LC":
415                weather.hideOceanCurrentFiel(); //流场
416                break;
417            default:
418                break;
419        }
420    },
421    qxlog: function (type, time) {
422        $.post("/Meteorology/Log", { type: type, time: time });
423    },
424    //气象弹框事件
425    last_t: '',
426    evt: function () {
427        var _ = this;
428        $(".MeteoTime").change(function () {
429            var v = $(this).val();
430            if (_.last_t != v) {
431                _.last_t = v
432            }
433            else {
434                _.last_t = '';
435                return false;
436            }
437            var typedesc = '';
438            var n = '';
439            $("#ocenWeather a.chose").each(function (i, item) {
440                var type = $(item).attr('data-type');
441                switch (type) {
442                    case "QY":
443                        weather.showPressureTile(v);
444                        //等压线
445
446                        if (!_.weatherChoroplethServer) {
447                            _['weatherChoroplethServer'] = ShipxyAPI.weatherChoroplethServer(map);
448                            // that.weatherChoroplethServer = new Page_isoline(elane_map);
449                        }
450                        map.weatherChoroplethServer.show(v); 
451                        
452                        typedesc = 'qiya';
453                        n = '气压';
454                        break;
455                    case "QW":
456                        weather.showTempTile(v);
457                        typedesc = 'qiwen';
458                        n = '气温'
459                        break;
460                    case "HF":
461                        weather.showSeaBreezes(v);
462                        typedesc = 'haifeng';
463                        n = '海风';
464                        break;
465                    case "HL":
466                        weather.showSeaWaves(v);
467                        typedesc = 'hailang';
468                        n = '海浪';
469                        break;
470                    case "FC":
471                        weather.showWindFiel(v);
472                        typedesc = 'fengchang';
473                        break;
474                    case "HAL":
475                        weather.showSeaWater(v);
476                        typedesc = 'hailiu';
477                        n = '海流';
478                        break;
479                    case "LC":
480                        weather.showOceanCurrentFiel(v);
481                        typedesc = 'liuchang';
482                        n = '洋流';
483                        break;
484                    default:
485                        break;
486                }
487                if (map.getZoom() > 7 && n != "") layer.errorBlue($.common.lang.zoommapwatch);
488            });
489
490            //
491            if (typedesc) {
492                elane.weather.qxlog(typedesc, v);
493            }
494        });
495        $(".times_select  .time_sub").click(function (e) {
496            e.stopPropagation();
497            var cur_time = $(".MeteoTime").val() || _.formatDate(new Date());
498            var temp = _.timeSub(cur_time);
499            $(".times_select  .time_plus").show();
500            $(".times_select  .time_sub").show();
501            if (temp.show) {
502                $(".MeteoTime").val(temp.time).change();
503            }
504            if (!temp.hasData) {
505                $(".times_select  .time_sub").hide();
506            }
507
508        }).mouseover(function () {
509
510        }).mouseout(function () {
511
512        })
513        $(".times_select .time_plus").click(function (e) {
514            e.stopPropagation();
515            var cur_time = $(".MeteoTime").val();
516            var step = parseInt($("#MeteoStep").val());
517            var temp = _.timePlus(cur_time);
518            $(".times_select  .time_plus").show();
519            $(".times_select  .time_sub").show();
520            if (temp.show) {
521                $(".MeteoTime").val(temp.time).change();
522            }
523            if (!temp.hasData) {
524                $(".times_select  .time_plus").hide();
525            }
526        }).mouseover(function () {
527
528        }).mouseout(function () {
529
530        })
531        //
532
533    },
534    //产生气象日期数据
535    createTime: function (time) {
536        var _ = this,
537			maxDay = 6,//预报最多天
538			dayPoint = 4,//一天分4段
539			timeSpan = 6;//
540        _.timeHash = [];
541        if (!time) return;
542        //产生第一个
543        _.timeHash.push(_.getCurDate(new Date(time.replace(/\-/g, '/')), true));
544        //扩展存在数据的时间
545        for (var i = 0; i < maxDay * dayPoint - 1; i++) {
546            var cur = _.timeHash[_.timeHash.length - 1];
547            _.timeHash.push(_.formatDate(_.offsetDate(cur, timeSpan, 'h')));
548        }
549    },
550    //气象播报时间增加
551    timePlus: function (cur) {
552        var _ = this,
553			step = 6;
554        if (!_.timeHash || _.timeHash.length == 0) {
555            return {
556                show: false,
557                time: ''
558            }
559        };
560        var newTime = _.offsetDate(cur, step, 'h'),
561			cur_time = new Date(cur.replace(/\-/g, '/'));
562        //查询数据
563        var hasData = _.timeHash.filter(function (val) {
564            return val == _.formatDate(newTime);
565        })
566        //是否气象播报数据时间
567        if (hasData.length > 0) {
568            //校验时间是否在当前前展示数据变量中
569            if (hasData == _.timeHash) {
570                return {
571                    show: true,
572                    time: hasData[0],
573                    hasData: false
574                }
575            } else {
576                return {
577                    show: true,
578                    time: hasData[0],
579                    hasData: true
580                }
581            }
582
583        } else {
584            return {
585                show: false,
586                hasData: false
587            }
588        }
589    },
590    //气象播报时间减少
591    timeSub: function (cur, step) {
592        var _ = this,
593			step = -6;
594        if (!_.timeHash || _.timeHash.length == 0) {
595            return {
596                show: false,
597                time: ''
598            }
599        };
600        var newTime = _.offsetDate(cur, step, 'h'),
601			cur_time = new Date(cur.replace(/\-/g, '/'));
602        //查询数据
603        var hasData = _.timeHash.filter(function (val) {
604            return val == _.formatDate(newTime);
605        })
606        //是否气象播报数据时间
607        if (hasData.length > 0) {
608            //校验时间是否在当前前展示数据变量中
609            return {
610                show: true,
611                time: hasData[0],
612                hasData: true
613            }
614        } else {
615            return {
616                show: false,
617                hasData: false
618            }
619        }
620    },
621    //当前时刻数据
622    //preOrNetxt:取数据点时 取前一个还是后一个
623    //true:Next,false:pre
624    getCurDate: function (time, preOrNetxt) {
625        var _ = this,
626				curtime = null,
627			timeArr = [],
628			timeFormate = _.formatDate(time, 'yyyy-MM-dd');
629        timeArr.push(_.formatDate(
630			_.offsetDate(time, -24, 'h'),
631			'yyyy-MM-dd') + " 20:00:00");
632        timeArr.push((timeFormate + " 02:00:00"));
633        timeArr.push((timeFormate + " 08:00:00"));
634        timeArr.push((timeFormate + " 14:00:00"));
635        timeArr.push((timeFormate + " 20:00:00"));
636        timeArr.push(_.formatDate(
637			_.offsetDate(time, 24, 'h'),
638			'yyyy-MM-dd') + " 02:00:00");
639        for (var i = 0; i < timeArr.length; i++) {
640            curtime = new Date(timeArr[i].replace(/\-/g, '/')).getTime();
641            if (curtime >= time.getTime()) {
642                //取下一个
643                if (preOrNetxt) {
644                    curtime = timeArr[i];
645                    break;
646                } else {
647                    //取上一个
648                    curtime = timeArr[i - 1];
649                    break;
650                }
651
652            }
653        }
654        return curtime;
655    },
656    getCurDate_old: function (time, preOrNetxt) {
657        var _ = this,
658				curtime = null,
659			timeArr = [],
660			timeFormate = _.formatDate(time, 'yyyy-MM-dd');
661        timeArr.push(_.formatDate(
662			_.offsetDate(time, -24, 'h'),
663			'yyyy-MM-dd') + " 18:00:00");
664        timeArr.push((timeFormate + " 00:00:00"));
665        timeArr.push((timeFormate + " 06:00:00"));
666        timeArr.push((timeFormate + " 12:00:00"));
667        timeArr.push((timeFormate + " 18:00:00"));
668        timeArr.push(_.formatDate(
669			_.offsetDate(time, 24, 'h'),
670			'yyyy-MM-dd') + " 00:00:00");
671        for (var i = 0; i < timeArr.length; i++) {
672            curtime = new Date(timeArr[i].replace(/\-/g, '/')).getTime();
673            if (curtime >= time.getTime()) {
674                //取下一个
675                if (preOrNetxt) {
676                    curtime = timeArr[i];
677                    break;
678                } else {
679                    //取上一个
680                    curtime = timeArr[i - 1];
681                    break;
682                }
683
684            }
685        }
686        return curtime;
687    },
688    formatDate: function (d, fmt) {
689        $.isNumeric(d) && (d = new Date(d));
690
691        if ($.type(d) !== 'date')
692            return '';
693
694        fmt = fmt || 'yyyy-MM-dd hh:mm:ss'; //支持的格式模板部件有:y--年份,M--月份,d--日,h--24制小时,H--12制小时,m--分
695        var o = {
696            "M+": d.getMonth() + 1, //月份     
697            "d+": d.getDate(), //日     
698            "H+": d.getHours() % 12 === 0 ? 12 : d.getHours() % 12, //小时     
699            "h+": d.getHours(), //小时     
700            "m+": d.getMinutes(), //分     
701            "s+": d.getSeconds(), //秒     
702            "q+": Math.floor((d.getMonth() + 3) / 3), //季度     
703            "S": d.getMilliseconds() //毫秒     
704        };
705        /(y+)/.test(fmt) && (fmt = fmt.replace(RegExp.$1, (d.getFullYear() + "").substr(4 - RegExp.$1.length)));
706
707        for (var k in o) {
708            var v = o[k];
709            new RegExp("(" + k + ")").test(fmt) && (fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? v : ("00" + v).substr(("" + v).length)));
710        }
711
712        return fmt;
713    },
714    //给指定日期偏移指定量的时间(date:yyyy-MM-dd hh:mm,new Date)
715    offsetDate: function (date, offset, type) {
716        typeof date === 'string' && (date = new Date(date.replace(/\-/, '/')));
717
718        var y = date.getFullYear(),
719			m = date.getMonth(),
720			d = date.getDate(),
721			h = date.getHours(),
722			mm = date.getMinutes(),
723			s = date.getSeconds();
724
725        return {
726            y: new Date(y + offset, m, d, h, mm, s),
727            M: new Date(y, m + offset, d, h, mm, s),
728            d: new Date(y, m, d + offset, h, mm, s),
729            h: new Date(y, m, d, h + offset, mm, s),
730            m: new Date(y, m, d, h, mm + offset, s),
731            s: new Date(y, m, d, h, mm, s + offset)
732        }[type || 's']; //默认偏移类型是秒
733    },
734    //保存用户选择
735    _sethistory: function () {
736        var qxType = [];
737        $("#ocenWeather a").each(function (i, item) {
738            if ($(item).hasClass('chose')) {
739                //$(item).click();
740                qxType.push($(item).attr("data-type"));
741            }
742        })
743        //保存用户选择
744        layerManager.setOptions('QX', qxType.join());
745    },
746    //全球海区显示
747    qqhqShow: function () {
748        this.areaViewSymbol.showArea("GSEA");
749    },
750    qqhqHide: function () {
751        this.areaViewSymbol.hideArea("GSEA");
752    },
753    //台风[对应前端;排放控制区]
754    pfkzqShow: function () {
755        this.areaViewSymbol.showArea("TYP");
756    },
757    pfkzqHide: function () {
758        this.areaViewSymbol.hideArea("TYP");
759    },
760    //专属经济区[对应前端;]
761    zsjjqShow: function () {
762        this.areaViewSymbol.showArea("EEZ");
763    },
764    zsjjqHide: function () {
765        this.areaViewSymbol.hideArea("EEZ");
766    },
767    //排放控制区中国;]
768    pfkzqzgShow: function () {
769        this.areaViewSymbol.showArea("CTYP");
770    },
771    pfkzqzgHide: function () {
772        this.areaViewSymbol.hideArea("CTYP");
773    }
774
775
776}
777

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.