-
Install firefox
-
Install GreaseMonkey (https://www.greasespot.net)
-
Start firefox and go to your FB marketplace
-
In top-right dropdown select "Switch to Classic Facebook" (if you were on the new look)
-
run your marketplace search (ie https://www.facebook.com/marketplace/category/exercise-fitness/?sort=CREATION_TIME_DESCEND)
-
Click the GreaseMonkey icom (firefox top-right monkey face) and select 'New user script...'
-
In the editor paste the following script:
// ==UserScript==
// @name MarketplaceFilterLastHour
// @include https://www.facebook.com/marketplace/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @grant GM_addStyle
// ==/UserScript==
//- The @grant directive is needed to restore the proper sandbox.
console.log("FACEBOOK MARKETPLACE FILTER LAST HOUR");
let pattern= 'a[href^="/marketplace/item/"]:contains("hours") , a[href^="/marketplace/item/"]:contains("day") , a[href^="/marketplace/item/"]:contains("week")';
function mutationHandler (mutationRecords) {
mutationRecords.forEach(function (mutation) {
if (mutation.type=="childList" && typeof mutation.addedNodes=="object" && mutation.addedNodes.length) {
for (let i=0; i<mutation.addedNodes.length; ++i) {
if (mutation.addedNodes[i].nodeType===1) elementMutationHandler(mutation.addedNodes[i]);
}
} else if (mutation.type == "attributes" && mutation.target.nodeType===1) {
elementMutationHandler(mutation.target);
}
});
}
function elementMutationHandler(elem) {
$(elem).find(pattern).each(function() { console.log($(this)); $(this).parent().remove(); });
}
// start
let MutationObserver = window.MutationObserver;
let myObserver = new MutationObserver(mutationHandler);
let obsConfig = { childList: true, attributes: true, subtree: true, attributeFilter: ['href'] };
myObserver.observe (document, obsConfig);
setTimeout((function() {
myObserver.disconnect();
window.location.reload();
}), 3*60*1000);
$('#globalContainer').attr('style', 'width: 100% !important');
$('#globalContainer:first div:first div:first div:first').attr('style', 'width: 95% !important');
setInterval((function() {
$('#globalContainer').attr('style', 'width: 100% !important');
$('#globalContainer:first div:first div:first div:first').attr('style', 'width: 95% !important');
}), 1000);
- Hit the save icon
- close greasemokey editor
- refresh your marketplace page
If anyone tries to do this in the future, change
.../?sort=CREATION_TIME_DESCEND
to.../?sortBy=creation_time_descend
.