mirror of
https://gitee.com/270580156/weiyu.git
synced 2026-04-30 05:50:17 +00:00
1 line
3.5 KiB
JavaScript
1 line
3.5 KiB
JavaScript
"use strict"; !function () { function t(t) { function o() { var t = document.createElement("iframe"); t.src = r.chatUrl, t.style.width = "100%", t.style.height = "100%", t.style.borderWidth = "2px", t.style.borderColor = "#ddd", t.style.borderStyle = "solid", t.style.borderRadius = "2%", y.appendChild(t) } function i() { a.style.display = "block", s.style.display = "none" } function n() { a.style.display = "none", s.style.display = "block" } var l = document.createElement("div"); l.id = "bytedesk-float-chat", document.body.appendChild(l); var r = Object.assign({}, e, t), s = document.createElement("button"); s.style.position = "fixed", s.style.left = "left" === r.buttonPosition ? r.buttonMargins.left + "px" : "", s.style.right = "right" === r.buttonPosition ? r.buttonMargins.right + "px" : "", s.style.bottom = r.buttonMargins.bottom + "px", s.style.width = "50px", s.style.height = "50px", s.style.borderRadius = "50%", s.style.backgroundColor = r.buttonBackgroundColor, s.style.color = "white", s.style.border = "none", s.style.cursor = "pointer", s.style.boxShadow = "0px 0px 10px 0px rgba(0,0,0,0.5)", s.style.display = r.showButton ? "block" : "none", s.innerHTML = '<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4384" width="26" height="26"><path d="M512 64c259.2 0 469.333333 200.576 469.333333 448s-210.133333 448-469.333333 448a484.48 484.48 0 0 1-232.725333-58.88l-116.394667 50.645333a42.666667 42.666667 0 0 1-58.517333-49.002666l29.76-125.013334C76.629333 703.402667 42.666667 611.477333 42.666667 512 42.666667 264.576 252.8 64 512 64z m0 64C287.488 128 106.666667 300.586667 106.666667 512c0 79.573333 25.557333 155.434667 72.554666 219.285333l5.525334 7.317334 18.709333 24.192-26.965333 113.237333 105.984-46.08 27.477333 15.018667C370.858667 878.229333 439.978667 896 512 896c224.512 0 405.333333-172.586667 405.333333-384S736.512 128 512 128z m-157.696 341.333333a42.666667 42.666667 0 1 1 0 85.333334 42.666667 42.666667 0 0 1 0-85.333334z m159.018667 0a42.666667 42.666667 0 1 1 0 85.333334 42.666667 42.666667 0 0 1 0-85.333334z m158.997333 0a42.666667 42.666667 0 1 1 0 85.333334 42.666667 42.666667 0 0 1 0-85.333334z" fill="#ffffff" p-id="4385"></></svg>', s.addEventListener("click", function () { r.showIframe && (o(), i()) }); var a = document.createElement("div"); a.style.position = "fixed", a.style.left = "left" === r.buttonPosition ? r.iframeMargins.left + "px" : "", a.style.right = "right" === r.buttonPosition ? r.iframeMargins.right + "px" : "", a.style.bottom = r.iframeMargins.bottom + "px", a.style.width = r.iframeWidth + "px", a.style.height = r.iframeHeight + "px", a.style.display = "none", a.style.backgroundColor = "white", a.style.zIndex = 1e3, a.style.borderRadius = "2%", a.style.boxShadow = "5px 5px 10px 0px rgba(0,0,0,0.5)"; var d = document.createElement("button"); d.innerText = "×", d.style.position = "absolute", d.style.right = "10px", d.style.top = "10px", d.style.padding = "5px", d.style.backgroundColor = "gray", d.style.color = "white", d.style.border = "none", d.style.cursor = "pointer", d.style.borderRadius = "10%", d.addEventListener("click", function () { n() }), l.appendChild(s); var y = l.appendChild(a); y.appendChild(d) } var e = { chatUrl: "https://www.weiyuai.cn/chat?t=1&sid=default_wg_uid&", buttonPosition: "right", buttonBackgroundColor: "blue", iframeWidth: 400, iframeHeight: 600, iframeMargins: { right: 20, bottom: 20, left: 20 }, buttonMargins: { right: 20, bottom: 20, left: 20 }, showButton: !0, showIframe: !0 }; window.ChatFloat = function (e, o) { return new t(e, o) } }(); |