const currentJsPath = document.currentScript.src.replace(/\/org\/first\.js([\s\S]*)$/, '/'); // svg !function(o,l){var r,a,s="createElement",g="getElementsByTagName",b="length",E="style",d="title",y="undefined",k="setAttribute",w="getAttribute",x=null,A="__svgInject",C="--inject-",S=new RegExp(C+"\\d+","g"),I="LOAD_FAIL",t="SVG_NOT_SUPPORTED",L="SVG_INVALID",v=["src","alt","onload","onerror"],j=l[s]("a"),G=typeof SVGRect!=y,f={useCache:!0,copyAttributes:!0,makeIdsUnique:!0},N={clipPath:["clip-path"],"color-profile":x,cursor:x,filter:x,linearGradient:["fill","stroke"],marker:["marker", "marker-end","marker-mid","marker-start"],mask:x,pattern:["fill","stroke"],radialGradient:["fill","stroke"]},u=1,c=2,O=1;function T(e){return(r=r||new XMLSerializer).serializeToString(e)}function P(e,r){var t,n,i,o,a=C+O++,f=/url\("?#([a-zA-Z][\w:.-]*)"?\)/g,u=e.querySelectorAll("[id]"),c=r?[]:x,l={},s=[],d=!1;if(u[b]){for(i=0;i `0${n}`.slice(-2); let month = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; let mon = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec']; let li = { Y: this.getFullYear().toString(), m: a(this.getMonth() + 1), d: a(this.getDate()), H: a(this.getHours()), i: a(this.getMinutes()), s: a(this.getSeconds()), F: month[this.getMonth()], M: mon[this.getMonth()] }; for (let i in li) str = str.replace(i, li[i]); return str; }; // wow const styleElement = document.createElement('style'); styleElement.textContent = `[scalc],.wow,[wow],[number-roll]:not(.isstart){visibility:hidden}img{min-width:1px;min-height:1px;}`; document.head.appendChild(styleElement); // iframe璺ㄥ煙鍑芥暟 window.$$My = { GET(u){ let a = (u||location.href).replace(/#[\s\S]*$/,'').replace(/^[\S\s]*\?/,'').split('&'); let b = {}; for (let i in a) { let v = a[i].split('='); b[v[0]] = v[1]; } return b; }, form(f, d){ let o = f ? new FormData(f) : new FormData(); if (d) for (let i in d) o.append(i, d[i]); return o; }, isMobile:()=>navigator.userAgent.toLowerCase().search(/(ipad|iphone os|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile)/)>-1, loading:(p)=>$$My.tip('',{...(p||{}),loading:1}), loadingRemove:()=>$$My.tipRemove(), loadingSvg(p){ p.border = p.border || (p.wh>40?3:2); p.wh = p.wh || 20; p.r = p.wh/2 - p.border; return `` }, append:(el, h)=>el.insertAdjacentHTML('beforeend',h), prepend:(el, h)=>el.insertAdjacentHTML('afterbegin',h), before:(el, h)=>el.insertAdjacentHTML('beforebegin',h), after:(el, h)=>el.insertAdjacentHTML('afterend',h), html:(h)=>document.documentElement.insertAdjacentHTML('beforeend',h), // 鍔ㄧ敾 animation:{ // 鍖€閫熻繍鍔 to(opt, fn, time, t, ts, opc){ ts = ts || 1; // 閫掑綊娆℃暟 t = t || 16; // 鍗曟鏃堕棿 let s = time/t; // 娈垫暟 if (ts==1) { opc = {}; for(let o in opt) opc[o] = 0; } else if (ts>=s) opc = opt; else for(let i in opt) opc[i] = opt[i] / s + opc[i]; fn && fn(opc); if (ts{this.to(opt, fn, time, t, ts+1, opc)}, t); }, // 鎯€ф粴鍔 inertia(opt, fn, ts, opc){ ts = ts || 1; if (ts==1) { opc = {}; for(let o in opt) opc[o] = 0; } let ov = 0; for(let i in opt) { opt[i] *= 0.9; if (Math.abs(opt[i])>0.2) ov=1; opc[i] += opt[i]; } fn && fn(opc); if (ov) requestAnimationFrame(()=>{this.inertia(opt, fn, ts+1, opc)}) }, }, // 绉诲姩鍑芥暟 moveFn: {}, move(opt){ this.eventxyO = this.eventxy; this.moveFn = opt; this.moveFn.down && this.moveFn.down.bind(this.moveFn)(this.eventxy); }, moveEl(el, mEl){ this.move({ el: el, moveEl: mEl, down(p){ this.s = [parseFloat(this.moveEl.style.top) || 0, parseFloat(this.moveEl.style.left) || 0]; }, move(o, p){ this.moveEl.style.top = this.s[0] + p.y - o.y + 'px'; this.moveEl.style.left = this.s[1] + p.x - o.x + 'px'; }, }) }, moveScroll:(el)=>$$My.move({ el: el, s:{}, down(o){ this.el.classList.add('notcopy'); this.s = [this.el.scrollTop, this.el.scrollLeft]; }, move(o, p){ this.el.scrollTop = this.s[0] - (p.y - o.y); this.el.scrollLeft = this.s[1] - (p.x - o.x); }, up(p, speed){ this.s = [this.el.scrollTop, this.el.scrollLeft]; this.el.classList.remove('notcopy'); }, // 鎯€ф粴鍔 inertia({x,y}){ this.el.scrollTop = this.s[0] - y; this.el.scrollLeft = this.s[1] - x; }, }), scroll(el, p){ let x = el.scrollLeft; let y = el.scrollTop; $$My.animation.to(p, res=>{ if (p.x) el.scrollLeft = x + res.x if (p.y) el.scrollTop = y + res.y }, 300); }, // 瀹氭椂鍣 setTime(fn, t){ if (!this.setTimes || this.setTimes>=t) { fn(); this.setTimes = 0; } this.setTimes++; requestAnimationFrame(()=>{this.setTime(fn, t)}) }, // 榧犳爣浜嬩欢瀹氫綅 event(e){ let p = {x:0,y:0}; if (e) if (e.clientX) p = {x: e.clientX, y: e.clientY}; else if (e.originalEvent && e.originalEvent.changedTouches) p = {x: e.originalEvent.changedTouches[0].clientX, y: e.originalEvent.changedTouches[0].clientY}; p.x += ISFunc.rect.left; p.y += ISFunc.rect.top; return p; }, // 鍏冪礌瀹氫綅 rect(e, event){ let vw = document.documentElement.clientWidth; let vh = document.documentElement.clientHeight; let r = e ? e.getBoundingClientRect() : {left:0,top:0,right:vw,bottom:vh,width:vw,height:vh}; let x = r.left; let y = r.top; let w = r.width; let h = r.height; let p = [ this.event(event), {x:x,y:y}, {x:x+w/2,y:y}, {x:x+w,y:y}, {x:x,y:y+h/2}, {x:x+w/2,y:y+h/2}, {x:x+w,y:y+h/2}, {x:x,y:y+h}, {x:x+w/2,y:y+h}, {x:x+w,y:y+h}, ]; for (let i in p) { p[i].i = i; } r.position = p; return r; }, // 浣嶇疆鍐欐硶 // var LYY = { // pos:(el, event)=>$$My.position(el, event, { // // id: el.dataset.id, // hover: true, // position: 6, // html: `
`, // }), // posClose:(el, event)=>$$My.position(el).close(), // } position(el, event, opt){ if (!opt) return window[el.dataset.positionId]; let ID = el.dataset.positionId || 'POSITION'+(opt.id || Math.random().toString().replace('.','')).replace(/[^a-zA-Z0-9_]/g,'_'); if (window[ID]) { window[ID] = {...window[ID],...opt,el:el,event:event}; } else { opt = {position:2,zIndex:900,...opt,el:el,event:event}; window[ID] = { ...opt, close(){ let self = window[ID]; self.levea = 1; clearTimeout(self.timer); if (self.hover) self.timer = setTimeout(()=>{self.cur=!self.levea}, 300); else self.cur = 0; }, show(){ let self = window[ID]; self.cur = 1; self.levea = 0; !self.boxEl && $$My.html(`
${self.html}
`); self.el.dataset.positionId = ID; self.boxEl = document.getElementById(ID); self.conEl = document.getElementById(ID+'CON'); if (!self.running) self.resize(); }, resize(){ let self = window[ID]; if (!self.cur) { self.running = 0; self.boxEl.children[0].classList.remove('cur'); self.boxEl.style.left = '-99999px'; return; } self.boxEl.children[0].classList.add('cur'); self.running = 1; self.boxEl.style.left = '0px'; let conP = $$My.rect(self.conEl); let elP = $$My.rect(self.el, self.event); let p1 = elP.position[1]; let p = elP.position[Math.abs(self.position>9?0:self.position)]; let ww = $$My.rect(); let top = p.y - conP.height; let left = p.x - conP.width/2; // 閲嶆柊璁$畻left if ([-3,6,-7,-9].indexOf(self.position)>=0) left = p.x; if ([-4,4,-1,-100].indexOf(self.position)>=0) left = p.x - conP.width; if ([6].indexOf(self.position)>=0 && left > ww.width-conP.width) left = p1.x - conP.width; left = Math.max(Math.min(left, ww.width-conP.width), 0); self.conEl.style.left = left + 'px'; // 閲嶆柊璁$畻top if ([4,6].indexOf(self.position)>=0) top = p.y - conP.height/2; if ([-4,7,-7,8,9,-9].indexOf(self.position)>=0) top = p.y; if ([-4,7,-7,8,9,-9].indexOf(self.position)>=0 && top > ww.height-conP.height) top = p1.y - conP.height; if ([100, -100].indexOf(self.position)>=0 && top < conP.width) top = p.y; top = Math.max(Math.min(top, ww.height-conP.height), 0); self.conEl.style.top = top + 'px'; requestAnimationFrame(()=>{self.resize()}); }, }; } window[ID].show(); return window[ID]; }, tip(msg, opt={}){ typeof msg == 'object' && (opt = msg, msg = ''); opt.keep = opt.id?1:0; let ID = 'lG'+(opt.id || Math.random().toString().replace('.','')).replace(/[^a-zA-Z0-9_]/g,'_'); if (!window[ID]) { opt.bg = opt.bg || 3; opt.str = opt.str || `
${opt.loading ? this.loadingSvg({color:opt.color,...(opt.svg||{})})+(opt.immediately?'':' loading...') : msg}
`; this.html(`
${opt.str}
`.replace(/([^a-zA-Z0-9_])self\./g, '$1window.'+ID+'.')); window[ID] = { ...opt, popup_remove:()=>window[ID].remove(), remove:()=>window[ID].close(1), close(rm){ let re = !opt.keep||rm; $$My.tipClose(ID, re); opt.close && opt.close(re); re && delete window[ID]; }, show:()=>window[ID].open(), open(init){ init && this.init && this.init(); let lo = document.querySelector('.'+ID); let po = lo.querySelector('popup'); lo.classList.remove('not'); setTimeout(() => {lo.classList.add('cur'); po && po.classList.add('cur')}, opt.immediately?0:30); setTimeout(() => {lo.classList.add(ID+'trans')}, 200); if (opt.time) setTimeout(() => {this.close()}, opt.time); } } } window[ID].open(1); return window[ID]; }, tipRemove:(ID)=>$$My.tipClose(ID, 1), tipClose(ID, rm){ ID = ID || 'IGFLoading'; let lo = document.querySelector('.'+ID); if (lo) { lo.classList.remove('cur'); let po = lo.querySelector('popup'); po && po.classList.remove('cur'); setTimeout(() => {rm?lo.remove():lo.classList.add('not');lo.classList.remove(ID+'trans');}, 300); } }, }; window.IGFunc = { name:()=>'z' + Math.random().toString().replace('.',''), popup(url, opt){ let div = document.createElement('div'); let name = this.name(); url = url + (url.indexOf('?')==-1?'?':'&') + 'iframe='+name; div.id = name; div.innerHTML = ``; document.body.appendChild(div); $$My.loading(); return this.set(name, opt); }, set(name, {callback, remove, close}){ if (!name) name = this.name(); let el = document.querySelector('[name="'+name+'"]'); window[name] = { el: el, name: name, callback(res){ if (callback) callback.call(window[name], res); }, remove: (res) => { if (remove) remove.call(window[name], res); document.getElementById(name).remove(); delete window[name]; }, send(type, data){ window[name].source.postMessage({type, name, data}); }, size(res){ el.style.width = res.data.width; el.style.height = res.data.height; } }; return window[name]; } }; window.ISFunc = { rect:{ width: 0, height: 0, left: 0, top: 0, }, window:{ width: 0, height: 0, }, name(){ let href = location.href; let iframe = href.match(/iframe=([^&#]+)/); return iframe ? iframe[1] : ''; }, href(url){ let name = this.name(); if (name) url += (url.indexOf('?')==-1?'?':'&') + 'iframe='+name; location.href = url; }, send(type, data){ type = 'lyy:'+type; window.parent.postMessage({ type, name:this.name(), data}); }, popupEl(){ let popup = document.querySelector('popup') || document.body; return popup; }, remove(t){this.close(t||1)}, close(time){ this.popupEl().classList.remove('cur'); setTimeout(()=>{this.send('remove')}, time||300); }, first(){ this.popupEl().classList.add('cur'); this.send('first'); } }; window.addEventListener('message', e=>{ let name = e.data.name; let type = e.data.type; let o = window[name]; if (!type || type.indexOf('lyy:')==-1) return; // 鍒濆鍖 if (type.indexOf(':first')>0) { $$My.loadingRemove(); window[name].source = e.source; e.source.postMessage({type:'first'}); } // 鍒犻櫎iframe if (type.indexOf(':remove')>0) { o.remove(e.data); } // 璁剧疆瀹介珮 if (type.indexOf(':size')>0) { o.size(e.data); } // 鍥炶皟鍑芥暟 if (type.indexOf(':callback')>0) { o.callback(e.data); } // 鍥炶皟鍑芥暟 if (type.indexOf(':rect')>0) { ISFunc.rect.left = e.data.data.left; ISFunc.rect.top = e.data.data.top; } }); $$My.setTime(()=>{ let ifr = document.querySelectorAll('iframe'); if (ifr) for (let i=0;i{ $$My.eventxy = $$My.event(e); $$My.speedeventxy = $$My.lasteventxy? {x:$$My.eventxy.x - $$My.lasteventxy.x, y:$$My.eventxy.y - $$My.lasteventxy.y} : {x:0, y:0}; $$My.lasteventxy = $$My.event(e); $$My.moveFn.move && $$My.moveFn.move.bind($$My.moveFn)($$My.eventxyO, $$My.eventxy); }); window.addEventListener($$My.isMobile()?'touchend':'mouseup', (e)=>{ $$My.moveFn.up && $$My.moveFn.up.bind($$My.moveFn)($$My.eventxy, $$My.speedeventxy); // 鎯€ф嫋鎷 if ($$My.moveFn.inertia) { $$My.animation.inertia({ x: Math.max(Math.min($$My.speedeventxy.x, 9), -9), // 鏈€澶ч€熷害6 y: Math.max(Math.min($$My.speedeventxy.y, 9), -9), }, $$My.moveFn.inertia.bind($$My.moveFn)); } $$My.moveFn = {}; }); ////////////////////////////////////////// if (document.querySelector('meta[loading]')) { $$My.loading({bg:2,immediately:1,svg:{wh:50}}); }