自动关闭 Pro 弹窗
脚本检测 Canva Pro 推销弹窗并点击其自带的关闭按钮。
可复制的代码
try {
var check = function () {
var dialogs = document.querySelectorAll('[role="dialog"]');
dialogs.forEach(function (d) {
var label = (d.getAttribute('aria-label') || '').toLowerCase();
var txt = (d.textContent || '').toLowerCase();
if (label.indexOf('upgrade') > -1 ||
txt.indexOf('upgrade to canva pro') > -1) {
var btn = d.querySelector('[aria-label*="Close" i],[aria-label*="Dismiss" i]');
if (btn) { btn.click(); }
}
});
};
check();
var mo = new MutationObserver(check);
if (document.body) {
mo.observe(document.body, { childList: true, subtree: true });
}
} catch (e) {
console.warn('Canva pro dialog auto-close failed:', e);
}
如何使用此示例
- 用上方按钮复制代码。
- 安装 JustZix(2 分钟),在目标页面打开扩展。
- 添加一条匹配该页面的新规则。
- 将代码粘贴到规则的 JavaScript 面板并保存 — 每次访问页面时都会运行。
为此示例评分
暂无评分 — 成为第一个。