Move the listing filter above price
// ==UserScript==
// @name move listings 2 the top
// @author croutons
// @namespace https://userstyles.world/user/croutons
// @version 6.9
// @description Move the listing filter above price
// @match https://csfloat.com/*
// ==/UserScript==
(function () {
'use strict';
function styleAndMoveListings() {
const style = document.createElement('style');
style.textContent = `
.logo img {
display: none;
}
.logo {
display: block;
width: 40px;
height: 40px;
background: url('https://upload.wikimedia.org/wikipedia/en/7/73/Trollface.png') no-repeat center center;
background-size: contain;
}
html, body {
margin: 0;
padding: 0;
width: 100vw;
height: 100vh;
}
* {
border-radius: 0 !important;
}
div.right > div.card {
display: none !important;
}
.mat-mdc-tooltip-trigger.sticker.ng-star-inserted {
transform: scale(1.8);
transform-origin: center;
}
`;
document.head.appendChild(style);
}
function moveListings() {
if (window.__listingsMoved__) return;
const containers = document.querySelectorAll('.container');
let listing = null;
let price = null;
for (const c of containers) {
const label = c.querySelector('.name');
if (!label) continue;
const text = label.textContent.trim().toLowerCase();
if (text === 'listing') listing = c;
if (text === 'price') price = c;
if (listing && price) break;
}
if (listing && price && price.parentNode) {
price.parentNode.insertBefore(listing, price);
window.__listingsMoved__ = true;
}
}
styleAndMoveListings();
const listingsObserver = new MutationObserver(() => {
clearTimeout(window.__listingsTimer__);
window.__listingsTimer__ = setTimeout(() => {
window.__listingsMoved__ = false;
moveListings();
}, 500);
});
listingsObserver.observe(document.body, { childList: true, subtree: true });
window.addEventListener('load', () => setTimeout(moveListings, 500));
})();
(function () {
'use strict';
const expiresSoonObserver = new MutationObserver(() => {
const panel = document.querySelector('#mat-select-2-panel');
if (!panel) return;
const options = Array.from(panel.querySelectorAll('mat-option'));
const expiresSoonOption = options.find(opt =>
opt.textContent.trim().includes('Expires Soon')
);
if (expiresSoonOption && panel.firstChild !== expiresSoonOption) {
panel.insertBefore(expiresSoonOption, panel.firstChild);
}
});
window.addEventListener('load', () => {
expiresSoonObserver.observe(document.body, { childList: true, subtree: true });
});
})();