forked from rolandas-valantinas/gists
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfacebook-marketplace.user.js
36 lines (31 loc) · 1.08 KB
/
facebook-marketplace.user.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
30
31
32
33
34
35
36
// ==UserScript==
// @author Rolandas Valantinas
// @description remove entries posted more 23 hours ago
// @include *facebook.com/marketplace*
// @exclude *facebook.com/marketplace/buying
// @exclude *facebook.com/marketplace/saved
// @exclude *facebook.com/marketplace/selling
// @name Facebook marketplace (day)
// @namespace https://greasyfork.org/users/157178
// @require https://code.jquery.com/jquery-3.2.1.min.js
// @supportURL https://github.com/rolandas-valantinas/gists/issues
// @version 1.4
// ==/UserScript==
(function () {
var interval = setInterval(removeItem, 3000);
var attempts = 0;
function removeItem() {
var items = $('._1oem')
.has('._uc9:contains("over a week ago"), ._uc9:contains("days ago"), ._uc9:contains("day ago")');
if (items.length > 0) {
attempts = 0;
items.remove();
} else {
attempts++;
}
window.scrollTo(0, $(document).height());
if (attempts > 5) {
clearInterval(interval);
}
}
})();