Skip to content

Instantly share code, notes, and snippets.

@salsalabs
salsalabs / LTE_paper_urls_to_links.html
Created March 11, 2021 20:10
Change newspaper URLs to links in the LTE paper selection grid. Makes it *much* easier to use.
@salsalabs
salsalabs / hide_optional_groups.html
Last active March 8, 2021 23:12
Hide optional groups when no optional groups are selected.
<!-- 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 February 23, 2021 18:14
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.
<!-- 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 December 14, 2020 22:22
Put "content after submit button" after the submit button in a client signup page.
<!-- 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 November 16, 2020 22:19
Provide a age group box for a client. The age group box is a <select> with a series of checkboxes inside.
<!-- 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 November 13, 2020 19:11
Wait for the payment option block to appear then delete it. Solves an issue with a misconfigured PayPal account.
<!-- 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 April 30, 2021 15:07
Script to change credit card expiration dates so that they start from the current year. This can be useful on Salsa storefronts.
<!-- BEGIN Change credit card expiration date year to start with the current year. -->
$(document).ready(() => {
const years = 20;
var e = $('select[name=ccExpYear]');
if (e.length == 0) {
return;
}
$('option', e).remove();
e.append('<option value="">Year</option>')
var thisYear = new Date().getFullYear();
@salsalabs
salsalabs / welcome_back_country_fill.html
Created August 3, 2020 22:14
Supply/fill Country field on the Welcome Back pages. We need this because the Welcome Back page does not cache Country (known issue).
<?
// 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 July 21, 2020 21:54
Script to remove the calendar buttons from an event.
<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 July 20, 2020 22:05
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.
<!-- 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. -->