复选框按关键字选择吗?

时间:2019-03-11 23:25:29

标签: javascript jquery checkbox tampermonkey

我必须在网站上订购许多文件,通过标记它们来选择它们,然后将它们发送到各自的文件夹中,问题是有超过12,000千个列表,每个列表包含30个项目!不同的格式和事物,您应该按类别进行排序...手动。

然后,我请求您的帮助来创建一个脚本,该脚本按关键字选择文件,也就是说,如果压缩文件包含关键字“ MacOS”(因为我选择了该文件并将其发送到其各自的文件夹),让我们看看这些图像将帮助我更好地解释我的愿望:

enter image description here

我们的机器人朋友将遍历整个示例的三个部分。

(1)我会找到关键字'Mac.OS'-小写或大写。

(2),它将选择匹配的元素。

本节的HTML :(出于字符数量的原因,我限制了HTML,complete DEMO in JSFiddle

<div id="FilesListContainer">



<form action="/action/Files/FilesList" autocomplete="off" id="FileListForm" method="post">    <input name="chomikName" type="hidden" value="chomikuj8ceggd">
    <input name="folderId" type="hidden" value="779">
    <input name="fileListSortType" type="hidden" value="Date">
    <input name="fileListAscending" type="hidden" value="False">
    <input name="gallerySortType" type="hidden" value="Name">
    <input name="galleryAscending" type="hidden" value="False">
    <input name="pageNr" type="hidden" value="1">
    <input name="isGallery" type="hidden" value="False">
</form>
    <div class="borderRadius tab" id="sortTab">

        <ul class="borderRadius tabGradientBg">
            <li class="selected" style="width:130px;">sortuj według:</li>

            <li><form action=""><a href="#" rel="nofollow" title="nazwa">nazwa</a><input name="fileListSortType" type="hidden" value="Name"><input name="fileListAscending" type="hidden" value="False"></form></li>
            <li><form action=""><a href="#" rel="nofollow" title="typ pliku">typ pliku</a><input name="fileListSortType" type="hidden" value="Type"><input name="fileListAscending" type="hidden" value="False"></form></li>
            <li><form action=""><a href="#" rel="nofollow" title="rozmiar">rozmiar</a><input name="fileListSortType" type="hidden" value="Size"><input name="fileListAscending" type="hidden" value="False"></form></li>
            <li><form action=""><a class="selected" href="#" rel="nofollow" title="data dodania">data dodania <img alt="Malejąco" src="//x4.static-chomikuj.pl/res/7c24b1ecca.png"></a><input name="fileListSortType" type="hidden" value="Date"><input name="fileListAscending" type="hidden" value="True"></form></li>
                <li style="width:30px;"><span><input type="checkbox" class="selectAllFiles" value="" name=""></span></li>
        </ul>
    </div>


<div id="listView" style="display: block">



<div class="filerow fileItemContainer">



<div class="fileinfo tab">
    <ul class="borderRadius tabGradientBg">
        <li><span>8,0 MB</span></li>
        <li><span class="date">11 mar 19 5:18</span></li>
            <li><span><input type="checkbox" value="6733949428" name="selectFileItem"></span></li>
    </ul>
</div>


<div class="fileActionsButtons clear visibleButtons  fileIdContainer" rel="6733949428" style="visibility: hidden;">
    <ul>
            <li><a class="showFileRating ratingBtn" href="javascript:;" title="Oceń plik"><span class="star5"></span></a></li>
                <li><a href="/chomikuj8ceggd/fff/Excel.Data.Analysis.For.Dummies.4th.Edition,6733949428.epub" class="downloadAction downloadContext" title="pobierz"><img alt="pobierz" src="//x4.static-chomikuj.pl/res/503435f17e.png" title="pobierz"></a></li>

        <li class="fileCommentsAction"><a href="#" title="komentarze" rel="nofollow"><img alt="komentarze" src="//x4.static-chomikuj.pl/res/d9b637b7b4.png" title="komentarze"></a></li>





            <li class="fileActionsFacebookSend" data-url="http://chomikuj.pl/chomikuj8ceggd/fff/Excel.Data.Analysis.For.Dummies.4th.Edition,6733949428.epub" data-title="Excel.Data.Analysis.For.Dummies.4th.Edition">
                <a href="javascript:;"><img alt="Podziel się na Facebook" src="//x4.static-chomikuj.pl/res/585911b602.gif" title="Podziel się na Facebook"></a>
            </li>

            <li><a class="showFileOptions" href="#" title="opcje" rel="nofollow"><img alt="opcje" src="//x4.static-chomikuj.pl/res/e174c25b70.png" title="opcje"></a></li>

    </ul>
</div>

    <div onmouseover="$('.visibleArrow', this).css('visibility', 'visible')" onmouseout="$('.visibleArrow', this).css('visibility', 'hidden');" class="filename txt">
        <h3>
                <a class="expanderHeader downloadAction downloadContext" href="/chomikuj8ceggd/fff/Excel.Data.Analysis.For.Dummies.4th.Edition,6733949428.epub" title="Excel.Data.Analysis.For.Dummies.4th.Edition">
                    <span class="bold">Excel.Data.Analysis.For.Dummies.4th.Edition</span>.epub
                </a>
            <img alt="pobierz" class="downloadArrow visibleArrow" src="//x4.static-chomikuj.pl/res/99a19ffb28.png" style="visibility: hidden;" title="pobierz">
        </h3>
    </div>

    <div style="clear:left;">



    <div rel="Other" class="expType" style="visibility: hidden">
        <a rel="highslide"></a>
    </div>
            <span class="filedescription" style="display: none">

        </span>
    </div>



    <div class="clear">
    </div>

</div>







<div class="filerow fileItemContainer">



<div class="fileinfo tab">
    <ul class="borderRadius tabGradientBg">
        <li><span>9,1 MB</span></li>
        <li><span class="date">11 mar 19 5:13</span></li>
            <li><span><input type="checkbox" value="6733945278" name="selectFileItem"></span></li>
    </ul>
</div>


<div class="fileActionsButtons clear visibleButtons  fileIdContainer" rel="6733945278" style="visibility: hidden;">
    <ul>
            <li><a class="showFileRating ratingBtn" href="javascript:;" title="Oceń plik"><span class="star5"></span></a></li>
                <li><a href="/chomikuj8ceggd/fff/Ad0b3.Zii.2019-Universal.Patcher.v4.1.7.Mac.OS.X_TNT,6733945278.rar(archive)" class="downloadAction downloadContext" title="pobierz"><img alt="pobierz" src="//x4.static-chomikuj.pl/res/503435f17e.png" title="pobierz"></a></li>

        <li class="fileCommentsAction"><a href="#" title="komentarze" rel="nofollow"><img alt="komentarze" src="//x4.static-chomikuj.pl/res/d9b637b7b4.png" title="komentarze"></a></li>





            <li class="fileActionsFacebookSend" data-url="http://chomikuj.pl/chomikuj8ceggd/fff/Ad0b3.Zii.2019-Universal.Patcher.v4.1.7.Mac.OS.X_TNT,6733945278.rar(archive)" data-title="Ad0b3.Zii.2019-Universal.Patcher.v4.1.7.Mac.OS.X_TNT">
                <a href="javascript:;"><img alt="Podziel się na Facebook" src="//x4.static-chomikuj.pl/res/585911b602.gif" title="Podziel się na Facebook"></a>
            </li>

            <li><a class="showFileOptions" href="#" title="opcje" rel="nofollow"><img alt="opcje" src="//x4.static-chomikuj.pl/res/e174c25b70.png" title="opcje"></a></li>

    </ul>
</div>

    <div onmouseover="$('.visibleArrow', this).css('visibility', 'visible')" onmouseout="$('.visibleArrow', this).css('visibility', 'hidden');" class="filename zip">
        <h3>
                <a class="expanderHeader downloadAction downloadContext" href="/chomikuj8ceggd/fff/Ad0b3.Zii.2019-Universal.Patcher.v4.1.7.Mac.OS.X_TNT,6733945278.rar(archive)" title="Ad0b3.Zii.2019-Universal.Patcher.v4.1.7.Mac.OS.X_TNT">
                    <span class="bold">Ad0b3.Zii.2019-Universal.Patcher.v4.1.7.Mac.OS.X_T<span class="e"> </span>NT</span>.rar
                </a>
            <img alt="pobierz" class="downloadArrow visibleArrow" src="//x4.static-chomikuj.pl/res/99a19ffb28.png" style="visibility: hidden;" title="pobierz">
        </h3>
    </div>

    <div style="clear:left;">



    <div rel="Other" class="expType" style="visibility: hidden">
        <a rel="highslide"></a>
    </div>
            <span class="filedescription" style="display: none">

        </span>
    </div>



    <div class="clear">
    </div>

</div>
<div class="filerow alt fileItemContainer">



<div class="fileinfo tab">
    <ul class="borderRadius tabGradientBg">
        <li><span>1,40 GB</span></li>
        <li><span class="date">11 mar 19 5:13</span></li>
            <li><span><input type="checkbox" value="6733945277" name="selectFileItem"></span></li>
    </ul>
</div>


<div class="fileActionsButtons clear visibleButtons  fileIdContainer" rel="6733945277" style="visibility: hidden;">
    <ul>
            <li><a class="showFileRating ratingBtn" href="javascript:;" title="Oceń plik"><span class="star5"></span></a></li>
                <li><a href="/chomikuj8ceggd/fff/Ad0b3.M3di4.3nc0d3r.CC.2019.v13.0.2-Crack.Mac.OS.X-CracksNow,6733945277.dmg(archive)" class="downloadAction downloadContext" title="pobierz"><img alt="pobierz" src="//x4.static-chomikuj.pl/res/503435f17e.png" title="pobierz"></a></li>

        <li class="fileCommentsAction"><a href="#" title="komentarze" rel="nofollow"><img alt="komentarze" src="//x4.static-chomikuj.pl/res/d9b637b7b4.png" title="komentarze"></a></li>





            <li class="fileActionsFacebookSend" data-url="http://chomikuj.pl/chomikuj8ceggd/fff/Ad0b3.M3di4.3nc0d3r.CC.2019.v13.0.2-Crack.Mac.OS.X-CracksNow,6733945277.dmg(archive)" data-title="Ad0b3.M3di4.3nc0d3r.CC.2019.v13.0.2-Crack.Mac.OS.X-CracksNow">
                <a href="javascript:;"><img alt="Podziel się na Facebook" src="//x4.static-chomikuj.pl/res/585911b602.gif" title="Podziel się na Facebook"></a>
            </li>

            <li><a class="showFileOptions" href="#" title="opcje" rel="nofollow"><img alt="opcje" src="//x4.static-chomikuj.pl/res/e174c25b70.png" title="opcje"></a></li>

    </ul>
</div>

    <div onmouseover="$('.visibleArrow', this).css('visibility', 'visible')" onmouseout="$('.visibleArrow', this).css('visibility', 'hidden');" class="filename iso">
        <h3>
                <a class="expanderHeader downloadAction downloadContext" href="/chomikuj8ceggd/fff/Ad0b3.M3di4.3nc0d3r.CC.2019.v13.0.2-Crack.Mac.OS.X-CracksNow,6733945277.dmg(archive)" title="Ad0b3.M3di4.3nc0d3r.CC.2019.v13.0.2-Crack.Mac.OS.X-CracksNow">
                    <span class="bold">Ad0b3.M3di4.3nc0d3r.CC.2019.v13.0.2-Crack.Mac.OS.X<span class="e"> </span>-CracksNow</span>.dmg
                </a>
            <img alt="pobierz" class="downloadArrow visibleArrow" src="//x4.static-chomikuj.pl/res/99a19ffb28.png" style="visibility: hidden;" title="pobierz">
        </h3>
    </div>

    <div style="clear:left;">



    <div rel="Other" class="expType" style="visibility: hidden">
        <a rel="highslide"></a>
    </div>
            <span class="filedescription" style="display: none">

        </span>
    </div>



    <div class="clear">
    </div>

</div>



    <div class="smallBL" id="selectedFilesActionButtons">
        <ul class="disabled">
            <li class="">
                <a class="button smallButton copyFilesBtn" href="javascript:;">
                    <img alt="Kopiuj" src="//x4.static-chomikuj.pl/res/8638d1a887.png" title="Kopiuj">
                </a>Kopiuj</li>
            <li class="">
                <a class="button smallButton moveFilesBtn" href="javascript:;">
                    <img alt="Przenieś" src="//x4.static-chomikuj.pl/res/72d861f112.png" title="Przenieś"></a>Przenieś</li>
            <li class="">
                <a class="button smallButton deleteFilesBtn" href="javascript:;">
                    <img alt="Usuń" src="//x4.static-chomikuj.pl/res/4c264123ef.png" title="Usuń"></a>Usuń</li>
        </ul>
        <p>Zaznaczone pliki:</p>
        <div class="clear"></div>
    </div>


</div>        </div>

enter image description here (3)我要点击“移动”

<li class="">
                <a class="button smallButton moveFilesBtn" href="javascript:;">
                    <img alt="Przenieś" src="//x4.static-chomikuj.pl/res/72d861f112.png" title="Przenieś"></a>Przenieś</li>

(4)等待此窗口出现

<div id="ui-tooltip-filesAction" class="ui-tooltip qtip ui-helper-reset ui-tooltip-default dialogWindow ui-tooltip-pos-c ui-draggable" tracking="false" role="alert" aria-live="polite" aria-atomic="false" aria-describedby="ui-tooltip-filesAction-content" aria-hidden="false" style="width: 261px; z-index: 15002; top: 497.333px; left: 477px; display: block; opacity: 1;"><div class="ui-tooltip-titlebar"><div id="ui-tooltip-filesAction-title" class="ui-tooltip-title" aria-atomic="true">Kopiowanie plików</div><a class="ui-state-default ui-tooltip-close ui-tooltip-icon" title="Zamknij" aria-label="Zamknij" role="button"><span class="ui-icon ui-icon-close">×</span></a></div><div class="ui-tooltip-content" id="ui-tooltip-filesAction-content" aria-atomic="true"><div style="display: block;">
<form action="/action/FileDetails/MoveFilesAction" method="post"><input id="ChomikName" name="ChomikName" type="hidden" value="chomikuj8ceggd"><input id="FolderId" name="FolderId" type="hidden" value="779">        <input type="hidden" name="Files" value="6733945277">
<input id="FolderTo" name="FolderTo" type="hidden" value="0">    <div>
        <p>Jesteś w trybie przenoszenia.Aby przenieść plik do innego folderu  
            wystarczy w drzewie folderów Twojego Chomika kliknąć na docelowy folder.</p>
        <input type="reset" class="greenButtonCSS" value="Anuluj przenoszenie">
    </div>
</form></div></div></div>

(5)最后单击相应的文件夹

<a href="/chomikuj8ceggd/MAC" rel="481" title="MAC" id="Ta_481"><span class="newfile_s">MAC</span></a>
  • (3)可以从您的班级访问它
  • (5)通过您的ID可以轻松访问它
    选中或标记复选框的方法恐怕必须与鼠标所提供的“单击”相似,之所以这么说是因为使用方法.prop (' checked ', true)进行选择会标记它们,但未启用“移动” '选项:

标记有脚本⚠️

Marked with script

已标记手册

enter image description here

也许MouseEvent (' click ',在这里是正确的,我没有必要的知识来确保它


如前所述,对于字符数量的问题,我将HTML缩写为,功能性但为缩写。现在,我留下了指向完整演示in JSFiddle

的链接

脚本

也许,也许您可​​以将script放在此代码中,以便每次按“回车”键时都执行它 如果有更好的方法,那么我很乐意接受!

document.onkeyup = function(e){
    document.onkeyup = function(e){
        if(e){
            var key = window.event ? e.keyCode : e.which;
                 }else{
            var key = window.event ? event.keyCode : event.which;
                            }
          if (key == '13') {
            //Code you would like to execute


                           }
                                                                }
                             }


-最终澄清:

  • 这将是一个坦帕蒙奇script

  • JavascriptJQuery

  • 这个想法是,在执行script时,所有内容都会标记为所选关键字,然后单击将其发送到文件夹

  • 我对此很陌生(很难 了解哈哈)

0 个答案:

没有答案