-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 508769c
Showing
9 changed files
with
760 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
*.pem | ||
|
||
# IntelliJ project files | ||
.idea | ||
*.iml | ||
out | ||
gen |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<p align="center"> | ||
<img src="https://raw.githubusercontent.com/StegSchreck/is24-price-per-area/master/images/icon_128.png" width="128px"> | ||
</p> | ||
|
||
# IS24 Price Per Area | ||
Chrome Extension for showing the price per m² on the search result pages of ImmobilienScout24. | ||
Grouped results (such as projects) and items hidden by the user are ignored. | ||
|
||
This extension is designed to only be active on `https://*.immobilienscout24.de`. | ||
|
||
The implementation details of ImmobilienScout24 make it necessary to include a 1 second delay before displaying the price per area value. | ||
|
||
## Installation | ||
Currently, this extension is not listed on the official Chrome Web Store. | ||
|
||
To use this extension, please follow the following steps: | ||
1. clone this repository | ||
2. open this url in a new Chrome tab: `chrome://extensions/` | ||
3. in the top-right corner click the switch to enable to the "Developer mode" | ||
4. a new menu bar appeared, where you can find the button "Load unpacked", which you need to click | ||
5. in the file dialog that just opened, navigate to the directory of the cloned repository and click "Open" | ||
|
||
### Disclaimer | ||
This project is not affiliated with ImmobilienScout24 in any way. There is no guarantee or reliability that I provide. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use strict'; | ||
|
||
let resultListItems = document.getElementsByTagName("article"); | ||
|
||
for (const resultListItem of resultListItems) { | ||
if (resultListItem.classList.contains("result-list-entry--project") || | ||
resultListItem.classList.contains("hidden-result")) { | ||
continue; | ||
} | ||
const resultListItemAttributes = resultListItem.querySelector('[data-is24-qa="attributes"]'); | ||
const price = extractPrice(resultListItemAttributes); | ||
const area = extractArea(resultListItemAttributes); | ||
const pricePerArea = (price / area).toFixed(2); | ||
setTimeout(function(){ insertPricePerArea(resultListItemAttributes, pricePerArea)}, 2000); | ||
|
||
} | ||
|
||
function extractPrice(resultListItemAttributes) { | ||
const resultListItemPriceElement = resultListItemAttributes.querySelector('dl:first-child dd'); | ||
const resultListItemPrice = resultListItemPriceElement.textContent | ||
.replace("€", "") | ||
.replace(".", "") | ||
.replace(",", ".") | ||
.trim(); | ||
return parseFloat(resultListItemPrice); | ||
} | ||
|
||
function extractArea(resultListItemAttributes) { | ||
const resultListItemAreaElement = resultListItemAttributes.querySelector('dl:nth-child(2) dd'); | ||
const resultListItemArea = resultListItemAreaElement.textContent | ||
.replace("m²", "") | ||
.replace(".", "") | ||
.replace(",", ".") | ||
.trim(); | ||
return parseFloat(resultListItemArea); | ||
} | ||
|
||
function insertPricePerArea(resultListItemAttributes, pricePerArea) { | ||
const pricePerAreaText = pricePerArea.toString().replace(".", ","); | ||
const pricePerAreaElement = | ||
`<dl class="grid-item result-list-entry__primary-criterion " role="presentation"> | ||
<dd class="font-nowrap font-line-xs">${pricePerAreaText} €/m²</dd> | ||
<dt class="font-s onlyLarge">Grundpreis</dt> | ||
</dl>`; | ||
|
||
resultListItemAttributes.insertAdjacentHTML('beforeend', pricePerAreaElement); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"manifest_version": 2, | ||
|
||
"name": "IS24 Price Per Area", | ||
"version": "1.0", | ||
"description": "Show price per m² on the search result page of ImmobilienScout24. Grouped results (such as projects) and hidden items are ignored. Not affiliated with ImmobilienScout24.", | ||
|
||
"content_scripts": [ | ||
{ | ||
"matches": ["https://*.immobilienscout24.de/*"], | ||
"run_at": "document_end", | ||
"js": ["contentScript.js"] | ||
} | ||
], | ||
"icons": { | ||
"16": "images/icon_16.png", | ||
"32": "images/icon_32.png", | ||
"48": "images/icon_48.png", | ||
"128": "images/icon_128.png" | ||
} | ||
} |