Skip to content

Instantly share code, notes, and snippets.

Salsalabs salsalabs

Block or report user

Report or block salsalabs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@salsalabs
salsalabs / hide_fed_country_muni.html
Created May 1, 2019
Hide federal, country and municipal legislators in the legislative_lookup.
View hide_fed_country_muni.html
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
if (window.location.href.indexOf('getLocal4.jsp') != -1) {
var a = Array.from(document.querySelectorAll('div[id^=officials]'))
a = a.filter(function(e) {
return /officials_S/.test(e.id) ? false : true;
})
a.forEach(function(e) {
e.style.display = 'none';
//Hide two trailing <br> tags.
@salsalabs
salsalabs / flat_10_dollar_shipping.html
Created May 1, 2019
Script to add a flat $10.00 shipping and handling to a storefront checkout if the merchandise total is $50 or less.
View flat_10_dollar_shipping.html
<script type="text/javascript">
$(document).ready(function() {
var shippingAndHandling = 10.00;
if (window.location.href.indexOf('/shop/checkOut.jsp') != -1) {
var s = $('input[name=sub]').val();
s = parseFloat(s);
if (s < 50.00) {
var t = s + shippingAndHandling;
$('input[name=shipping]').val(shippingAndHandling.toFixed(2));
$('input[name=amount]').val(t.toFixed(2));
@salsalabs
salsalabs / default_receive_email_to_unsubscribed.html
Created Mar 26, 2019
Script to set the default value of a Receive_Email field in a Classic form to -3. All other fields named "Receive_Email" are removed to avoid confusion.
View default_receive_email_to_unsubscribed.html
<!-- BEGIN Default Receive_Email to unsubscribed. -->
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function () {
// Remove hard-coded Receive_Email hidden inputs. That will leave the
// Receive_Email dropdown that the user can see.
var a = document.querySelectorAll('input[name=Receive_Email]');
a.forEach(function(e) {
e.parentNode.removeChild(e);
});
// Set the default value for the Receive Email dropdown.
@salsalabs
salsalabs / action_invalid_address_highlight.html
Created Feb 20, 2019
CSS to highlight the "invalid address" message in targeted actions.
View action_invalid_address_highlight.html
<!-- SalsaStaff 273659: BEGIN highlight for the address error in a targeted action. -->
<style type="text/css">
#notEnoughData {
padding-bottom: 20px;
color: red;
}
</style>
<!-- SalsaStaff 273659: END highlight for the address error in a targeted action. -->
@salsalabs
salsalabs / custom_column_option_values.sql
Created Jan 18, 2019
Query to retrieve custom column option values. Useful for creating cusotm fields in Engage when importing form Classic.
View custom_column_option_values.sql
select cc.label, cc.type, cco.value
from custom_column cc
left outer join custom_column_option cco
on cco.custom_column_KEY = cc.custom_column_KEY
where cc.organization_KEY = 51035
and cco.organization_KEY = 51035
order by cc.label, cco.value;
@salsalabs
salsalabs / redirect_non-secure_signup_pages.html
Created Jan 10, 2019
Script to redirect non-secure signup page URLs to the secure version. Install this script just after the <head> tag in your template(s).
View redirect_non-secure_signup_pages.html
<!-- BEGIN redirect non-secure signup pages to secure URLs. -->
<script type="text/javascript">
if (window.location.href.indexOf('signup?signup_page_KEY=') != -1) {
if (window.location.protocol == 'http:') {
window.location.protocol = 'https:';
}
}
</script>
<!-- END redirect non-secure signup pages to secure URLs. -->
@salsalabs
salsalabs / blast_archive_titles.html
Created Jan 4, 2019
Script to change the labels at the top of the email blast archive. Text is for a specific client. Feel free to change it as necessary after it's installed.
View blast_archive_titles.html
<!-- SalsaStaff 267704: BEGIN script to modify titles on the email blast archive. -->
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function() {
if (window.location.href.indexOf("blastContent.jsp") != -1) {
document.querySelector('#selectBlastSpan').innerHTML = "View a past newsletter: ";
document.querySelector('a[href$="email/public/rss"]:nth-child(2)').innerHTML = "Subscribe to the APFED Newsletter feed.";
}
})
</script>
<!-- SalsaStaff 267704: END script to modify titles on the email blast archive. -->
View donation_oter_amount_no_commas.html
<!-- BEGIN script to remove commas from the "other" amount field on a donation page. -->
<script type="text/javascript">
$(document).ready(function() {
var e = $('form[name="subform"]');
if (e.length != 0) {
e.submit(function() {
var v = $('input[name="amountOther"]')
if (v.length != 0) {
v.val(v.val().replace(/,/g, ''));
}
@salsalabs
salsalabs / donation_oter_amount_no_commas.html
Created Jan 3, 2019
Remove commas from the "other" amount field.
View donation_oter_amount_no_commas.html
<!-- BEGIN script to remove commas from the "other" amount field on a donation page. ==>
<script type="text/javascript">
$(document).ready(function() {
var e = $('form[name="subform"]');
if (e.length != 0) {
e.submit(function() {
var v = $('input[name="amountOther"]')
if (v.length != 0) {
v.val(v.val().replace(/,/g, ''));
}
@salsalabs
salsalabs / unsub_message_fix.html
Last active Dec 27, 2018
Workaround to replace a potentially confusing message in the unsubscribe workflow.
View unsub_message_fix.html
<!-- SalsaStaff 266260: BEGIN workaround to change potentially confusing unsubscribe message. -->
<script type="text/javascript">
var NEW_TEXT = "Please check your email for a confirmation letter from us to click a final link to be removed from all future emails.";
if (window.location.href.indexOf('/followUp') != -1) {
document.addEventListener("DOMContentLoaded", function() {
var e = document.querySelector("div.error");
if (e != null) {
if (/You were successfully removed from all future emails/.test(e.innerHTML)) {
e.innerHTML = NEW_TEXT;
}
You can’t perform that action at this time.