Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Property Grabber
- // @namespace http://redfin.property.grabber.com
- // @version 0.1
- // @description Copy essential property info from Redfin
- // @author You
- // @match https://www.redfin.com/*
- // @require https://code.jquery.com/jquery-2.1.4.min.js
- // @icon https://www.google.com/s2/favicons?domain=hibbard.eu
- // @grant none
- // ==/UserScript==
- // Note that the button to copy the property info is at the bottom right of the page, you need to wait for the page to load
- // completely before it appears. Sometimes it doesn't appear at all for some reason, just refresh the page and it should.
- 'use strict';
- var $ = window.$;
- $(window).load(function() {
- $('body').append('<input type="button" value="Copy Info" id="CP">')
- $("#CP").css("position", "fixed").css("bottom", 0).css("right", 0).css("color", "black");
- $('#CP').click(function(){
- // var moves = $('.move');
- console.log("Grabbing property info")
- var url = window.location.href;
- // Info from title at top below pictures
- const addr = $('.street-address').attr('title') + ', ' + $('.homeAddress .dp-subtext').html().replace(/<!-- -->/g,'')
- const price = $('[data-rf-test-id=abp-price]').find('.statsValue').html()
- const sqft = $('[data-rf-test-id=abp-sqFt]').find('.statsValue').html()
- const beds = $('[data-rf-test-id=abp-beds]').find('.statsValue').html()
- const baths = $('[data-rf-test-id=abp-baths]').find('.statsValue').html()
- // Grab details from table and store in key-val pair; Some propery may not have HOA Dues, so can't hard code
- var det = {}
- const wanted = ['Year Built', 'Lot Size', 'MLS#', 'HOA Dues']
- const details = $('.keyDetailsList:first').find('.header').filter(function(){return wanted.includes($(this).html())})
- details.each(function() { det[$(this).html()] = $(this).siblings().html() })
- //const year = $(details[0]).siblings().html()
- //const lotSize = $(details[1]).siblings().html()
- //const mls = $(details[2]).siblings().html()
- // Payment calculator section info
- const monthlyTax = $('.CalculatorSummary .colorBarLegend div:nth-child(2) span.Row--content').html() // seems like tax is always the 2nd one?
- const insurance = $('.CalculatorSummary .colorBarLegend div:last-child span.Row--content').html() // sometimes HOA fees are also in there
- // Tax Table (this doesn't work unless user scroll down to tax table and clicks the Tax History)
- //const tax = $('.TaxHistoryTable tr:nth-child(2) td:nth-child(2)').html()
- var info = [url, det['MLS#'], addr, det['Year Built'], beds, baths, det['Lot Size'], sqft, det['HOA Dues'], insurance, monthlyTax, price]
- info = info.join('\r\n')
- console.log(info)
- navigator.clipboard.writeText(info); // copy to clipboard
- });
- });
Add Comment
Please, Sign In to add comment