-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultipics.js
29 lines (28 loc) · 1007 Bytes
/
multipics.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* Be able to filter based on the number of photos available. Motivation is that scammer listings often only have one or
very few photos available. Craigslist allows filtering based on if a posting has images or not, but it doesn't have filtering
based on how many photos are available.
*/
javascript:
var results = [].slice.call(document.querySelectorAll("div#sortable-results.content ul.rows li"));
var reqPics;
var count = 0;
do {
reqPics = Number(prompt("At least how many pics must be present?", "2"));
} while (!isFinite(reqPics));
results.forEach(li=>{
var info = li.querySelector("a div.slider-info");
if (info) {
var mat = info.textContent.match(/[0-9]+$/);
if (mat) {
mat = Number(mat[0]);
if (mat < reqPics) {
li.parentElement.removeChild(li);
count++;
}
}
} else {
li.parentElement.removeChild(li);
count++;
}
});
alert("Eliminated: " + count + " results");