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 ////////////////////////////////////////// // 瀵筳avascript鐨勭悊瑙f祿缂 // 瀹氭椂鍣 requestAnimationFrame = (function(){return requestAnimationFrame||webkitRequestAnimationFrame||mozRequestAnimationFrame||function(callback){setTimeout(callback,1000/60)}})(); // 鏃堕棿鏍煎紡 Date.prototype.date = function(str) { let a = n => `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,un){ if (un && typeof(un)=='string') un = un.split(','); var a = (u||location.href).replace(/^[\S\s]*\?|#[\s\S]{0,}$/g,'').split('&'); var b = {} for (var i in a) { var v = a[i].split('='); if (!un || un.indexOf(v[0])<0) b[v[0]] = v[1]; } return b; }, queryString(u, un){ let r = (u||location.href).split('?'); let g = $$My.GET(r[1], un); let q = []; for (let i in g) q.push(i+'='+g[i]); return r[0]+'?'+q.join('&'); }, includeArr:[], include(f){ f = f.replace(/^(https?:)?\/\//,'$1##').replace(/([\/]+)/g,'/').replace(/\?[\s\S]+$/,'').replace(/##/,'//'); if (this.includeArr.includes(f)) return; this.includeArr.push(f); let s; if (f.search(/\.js$/)>0) {s=document.createElement('script'); s.type='text/javascript'; s.src=f;} else {s=document.createElement('link'); s.type='text/css'; s.rel='stylesheet'; s.href=f;} document.getElementsByTagName('head')[0].appendChild(s); }, 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; }, formObjectKey:(o,p='')=>Object.entries(o).reduce((r,[k,v])=>{const K=p?`${p}[${k}]`:k;return typeof v==='object'&&v!==null&&!Array.isArray(v)?{...r,...$$My.formObjectKey(v,K)}:{...r,[K]:v}},{}), formObject(f,d) { let o = Object.fromEntries(this.form(f, d)); const r = {}; for (const [k, v] of Object.entries(o)) { const key = k.replace(/\]/g, '').split('['); let c = r; for (let i = 0; i < key.length; i++) { const n = key[i]; if (i === key.length - 1) { c[n] = v; } else { c[n] = c[n] || {}; c = c[n]; } } } return r; }, json(str){ if (typeof(str)=='string') { // 淇涓嶈鑼冪殑json瀛楃涓 let un = [ ['\n','\r','\t',' '], ['`n`','`r`','`t`','`u`'] ]; function r (a,b,c){for(var i in a)c=c.replace(new RegExp(a[i],'g'),b[i]);return c;} function s (a) {for(var i in a)if(typeof(a[i])=='string')a[i]=r(un[1],un[0],a[i]);else s(a[i]);} try { let z = JSON.parse(str.replace(/"([^"\\]*(\\.[^"\\]*)*)"/g, m=>r(un[0],un[1],m))); s(z); return z; } catch (e) { return {}; } } else { return JSON.stringify(str); } }, 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.body||document.documentElement).insertAdjacentHTML('beforeend',h), DOM:(h)=>new DOMParser().parseFromString(h.replace(/^[\s\S]*]*>|<\/body>[\s\S]*$/g,''), 'text/html'), // 鏃犳劅鍒锋柊鏂规硶 flushCallback:{}, flush:()=>fetch('').then(res=>res.text()).then(html=>{ html = $$My.DOM(html); document.querySelectorAll('[ajax-change]').forEach(e=>{ let el = html.querySelector(`[ajax-change="${e.getAttribute('ajax-change')}"]`); if (el) e.innerHTML = el.innerHTML; }); Object.values($$My.flushCallback).forEach(fn=>fn(html)); $$My.RunAll(); }), // 鍔ㄧ敾 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); }, // 瀹氭椂鍣 setTimeFn: {}, RunAll(){for (let n in this.setTimeFn) {this.setTimeFn[n](); delete this.setTimeFn[n];}}, setTime(fn, t, ts, n){ t = t || Math.floor(Math.random() * 41) + 10; n = n || Math.random(); if (!ts || ts>=t) { this.setTimeFn[n] = fn; fn(); ts = 0; } requestAnimationFrame(()=>{this.setTime(fn, t, ts+1, n)}) }, // 榧犳爣浜嬩欢瀹氫綅 event(e, t){ 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 += t?0:ISFunc.rect.left; p.y += t?0: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: `
`, // }).show(), // posClose:(el, event)=>$$My.position(el).close(), // } position(el, event, opt){ opt = opt || {}; 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,padding:0,margin:0,zIndex:900,keep:1,...opt,el:el,input:el.querySelector('input[type="text"]'),event:event}; window[ID] = { ...opt, toggle(){ let self = window[ID]; if (self.input) { self.input.focus(); self.input.select(); } }, remove(){ this.keep = 0; this.close(); }, 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; }, closeSoon(){ let self = window[ID]; self.levea = 1; self.cur = 0; self.boxEl.style.left = '-99999px'; }, create(){ let self = window[ID]; !self.boxEl && $$My.html(`
${self.html}
`.replace(/([^a-zA-Z0-9_])__THIS\./g, '$1'+ID+'.')); self.el.dataset.positionId = ID; }, show(){ let self = window[ID]; self.cur = 1; self.levea = 0; self.create(); self.boxEl = document.getElementById(ID); self.conEl = document.getElementById(ID+'CON'); self.inpEl = document.getElementById(ID+'INP'); if (!self.running) self.resize(); setTimeout(()=>{self.cur&&self.conEl.children[0].classList.add('cur');}, 30); self.el.classList.add('cur'); }, resize(){ let self = window[ID]; if (!self.cur) { self.running = 0; self.el.classList.remove('cur'); self.conEl.children[0].classList.remove('cur'); clearTimeout(self.closeTi); self.closeTi = setTimeout(()=>{ self.boxEl.style.left = '-99999px'; if (!self.keep) { delete window[ID]; self.boxEl.remove(); } }, self.closeDelayTime||1); return; } 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.floor(Math.abs(self.position>9?0:self.position))]; let ww = $$My.rect(); let top = p.y - conP.height - self.padding; let left = p.x - conP.width/2; // 閲嶆柊璁$畻left if ([-3,-7,-9,7.5].indexOf(self.position)>=0) left = p.x; if ([-1,-100].indexOf(self.position)>=0) left = p.x - conP.width; if ([-4,4].indexOf(self.position)>=0) left = p.x - conP.width - self.padding; if ([6].indexOf(self.position)>=0) left = p.x + self.padding; if ([6].indexOf(self.position)>=0 && left > ww.width-conP.width) left = p1.x - conP.width - self.padding; left = Math.max(Math.min(left, ww.width-conP.width-self.margin), self.margin); self.conEl.style.left = left + 'px'; // 閲嶆柊璁$畻top if ([4,6].indexOf(self.position)>=0) top = p.y - conP.height/2; if ([-4].indexOf(self.position)>=0) top = p.y; if ([7,7.5,-7,8,9,-9].indexOf(self.position)>=0) top = p.y + self.padding; if ([7,7.5,-7,8,9,-9].indexOf(self.position)>=0 && top > ww.height-conP.height) top = p1.y - conP.height - self.padding; if ([100, -100].indexOf(self.position)>=0 && top < conP.width) top = p.y + self.padding; top = Math.max(Math.min(top, ww.height-conP.height-self.margin), self.margin); self.conEl.style.top = top + 'px'; // 杈撳叆妗嗕綅缃 if (self.input) { let pP = $$My.rect(self.input); self.inpEl.style=`left:${pP.left}px;top:${pP.top}px;width:${pP.width}px;height:${pP.height}px;pointer-events:auto;`; } requestAnimationFrame(()=>{self.resize()}); }, }; } 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_])__THIS\./g, '$1'+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.replace('#','?').split('?'); url = url[0] + '?' + url[1] + '&ThisIsPopupIframe=1&iframe='+name + '#' + (url[2]||''); div.id = name; div.innerHTML = ``; document.body.appendChild(div); $$My.loading(); return this.set(name, opt); }, set(name, opt){ if (!name) name = this.name(); let el = document.querySelector('[name="'+name+'"]'); if (!opt) return window[name]; window[name] = { el: el, name: name, first(res){ if (opt.first) opt.first.call(window[name], res); }, callback(res){ if (opt.callback) opt.callback.call(window[name], res); }, remove(time){ if (opt.remove) opt.remove.call(window[name]); setTimeout(()=>{document.getElementById(name).remove();}, time||1); delete window[name]; }, send(type, data){ type = 'lyy:'+type; window[name].el.contentWindow.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'); this.send('remove', {time: 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(); o && o.first(e.data); } // 鍒犻櫎iframe if (type.indexOf(':remove')>0) { if (e.data.data && e.data.data.time) o.remove(e.data.data.time); else o.remove(1); } // 璁剧疆瀹介珮 if (type.indexOf(':size')>0) { o.size(e.data); } // 鍥炶皟鍑芥暟 if (type.indexOf(':callback')>0) { o && o.callback(e.data); if (window.ISFunc.callback) window.ISFunc.callback(e.data); if (window.IGFunc.callback) window.IGFunc.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}}); }