Skip to content

Instantly share code, notes, and snippets.

@diggles
Created September 9, 2018 04:10
Show Gist options
  • Save diggles/9c52b915dd8581a081e933db151bc1f9 to your computer and use it in GitHub Desktop.
Save diggles/9c52b915dd8581a081e933db151bc1f9 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Trademe Fixes
// @namespace https://gist.github.com/diggles/9c52b915dd8581a081e933db151bc1f9
// @version 0.1
// @description Hide Trademe ads, hide international listings, layout improvements
// @author You
// @match https://www.trademe.co.nz/*
// @grant none
// @require https://code.jquery.com/jquery-3.3.1.slim.min.js
// ==/UserScript==
(function() {
'use strict';
var excludedLocations = ['United Kingdom', 'Australia', 'China', 'Hong Kong'];
// Hide ads
$('#SiteHeader_SkyscraperContainer').hide();
$('.sat-nav').hide();
$('#adBlock').hide();
$('#google-ads').hide();
$('.no-listing').hide();
// Adjust styles
// Make the search grid full width
$('#container').removeClass('wrapper');
$('.site-header').css({ width: 'inherit' });
$('.supergrid-bucket').css({width:'inherit', height: 'inherit', position: 'inherit', float: 'inherit', margin: '0'});
$('.supergrid-overlord').css({ width: 'inherit' });
$('.supergrid-listing').removeClass('card1').removeClass('card2').removeClass('card3').removeClass('medium').removeClass('small').removeClass('large').addClass('medium');
$('.supergrid-listing').css({ position: 'relative', margin: '10px' });
$('.supergrid-bucket').removeClass('medium').removeClass('small').removeClass('large').addClass('medium');
// Make the listing view fill width
$('.main-content').css({ width: 'inherit'});
// Hide excluded locations
var locations = $('.location');
for(var i = 0; i < locations.length; i++) {
var item = $(locations[i]);
if(excludedLocations.indexOf(item.text().trim()) !== -1)
item.closest('.supergrid-listing').hide();
}
//
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment