Skip to content

Instantly share code, notes, and snippets.

Last active Aug 26, 2016
What would you like to do?
Home Teaching Needs Analysis - Households jQuery Scraping Script
// This script generates a tab-delimeted list of households with the currently
// assigned home teachers. Copy and paste the script into the browser JS console
// (opened by hitting the F12 key on PCs) when on the Households tab of the
// Hometeaching section of Leader and Clerk Resources on
// The output is formatted in a way that allows you to pase it into your favorite
// spreadsheet program.
// For each household...
var row = $(this);
return [
// Get the household name and trim whitespace
// Get the names of both hometeachers, trim whitespace,
// and join them with a ' / ' separator. We can't just pull the
// text of their shared parent container because there's hidden
// mobile "Home Teachers" header that we don't want in the output
// so we have to extract their two names individually then join
// them together.
return this.textContent.trim();
}).get().join(' / ')
// Join the household name with the home teachers, separated
// by a tab so that the spreadsheet program knows the household
// and hometeachers' names are two different cells
// We separate each row with a new line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment