Last active
August 29, 2015 14:17
-
-
Save salsalabs/bc06c88d4b9bc3dcba7d to your computer and use it in GitHub Desktop.
Scripts to change the title of a TAF from a P2P donation page to the P2P donation page's title
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
<? | |
// If this is a TAF page and there is a 'supporter_my_donation_page_KEY' in the URL, then use | |
// the P2P page's title to fill the TAF page subject. | |
// | |
if (Request.getURL().indexOf('my/tellafriend.jsp') != -1) { | |
var myDonatePageTitle = null; | |
var myDonatePageKey = Request.getParameter('supporter_my_donate_page_KEY'); | |
if (myDonatePageKey != null) { | |
var myDonatePage = DB.getObject('supporter_my_donate_page', myDonatePageKey); | |
myDonatePageTitle = myDonatePage == null ? "null" : ('"' + myDonatePage.Page_Title + '"'); | |
?> | |
<script type="text/javascript"> | |
var myDonatePageTitle = <?= myDonatePageTitle ?>; | |
if (myDonatePageTitle != null) { | |
var formRow = $('label[for=subject]').parent(); | |
if (formRow.length > 0) { | |
var target = $('blockquote p', formRow); | |
if (target.length > 0) { | |
target.text(myDonatePageTitle); | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment