Created
February 28, 2015 13:08
-
-
Save silvasur/c93215dbe87593e4bd25 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name immobilienscout++ | |
// @namespace kch42 | |
// @include http://www.immobilienscout24.de/Suche/* | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
/* | |
* Immobilienscout24 Suche verbessern. | |
* Im Moment wird die Warmmiete in den Suchergebnissen angezeigt. | |
*/ | |
function mkcrit(title, value) { | |
var nc = document.createElement("dl"); | |
nc.classList.add("criteria"); | |
var dt = document.createElement("dt"); | |
dt.classList.add("title"); | |
dt.textContent = title; | |
var dd = document.createElement("dd"); | |
dd.classList.add("value"); | |
dd.textContent = value; | |
dd.style.fontSize = "75%"; | |
nc.appendChild(dt); | |
nc.appendChild(dd); | |
return nc; | |
} | |
function procresult(result) { | |
if(result.classList.contains("isplusplus_processed")) { | |
return; | |
} | |
var url = result.querySelector("span.title a").getAttribute("href"); | |
var req = new XMLHttpRequest(); | |
req.addEventListener("load", function() { | |
var doc = this.responseXML; | |
var warmmiete = doc.querySelector(".is24qa-gesamtmiete"); | |
result.querySelector(".resultlist_criteria").appendChild(mkcrit("Warmmiete", warmmiete ? warmmiete.textContent : "?")); | |
result.classList.add("isplusplus_processed") | |
}); | |
req.open("GET", url); | |
req.responseType = "document"; | |
req.send(); | |
} | |
var results = document.querySelectorAll("#resultListItems > li.resultlist"); | |
for (var i = 0; i < results.length; i++) { | |
procresult(results[i]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated this script to make it compatible with the current version of immobilienscout24 (as of 2020/11/13):
https://gist.github.com/yutamago/266e393047355cbcf48197da67badd14