创建Greasemonkey脚本以在找到时删除某些HTML行 [英] Create Greasemonkey script to Remove certain HTML lines when found

查看:78
本文介绍了创建Greasemonkey脚本以在找到时删除某些HTML行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作可以删除html中某些行的油脂猴子脚本

I'm trying to make grease monkey script that could remove certain lines in html

例如这样

<ul class="actionList" id="actionList" style="height: 158px;">
    <li class="actionListItem minion minion-0 first">
        <div class="header">
            <div class="verbs">
                <a data-tipped="Look at the XXX" class="view verb tip-static" href="#"></a>
                <a title="Attack XXX" href="#" class="verb attack attack-1 action-attack-minion-2442 default"></a></div>
            <a data-tipped="minion" data-name="XXX" class="icon tip-static" href="#"></a>XXX</div></li>
    <li class="actionListItem minion minion-0">
        <div class="header">
            <div class="verbs">
                <a data-tipped="Look at XXX" class="view verb tip-static" href="#"></a>
                <a title="Attack XXX" href="#" class="verb attack attack-2 action-attack-minion-2442 default"></a></div>
            <a data-tipped="minion" data-name="XXX" class="icon tip-static" href="#"></a>XXX</div></li>
    <li class="actionListItem Minion Minion-0 last">
    <div class="header"><div class="verbs"><a data-tipped="Look at the XXX" class="view verb tip-static" href="#"></a><a title="Attack XXX" href="#" class="verb attack attack-3 action-attack-Minion-2442 default"></a></div><a data-tipped="Minion" data-name="XXX" class="icon tip-static" href="#"></a>XXX</div></li></ul>

我要删除

尝试了这样的东西

$('li:contains("actionListItem minion minion-0")').parent().remove();

$('li:contains("actionListItem minion minion-0")').parent().remove();

在编写脚本方面我仍然是新手,无法正常工作.帮助将不胜感激

I'm still new in scripting its not working. Help would be appreciated

推荐答案

尝试一下:

$( ".doc" ).remove()

,这里是您的确切示例的答案( http://pl. tinypic.com/view.php?pic=1yl65u&s=8 ):

and here's answer for your exact example ( http://pl.tinypic.com/view.php?pic=1yl65u&s=8 ):

$('#actionList').empty();

这篇关于创建Greasemonkey脚本以在找到时删除某些HTML行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆