I have a question that arose from a solution. Use Tampermonkey to deselect files from a list; It works fine, but I wonder if I could apply regular expression to further expand its goal.
<div class="well">
<h2>Select you files</h2>
<table id="list-files" class="table table-bordered table-striped table-condensed table-hover">
<tbody>
<tr>
<th width="10px"><input type="checkbox" id="select-all-files" checked="checked"></th>
<th>File</th>
<th>Size</th>
</tr>
<tr class="selectedFiles" style="display: table-row;">
<td><input type="checkbox" name="files[]" value="0" ""></td>
<td>
<div><span class="pull-left">The.Blind.Side.2009.1080p.BluRay.x264.DTS-FGT/</span><span style="padding-top:1px;padding: 0 2px;display:block;overflow:hidden"><input style="width:100%;color:#c8c8c8;background-color:transparent;padding:0px;margin:0px" type="text" name="rename[0]" value="tuSITIO.com.txt"></span></div>
</td>
<td>34.0 iB</td>
</tr>
<tr class="selectedFiles" style="display: table-row;">
<td><input type="checkbox" name="files[]" value="1" checked=""></td>
<td>
<div><span class="pull-left">The.Blind.Side.2009.1080p.BluRay.x264.DTS-FGT/</span><span style="padding-top:1px;padding: 0 2px;display:block;overflow:hidden"><input style="width:100%;color:#c8c8c8;background-color:transparent;padding:0px;margin:0px" type="text" name="rename[1]" value="The.Blind.Side.2009.1080p.BluRay.x264.DTS-FGT.mkv"></span></div>
</td>
<td>8.8 GiB</td>
</tr>
<tr class="selectedFiles" style="display: table-row;">
<td><input type="checkbox" name="files[]" value="2" checked=""></td>
<td>
<div><span class="pull-left">The.Blind.Side.2009.1080p.BluRay.x264.DTS-FGT/</span><span style="padding-top:1px;padding: 0 2px;display:block;overflow:hidden"><input style="width:100%;color:#c8c8c8;background-color:transparent;padding:0px;margin:0px" type="text" name="rename[2]" value="The.Blind.Side.2009.1080p.BluRay.x264.DTS-FGT.nfo"></span></div>
</td>
<td>5.4 KiB</td>
</tr>
</tbody>
</table>
</div>
Here we see an example where Script
does its job correctly and, in this case, unchecks the "tuSITIO.com.txt"
file.
My Script
:
var inp=$("tr input");
var r="tuSITIO.com.txt";
for (i = 0; i < inp.length; i++) {
if(inp[i].value == r){
inp[i-1].checked = false;
}
}
This Script
(by @Bryro) unchecks any file that is uploaded to a list works very well for exact values like the%%% example
Now ... How could you expand your goal using regular expressions?
Suppose I do not want to include any file "tuSITIO.com.txt"
, .txt
, .nfo
or .url
. Is that possible?
For example, uncheck type files:
metadata.nfo
tu.sitio.nfo
qwerty(23).nfo
1a2b3c4d.url
I have seen some like: .website
it occurs to me that perhaps putting: "([^\s]+(\.(?i)(jpg|png|gif|bmp))$)";
could result but I do not know how it could proceed, I appreciate your help and / or information, regards. Remember it's for Tampermonkey similar to Greasemonkey .