Skip to content

Instantly share code, notes, and snippets.

@cheesinglee
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cheesinglee/afe31ed4e18f92e79fda to your computer and use it in GitHub Desktop.
Save cheesinglee/afe31ed4e18f92e79fda to your computer and use it in GitHub Desktop.
Snippets for browser extension blog post
// check if a loan ID is at the end of the url
var re = /lend\/(\d+)/ ;
var result = re.exec(window.location.href) ;
if (result !== null){
// individual loan page
var loan_id = result[1] ;
img = makeStatusIndicator(loan_id) ;
$("#lendFormWrapper").append(img) ;
}else{
// list of loans
$("article.borrowerQuickLook").each(function(idx,element){
var result = re.exec($(this).find("a.borrowerName").attr("href")) ;
var loan_id = result[1] ;
img = makeStatusIndicator(loan_id) ;
$(this).find("div.fundAction").append(img) ;
}) ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment