Last active
December 29, 2020 09:42
-
-
Save alamkanak/f36a03283b10b8ed52dacaf7cb408c22 to your computer and use it in GitHub Desktop.
Bikroy property organize
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
// Increase width. | |
var width = "710px"; | |
for (var clss of ["ad-list-container--1UnyA", "list-wrapper--t_A02", "list--3NxGO", "gtm-top-ad", "gtm-normal-ad"]) { | |
var elems = document.getElementsByClassName(clss) | |
for (var elem of elems) { | |
elem.style.maxWidth = width; | |
elem.style.width = width; | |
} | |
} | |
// Calculate price per katha. | |
var elemToChange = "updated-time--1DbCk"; | |
var all = []; | |
var items = document.getElementsByClassName("gtm-ad-item"); | |
for (var item of items) { | |
var cont = item.getElementsByClassName("content--3JNQz")[0].getElementsByTagName("div")[0]; | |
var katha = cont.getElementsByTagName('div')[0].textContent; | |
katha = katha.match(/(.*?) katha/i)[1]; | |
katha = parseFloat(katha); | |
var priceFull = cont.getElementsByClassName("price--3SnqI")[0].textContent; | |
price = priceFull.match(/Tk (.*?) .*? .*?/i)[1]; | |
price = parseInt(price.replace(/,/g, '')); | |
unit = priceFull.match(/Tk .*? (.*)/i)[1]; | |
var totalPrice, unitPrice; | |
if (unit == 'total price') { | |
totalPrice = price; | |
unitPrice = price / katha; | |
} | |
else { | |
totalPrice = price * katha; | |
unitPrice = price; | |
} | |
var elem = item.getElementsByClassName("updated-time--1DbCk")[0]; | |
if (elem != null) { | |
elem.innerHTML = elem.textContent + " | Tk <strong>" + (totalPrice/10000000.0) + " crore</strong> total | Tk <strong>" + (unitPrice / 100000).toFixed(2) + " lakh</strong>/katha"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment