pops

纯JavaScript编写的弹窗,内置方法confirm、alert、prompt、loading、iframe、isPhone、tooltip、folder、panel、rightClickMenu。

目前為 2023-12-16 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/456485/1296703/pops.js

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

作者
WhiteSevs
版本
0.0.1.20231216072134
建立日期
2022-12-12
更新日期
2023-12-16
尺寸
285.0 KB
授權條款
未知

自定义弹窗

pops.alert    /* 普通信息框 */
pops.confirm  /* 询问框 */
pops.prompt   /* 输入框 */
pops.loading  /* 加载层 */
pops.iframe   /* iframe层 */
pops.isPhone  /* 判断是否是手机访问 */
pops.tooltip  /* 提示框 */
pops.drawer   /* 抽屉层 */
# 部分使用方法

pops.alert({
  closeEnable: false,
  mask: {
    enable: true
  },
  only: true,
});

pops.prompt({
  position: "center",
  closeEnable: true,
  mask: {
    enable: true
  },
  only: true,
  title: {
    text: "prompt",
    position: "center",
  },
  content: {
    placeholder: "提示",
    text: "自带的内容",
    row: false /* 多行 */,
    focus: true /* 输入框自动聚焦 */,
  },
  btn: {
    ok: {
      callback: (event) => {
        console.log(event);
        alert("确定");
        event.close();
      },
    },
  },
});

pops.loading({
  parent: document.body,
  only: true,
});

pops.tooltip({
  target: document.querySelector(".xxx"),/* 目标元素 */
  content:"测试文字",
  location:"top", /* 提示框弹出的方向 上、右、下、左(left,right,bottom,top)*/,
  triggerShowEventName: "mouseenter" /* 触发显示事件的名称  */,
  triggerCloseEventName: "mouseleave" /* 触发关闭事件的名称  */,
  triggerShowEventCallBack: function () {} /* 触发显示事件的回调 */,
  triggerCloseEventCallBack: function () {} /* 触发关闭事件的回调*/,
})

pops.drawer()

详情参数请看代码