1 Star 0 Fork 0

淡云孤月/alay

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
alay.min.js 3.73 KB
一键复制 编辑 原始数据 按行查看 历史
淡云孤月 提交于 2023-03-23 09:53 . no commit message
!function (a, l) { let e = l.body, o = { newElm: a => { var l = document.createElement("a"); return l.innerHTML = a, l.firstChild }, fadeIn: (a, l) => { a.style.opacity = 0, e.appendChild(a); let o = 0, t = setInterval(e => { o += 20, a.style.opacity = o / 100, 100 == o && (clearInterval(t), l && l()) }, 20) }, fadeOut: (a, l) => { a.style.opacity = 1; let o = 100, t = setInterval(n => { o -= 20, a.style.opacity = o / 100, 0 == o && (clearInterval(t), e.removeChild(a), l && l()) }, 20) }, newId: () => "m" + (1e6 * Math.random()).toFixed(0), msg: (a, l) => { l || (l = 2e3); let e = o.newElm(`<div class="alay-info">${a}</div>`); o.fadeIn(e, a => { setTimeout(a => { o.fadeOut(e) }, l) }) }, alert: (a, l, e) => { e || (e = "消息"); let t = o.newId(), n = o.newElm(`<div id="${t}" class="alay-container"><div class="alay-panel"><div class="alay-title">${e}<label onclick="alay.close('${t}',false)">×</label></div><div class="alay-content">${a}</div><div class="alay-btns"><input type="button" class="alay-btn-ok" onclick="alay.close('${t}',true)" value="确定"></div></div></div></div></div>`); o.fadeIn(n), o.fc = l }, loading: a => { a || (a = "加载中"); let l = o.newId(), e = o.newElm(`<div id="${l}" class="alay-container"><div class="alay-loading"><div class="alay-icon"></div>${a}</div></div>`); return o.fadeIn(e), l }, close: (a, l) => { let e = document.querySelector("#" + a); o.fadeOut(e), o.fc && (o.fc(l), o.fc = 0) }, confirm: (a, l, e) => { e || (e = "消息"); let t = o.newId(), n = o.newElm(`<div id="${t}" class="alay-container"><div class="alay-panel"><div class="alay-title">${e}<label onclick="alay.close('${t}',false)">×</label></div><div class="alay-content">${a}</div><div class="alay-btns"><input type="button" class="alay-btn-cancel" onclick="alay.close('${t}',false)" value="取消"><input type="button" class="alay-btn-ok" onclick="alay.close('${t}',true)" value="确定"></div></div></div></div></div>`); o.fadeIn(n), o.fc = l } }; a.alay = o; let t = o.newElm("<style>@keyframes load{0%{transform:rotate(0deg);}100%{transform:rotate(360deg);}}.alay-info{position:fixed;background-color:rgba(0,0,0,.6);color:#fff;padding:6px 20px;border-radius:5px;font-size:13px;top:50%;letter-spacing:1px;left:50%;transform:translate(-50%,-50%);box-shadow:0 0 5px #fff;}.alay-container{position:fixed;width:100vw;height:100vh;top:0;left:0;display:flex;justify-content:center;align-items:center;}.alay-loading{width:100px;height:80px;background-color:rgba(0,0,0,.6);border-radius:15px;text-align:center;color:#fff;font-size:13px;padding-top:18px;line-height:32px;}.alay-icon{border:5px solid #f3f3f3;border-radius:50%;border-top:5px solid #ff6666;width:30px;height:30px;margin:auto;animation:load 2s ease-in-out infinite;}.alay-panel{position:fixed;width:250px;background-color:#fff;box-shadow:0 0 8px #bbb;border-radius:5px;top:50%;left:50%;transform:translate(-50%,-50%);}.alay-panel .alay-title{background-color:#6669ff;border-radius:5px 5px 0 0;color:#fff;padding:5px 10px;box-sizing:border-box;display:flex;justify-content:space-between;}.alay-panel .alay-title label{cursor:pointer;display:block;width:20px;text-align:center;}.alay-panel .alay-content{padding:5px 10px;font-size:14px;min-height:80px;}.alay-panel .alay-btns{padding:6px 10px;border-top:1px solid #ddd;overflow:hidden;}.alay-panel .alay-btns input{outline:none;border-radius:5px;padding:2px 10px;font-size:13px;transition:all .1s;cursor:pointer;}.alay-btn-ok{background-color:#fff;border:1px #aaa solid;float:right;}.alay-btn-cancel{background-color:#fff;border:1px #ff6666 solid;color:#ff6666;float:left;}.alay-btn-ok:hover{background-color:#ff6666;color:#fff;border-color:#ff6666;}.alay-btn-cancel:hover{background-color:#ff6666;color:#fff;border-color:#ff6666;}</style>"); l.head.appendChild(t) }(window, document);
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/axspic/alay.git
git@gitee.com:axspic/alay.git
axspic
alay
alay
master

搜索帮助