简体   繁体   English

为什么我的简单用户脚本不起作用?

[英]How come my simple userscript doesn't work?

I made a simple userscript that hides certain matchups on a video game website. 我做了一个简单的用户脚本,该脚本隐藏了视频游戏网站上的某些对决。

// ==UserScript==
// @name CSGL BO1 Removal
// @description Removes all BO1s on CSGL
// @namespace SP
// @include http://www.csgolounge.com/*
// @include http://csgolounge.com/*
// @match http://www.csgolounge.com/*
// @match http://csgolounge.com/*
// @grant       GM_addStyle
// @require     http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @version 1.0
// ==/UserScript==

var bo1Games = $("div.match span.format:contains('BO1')");
bo1Games.parent().parent().parent().parent().parent().hide();

This works perfectly fine when running from the chrome console. 从chrome控制台运行时,这工作得很好。

Can anyone give me a clue on why it's not working when implemented? 谁能给我一个线索,说明为什么它在实施时不起作用?

Try removing the apostrophes from the contains: 尝试从包含中删除撇号:

$("div.match span.format:contains(BO1)");

Also the HTML example shows that the format span contains the string BO3 - I take it that's not your issue? HTML示例还显示格式范围包含字符串BO3-我认为这不是您的问题吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM