在Google Play订单历史上过滤$ 0.00值
我想在Google Play上检查旧购买,但是历史将显示一切我声称。包括大量免费应用程序(列出为$ 0.00),并且不可能过滤该列表中的任何内容。
因此,我认为我可以制作一个简单的TampermonKey脚本来为我做,但由于某种原因无法工作。
我在这里想念什么?谢谢。
这是我到目前为止得到的:
// ==UserScript==
// @name Filter Out $0.00 Garbage
// @namespace http://tampermonkey.net/
// @version 0.1
// @description ...
// @author Me
// @match https://play.google.com/store/account/orderhistory
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.com
// @grant none
// ==/UserScript==
(function() {
var ele = document.getElementsByClassName('mshXob');
for (var i = 0; i < ele.length; ++i) {
var item = ele[i];
if (item.innerHTML == '$0.00') {
var gp = item.parentNode.parentNode.parentNode;
gp.style.display = 'none';
}
}
})();
I wanted to check an old purchase on Google Play, but the history will show everything that I claimed. Including, a ton of free apps (listed as $0.00), and it's impossible to filter anything in that list.
So I thought I could make a simple TamperMonkey script to do it for me, but it's not working for some reason.
What am I missing here? Thanks.
Here's what I got so far:
// ==UserScript==
// @name Filter Out $0.00 Garbage
// @namespace http://tampermonkey.net/
// @version 0.1
// @description ...
// @author Me
// @match https://play.google.com/store/account/orderhistory
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.com
// @grant none
// ==/UserScript==
(function() {
var ele = document.getElementsByClassName('mshXob');
for (var i = 0; i < ele.length; ++i) {
var item = ele[i];
if (item.innerHTML == '$0.00') {
var gp = item.parentNode.parentNode.parentNode;
gp.style.display = 'none';
}
}
})();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
也许在此处使用XPATH尝试一下
:
Note :我不确定是否有一种方法可以断开观察者在Userscript中的连接。
Maybe try it out with XPATH
Here:
Note: I'm not sure if there is a way to disconnect the observer or not inside the userscript.
您可能依靠更改的类名称。 JavaScript库(例如Angular/React/etc)可能会将ID和类名称更改为混淆代码。
尝试使用不依赖恒定ID和类名的DOM选择器和DOM遍历方法。
尝试以下操作:
You may be relying on classNames that change. JavaScript libraries like Angular/React/etc may change IDs and ClassNames to obfuscate code.
Try using DOM selectors and DOM traversal methods that do not rely on constant ID and class names.
Try this:
这是另一个答复您的评论(由于需要更多的灵活性而无法回答)。
访问该页面时,TM图标会得到红点吗?如果是这样,脚本正在运行但不起作用;如果没有,@Match行没有触发脚本(即与URL不匹配)。您能确定哪种情况吗?
接下来要检查:打开DevTools(F12)并在第一个QuerySelector中粘贴。 devtools是否显示这样的内容(DevTools正在使用
div.ngftbf.fny74c
):”行,可能有必要调整选择器。做到这一点的方法是逐步构建选择器,并查看添加每个阶段时会发生什么:
然后:
noreferrer“>
- 也尝试)
在每个阶段,Chrome DevTools应该显示一些东西。例如:
您可能会发现此视频很有帮助: https> https:https: //www.youtube.com/watch?v=sowajlx1uka
让我知道您所看到的。
Here is another answer responding to your comment (could not respond with a comment because more flexibility required).
Does the TM icon get a red dot when you visit that page? If so, the script is running but not working; if not, the @match line is not triggering the script (i.e. does not match the url). Can you determine which is the case?
Next thing to check: open DevTools (F12) and paste in the first querySelector. Does DevTools show anything like this (DevTools is responding with
div.NgfTBf.fny74c
):If nothing appears when you paste-in that querySelector line, it might be necessary to tweak that selector. The way to do that is to build-up the selector bit-by-bit and see what happens as each stage is added:
then:
(that one might need to be
nth-child(3)
- try that also)At each stage, Chrome DevTools should show something. For example:
You might find this video to be helpful: https://www.youtube.com/watch?v=SowaJlX1uKA
Let me know what you see.