Last active
August 29, 2015 14:03
-
-
Save cheesinglee/afe31ed4e18f92e79fda to your computer and use it in GitHub Desktop.
Snippets for browser extension blog post
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
// 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