Skip to content

Instantly share code, notes, and snippets.

@fmagnan
Last active August 29, 2015 14:00
Show Gist options
  • Save fmagnan/11363764 to your computer and use it in GitHub Desktop.
Save fmagnan/11363764 to your computer and use it in GitHub Desktop.
formatted leboncoin.fr results
// ==UserScript==
// @name leboncoin
// @namespace marvin.org
// @include http://www.leboncoin.fr/*/offres/*
// @include http://www.leboncoin.fr/li*
// @version 1
// @grant none
// ==/UserScript==
/* jshint strict: true */
var addGlobalStyle = function (innerHtml) {
"use strict";
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = innerHtml;
var head = document.getElementsByTagName('head')[0];
head.appendChild(style);
};
var removeElement = function (element) {
"use strict";
if (element === null) {
return false;
}
var parent = element.parentNode;
if (typeof(parent) === 'undefined') {
return false;
}
return parent.removeChild(element);
};
var removeElementById = function (id) {
"use strict";
removeElement(document.getElementById(id));
};
var removeElementsByClass = function (classname) {
"use strict";
var tags = document.getElementsByClassName(classname);
while (tags.length > 0) {
tags = document.getElementsByClassName(classname);
removeElement(tags[0]);
}
};
removeElementById('account_login_f');
removeElementById('account_submenu');
removeElementsByClass('border');
removeElementById('categories_container');
removeElementsByClass('category');
removeElementsByClass('clear');
removeElementsByClass('comment');
removeElementsByClass('date');
removeElementById('footer');
removeElementsByClass('google');
removeElementById('headermain');
removeElementsByClass('list-gallery');
removeElementById('log_oas');
removeElementsByClass('location');
removeElementById('location_hints_box');
removeElementsByClass('nb');
removeElementsByClass('oas-top');
removeElementsByClass('oas-x01');
removeElementsByClass('oas-x02');
removeElementsByClass('oas-x03');
removeElementsByClass('oas-x04');
removeElementsByClass('placement');
removeElementById('pricelist');
removeElementsByClass('searchbutton_zone');
removeElementById('titlesearch');
removeElementsByClass('type');
removeElementById('urgentsearch');
removeElementById('zipcode');
/*jshint multistr: true */
var cssStyle = " \
a {color:black;} \
nav {float:left;} \
.page_width {width:auto;} \
.content-border {background:none;padding:0;} \
.content-border.list {clear:both;} \
.select-and-link, .submitsearch {width:auto; margin:0;} \
\
.list-lbc, .list-lbc .lbc .image, .list-lbc .lbc .image-and-nb img, .list-lbc .lbc .detail {width:auto;} \
.list-lbc a .lbc, .list-lbc a:first-child .lbc {float:left;} \
.list-lbc a .lbc {border:none;padding:2px;margin-right:5px;} \
.list-lbc .lbc {margin-left:2px;height:180px;} \
\
.list-lbc {margin:0;width:auto;float:none;} \
.list-lbc .lbc .detail {padding:0;float:none;width:120px;} \
.list-lbc .lbc .image, .list-lbc .lbc .image-and-nb {padding:0;float:none;} \
\
.lbc .detail .title {font-weight:normal;font-size:11px;} \
.lbc .detail .price {height:auto;line-height:normal;font-size:inherit;color:red;padding-right:0;}";
addGlobalStyle(cssStyle);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment