Skip to content

Instantly share code, notes, and snippets.

@salsalabs
salsalabs / profile_manager_mods_1.html
Created May 14, 2014 15:11
This is a script that modifies the contents of the profile manager page. See the comments for more details.
<script type="text/javascript">
$(document).ready(function() {
if (RegExp('profile/login').test(window.location.href)) {
$('a[onclick*=forgotpassword]')
.html("Click here to receive your password.")
.click(function() {
$('.login form').eq(0).hide();
$('.login table').eq(0).hide();
$('a[onclick*=forgotpassword]').hide();
var x = $('#forgotpassword').html()
@salsalabs
salsalabs / sample_authentication.text
Last active August 29, 2015 14:01
This is a sample of an API authentication URL, broken down for legibility. See https://salsasupport.zendesk.com/entries/23529436-Authenticating
[API URL]/api/authenticate.sjs
?xml
&email=[email]
&password=[password]
&organization_KEY=[number]
&chapter_KEY=[number]
@salsalabs
salsalabs / upload_validation.html
Last active August 29, 2015 14:01
This script makes sure that a Salsa upload page has both a file and a file name before the upload is submitted. An alert is displayed if the file is missing. If the file is missing and the name is empty, then the script uses the basename of the file as the name.
<!-- Add client-side validation and defaulting to any upload page. -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
if (/upload_page_KEY=\d+/.test(window.location.href)) {
$('#upload_page').submit(function () {
var file = $('*[name=file]').val();
if (file.length == 0 || file == 'No file selected.') {
alert('Please click the Browser button to choose a file before submitting this form.');
return(false);
@salsalabs
salsalabs / forced_redirect.html
Created May 21, 2014 21:21
Redirect to another URL whenever the URL for a page is clicked.
<script type="text/javascript">
// Replace `URL` with the URL where you want the user to go.
// Please keep all punctuation intact!
window.location = "URL";
</script>
@salsalabs
salsalabs / basic_login.txt
Last active August 29, 2015 14:01
Sample basic login URL, on multiple lines to improve legibility.
https://sample.salsalabs.com/api/authenticate.sjs
?xml
&email=youremail@email.com
&password=yourpass
@salsalabs
salsalabs / authenticate_org_key.txt
Created May 21, 2014 22:53
Login specifying an organization_KEY to disambiguate the login credentials. On several lines to aid legibility.
https://sample.salsalabs.com/api/authenticate.sjs
?json
&email=youremail@email.com
&password=yourpass
&organization_KEY=12345
@salsalabs
salsalabs / authenticate_org_chapter.txt
Created May 21, 2014 22:55
Authenticate with both organization_KEY and chapter_KEY to disambiguate credentials. On several lines to aid legibility.
https://big_org.salsalabs.com/api/authenticate.sjs
?xml
&email=youremail@email.com
&password=yourpass
&organization_KEY=12345
&chapter_KEY=1234
@salsalabs
salsalabs / salsa_sample.php
Last active August 29, 2015 14:01
Sample of using the Salsa API in PHP. Note that cookies must be passed to every call after authentication!
<?php
// See https://salsasupport.zendesk.com/entries/23514381-Definitions-for-common-terms
// to find out to retrieve the API URL in $url.
$url = "https://API_URL/api";
$username = ""; # Campaign Manager username goes here
$password = ""; # Campaign Manager password goes here
// Method #1 for building post objects to send to Salsa
$authfields["email"] = $username;
<style type="text/css">
.perpetual-disclaimer {
padding: 5px;
width: 500px;
text-align: center;
background-color: lemonchiffon;
color: darkblue;
border: 1pt solid forestgreen;
line-height: 1.2em;
}
@salsalabs
salsalabs / donation_designation_required.html
Last active August 29, 2015 14:01
Script to make the Donation_Designation field required in a donation page. The Donation_Designation field is usually optional, but there are some use cases, particularly when the field is a dropdown, where it needs to be required.
<script type="text/javascript">
$(document).ready(function() {
var required = $('*[name=required]');
var val = required.val();
if (val.indexOf('Designation_Code') == -1) {
val = val + "Designation_Code,";
required.val(val);
}
});
</script>