Skip to content

Instantly share code, notes, and snippets.

@salsalabs
salsalabs / LTE_paper_urls_to_links.html
Created Mar 11, 2021
Change newspaper URLs to links in the LTE paper selection grid. Makes it *much* easier to use.
View LTE_paper_urls_to_links.html
@salsalabs
salsalabs / hide_optional_groups.html
Last active Mar 8, 2021
Hide optional groups when no optional groups are selected.
View hide_optional_groups.html
<!-- BEGIN script to hide optional groups prompt when there are no optional groups. -->
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", () => {
var e = document.querySelector("#salsa-optional-groups-header")
if (e != null) {
var f = document.querySelectorAll("li.salsa-optional-group")
if (f.length == 0) {
e.style.display = "None"
}
}
@salsalabs
salsalabs / fix_iho_imo.html
Last active Feb 23, 2021
Clean up In Honor Of and In Memory Of to make them legible and have the same style as the rest of the donation page.
View fix_iho_imo.html
<!-- BEGIN Clean up In Honor Of and in Memory Of fields on donation pages. -->
<!-- See: https://gist.github.com/salsalabs/120d0cd6b476242bf7d7cd79ddbacd8e -->
<style type="text/css">
/* Force label to appear before In_Honor_Address. */
label[for=In_Honor_Address],
*[name=In_Honor_Address] {
float: left;
}
/* SalsaStaff 386297: Make the "In Memory Of" prompt easier to read. */
#honorof > p:nth-child(6) {
@salsalabs
salsalabs / move-content-after-submit.html
Created Dec 14, 2020
Put "content after submit button" after the submit button in a client signup page.
View move-content-after-submit.html
<!-- SalsaStaff 373827: BEGIN Position privacy statement below submit button. -->
<div class="formRow" id="post-submit">
Roots Action considers your contact information to be private and confidential. We will NOT disclose it to any other
entity unless you specifically authorize us to do so. You can read our privacy policy in its entirety
<a href="http://www.rootsaction.org/privacy-policy"> here</a>.
</div>
<script type="text/javascript">
$(document).ready(() => {
var diaFields = $('input[name=Email]').parent().parent();
var submit = $('#submitSignup');
@salsalabs
salsalabs / age_group_checkbox.html
Created Nov 16, 2020
Provide a age group box for a client. The age group box is a <select> with a series of checkboxes inside.
View age_group_checkbox.html
<!-- BEGIN SalsaStaff 366219: Put a fieldset containing "nn-nn years old" optional groups after the Organization field in a
Salsa Classic form. The optional groups are all of subgroups to the "Age Groups" group.
The age group box will apppear on any page that has
1. "An Organization" field.
2. This special html.
<div style="display: none;" id="show-age-group-box"></div>
@salsalabs
salsalabs / delete-payment-option.html
Created Nov 13, 2020
Wait for the payment option block to appear then delete it. Solves an issue with a misconfigured PayPal account.
View delete-payment-option.html
<!-- SalsaStaff 365924: BEGIN delete the payment option fieldset that holds the PayPal payment option. -->
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", () => {
// select the target node
var target = document.querySelector("#salsa");
// create an observer instance
var observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
console.log(mutation.type);
});
@salsalabs
salsalabs / expiration_date_year_fix.html
Last active Aug 7, 2020
Script to change credit card expiration dates so that they start from the current year. This can be useful on Salsa storefronts.
View expiration_date_year_fix.html
<!-- BEGIN Change credit card expiration date year to start with the current year. -->
$(document).ready(() => {
var e = $('select[name=ccExpYear]');
if (e.length == 0) {
return;
}
$('option', e).remove();
e.append('<option value="">Year</option>')
var thisYear = new Date().getFullYear();
Array.from(Array(12).keys()).forEach((v) => {
@salsalabs
salsalabs / welcome_back_country_fill.html
Created Aug 3, 2020
Supply/fill Country field on the Welcome Back pages. We need this because the Welcome Back page does not cache Country (known issue).
View welcome_back_country_fill.html
<?
// SalsaScript to check if the supporter is logged in. If so,
// it deposits the script that populates/appends the Country field.
(function() {
var country = null;
if (Supporter == null) { return; }
country = Supporter.get("Country");
country = (country == null) ? "US" : country;
?>
<!-- BEGIN Supply/fill country field on Welcome Back pages. -->
@salsalabs
salsalabs / event_remove_calendar_buttions.html
Created Jul 21, 2020
Script to remove the calendar buttons from an event.
View event_remove_calendar_buttions.html
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function() {
var e = document.querySelector("#calendarButtons");
if (e != null) {
e.style.display = "none";
}
})
</script>
@salsalabs
salsalabs / event_hide_submit_button.html
Last active Jul 20, 2020
Script to hide the submit button on an event. Input fields will still be live -- there just won't be a way to submit them.
View event_hide_submit_button.html
<!-- BEGIN Hide submit button on an event. -->
<script type="text/javascript">
$(document).ready(function () {
var e = document.querySelector("#submitAddAttendee");
if (e != null) {
e.style.display = "none";
}
});
</script>
<!-- END Hide Submit button on an event. -->