Skip to content

Instantly share code, notes, and snippets.

@cheesinglee

cheesinglee/kivapredict.js

Last active Aug 29, 2015
Embed
What would you like to do?
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