【发布时间】:2016-12-25 12:39:50
【问题描述】:
我正在尝试为 XenForo 论坛打开一个覆盖对话框,重用现有库:
// ==UserScript==
// @name FooBar
// @match https://xenforo.com/community/
// @grant GM_getValue
// ==/UserScript==
(function() {
'use strict';
unsafeWindow.XenForo.createOverlay(null, $(`
<div class="xenOverlay">
<form id="efd_form">
<div class="section">
<h2 class="heading h1">Greasemonkey test</h2>
<h3 class="primaryContent">${GM_getValue('lorem', 'Lorem ipsum dolor sit amet …')}</h3>
</div>
</form>
</div>
`), { noCache: true }).load();
})();
当您使用 Tampermonkey (Firefox/Chromium) 访问 https://xenforo.com/community/ 时,此脚本将打开简单的对话框。
但是当你用 Greasemonkey (Firefox) 尝试它时,什么也没有发生。有没有办法在访问GM_getValue 的同时实现这一点?
【问题讨论】:
标签: firefox greasemonkey tampermonkey