如何在Slack Web Verision中触发TampermonKey/GreaseMonKey用户标记?

发布于 2025-02-05 10:46:17 字数 647 浏览 3 评论 0原文

我很难在Slack Web界面中执行任何用户字样。 如Tampermonkey所示,该脚本带有页面加载,但甚至没有写入控制台。

即使是完全基本的东西,例如下面也没有效果。

// ==UserScript==
// @name         New Userscript
// @namespace    Namespace
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://app.slack.com/*
// @grant        none
// ==/UserScript==

(function() {
    console.log('==================');
})();

我尝试使用WaitforKeyements,但没有成功。 有办法解决吗?

编辑: Firefox(101.0(64位))& amp;似乎特别是一个问题。 Tampermonkey 4.17.6161,AS Edge(版本102.0.1245.33(官方构建)(64位))& Tampermonkey 4.16.1与同一用户cription一起工作正常。

I'm having trouble getting any userscript to execute in Slack web interface.
The script is loaded with the page, as shown by Tampermonkey, but it doesn't even write into the console.

Even something totally basic like below has no effect.

// ==UserScript==
// @name         New Userscript
// @namespace    Namespace
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://app.slack.com/*
// @grant        none
// ==/UserScript==

(function() {
    console.log('==================');
})();

I tried to use waitForKeyElements but with no success.
Is there a way around this?

EDIT:
It appears to be a problem specifically with Firefox (101.0 (64-bit)) & Tampermonkey 4.17.6161, as Edge (Version 102.0.1245.33 (Official build) (64-bit)) & Tampermonkey 4.16.1 works fine with the same userscript.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

策马西风 2025-02-12 10:46:17

Firefox(101.0(64位))& amp;似乎特别是一个问题。 Tampermonkey 4.17.6161,AS Edge(版本102.0.1245.33(官方构建)(64位))& Tampermonkey 4.16.1与同一用户cription一起工作正常。
这里的变量很少,但是我认为这是我当前需求足以满足这个问题的答案。

It appears to be a problem specifically with Firefox (101.0 (64-bit)) & Tampermonkey 4.17.6161, as Edge (Version 102.0.1245.33 (Official build) (64-bit)) & Tampermonkey 4.16.1 works fine with the same userscript.
There are few variables here, but I consider this an answer to this question sufficient to my current needs.

回忆那么伤 2025-02-12 10:46:17

好的,所以让您知道它对我有用。但是还有许多其他线路淹没了控制台(尤其是在松弛频道中),因此我确保添加的控制台日志很容易注意到。这是我添加的:

// ==UserScript==
// @name         ___NewUserscript
// @namespace    http://tampermonkey.net/
// @match        https://app.slack.com/*
// @grant        none
// ==/UserScript==

(function() {
console.log('**********************************************************************');
console.log('**********************************************************************');
console.log('**********************************************************************');
console.log('**********************************************************************');
console.log('**********************************************************************');
console.log('**********************************************************************');
console.log('**********************************************************************');
console.log('**********************************************************************');
console.log('**********************************************************************');
console.log('**********************************************************************');
})();

在控制台中,我的星号块向下添加了约15行,然后出现了一条线条。

您可能是一个Firefox问题 - 我尝试使用Brave Browser(由创建Firefox的同一家伙的Chrome的安全变体)尝试了我的脚本,而且效果很好。

如果这是答案(即Firefox vs Chrome/Edge),请添加作为答案,并将其标记为正确的答案,以便结束问题并使下一个家伙轻松。

Okay, so letting you know that it worked for me. But there were many other lines that flooded the console (especially in a Slack channel), so I made sure the console log I added would be easy to notice. Here's what I added:

// ==UserScript==
// @name         ___NewUserscript
// @namespace    http://tampermonkey.net/
// @match        https://app.slack.com/*
// @grant        none
// ==/UserScript==

(function() {
console.log('**********************************************************************');
console.log('**********************************************************************');
console.log('**********************************************************************');
console.log('**********************************************************************');
console.log('**********************************************************************');
console.log('**********************************************************************');
console.log('**********************************************************************');
console.log('**********************************************************************');
console.log('**********************************************************************');
console.log('**********************************************************************');
})();

In the console, my blocks of asterisks were added about 15 lines down, and then scads of lines appeared after that.

You are probably right that it's a Firefox problem - I tried my script with Brave browser (a secure variant of Chrome by the same guy who created Firefox) and it worked fine.

If that's the answer (i.e. Firefox vs Chrome/Edge), please add that as an answer and mark it as the correct answer in order to close out the question and make it easy for the next guy.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文