1 2var WeatherPlayBack = function(opts){ 3 this.initialize(opts); 4} 5WeatherPlayBack.prototype = { 6 options: { 7 contanier:'', 8 playSpeed: 60, 9 playCallBack: null, 10 data:[] 11 }, 12 hash:{}, 13 playSate: !1, 14 currentTimePosition: 0, 15 playSpeed: 60, 16 minTime: 0, 17 maxTime: 0, 18 playItems: {}, 19 frequency: 1, 20 _timer_move: void 0, 21 areaLayer: void 0, 22 area_arr: void 0, 23 initialize: function (e) { 24 var i = this; 25 i.options = { 26 contanier: '', 27 playSpeed: 60, 28 playCallBack: null, 29 data: [] 30 }, 31 i.playItems = {}, 32 e && L.Util.extend(i.options, e), 33 i.setTimeRange(), 34 i.playSate = !1, 35 i._createPlayerHtml(), 36 i.initPlayItem() 37 return i; 38 }, 39 setTimeRange: function () { 40 var t = this; 41 var minTime, maxTime; 42 t.options.data.forEach(function (item,i) { 43 t.hash[item.playtime] = item; 44 if (i == 0) minTime = item.playtime; 45 if (i == t.options.data.length - 1) maxTime = item.playtime; 46 }); 47 t.minTime = minTime; 48 t.maxTime = maxTime; 49 t.currentTimePosition = t.minTime; 50 }, 51 initPlayItem: function () { 52 var t = this; 53 t._resetMinMaxTime(), 54 t.setPlayerDisplay(), 55 t.playStart(null, !1, !0); 56 t.options.clearLayer && t.options.clearLayer(); 57 }, 58 removeAll: function () { 59 var t = this; 60 t.currentTimePosition = 0, 61 t.playStop(), 62 t.areaLayer && t.areaLayer.remove(), 63 L.DomUtil.remove(t.playerDiv) 64 }, 65 playStart: function (t, e, i) { 66 var n = this; 67 if (null == i && (i = !1), 68 1 == i) 69 return; 70 t ? (n.currentTimePosition = Math.max(n.minTime, t), 71 n.currentTimePosition = Math.min(n.currentTimePosition, n.maxTime)) : (n.currentTimePosition = Math.max(n.currentTimePosition, n.minTime), 72 n.currentTimePosition = Math.min(n.currentTimePosition, n.maxTime)), 73 n.currentTimePosition >= n.maxTime && (n.currentTimePosition = n.minTime), 74 n.currentTimePosition <= n.minTime && (n.currentTimePosition = n.minTime), 75 null == e && (e = !1), 76 0 == n.playSate && (n.playSate = !0, 77 n._setPlayBtnClass(), 78 n._playByPosition(e)) 79 }, 80 playStop: function () { 81 var t = this; 82 t.playSate = !1, 83 t._setPlayBtnClass() 84 }, 85 playStartOrStop: function () { 86 var t = this; 87 return 1 == t.playSate ? t.playStop() : ( 88 t.initPlayItem(),setTimeout(function () { t.playStart() }, 1e3 * t.frequency)); 89 }, 90 _playByPosition: function (t) { 91 var e = this; 92 1 == e.playSate && (null == t && (t = !1), 93 e.currentTimePosition < e.maxTime ? (0 == t && (e.currentTimePosition = e.getcurrentTime()), 94 e.currentTimePosition >= e.maxTime && (e.currentTimePosition = e.maxTime), 95 e._setPlayerPosition(), 96 e.options.playCallBack && e.options.playCallBack(e.currentTimePosition), 97 1 == e.playSate && 0 == t ? setTimeout(function () { 98 e._playByPosition() 99 }, 1e3 * e.frequency) : (e.playSate = !1, 100 e._setPlayBtnClass())) : (ShipxyAPI.console().log("ææ¾å®æ!"), 101 e.playSate = !1, 102 e._setPlayBtnClass(), 103 e.currentTimePosition = e.maxTime, 104 e._setPlayerPosition(), 105 e.options.playCallBack && e.options.playCallBack(e.currentTimePosition))) 106 }, 107 getcurrentTime: function () { 108 var e = this,c,idx=-1; 109 var data = e.options.data,time; 110 for (var i = 0; i < data.length; i++) { 111 c = data[i].playtime; 112 if (c > e.currentTimePosition) { 113 idx = i - 1; 114 break; 115 } 116 } 117 118 if (idx != -1) { 119 time = data[idx + 1].playtime || data[0].playtime 120 } else { 121 time = data[0].playtime 122 } 123 return time; 124 }, 125 _resetMinMaxTime: function () { 126 var t = this; 127 0 == t.minTime || 0 == t.maxTime ? (t.currentTimePosition = t.minTime): (t.currentTimePosition < t.minTime && (t.currentTimePosition = t.minTime)); 128 }, 129 _createPlayerHtml: function () { 130 var t = this; 131 t.playerDiv = L.DomUtil.create("div", "castboxplayer areaplayer", t.options.container), 132 L.DomEvent.disableClickPropagation(t.playerDiv), 133 t.playerOptionDiv = L.DomUtil.create("div", "areaplayer-option", t.playerDiv), 134 t.playBtn = L.DomUtil.create("input", "areaplayer-play start float-left", t.playerOptionDiv), 135 t.playBtn.type = "button", 136 t.playerTiao = L.DomUtil.create("div", "areaplayer-tiao", t.playerDiv), 137 t.playerYuan = L.DomUtil.create("div", "areaplayer-yuan", t.playerTiao), 138 t.playerJindu = L.DomUtil.create("div", "areaplayer-jindu", t.playerTiao), 139 t.playerCloseDiv = L.DomUtil.create("div", "areaplayer-close", t.playerDiv), 140 t.playerCloseImg = L.DomUtil.create("Img", "", t.playerCloseDiv), 141 t.playerTiaoW = t.playerTiao.offsetWidth - t.playerYuan.offsetWidth, 142 t.playerPercentage = 0, 143 t.playerMinValue = 0, 144 t.playerMaxValue = 100, 145 t._buildPlayer(), 146 t.playerCloseImg.setAttribute('src','/Content/images/white_close_btn.png') 147 }, 148 _setPlayBtnClass: function (t) { 149 var e = this; 150 L.DomUtil.removeClass(e.playBtn, "start"), 151 L.DomUtil.removeClass(e.playBtn, "stop"), 152 null != t && (e.playSate = t), 153 1 == e.playSate ? L.DomUtil.addClass(e.playBtn, "stop") : L.DomUtil.addClass(e.playBtn, "start") 154 }, 155 _buildPlayer: function () { 156 var t = this 157 , e = document.body; 158 t.isMousedown = !1, 159 t.playBtn.onclick = function (e) { 160 t.playStartOrStop() 161 } 162 , 163 t.playerYuan.onmousedown = function (i) { 164 t.isMousedown = !0, 165 e.onmousemove = function (e) { 166 t._setYuanPosition(e) 167 } 168 } 169 , 170 e.onmouseup = function (e) { 171 t.isMousedown = !1 172 } 173 , 174 t.playerTiao.onclick = function (e) { 175 t.isMousedown = !0, 176 t._setYuanPosition(e), 177 t.isMousedown = !1 178 }, 179 t.playerCloseDiv.onclick = function () { 180 t.options.container.style.display = 'none'; 181 t.options.close && t.options.close(); 182 } 183 }, 184 _setYuanPosition: function (t) { 185 var e = this; 186 if (0 != e.isMousedown) { 187 e.playStop(), 188 e._timer_move && clearTimeout(e._timer_move); 189 var i = (e.playerYuan.offsetLeft, 190 e.playerYuan.offsetWidth) 191 , n = e.playerTiaoW + Math.round(i / 2) 192 , o = t.clientX 193 , r = o - e.playerDiv.offsetLeft - e.playerTiao.offsetLeft - Math.round(i / 2) 194 , a = Math.min(n, r); 195 e.playerYuan.style.marginLeft = Math.max(0, a) + "px", 196 e.playerJindu.style.width = a + "px", 197 e.playerPercentage = Math.round(1e4 * Math.max(0, a / n)) / 1e4; 198 var s = e.maxTime - e.minTime 199 , l = e.minTime + Math.round(e.playerPercentage * s); 200 l = 60 * parseInt(l / 60), 201 e._timer_move = setTimeout(function () { 202 e.playStart(l, !0) 203 }, 500) 204 } 205 }, 206 _setPlayerPosition: function () { 207 var t = this 208 , e = Math.max(0, t.currentTimePosition - t.minTime); 209 t.playerMinValue = 0, 210 t.playerMaxValue = Math.max(0, t.maxTime - t.minTime), 211 //t.playerCtime.innerHTML = CanvasShipUtils.dataFormat(new Date(1e3 * t.currentTimePosition), "yyyy-MM-dd hh:mm:ss"), 212 t.currentTimePosition == t.maxTime && t._setPlayBtnClass(!1), 213 t.playerPercentage = Math.round(e / t.playerMaxValue * 1e4) / 1e4; 214 var i = t.playerYuan.offsetWidth; 215 t.playerTiaoW = t.playerTiao.offsetWidth - i; 216 var n = t.playerTiaoW + Math.round(i / 2); 217 t.playerPercentage = Math.max(0, t.playerPercentage), 218 t.playerPercentage = Math.min(1, t.playerPercentage); 219 var o = t.playerPercentage * n; 220 t.playerYuan.style.marginLeft = o + "px", 221 t.playerJindu.style.width = o + "px" 222 }, 223 setPlayerDisplay: function (t) { 224 var e = this; 225 null == t && (t = e.maxTime - e.minTime > 0), 226 L.DomUtil.removeClass(e.playerDiv, "areaplayer-display-none"), 227 L.DomUtil.removeClass(e.playerDiv, "areaplayer-display-block"), 228 1 == t ? (L.DomUtil.addClass(e.playerDiv, "areaplayer-display-block"), 229 e.playerTiaoW = e.playerTiao.offsetWidth - e.playerYuan.offsetWidth, 230 e.playStart(null, !0)) : L.DomUtil.addClass(e.playerDiv, "areaplayer-display-none") 231 } 232}
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.