├── .gitattributes ├── .github └── workflows │ └── checkmarxone.yml ├── .gitignore ├── README.md ├── examples ├── README.md ├── bootstrap │ ├── README.md │ ├── action-center.html │ ├── donate.html │ ├── index.html │ ├── js │ │ ├── luminateExtend-examples.js │ │ ├── luminateExtend.js │ │ ├── respond.proxy.gif │ │ └── respond.proxy.js │ ├── sign-up.html │ └── walk-for-health.html └── foundation │ ├── README.md │ ├── action-center.html │ ├── donate.html │ ├── index.html │ ├── js │ ├── luminateExtend-examples.js │ └── luminateExtend.js │ ├── sign-up.html │ └── walk-for-health.html ├── luminateExtend.js ├── luminateExtend.min.js ├── luminateExtend_server.html ├── src ├── luminateExtend.js └── luminateExtend_server.html └── test ├── README.md ├── api.html ├── global.html ├── init.html ├── js ├── api.js ├── global.js ├── init.js ├── luminateExtend.js ├── setup.js └── utils.js └── utils.html /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.github/workflows/checkmarxone.yml: -------------------------------------------------------------------------------- 1 | name: Checkmarx AST Github Action 2 | on: 3 | push: 4 | branches: 5 | - main 6 | - master 7 | 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v4 15 | - name: Checkmarx AST Github Action 16 | uses: Checkmarx/ast-github-action@2.0.36 17 | with: 18 | base_uri: https://us.ast.checkmarx.net 19 | cx_tenant: blackbaud 20 | cx_client_id: ${{ secrets.CX_CLIENT_ID }} 21 | cx_client_secret: ${{ secrets.CX_CLIENT_SECRET }} 22 | project_name: luminateExtend 23 | branch: ${{ github.head_ref || github.ref }} 24 | #github_token: # optional, default is ${{ github.token }} 25 | additional_params: --async --project-groups CustomerSuccess --sast-preset-name "BlackbaudSAST" --sast-filter !cvs,!.svn,!.hg,!.git,!.bzr,!bin,!obj,!backup,!.idea,!node_modules,!**/*.test/**,!**/tests/**,!**/*.Test/**,!**/Tests/**,!**/*.ITests/**,!**/*.UnitTests/**,!**/UnitTests/**,!**/*.Steps/**,!**/*.TestTools/**,!**/SpecFlow.*/**,!**/SpecFlow.*.nupkg,!**/SpecRun.Runner.*/**,!**/SpecRun.Runner,!.UnitTests,!**/*.DS_Store,!**/*.ipr,!**/*.iws,!**/*.bak,!**/*.tmp,!**/*.aac,!**/*.aif,!**/*.iff,!**/*.m3u,!**/*.mid,!**/*.mp3,!**/*.mpa,!**/*.ra,!**/*.wav,!**/*.wma,!**/*.3g2,!**/*.3gp,!**/*.asf,!**/*.asx,!**/*.avi,!**/*.flv,!**/*.mov,!**/*.mp4,!**/*.mpg,!**/*.rm,!**/*.swf,!**/*.vob,!**/*.wmv,!**/*.bmp,!**/*.gif,!**/*.jpg,!**/*.png,!**/*.psd,!**/*.tif,!**/*.swf,!**/*.jar,!**/*.zip,!**/*.rar,!**/*.exe,!**/*.dll,!**/*.pdb,!**/*.7z,!**/*.gz,!**/*.tar.gz,!**/*.tar,!**/*.gz,!**/*.ahtm,!**/*.ahtml,!**/*.fhtml,!**/*.hdm,!**/*.hdml,!**/*.hsql,!**/*.ht,!**/*.hta,!**/*.htc,!**/*.htd,!**/*.war,!**/*.ear,!**/*.htmls,!**/*.ihtml,!**/*.mht,!**/*.mhtm,!**/*.mhtml,!**/*.ssi,!**/*.stm,!**/*.stml,!**/*.ttml,!**/*.txn,!**/*.xhtm,!**/*.xhtml,!**/*.class,!**/*.iml 26 | repo_name: ${{ github.event.repository.name }} 27 | #namespace: # optional, default is ${{ github.repository_owner }} 28 | #pr_number: # optional, default is ${{ github.event.number }} 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | [Dd]ebug/ 46 | [Rr]elease/ 47 | *_i.c 48 | *_p.c 49 | *.ilk 50 | *.meta 51 | *.obj 52 | *.pch 53 | *.pdb 54 | *.pgc 55 | *.pgd 56 | *.rsp 57 | *.sbr 58 | *.tlb 59 | *.tli 60 | *.tlh 61 | *.tmp 62 | *.vspscc 63 | .builds 64 | *.dotCover 65 | 66 | ## TODO: If you have NuGet Package Restore enabled, uncomment this 67 | #packages/ 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | *.sdf 75 | 76 | # Visual Studio profiler 77 | *.psess 78 | *.vsp 79 | 80 | # ReSharper is a .NET coding add-in 81 | _ReSharper* 82 | 83 | # Installshield output folder 84 | [Ee]xpress 85 | 86 | # DocProject is a documentation generator add-in 87 | DocProject/buildhelp/ 88 | DocProject/Help/*.HxT 89 | DocProject/Help/*.HxC 90 | DocProject/Help/*.hhc 91 | DocProject/Help/*.hhk 92 | DocProject/Help/*.hhp 93 | DocProject/Help/Html2 94 | DocProject/Help/html 95 | 96 | # Click-Once directory 97 | publish 98 | 99 | # Others 100 | [Bb]in 101 | [Oo]bj 102 | sql 103 | TestResults 104 | *.Cache 105 | ClientBin 106 | stylecop.* 107 | ~$* 108 | *.dbmdl 109 | Generated_Code #added for RIA/Silverlight projects 110 | 111 | # Backup & report files from converting an old project file to a newer 112 | # Visual Studio version. Backup files are not needed, because we have git ;-) 113 | _UpgradeReport_Files/ 114 | Backup*/ 115 | UpgradeLog*.XML 116 | 117 | 118 | 119 | ############ 120 | ## Windows 121 | ############ 122 | 123 | # Windows image file caches 124 | Thumbs.db 125 | 126 | # Folder config file 127 | Desktop.ini 128 | 129 | 130 | ############# 131 | ## Python 132 | ############# 133 | 134 | *.py[co] 135 | 136 | # Packages 137 | *.egg 138 | *.egg-info 139 | dist 140 | build 141 | eggs 142 | parts 143 | bin 144 | var 145 | sdist 146 | develop-eggs 147 | .installed.cfg 148 | 149 | # Installer logs 150 | pip-log.txt 151 | 152 | # Unit test / coverage reports 153 | .coverage 154 | .tox 155 | 156 | #Translations 157 | *.mo 158 | 159 | #Mr Developer 160 | .mr.developer.cfg 161 | 162 | # Mac crap 163 | .DS_Store 164 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | luminateExtend.js - Examples 2 | ============================ 3 | 4 | Together, the examples provided here represent a very basic sample website for the fictitious organization American Health Society. 5 | Two versions of the examples are available for your perusal — one built with 6 | [Bootstrap 3](https://github.com/convio/luminateExtend/tree/master/examples/bootstrap/), and one with 7 | [Foundation 4](https://github.com/convio/luminateExtend/tree/master/examples/foundation/). -------------------------------------------------------------------------------- /examples/bootstrap/action-center.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | American Health Society Action Center 6 | 7 | 8 | 9 | 15 | 16 | 24 | 25 | 26 | 27 | 28 | 29 | 66 |
67 | 70 |

Become an advocate for health!

71 |
72 | Loading ... 73 |
74 |
75 | 78 |
79 | 80 | 81 | 82 | 83 | 84 | 89 | 90 | -------------------------------------------------------------------------------- /examples/bootstrap/donate.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Donate to American Health Society 6 | 7 | 8 | 9 | 23 | 24 | 32 | 33 | 34 | 35 | 36 | 37 | 74 |
75 | 78 |

You can be a part of the solution – make a donation to help fund important research. We can't do it without you.

79 |
80 | 81 | 82 | 83 |
84 |
Donation Information
85 |
86 |
87 | 88 |
89 |
90 | 93 |
94 |
95 | 98 |
99 |
100 | 103 |
104 |
105 | 108 |
109 |
110 | $ 111 |
112 |
113 |
114 |
115 |
116 | 117 |
118 |
Billing Information
119 |
120 |
121 | 122 |
123 | 124 |
125 |
126 |
127 | 128 |
129 | 130 |
131 |
132 |
133 | 134 |
135 | 136 |
137 |
138 |
139 | 140 |
141 | 142 |
143 |
144 |
145 | 146 |
147 | 148 |
149 |
150 |
151 | 152 |
153 | 232 |
233 |
234 |
235 | 236 |
237 | 238 |
239 |
240 |
241 |
242 | 243 |
244 |
Email
245 |
246 |
247 | 248 |
249 | 250 |
251 |
252 |
253 |
254 |
255 | 258 |
259 |
260 |
261 |
262 |
263 | 264 |
265 |
Payment Information
266 |
267 |
268 | 269 |
270 | 271 |
272 |
273 |
274 | 275 |
276 | 277 |
278 |
279 |
280 | 281 |
282 | 297 |
298 |
299 | 308 |
309 |
310 |
311 |
312 | 313 | 314 |
315 |
316 | 319 |
320 | 321 | 322 | 323 | 324 | 325 | 326 | -------------------------------------------------------------------------------- /examples/bootstrap/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | American Health Society 6 | 7 | 8 | 9 | 15 | 16 | 24 | 25 | 26 | 27 | 28 | 29 | 66 |
67 |
68 |

Your Donation Today Can Save Countless Lives

69 |

You can be a part of the solution – make a donation to help fund important research. We can't do it without you.

70 |

Donate Now »

71 |
72 |
73 |
74 |
75 |
76 |

Get AHS News

77 |

Sign up today to receive the American Health Society's weekly e-newsletter.

78 |

Sign Up »

79 |
80 |
81 |

Action Center

82 |

Become an advocate for health! View the list of our latest action alerts.

83 |

Take Action »

84 |
85 |
86 |

Walk for Health

87 |

Form a team in the Walk for Health and help raise money for our important mission.

88 |

Find an Event »

89 |
90 |
91 |
92 | 95 |
96 | 97 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /examples/bootstrap/js/luminateExtend-examples.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | /* define init variables for your organization */ 3 | luminateExtend({ 4 | apiKey: '123456789', 5 | path: { 6 | nonsecure: 'http://shortname.convio.net/site/', 7 | secure: 'https://secure2.convio.net/shortname/site/' 8 | } 9 | }); 10 | 11 | $(function() { 12 | /* example: get information on the currently logged in user, and display a "welcome back" message in the site's header */ 13 | window.getUser = function() { 14 | var getUserCallback = function(data) { 15 | if(data.getConsResponse && data.getConsResponse.name) { 16 | $('#login-form').replaceWith(''); 20 | } 21 | }; 22 | luminateExtend.api({ 23 | api: 'cons', 24 | callback: getUserCallback, 25 | data: 'method=getUser', 26 | requiresAuth: true 27 | }); 28 | }; 29 | 30 | /* example: check if the user is logged in onload */ 31 | /* if they are logged in, call the getUser function above to display the "welcome back" message */ 32 | /* if they are not logged in, show the login form */ 33 | var loginTestCallback = { 34 | success: function() { 35 | getUser(); 36 | }, 37 | error: function() { 38 | $('#login-form').removeClass('hide'); 39 | } 40 | }; 41 | luminateExtend.api({ 42 | api: 'cons', 43 | callback: loginTestCallback, 44 | data: 'method=loginTest' 45 | }); 46 | 47 | /* example: handle the login form in the site's header */ 48 | /* if the user is logged in successfully, call the getUser function above to display the "welcome back" message */ 49 | /* if the user is not logged in, display the error message returned by the API in a modal */ 50 | window.loginCallback = { 51 | error: function(data) { 52 | if($('#login-error-modal').length == 0) { 53 | $('body').append(''); 69 | } 70 | else { 71 | $('#login-error-modal .modal-body p').html(data.errorResponse.message); 72 | } 73 | $('#login-error-modal').modal('show'); 74 | }, 75 | success: function(data) { 76 | getUser(); 77 | } 78 | }; 79 | 80 | /* UI handlers for the donation form example */ 81 | if($('.donation-form').length > 0) { 82 | $('input[name="level_id"]').click(function() { 83 | if($(this).is('#level-other')) { 84 | $('#other-amount').removeAttr('disabled'); 85 | $('#other-amount').attr('name', 'other_amount'); 86 | $('#other-amount').focus(); 87 | } 88 | else { 89 | $('#other-amount').attr('disabled', 'disabled'); 90 | $('#other-amount').removeAttr('name'); 91 | } 92 | }); 93 | 94 | $('.donation-form').submit(function() { 95 | window.scrollTo(0, 0); 96 | $(this).hide(); 97 | $(this).before('
' + 98 | 'Loading ...' + 99 | '
'); 100 | }); 101 | } 102 | 103 | /* example: handle the donation form submission */ 104 | /* if the donation is successful, display a thank you message */ 105 | /* if there is an error with the donation, display it inline */ 106 | window.donateCallback = { 107 | error: function(data) { 108 | $('#donation-errors').remove(); 109 | 110 | $('.donation-form').prepend('
' + 111 | '
' + 112 | data.errorResponse.message + 113 | '
' + 114 | '
'); 115 | 116 | $('.donation-loading').remove(); 117 | $('.donation-form').show(); 118 | }, 119 | success: function(data) { 120 | $('#donation-errors').remove(); 121 | 122 | if(data.donationResponse.errors) { 123 | $('.donation-form').prepend('
' + 124 | ((data.donationResponse.errors.message) ? ('
' + 125 | data.donationResponse.errors.message + 126 | '
') : '') + 127 | '
'); 128 | 129 | if(data.donationResponse.errors.fieldError) { 130 | var fieldErrors = luminateExtend.utils.ensureArray(data.donationResponse.errors.fieldError); 131 | $.each(fieldErrors, function() { 132 | $('#donation-errors').append('
' + 133 | this + 134 | '
'); 135 | }); 136 | } 137 | 138 | $('.donation-loading').remove(); 139 | $('.donation-form').show(); 140 | } 141 | else { 142 | $('.donation-loading').remove(); 143 | $('.donation-form').before('
' + 144 | 'Your donation has been processed!' + 145 | '
' + 146 | '
' + 147 | '

Thank you for your donation of $' + data.donationResponse.donation.amount.decimal + '.

' + 148 | '

Your confirmation code is ' + data.donationResponse.donation.confirmation_code + '.

' + 149 | '
'); 150 | } 151 | } 152 | }; 153 | 154 | /* UI handlers for the Survey example */ 155 | if($('.survey-form').length > 0) { 156 | $('.survey-form').submit(function() { 157 | window.scrollTo(0, 0); 158 | $(this).hide(); 159 | $(this).before('
' + 160 | 'Loading ...' + 161 | '
'); 162 | }); 163 | } 164 | 165 | /* example: handle the Survey form submission */ 166 | /* if the Survey is submitted succesfully, display a thank you message */ 167 | /* if there is an error, display it inline */ 168 | window.submitSurveyCallback = { 169 | error: function(data) { 170 | $('#survey-errors').remove(); 171 | $('.survey-form .form-group .alert').remove(); 172 | 173 | $('.survey-form').prepend('
' + 174 | '
' + 175 | data.errorResponse.message + 176 | '
' + 177 | '
'); 178 | 179 | $('.survey-loading').remove(); 180 | $('.survey-form').show(); 181 | }, 182 | success: function(data) { 183 | $('#survey-errors').remove(); 184 | $('.survey-form .form-group .survey-alert-wrap').remove(); 185 | 186 | if(data.submitSurveyResponse.success == 'false') { 187 | $('.survey-form').prepend('
' + 188 | '
' + 189 | 'There was an error with your submission. Please try again.' + 190 | '
' + 191 | '
'); 192 | 193 | var surveyErrors = luminateExtend.utils.ensureArray(data.submitSurveyResponse.errors); 194 | $.each(surveyErrors, function() { 195 | if(this.errorField) { 196 | $('input[name="' + this.errorField + '"]').closest('.form-group') 197 | .prepend('
' + 198 | '
' + 199 | this.errorMessage + 200 | '
' + 201 | '
'); 202 | } 203 | }); 204 | 205 | $('.survey-loading').remove(); 206 | $('.survey-form').show(); 207 | } 208 | else { 209 | $('.survey-loading').remove(); 210 | $('.survey-form').before('
' + 211 | 'You\'ve been signed up!' + 212 | '
' + 213 | '
' + 214 | '

Thanks for joining. You should receive your first issue of the e-newsletter shortly.

' + 215 | '
'); 216 | } 217 | } 218 | }; 219 | 220 | /* example: display a list of action alerts for the organization in the specified container */ 221 | window.getAdvocacyAlerts = function(selector) { 222 | var getAdvocacyAlertsCallback = function(data) { 223 | $(selector).html(''); 224 | 225 | var alertList = luminateExtend.utils.ensureArray(data.getAdvocacyAlertsResponse.alert); 226 | $.each(alertList, function() { 227 | $(selector).append('
' + 228 | '

' + this.title + '
' + 229 | this.description + '
' + 230 | ((this.interactionCount == '0') ? 'No actions taken so far. Be the first to respond!' : ('' + this.interactionCount + ' actions taken so far.')) + 231 | '

' + 232 | '

Take Action

' + 233 | '
'); 234 | }); 235 | }; 236 | 237 | luminateExtend.api({ 238 | api: 'advocacy', 239 | callback: getAdvocacyAlertsCallback, 240 | data: 'method=getAdvocacyAlerts&alert_status=active&alert_type=action' 241 | }); 242 | }; 243 | 244 | /* example: handle the TeamRaiser ZIP Code radius form */ 245 | /* if one or more TeamRaisers are returned, display them */ 246 | /* if an error is returned, display it above the form */ 247 | window.getTeamraisersByDistanceCallback = { 248 | error: function(data) { 249 | $('#teamraiser-event-search-errors').remove(); 250 | $('#teamraiser-event-search-results').html(''); 251 | 252 | $('.teamraiser-event-search-form').prepend('
' + 253 | '
' + 254 | data.errorResponse.message + 255 | '
' + 256 | '
'); 257 | }, 258 | success: function(data) { 259 | $('#teamraiser-event-search-errors').remove(); 260 | $('#teamraiser-event-search-results').html(''); 261 | 262 | if(data.getTeamraisersResponse.totalNumberResults == 0) { 263 | $('.teamraiser-event-search-form').prepend('
' + 264 | '
' + 265 | 'No events found. Please try another search.' + 266 | '
' + 267 | '
'); 268 | } 269 | else { 270 | $('#teamraiser-event-search-results').html('
'); 271 | var teamraiserList = luminateExtend.utils.ensureArray(data.getTeamraisersResponse.teamraiser); 272 | $.each(teamraiserList, function() { 273 | $('#teamraiser-event-search-results .well').append('
' + 274 | '

' + this.name + '
' + 275 | luminateExtend.utils.simpleDateFormat(this.event_date, 'MMMM d, yyyy') + '

' + 276 | '

Form a Team ' + 277 | 'Join a Team ' + 278 | '

'); 279 | }); 280 | } 281 | } 282 | }; 283 | 284 | /* bind any forms with the "luminateApi" class */ 285 | luminateExtend.api.bind(); 286 | }); 287 | })(jQuery); -------------------------------------------------------------------------------- /examples/bootstrap/js/luminateExtend.js: -------------------------------------------------------------------------------- 1 | /* luminateExtend.js | Version: 1.9.0 (07-AUG-2021) */ 2 | !function(e){var t=function(t){return t&&e.inArray(t,["es_US","en_CA","fr_CA","en_GB","en_AU"])<0&&(t="en_US"),t},a=function(e){return e&&(e=t(e),luminateExtend.sessionVars.set("locale",e)),e},n=function(e,t){return(e?luminateExtend.global.path.secure+"S":luminateExtend.global.path.nonsecure)+"PageServer"+(luminateExtend.global.routingId&&""!==luminateExtend.global.routingId?";"+luminateExtend.global.routingId:"")+"?pagename=luminateExtend_server&pgwrap=n"+(t?"&"+t:"")},i=function(t,a){if(t.responseFilter&&t.responseFilter.array&&t.responseFilter.filter&&luminateExtend.utils.stringToObj(t.responseFilter.array,a)){var n,i,l=t.responseFilter.filter.split("==")[0].split("!=")[0].replace(/^\s+|\s+$/g,"");if(-1!==t.responseFilter.filter.indexOf("!=")?(n="nequal",i=t.responseFilter.filter.split("!=")[1]):-1!==t.responseFilter.filter.indexOf("==")&&(n="equal",i=t.responseFilter.filter.split("==")[1]),n&&i){i=i.replace(/^\s+|\s+$/g,"");var o=[],r=!1;if(e.each(luminateExtend.utils.ensureArray(luminateExtend.utils.stringToObj(t.responseFilter.array,a)),function(){"nequal"===n&&this[l]===i||"equal"===n&&this[l]!==i?r=!0:o.push(this)}),r){var s=t.responseFilter.array.split(".");e.each(a,function(t,n){t===s[0]&&e.each(n,function(n,i){n===s[1]&&(2===s.length?a[t][n]=o:e.each(i,function(i,l){i===s[2]&&(3===s.length?a[t][n][i]=o:e.each(l,function(e,l){e===s[3]&&4===s.length&&(a[t][n][i][e]=o)}))}))})})}}}var u=e.noop;t.callback&&("function"==typeof t.callback?u=t.callback:t.callback.error&&a.errorResponse?u=t.callback.error:t.callback.success&&!a.errorResponse&&(u=t.callback.success));var d=-1!==t.data.indexOf("&method=login")&&-1===t.data.indexOf("&method=loginTest"),c=-1!==t.data.indexOf("&method=logout");if(d||c){var p={callback:function(){u(a)},useCache:!1,useHTTPS:t.useHTTPS};d&&a.loginResponse&&a.loginResponse.nonce&&(p.nonce="NONCE_TOKEN="+a.loginResponse.nonce),luminateExtend.api.getAuth(p)}else u(a)};window.luminateExtend=function(e){luminateExtend.init(e||{})},luminateExtend.library={version:"1.9.0"},luminateExtend.global={update:function(t,n){t&&(t.length?n&&("locale"===t&&(n=a(n)),luminateExtend.global[t]=n):(t.locale&&(t.locale=a(t.locale)),luminateExtend.global=e.extend(luminateExtend.global,t)))}},luminateExtend.init=function(a){var n=e.extend({apiCommon:{},auth:{type:"auth"},path:{}},a||{});(n.locale&&(n.locale=t(n.locale)),n.supportsCORS=!1,window.XMLHttpRequest)&&("withCredentials"in new XMLHttpRequest&&(n.supportsCORS=!0));return luminateExtend.global=e.extend(luminateExtend.global,n),luminateExtend},luminateExtend.api=function(e){luminateExtend.api.request(e||{})},luminateExtend.api.bind=function(t){return e(t=t||"form.luminateApi").length>0&&e(t).each(function(){"form"===this.nodeName.toLowerCase()&&e(this).bind("submit",function(t){t.cancelBubble=!0,t.returnValue=!1,t.stopPropagation&&(t.stopPropagation(),t.preventDefault()),e(this).attr("id")||e(this).attr("id","luminateApi-"+(new Date).getTime());var a,n=e(this).attr("action"),i=n.split("?"),l=e(this).data("luminateapi"),o=-1!==i[0].indexOf("/site/")?i[0].split("/site/")[1]:i[0],r=e(this).attr("enctype"),s=i.length>1?i[1]:"",u="#"+e(this).attr("id"),d=!1,c=!1;l&&(l.callback&&(a=luminateExtend.utils.stringToObj(l.callback)),l.requiresAuth&&"true"===l.requiresAuth&&(d=!0),(0===n.indexOf("https:")||"https:"===window.location.protocol&&-1===n.indexOf("http"))&&(c=!0)),luminateExtend.api.request({api:o,callback:a,contentType:r,data:s,form:u,requiresAuth:d,useHTTPS:c})})}),luminateExtend},luminateExtend.api.getAuth=function(t){var a=e.extend({useCache:!0,useHTTPS:!1},t||{});if(luminateExtend.api.getAuthLoad)if(luminateExtend.api.getAuthLoad=!1,a.useCache&&luminateExtend.global.auth.type&&luminateExtend.global.auth.token)luminateExtend.api.getAuthLoad=!0,a.callback&&a.callback();else{var i=function(e){luminateExtend.global.update(e),luminateExtend.api.getAuthLoad=!0,a.callback&&a.callback()};luminateExtend.global.supportsCORS?e.ajax({url:(a.useHTTPS?luminateExtend.global.path.secure:luminateExtend.global.path.nonsecure)+"CRConsAPI",data:"luminateExtend="+luminateExtend.library.version+(a.nonce&&""!==a.nonce?"&"+a.nonce:"")+"&api_key="+luminateExtend.global.apiKey+"&method=getLoginUrl&response_format=json&v=1.0",xhrFields:{withCredentials:!0},dataType:"json",success:function(e){var t=e.getLoginUrlResponse,a=t.url,n=t.routing_id,l=t.JSESSIONID;n||-1===a.indexOf("CRConsAPI;jsessionid=")||(n=a.split("CRConsAPI;jsessionid=")[1].split("?")[0]),i({auth:{type:"auth",token:t.token},routingId:n?"jsessionid="+n:"",sessionCookie:l?"JSESSIONID="+l:""})}}):e.ajax({url:n(a.useHTTPS,"action=getAuth&callback=?"),dataType:"jsonp",success:i})}else setTimeout(function(){luminateExtend.api.getAuth(a)},1e3)},luminateExtend.api.getAuthLoad=!0;var l=function(t){var a=e.extend({contentType:"application/x-www-form-urlencoded",data:"",requiresAuth:!1,useHTTPS:null},t||{});if(e.inArray(a.api.toLowerCase(),["addressbook","advocacy","connect","cons","content","datasync","donation","email","group","orgevent","recurring","survey","teamraiser"])>=0&&(a.api="CR"+a.api.charAt(0).toUpperCase()+a.api.slice(1).toLowerCase()+"API",a.api=a.api.replace("Addressbook","AddressBook").replace("Datasync","DataSync").replace("Orgevent","OrgEvent")),luminateExtend.global.path.nonsecure&&luminateExtend.global.path.secure&&luminateExtend.global.apiKey&&a.api){if("multipart/form-data"===a.contentType.split(";")[0]?a.contentType="multipart/form-data":a.contentType="application/x-www-form-urlencoded",a.contentType+="; charset=UTF-8",a.data="luminateExtend="+luminateExtend.library.version+(""===a.data?"":"&"+a.data),a.form&&e(a.form).length>0&&(a.data+="&"+e(a.form).eq(0).serialize()),-1===a.data.indexOf("&api_key=")&&(a.data+="&api_key="+luminateExtend.global.apiKey),luminateExtend.global.apiCommon.centerId&&-1===a.data.indexOf("¢er_id=")&&(a.data+="¢er_id="+luminateExtend.global.apiCommon.centerId),luminateExtend.global.apiCommon.categoryId&&-1===a.data.indexOf("&list_category_id=")&&(a.data+="&list_category_id="+luminateExtend.global.apiCommon.categoryId),-1!==a.data.indexOf("&response_format=xml")?a.data=a.data.replace(/&response_format=xml/g,"&response_format=json"):-1===a.data.indexOf("&response_format=")&&(a.data+="&response_format=json"),luminateExtend.global.apiCommon.source&&-1===a.data.indexOf("&source=")){var l=luminateExtend.global.apiCommon.source;l.length>255&&(l=l.substring(0,255)),a.data+="&source="+l}if(luminateExtend.global.apiCommon.subSource&&-1===a.data.indexOf("&sub_source=")){var o=luminateExtend.global.apiCommon.subSource;o.length>255&&(o=o.substring(0,255)),a.data+="&sub_source="+o}-1===a.data.indexOf("&suppress_response_codes=")&&(a.data+="&suppress_response_codes=true"),luminateExtend.global.locale&&-1===a.data.indexOf("&s_locale=")&&(a.data+="&s_locale="+luminateExtend.global.locale),-1===a.data.indexOf("&v=")&&(a.data+="&v=1.0");var r="http://",s=luminateExtend.global.path.nonsecure.split("http://")[1];"CRDonationAPI"===a.api||"CRTeamraiserAPI"===a.api||"CRConnectAPI"!==a.api&&("https:"===window.location.protocol&&null==a.useHTTPS||1==a.useHTTPS)?a.useHTTPS=!0:a.useHTTPS=!1,a.useHTTPS&&(r="https://",s=luminateExtend.global.path.secure.split("https://")[1]),r+=s+a.api;var u,d=!1,c=!1,p=!1;window.location.protocol===r.split("//")[0]&&document.domain===s.split("/")[0]?(d=!0,c=!0):luminateExtend.global.supportsCORS?c=!0:"postMessage"in window&&(p=!0),c?u=function(){luminateExtend.global.routingId&&""!==luminateExtend.global.routingId&&(r+=";"+luminateExtend.global.routingId),a.requiresAuth&&-1===a.data.indexOf("&"+luminateExtend.global.auth.type+"=")&&(a.data+="&"+luminateExtend.global.auth.type+"="+luminateExtend.global.auth.token),luminateExtend.global.sessionCookie&&""!==luminateExtend.global.sessionCookie&&(a.data+="&"+luminateExtend.global.sessionCookie),a.data+="&ts="+(new Date).getTime(),e.ajax({url:r,data:a.data,xhrFields:{withCredentials:!0},contentType:a.contentType,dataType:"json",type:"POST",success:function(e){i(a,e)}})}:p&&(u=function(){var t=(new Date).getTime(),l="luminateApiPostMessage"+t,o=n(a.useHTTPS,"action=postMessage");luminateExtend.global.routingId&&""!==luminateExtend.global.routingId&&(r+=";"+luminateExtend.global.routingId),a.requiresAuth&&-1===a.data.indexOf("&"+luminateExtend.global.auth.type+"=")&&(a.data+="&"+luminateExtend.global.auth.type+"="+luminateExtend.global.auth.token),luminateExtend.global.sessionCookie&&""!==luminateExtend.global.sessionCookie&&(a.data+="&"+luminateExtend.global.sessionCookie),a.data+="&ts="+t,luminateExtend.api.request.postMessageEventHandler||(luminateExtend.api.request.postMessageEventHandler={},luminateExtend.api.request.postMessageEventHandler.handler=function(t){if(-1!==luminateExtend.global.path.nonsecure.indexOf(t.origin)||-1!==luminateExtend.global.path.secure.indexOf(t.origin)){var a=e.parseJSON(t.data),n=a.postMessageFrameId,i=e.parseJSON(decodeURIComponent(a.response));luminateExtend.api.request.postMessageEventHandler[n]&&luminateExtend.api.request.postMessageEventHandler[n](n,i)}},void 0!==window.addEventListener?window.addEventListener("message",luminateExtend.api.request.postMessageEventHandler.handler,!1):void 0!==window.attachEvent&&window.attachEvent("onmessage",luminateExtend.api.request.postMessageEventHandler.handler)),luminateExtend.api.request.postMessageEventHandler[l]=function(t,n){i(a,n),e("#"+t).remove(),delete luminateExtend.api.request.postMessageEventHandler[t]},e("body").append(''),e("#"+l).bind("load",function(){var t='{"postMessageFrameId": "'+e(this).attr("id")+'", "requestUrl": "'+r+'", "requestContentType": "'+a.contentType+'", "requestData": "'+a.data+'"}',n=r.split("/site/")[0].split("/admin/")[0];document.getElementById(e(this).attr("id")).contentWindow.postMessage(t,n)}),e("#"+l).attr("src",o)}),a.requiresAuth||!c&&!d&&!luminateExtend.global.sessionCookie?luminateExtend.api.getAuth({callback:u,useHTTPS:a.useHTTPS}):u()}};luminateExtend.api.request=function(t){if(e.isArray(t)){t.reverse();var a=[];e.each(t,function(n){var i=e.extend({async:!0},this);if(i.async||n===t.length-1)a.push(i);else if((r=t[n+1]).callback&&"function"!=typeof r.callback){var o=r.callback.success||e.noop;r.callback.success=function(e){o(e),l(i)}}else{var r,s=(r=t[n+1]).callback||e.noop;r.callback={success:function(e){s(e),l(i)},error:function(e){s(e)}}}}),a.reverse(),e.each(a,function(){l(this)})}else l(t)},luminateExtend.sessionVars={set:function(e,t,a){var n={};a&&(n.callback=a),e&&(n.data="s_"+e+"="+(t||""),luminateExtend.utils.ping(n))}},luminateExtend.tags=function(e,t){luminateExtend.tags.parse(e,t)},luminateExtend.tags.parse=function(t,a){luminateExtend.widgets?luminateExtend.widgets(t,a):(t=t&&"all"!==t?luminateExtend.utils.ensureArray(t):["cons"],a=a||"body",e.each(t,function(t,n){if("cons"===n){var i=e(a).find(document.getElementsByTagName("luminate:cons"));if(i.length>0){luminateExtend.api.request({api:"cons",callback:function(t){i.each(function(){t.getConsResponse?e(this).replaceWith(luminateExtend.utils.stringToObj(e(this).attr("field"),t.getConsResponse)):e(this).remove()})},data:"method=getUser",requiresAuth:!0})}}}))},luminateExtend.utils={ensureArray:function(t){return e.isArray(t)?t:t?[t]:[]},stringToObj:function(e,t){var a=t||window;if(e)for(var n=e.split("."),i=0;i'),e("#"+n).bind("load",function(){e(this).remove(),a.callback&&a.callback()}),e("#"+n).attr("src",("https:"===window.location.protocol?luminateExtend.global.path.secure:luminateExtend.global.path.nonsecure)+"EstablishSession"+(luminateExtend.global.routingId&&""!==luminateExtend.global.routingId?";"+luminateExtend.global.routingId:"")+"?"+(null==a.data?"":a.data+"&")+"NEXTURL="+encodeURIComponent(("https:"===window.location.protocol?luminateExtend.global.path.secure:luminateExtend.global.path.nonsecure)+"PixelServer"))},simpleDateFormat:function(a,n,i){if(i=i||luminateExtend.global.locale,i=t(i),n=n||(e.inArray(i,["en_CA","fr_CA","en_GB","en_AU"])>=0?"d/M/yy":"M/d/yy"),!((a=a||new Date)instanceof Date)){var l=a.split("T")[0].split("-"),o=a.split("T").length>1?a.split("T")[1].split(".")[0].split("Z")[0].split("-")[0].split(":"):["00","00","00"];a=new Date(l[0],l[1]-1,l[2],o[0],o[1],o[2])}var r=function(e){return 0===(e=""+e).indexOf("0")&&"0"!==e?e.substring(1):e},s=function(e){return e=Number(e),isNaN(e)?"00":(e<10?"0":"")+e},u={month:s(a.getMonth()+1),date:s(a.getDate()),year:s(a.getFullYear()),day:a.getDay(),hour24:a.getHours(),hour12:a.getHours(),minutes:s(a.getMinutes()),ampm:"AM"};u.hour24>11&&(u.ampm="PM"),u.hour24=s(u.hour24),0===u.hour12&&(u.hour12=12),u.hour12>12&&(u.hour12=u.hour12-12),u.hour12=s(u.hour12);var d=function(e){var t=e.replace(/yy+(?=y)/g,"yy").replace(/MMM+(?=M)/g,"MMM").replace(/d+(?=d)/g,"d").replace(/EEE+(?=E)/g,"EEE").replace(/a+(?=a)/g,"").replace(/k+(?=k)/g,"k").replace(/h+(?=h)/g,"h").replace(/m+(?=m)/g,"m").replace(/yyy/g,u.year).replace(/yy/g,u.year.substring(2)).replace(/y/g,u.year).replace(/dd/g,u.date).replace(/d/g,r(u.date)),a=function(e,t,a){for(var n=1;n23&&(i=23);var l="+"===a?i:0-i;"kk"===t||"k"===t?(l=Number(u.hour24)+l)>24?l-=24:l<0&&(l+=24):((l=Number(u.hour12)+l)>24?l-=24:l<0&&(l+=24),l>12&&(l-=12)),l=""+l,"kk"!==t&&"hh"!==t||(l=s(l)),("h"===t&&0===l||"hh"===t&&"00"===l)&&(l="12"),e[n]=l+e[n]}return e.join("")};-1!==t.indexOf("k+")&&(t=a((t=a(t.split("kk+"),"kk","+")).split("k+"),"k","+")),-1!==t.indexOf("k-")&&(t=a((t=a(t.split("kk-"),"kk","-")).split("k-"),"k","-")),-1!==(t=t.replace(/kk/g,u.hour24).replace(/k/g,r(u.hour24))).indexOf("h+")&&(t=a((t=a(t.split("hh+"),"hh","+")).split("h+"),"h","+")),-1!==t.indexOf("h-")&&(t=a((t=a(t.split("hh-"),"hh","-")).split("h-"),"h","-")),t=(t=(t=t.replace(/hh/g,u.hour12<12&&u.hour12.indexOf&&0!==u.hour12.indexOf("0")?"0"+u.hour12:u.hour12).replace(/h/g,r(u.hour12))).replace(/mm/g,u.minutes).replace(/m/g,r(u.minutes))).replace(/a/g,"A");var n=["January","February","march","april","may","June","July","august","September","October","November","December"];"es_US"===i&&(n=["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]),"fr_CA"===i&&(n=["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]);var l=n[Number(u.month)-1].substring(0,3);"fr_CA"===i&&("f&#"===l?l="fév":"ao&"===l?l="aoû":"d&#"===l&&(l="déc")),t=t.replace(/MMMM/g,n[Number(u.month)-1]).replace(/MMM/g,l).replace(/MM/g,u.month).replace(/M/g,r(u.month));var o=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];"es_US"===i&&(o=["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]),"fr_CA"===i&&(o=["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]);var d=o[u.day].substring(0,3);return"es_US"===i&&("mi&"===d?d="mié":"s&a"===d&&(d="sáb")),t=(t=t.replace(/EEEE/g,o[u.day]).replace(/EEE/g,d).replace(/EE/g,d).replace(/E/g,d)).replace(/A/g,u.ampm).replace(/apr/g,"Apr").replace(/aug/g,"Aug"),"es_US"!==i&&"fr_CA"!==i&&(t=t.replace(/mar/g,"Mar").replace(/may/g,"May")),t};if(-1!==n.indexOf("'")){var c=n.replace(/\'+(?=\')/g,"''").split("''");if(1===c.length){c=n.split("'");for(var p=0;p');a.close();u=a.getElementById("x")}else{u=t.createElement("iframe");u.style.cssText="position:absolute;top:-99em";r.insertBefore(u,r.firstElementChild||r.firstChild)}u.src=c(i)+"?url="+f(s)+"&css="+f(c(n));e.setTimeout(l,500)}function c(e){var t=document.createElement("div"),n=e.split("&").join("&").split("<").join("<").split('"').join(""");t.innerHTML='x';return t.firstChild.href}function h(){if(~!s.indexOf(location.host)){var e=t.createElement("div");e.innerHTML='';r.insertBefore(e,r.firstElementChild||r.firstChild);s=e.firstChild.href;e.parentNode.removeChild(e);e=null}}function p(){var e=t.getElementsByTagName("link");for(var n=0,r=e.length;n=0&&a){(function(e){l(s,function(t){e.styleSheet.rawCssText=t;respond.update()})})(i)}}}var r=t.documentElement,i=t.getElementById("respond-proxy").href,s=(t.getElementById("respond-redirect")||location).href,o=t.getElementsByTagName("base")[0],u=[],a;if(!respond.mediaQueriesSupported){h();p()}})(window,document) -------------------------------------------------------------------------------- /examples/bootstrap/sign-up.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Sign Up for News from American Health Society 6 | 7 | 8 | 9 | 15 | 16 | 24 | 25 | 26 | 27 | 28 | 29 | 66 |
67 | 70 |

Sign up today to receive the American Health Society's weekly e-newsletter.

71 |
72 | 73 | 74 |
75 | 76 |
77 | 78 |
79 |
80 |
81 | 82 |
83 | 84 |
85 |
86 |
87 | 88 |
89 | 90 |
91 |
92 | 93 |
94 |
95 |
96 | By filling out this form, you'll be signed up to receive periodic updates from American Health Society. 97 |
98 |
99 |
100 |
101 |
102 | 103 |
104 |
105 |
106 |
107 |
108 |

© American Health Society 2015

109 |
110 |
111 | 112 | 113 | 114 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /examples/bootstrap/walk-for-health.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Walk for Health - American Health Society 6 | 7 | 8 | 9 | 18 | 19 | 27 | 28 | 29 | 30 | 31 | 32 | 69 |
70 | 73 |

Form a team in the Walk for Health and help raise money for our important mission. To get started, use the form below to search for an event in your area.

74 |
75 | 76 |
77 | 78 |
79 |
80 | 87 |
88 | 89 |
90 | 91 |
92 |
93 |
94 |

© American Health Society 2015

95 |
96 |
97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /examples/foundation/README.md: -------------------------------------------------------------------------------- 1 | luminateExtend.js - Foundation Examples 2 | ======================================= 3 | 4 | These examples show how luminateExtend.js can be used to build a website with [Foundation 4](http://foundation.zurb.com/docs/v/4.3.2/). 5 | 6 | Getting started with the example website 7 | ---------------------------------------- 8 | 9 | If you haven't already done so, you'll need to follow the [basic setup instructions](https://github.com/convio/luminateExtend#libSetup) 10 | for using luminateExtend.js. 11 | 12 | Once you've completed setup, download the HTML and JavaScript files found here to your desktop. You'll need to make a few small tweaks to these files, and then you can upload them to a server of your choosing. 13 | 14 | [luminateExtend-examples.js](https://raw.github.com/convio/luminateExtend/master/examples/foundation/js/luminateExtend-examples.js) is where all the magic happens. At the very top of this file, you'll need to change the API Key and the non-secure and secure paths for your organization: 15 | 16 | ```js 17 | /* define init variables for your organization */ 18 | luminateExtend({ 19 | apiKey: '123456789', 20 | path: { 21 | nonsecure: 'http://shortname.convio.net/site/', 22 | secure: 'https://secure2.convio.net/shortname/site/' 23 | } 24 | }); 25 | ``` 26 | 27 | This is the only change you should need to make to this file. Each of the HTML files detailed below will require additional changes. 28 | 29 | Login / Welcome back 30 | -------------------- 31 | 32 | At the top right of each page on the example site, users are either presented with a login form, or if they are already logged in, a "Welcome back" message and the option to log out. 33 | 34 | You'll need to edit the login form within each HTML file to change the login form's action to use your organization's domain: 35 | 36 | ```html 37 |
38 | 39 |
40 |
41 | 42 |
43 |
44 | 45 |
46 |
47 | 48 |
49 |
50 |
51 | ``` 52 | 53 | On each page load, the [loginTest](http://open.convio.com/api/#single_sign_on_api.loginTest_method.html) API method is used to check if the user is currently logged in. If this API method does not return an error, then the user is logged in. 54 | 55 | ```js 56 | /* example: check if the user is logged in onload */ 57 | /* if they are logged in, call the getUser function above to display the "welcome back" message */ 58 | /* if they are not logged in, show the login form */ 59 | var loginTestCallback = { 60 | success: function() { 61 | getUser(); 62 | }, 63 | error: function() { 64 | $('#login-form').removeClass('hide'); 65 | } 66 | }; 67 | luminateExtend.api({ 68 | api: 'cons', 69 | callback: loginTestCallback, 70 | data: 'method=loginTest' 71 | }); 72 | ``` 73 | 74 | If the user is logged in, the getUser function is called to display a message like "Welcome back, Jane!" in place of the login form. 75 | 76 | ```js 77 | /* example: get information on the currently logged in user, and display a "welcome back" message in the site's header */ 78 | window.getUser = function() { 79 | var getUserCallback = function(data) { 80 | if(data.getConsResponse && data.getConsResponse.name) { 81 | $('#login-form').replaceWith('

' + 82 | 'Welcome back' + ((data.getConsResponse.name.first) ? (', ' + data.getConsResponse.name.first) : '') + '! ' + 83 | 'Logout' + 84 | '

'); 85 | } 86 | }; 87 | luminateExtend.api({ 88 | api: 'cons', 89 | callback: getUserCallback, 90 | data: 'method=getUser', 91 | requiresAuth: true 92 | }); 93 | }; 94 | ``` 95 | 96 | If the user is not logged in, they will be presented with the login form. Reading the HTML for the login form above, you'll note that the form tag has a callback defined for handling the API response, loginCallback. If the username and password provided by the user are correct, the getUser function is called to display the "Welcome back" message. If the credentials are not correct, a modal is displayed with the specific error message that was returned. 97 | 98 | ```js 99 | /* example: handle the login form in the site's header */ 100 | /* if the user is logged in successfully, call the getUser function above to display the "welcome back" message */ 101 | /* if the user is not logged in, display the error message returned by the API in a modal */ 102 | window.loginCallback = { 103 | error: function(data) { 104 | if($('#login-error-modal').length == 0) { 105 | $('body').append('
' + 106 | '

Error

' + 107 | '

' + data.errorResponse.message + '

' + 108 | '×' + 109 | '
'); 110 | } 111 | else { 112 | $('#login-error-modal p').html(data.errorResponse.message); 113 | } 114 | $('#login-error-modal').foundation('reveal', 'open'); 115 | }, 116 | success: function(data) { 117 | getUser(); 118 | } 119 | }; 120 | ``` 121 | 122 | Donation form 123 | ------------- 124 | 125 | [donate.html](https://raw.github.com/convio/luminateExtend/master/examples/foundation/donate.html) contains a minimalistic donation form which uses the [donate](http://open.convio.com/api/#donation_api.donate_method.html) API method to process gifts. In this example, the form's donation levels and fields are hardcoded in the page's HTML. A more robust version of this form would use the [getDonationFormInfo](http://open.convio.com/api/#donation_api.getDonationFormInfo_method.html) API method to dynamically build these fields onload. 126 | 127 | To use the donation form, you'll first need to edit the donation form's action to use your organization's domain: 128 | 129 | ```html 130 |
131 | ``` 132 | 133 | You'll also need to edit the donation form ID to use the appropriate shadow form: 134 | 135 | ```html 136 | 137 | ``` 138 | 139 | Finally, you'll need to edit the HTML for the donation levels to use the correct IDs and dollar amounts. As noted above, when building out a real form, you'll likely want to use the API to dynamically generate this HTML instead. 140 | 141 | ```html 142 |
143 | 146 |
147 |
148 | 151 |
152 |
153 | 156 |
157 |
158 | 161 |
162 | ``` 163 | 164 | Reading the HTML for the donation form above, you'll note that the form tag has a callback defined for handling the API response, donateCallback. If the donation is successfully processed, a thank you message is shown to the donor in place of the form. If one or more errors are returned, they are displayed above the form. For your form, you may wish to slightly modify this code to, for example, highlight all fields that are in error in red. 165 | 166 | ```js 167 | /* example: handle the donation form submission */ 168 | /* if the donation is successful, display a thank you message */ 169 | /* if there is an error with the donation, display it inline */ 170 | window.donateCallback = { 171 | error: function(data) { 172 | $('#donation-errors').remove(); 173 | 174 | $('.donation-form').prepend('
' + 175 | '
' + 176 | data.errorResponse.message + 177 | '
' + 178 | '
'); 179 | 180 | $('.donation-loading').remove(); 181 | $('.donation-form').show(); 182 | }, 183 | success: function(data) { 184 | $('#donation-errors').remove(); 185 | 186 | if(data.donationResponse.errors) { 187 | $('.donation-form').prepend('
' + 188 | ((data.donationResponse.errors.message) ? ('
' + 189 | data.donationResponse.errors.message + 190 | '
') : '') + 191 | '
'); 192 | 193 | if(data.donationResponse.errors.fieldError) { 194 | var fieldErrors = luminateExtend.utils.ensureArray(data.donationResponse.errors.fieldError); 195 | $.each(fieldErrors, function() { 196 | $('#donation-errors').append('
' + 197 | this + 198 | '
'); 199 | }); 200 | } 201 | 202 | $('.donation-loading').remove(); 203 | $('.donation-form').show(); 204 | } 205 | else { 206 | $('.donation-loading').remove(); 207 | $('.donation-form').before('
' + 208 | 'Your donation has been processed!' + 209 | '
' + 210 | '
' + 211 | '

Thank you for your donation of $' + data.donationResponse.donation.amount.decimal + '.

' + 212 | '

Your confirmation code is ' + data.donationResponse.donation.confirmation_code + '.

' + 213 | '
'); 214 | } 215 | } 216 | }; 217 | ``` 218 | 219 | Newsletter sign-up form 220 | ----------------------- 221 | 222 | [sign-up.html](https://raw.github.com/convio/luminateExtend/master/examples/foundation/sign-up.html) is a typical newsletter sign-up form which collects users' names and email addresses using a Luminate Online Survey and the [submitSurvey](http://open.convio.com/api/#survey_api.submitSurvey_method.html) API method. 223 | 224 | To use the sign-up form, you'll first need to edit the form's action to use your organization's domain: 225 | 226 | ```html 227 | 228 | ``` 229 | 230 | You'll also need to edit the Survey ID to use the appropriate Survey from your organization's site: 231 | 232 | ```html 233 | 234 | ``` 235 | 236 | Reading the HTML for the sign-up form above, you'll note that the form tag has a callback defined for handling the API response, submitSurveyCallback. If the Survey is submitted without error, a thank you message is shown to the user in place of the form. If one or more errors are returned, they are displayed above the form. 237 | 238 | ```js 239 | /* example: handle the Survey form submission */ 240 | /* if the Survey is submitted succesfully, display a thank you message */ 241 | /* if there is an error, display it inline */ 242 | window.submitSurveyCallback = { 243 | error: function(data) { 244 | $('#survey-errors').remove(); 245 | $('.survey-form .row .alert').remove(); 246 | 247 | $('.survey-form').prepend('
' + 248 | '
' + 249 | data.errorResponse.message + 250 | '
' + 251 | '
'); 252 | 253 | $('.survey-loading').remove(); 254 | $('.survey-form').show(); 255 | }, 256 | success: function(data) { 257 | $('#survey-errors').remove(); 258 | $('.survey-form .row .alert').remove(); 259 | 260 | if(data.submitSurveyResponse.success == 'false') { 261 | $('.survey-form').prepend('
' + 262 | '
' + 263 | 'There was an error with your submission. Please try again.' + 264 | '
' + 265 | '
'); 266 | 267 | var surveyErrors = luminateExtend.utils.ensureArray(data.submitSurveyResponse.errors); 268 | $.each(surveyErrors, function() { 269 | if(this.errorField) { 270 | $('input[name="' + this.errorField + '"]').closest('.row') 271 | .prepend('
' + 272 | '
' + 273 | this.errorMessage + 274 | '
' + 275 | '
'); 276 | } 277 | }); 278 | 279 | $('.survey-loading').remove(); 280 | $('.survey-form').show(); 281 | } 282 | else { 283 | $('.survey-loading').remove(); 284 | $('.survey-form').before('
' + 285 | 'You\'ve been signed up!' + 286 | '
' + 287 | '
' + 288 | '

Thanks for joining. You should receive your first issue of the e-newsletter shortly.

' + 289 | '
'); 290 | } 291 | } 292 | }; 293 | ``` 294 | 295 | Action alert list 296 | ----------------- 297 | 298 | [action-center.html](https://raw.github.com/convio/luminateExtend/master/examples/foundation/action-center.html) is a page that allows users to see a list of active action alerts for your organization, with a link to the alert and a counter showing how many people have taken action to-date. This example could be further extended to allow for the alerts to be taken via API as well using the [takeAction](http://open.convio.com/api/#advocacy_api.takeAction_method.html) method. 299 | 300 | The getAdvocacyAlerts function builds the list of alerts using the [getAdvocacyAlerts](http://open.convio.com/api/#advocacy_api.getAdvocacyAlerts_method.html) API method. 301 | 302 | ```js 303 | /* example: display a list of action alerts for the organization in the specified container */ 304 | window.getAdvocacyAlerts = function(selector) { 305 | var getAdvocacyAlertsCallback = function(data) { 306 | $(selector).html(''); 307 | 308 | var alertList = luminateExtend.utils.ensureArray(data.getAdvocacyAlertsResponse.alert); 309 | $.each(alertList, function() { 310 | $(selector).append('
' + 311 | '

' + this.title + '
' + 312 | this.description + '
' + 313 | ((this.interactionCount == '0') ? 'No actions taken so far. Be the first to respond!' : ('' + this.interactionCount + ' actions taken so far.')) + 314 | '

' + 315 | 'Take Action' + 316 | '
'); 317 | }); 318 | }; 319 | 320 | luminateExtend.api({ 321 | api: 'advocacy', 322 | callback: getAdvocacyAlertsCallback, 323 | data: 'method=getAdvocacyAlerts&alert_status=active&alert_type=action' 324 | }); 325 | }; 326 | ``` 327 | 328 | Within the HTML for the action center, the getAdvocacyAlerts function is called and passed the selector where the alert list is to be placed. 329 | 330 | ```js 331 | $(function() { 332 | getAdvocacyAlerts('#action-alert-list'); 333 | }); 334 | ``` 335 | 336 | TeamRaiser ZIP Code radius search 337 | --------------------------------- 338 | 339 | [walk-for-health.html](https://raw.github.com/convio/luminateExtend/master/examples/foundation/walk-for-health.html) lets users search for TeamRaiser events in their local area using the [getTeamraisersByDistance](http://open.convio.com/api/#teamraiser_api.getTeamraisersByDistance_method.html) API method. Each event in the search results includes basic information such as the event name and date, as well as links to form or join a team. 340 | 341 | To use the event search form, you'll need to edit the form's action to use your organization's domain: 342 | 343 | ```html 344 | 345 | ``` 346 | 347 | Reading the HTML for the search form above, you'll note that the form tag has a callback defined for handling the API response, getTeamraisersByDistanceCallback. If one or more events is returned for the ZIP Code provided, they are displayed below the form. If an error is returned, e.g. because no events match the search criteria, the error message is displayed above the form. 348 | 349 | ```js 350 | /* example: handle the TeamRaiser ZIP Code radius form */ 351 | /* if one or more TeamRaisers are returned, display them */ 352 | /* if an error is returned, display it above the form */ 353 | window.getTeamraisersByDistanceCallback = { 354 | error: function(data) { 355 | $('#teamraiser-event-search-errors').remove(); 356 | $('#teamraiser-event-search-results').html(''); 357 | 358 | $('.teamraiser-event-search-form').prepend('
' + 359 | '
' + 360 | data.errorResponse.message + 361 | '
' + 362 | '
'); 363 | }, 364 | success: function(data) { 365 | $('#teamraiser-event-search-errors').remove(); 366 | $('#teamraiser-event-search-results').html(''); 367 | 368 | if(data.getTeamraisersResponse.totalNumberResults == 0) { 369 | $('.teamraiser-event-search-form').prepend('
' + 370 | '
' + 371 | 'No events found. Please try another search.' + 372 | '
' + 373 | '
'); 374 | } 375 | else { 376 | $('#teamraiser-event-search-results').html('
'); 377 | var teamraiserList = luminateExtend.utils.ensureArray(data.getTeamraisersResponse.teamraiser); 378 | $.each(teamraiserList, function() { 379 | $('#teamraiser-event-search-results .panel').append('
' + 380 | '

' + this.name + '
' + 381 | luminateExtend.utils.simpleDateFormat(this.event_date, 'MMMM d, yyyy') + '

' + 382 | 'Form a Team ' + 383 | 'Join a Team ' + 384 | '
'); 385 | }); 386 | } 387 | } 388 | }; 389 | ``` -------------------------------------------------------------------------------- /examples/foundation/action-center.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | American Health Society Action Center 8 | 9 | 10 | 11 | 20 | 21 | 22 | 23 | 24 |
25 | 72 |
73 |
74 |
75 |

Action Center

76 |
77 |

Become an advocate for health!

78 |
79 | Loading ... 80 |
81 |
82 |
83 |
84 |
85 |
86 |

© American Health Society 2015

87 |
88 |
89 |
90 |
91 |
92 |
93 | 94 | 99 | 100 | 103 | 104 | 105 | 106 | 111 | 112 | -------------------------------------------------------------------------------- /examples/foundation/donate.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Donate to American Health Society 8 | 9 | 10 | 11 | 53 | 54 | 55 | 56 | 57 |
58 | 105 |
106 |
107 |
108 |

Donate

109 |
110 |

You can be a part of the solution – make a donation to help fund important research. We can't do it without you.

111 |
112 | 113 | 114 | 115 |
116 |

Donation Information

117 |
118 |
119 | 120 |
121 |
122 |
123 | 126 |
127 |
128 | 131 |
132 |
133 | 136 |
137 |
138 | 141 |
142 |
143 |
144 |
145 | $ 146 |
147 |
148 | 149 |
150 |
151 |
152 |
153 |
154 |
155 | 156 |
157 |

Billing Information

158 |
159 |
160 | 161 |
162 |
163 | 164 |
165 |
166 |
167 |
168 | 169 |
170 |
171 | 172 |
173 |
174 |
175 |
176 | 177 |
178 |
179 | 180 |
181 |
182 |
183 |
184 | 185 |
186 |
187 | 188 |
189 |
190 |
191 |
192 | 193 |
194 |
195 | 196 |
197 |
198 |
199 |
200 | 201 |
202 |
203 | 282 |
283 |
284 |
285 |
286 | 287 |
288 |
289 | 290 |
291 |
292 |
293 | 294 |
295 |

Email

296 |
297 |
298 | 299 |
300 |
301 | 302 |
303 |
304 |
305 |
306 |
307 | 310 |
311 |
312 |
313 |
314 | 315 |
316 |

Payment Information

317 |
318 |
319 | 320 |
321 |
322 | 323 |
324 |
325 |
326 |
327 | 328 |
329 |
330 | 331 |
332 |
333 |
334 |
335 | 336 |
337 |
338 | 353 |
354 |
355 | 364 |
365 |
366 |
367 | 368 |
369 |
370 | 371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |

© American Health Society 2015

380 |
381 |
382 |
383 |
384 |
385 |
386 | 387 | 392 | 393 | 396 | 397 | 398 | 399 | 400 | -------------------------------------------------------------------------------- /examples/foundation/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | American Health Society 8 | 9 | 10 | 11 | 25 | 26 | 27 | 28 | 29 |
30 | 77 |
78 |
79 |
80 |
81 |
82 |

Your Donation Today Can Save Countless Lives

83 |

You can be a part of the solution – make a donation to help fund important research. We can't do it without you.

84 | Donate Now » 85 |
86 |
87 |
88 |
89 |
90 |
91 |

Get AHS News

92 |

Sign up today to receive the American Health Society's weekly e-newsletter.

93 |

Sign Up »

94 |
95 |
96 |

Action Center

97 |

Become an advocate for health! View the list of our latest action alerts.

98 |

Take Action »

99 |
100 |
101 |

Walk for Health

102 |

Form a team in the Walk for Health and help raise money for our important mission.

103 |

Find an Event »

104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |

© American Health Society 2015

114 |
115 |
116 |
117 |
118 |
119 |
120 | 121 | 126 | 127 | 130 | 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /examples/foundation/js/luminateExtend-examples.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | /* define init variables for your organization */ 3 | luminateExtend({ 4 | apiKey: '123456789', 5 | path: { 6 | nonsecure: 'http://shortname.convio.net/site/', 7 | secure: 'https://secure2.convio.net/shortname/site/' 8 | } 9 | }); 10 | 11 | $(function() { 12 | /* example: get information on the currently logged in user, and display a "welcome back" message in the site's header */ 13 | window.getUser = function() { 14 | var getUserCallback = function(data) { 15 | if(data.getConsResponse && data.getConsResponse.name) { 16 | $('#login-form').replaceWith('

' + 17 | 'Welcome back' + ((data.getConsResponse.name.first) ? (', ' + data.getConsResponse.name.first) : '') + '! ' + 18 | 'Logout' + 19 | '

'); 20 | } 21 | }; 22 | luminateExtend.api({ 23 | api: 'cons', 24 | callback: getUserCallback, 25 | data: 'method=getUser', 26 | requiresAuth: true 27 | }); 28 | }; 29 | 30 | /* example: check if the user is logged in onload */ 31 | /* if they are logged in, call the getUser function above to display the "welcome back" message */ 32 | /* if they are not logged in, show the login form */ 33 | var loginTestCallback = { 34 | success: function() { 35 | getUser(); 36 | }, 37 | error: function() { 38 | $('#login-form').removeClass('hide'); 39 | } 40 | }; 41 | luminateExtend.api({ 42 | api: 'cons', 43 | callback: loginTestCallback, 44 | data: 'method=loginTest' 45 | }); 46 | 47 | /* example: handle the login form in the site's header */ 48 | /* if the user is logged in successfully, call the getUser function above to display the "welcome back" message */ 49 | /* if the user is not logged in, display the error message returned by the API in a modal */ 50 | window.loginCallback = { 51 | error: function(data) { 52 | if($('#login-error-modal').length == 0) { 53 | $('body').append('
' + 54 | '

Error

' + 55 | '

' + data.errorResponse.message + '

' + 56 | '×' + 57 | '
'); 58 | } 59 | else { 60 | $('#login-error-modal p').html(data.errorResponse.message); 61 | } 62 | $('#login-error-modal').foundation('reveal', 'open'); 63 | }, 64 | success: function(data) { 65 | getUser(); 66 | } 67 | }; 68 | 69 | /* UI handlers for the donation form example */ 70 | if($('.donation-form').length > 0) { 71 | $('input[name="level_id"]').click(function() { 72 | if($(this).is('#level-other')) { 73 | $('#other-amount').removeAttr('disabled'); 74 | $('#other-amount').attr('name', 'other_amount'); 75 | $('#other-amount').focus(); 76 | } 77 | else { 78 | $('#other-amount').attr('disabled', 'disabled'); 79 | $('#other-amount').removeAttr('name'); 80 | } 81 | }); 82 | 83 | $('.donation-form').submit(function() { 84 | window.scrollTo(0, 0); 85 | $(this).hide(); 86 | $(this).before('
' + 87 | 'Loading ...' + 88 | '
'); 89 | }); 90 | } 91 | 92 | /* example: handle the donation form submission */ 93 | /* if the donation is successful, display a thank you message */ 94 | /* if there is an error with the donation, display it inline */ 95 | window.donateCallback = { 96 | error: function(data) { 97 | $('#donation-errors').remove(); 98 | 99 | $('.donation-form').prepend('
' + 100 | '
' + 101 | data.errorResponse.message + 102 | '
' + 103 | '
'); 104 | 105 | $('.donation-loading').remove(); 106 | $('.donation-form').show(); 107 | }, 108 | success: function(data) { 109 | $('#donation-errors').remove(); 110 | 111 | if(data.donationResponse.errors) { 112 | $('.donation-form').prepend('
' + 113 | ((data.donationResponse.errors.message) ? ('
' + 114 | data.donationResponse.errors.message + 115 | '
') : '') + 116 | '
'); 117 | 118 | if(data.donationResponse.errors.fieldError) { 119 | var fieldErrors = luminateExtend.utils.ensureArray(data.donationResponse.errors.fieldError); 120 | $.each(fieldErrors, function() { 121 | $('#donation-errors').append('
' + 122 | this + 123 | '
'); 124 | }); 125 | } 126 | 127 | $('.donation-loading').remove(); 128 | $('.donation-form').show(); 129 | } 130 | else { 131 | $('.donation-loading').remove(); 132 | $('.donation-form').before('
' + 133 | 'Your donation has been processed!' + 134 | '
' + 135 | '
' + 136 | '

Thank you for your donation of $' + data.donationResponse.donation.amount.decimal + '.

' + 137 | '

Your confirmation code is ' + data.donationResponse.donation.confirmation_code + '.

' + 138 | '
'); 139 | } 140 | } 141 | }; 142 | 143 | /* UI handlers for the Survey example */ 144 | if($('.survey-form').length > 0) { 145 | $('.survey-form').submit(function() { 146 | window.scrollTo(0, 0); 147 | $(this).hide(); 148 | $(this).before('
' + 149 | 'Loading ...' + 150 | '
'); 151 | }); 152 | } 153 | 154 | /* example: handle the Survey form submission */ 155 | /* if the Survey is submitted succesfully, display a thank you message */ 156 | /* if there is an error, display it inline */ 157 | window.submitSurveyCallback = { 158 | error: function(data) { 159 | $('#survey-errors').remove(); 160 | $('.survey-form .row .alert').remove(); 161 | 162 | $('.survey-form').prepend('
' + 163 | '
' + 164 | data.errorResponse.message + 165 | '
' + 166 | '
'); 167 | 168 | $('.survey-loading').remove(); 169 | $('.survey-form').show(); 170 | }, 171 | success: function(data) { 172 | $('#survey-errors').remove(); 173 | $('.survey-form .row .survey-alert-wrap').remove(); 174 | 175 | if(data.submitSurveyResponse.success == 'false') { 176 | $('.survey-form').prepend('
' + 177 | '
' + 178 | 'There was an error with your submission. Please try again.' + 179 | '
' + 180 | '
'); 181 | 182 | var surveyErrors = luminateExtend.utils.ensureArray(data.submitSurveyResponse.errors); 183 | $.each(surveyErrors, function() { 184 | if(this.errorField) { 185 | $('input[name="' + this.errorField + '"]').closest('.row') 186 | .prepend('
' + 187 | '
' + 188 | this.errorMessage + 189 | '
' + 190 | '
'); 191 | } 192 | }); 193 | 194 | $('.survey-loading').remove(); 195 | $('.survey-form').show(); 196 | } 197 | else { 198 | $('.survey-loading').remove(); 199 | $('.survey-form').before('
' + 200 | 'You\'ve been signed up!' + 201 | '
' + 202 | '
' + 203 | '

Thanks for joining. You should receive your first issue of the e-newsletter shortly.

' + 204 | '
'); 205 | } 206 | } 207 | }; 208 | 209 | /* example: display a list of action alerts for the organization in the specified container */ 210 | window.getAdvocacyAlerts = function(selector) { 211 | var getAdvocacyAlertsCallback = function(data) { 212 | $(selector).html(''); 213 | 214 | var alertList = luminateExtend.utils.ensureArray(data.getAdvocacyAlertsResponse.alert); 215 | $.each(alertList, function() { 216 | $(selector).append('
' + 217 | '

' + this.title + '
' + 218 | this.description + '
' + 219 | ((this.interactionCount == '0') ? 'No actions taken so far. Be the first to respond!' : ('' + this.interactionCount + ' actions taken so far.')) + 220 | '

' + 221 | 'Take Action' + 222 | '
'); 223 | }); 224 | }; 225 | 226 | luminateExtend.api({ 227 | api: 'advocacy', 228 | callback: getAdvocacyAlertsCallback, 229 | data: 'method=getAdvocacyAlerts&alert_status=active&alert_type=action' 230 | }); 231 | }; 232 | 233 | /* example: handle the TeamRaiser ZIP Code radius form */ 234 | /* if one or more TeamRaisers are returned, display them */ 235 | /* if an error is returned, display it above the form */ 236 | window.getTeamraisersByDistanceCallback = { 237 | error: function(data) { 238 | $('#teamraiser-event-search-errors').remove(); 239 | $('#teamraiser-event-search-results').html(''); 240 | 241 | $('.teamraiser-event-search-form').prepend('
' + 242 | '
' + 243 | data.errorResponse.message + 244 | '
' + 245 | '
'); 246 | }, 247 | success: function(data) { 248 | $('#teamraiser-event-search-errors').remove(); 249 | $('#teamraiser-event-search-results').html(''); 250 | 251 | if(data.getTeamraisersResponse.totalNumberResults == 0) { 252 | $('.teamraiser-event-search-form').prepend('
' + 253 | '
' + 254 | 'No events found. Please try another search.' + 255 | '
' + 256 | '
'); 257 | } 258 | else { 259 | $('#teamraiser-event-search-results').html('
'); 260 | var teamraiserList = luminateExtend.utils.ensureArray(data.getTeamraisersResponse.teamraiser); 261 | $.each(teamraiserList, function() { 262 | $('#teamraiser-event-search-results .panel').append('
' + 263 | '

' + this.name + '
' + 264 | luminateExtend.utils.simpleDateFormat(this.event_date, 'MMMM d, yyyy') + '

' + 265 | 'Form a Team ' + 266 | 'Join a Team ' + 267 | '
'); 268 | }); 269 | } 270 | } 271 | }; 272 | 273 | /* bind any forms with the "luminateApi" class */ 274 | luminateExtend.api.bind(); 275 | }); 276 | })(typeof jQuery === 'undefined' && typeof Zepto === 'function' ? Zepto : jQuery); -------------------------------------------------------------------------------- /examples/foundation/js/luminateExtend.js: -------------------------------------------------------------------------------- 1 | /* luminateExtend.js | Version: 1.9.0 (07-AUG-2021) */ 2 | !function(e){var t=function(t){return t&&e.inArray(t,["es_US","en_CA","fr_CA","en_GB","en_AU"])<0&&(t="en_US"),t},a=function(e){return e&&(e=t(e),luminateExtend.sessionVars.set("locale",e)),e},n=function(e,t){return(e?luminateExtend.global.path.secure+"S":luminateExtend.global.path.nonsecure)+"PageServer"+(luminateExtend.global.routingId&&""!==luminateExtend.global.routingId?";"+luminateExtend.global.routingId:"")+"?pagename=luminateExtend_server&pgwrap=n"+(t?"&"+t:"")},i=function(t,a){if(t.responseFilter&&t.responseFilter.array&&t.responseFilter.filter&&luminateExtend.utils.stringToObj(t.responseFilter.array,a)){var n,i,l=t.responseFilter.filter.split("==")[0].split("!=")[0].replace(/^\s+|\s+$/g,"");if(-1!==t.responseFilter.filter.indexOf("!=")?(n="nequal",i=t.responseFilter.filter.split("!=")[1]):-1!==t.responseFilter.filter.indexOf("==")&&(n="equal",i=t.responseFilter.filter.split("==")[1]),n&&i){i=i.replace(/^\s+|\s+$/g,"");var o=[],r=!1;if(e.each(luminateExtend.utils.ensureArray(luminateExtend.utils.stringToObj(t.responseFilter.array,a)),function(){"nequal"===n&&this[l]===i||"equal"===n&&this[l]!==i?r=!0:o.push(this)}),r){var s=t.responseFilter.array.split(".");e.each(a,function(t,n){t===s[0]&&e.each(n,function(n,i){n===s[1]&&(2===s.length?a[t][n]=o:e.each(i,function(i,l){i===s[2]&&(3===s.length?a[t][n][i]=o:e.each(l,function(e,l){e===s[3]&&4===s.length&&(a[t][n][i][e]=o)}))}))})})}}}var u=e.noop;t.callback&&("function"==typeof t.callback?u=t.callback:t.callback.error&&a.errorResponse?u=t.callback.error:t.callback.success&&!a.errorResponse&&(u=t.callback.success));var d=-1!==t.data.indexOf("&method=login")&&-1===t.data.indexOf("&method=loginTest"),c=-1!==t.data.indexOf("&method=logout");if(d||c){var p={callback:function(){u(a)},useCache:!1,useHTTPS:t.useHTTPS};d&&a.loginResponse&&a.loginResponse.nonce&&(p.nonce="NONCE_TOKEN="+a.loginResponse.nonce),luminateExtend.api.getAuth(p)}else u(a)};window.luminateExtend=function(e){luminateExtend.init(e||{})},luminateExtend.library={version:"1.9.0"},luminateExtend.global={update:function(t,n){t&&(t.length?n&&("locale"===t&&(n=a(n)),luminateExtend.global[t]=n):(t.locale&&(t.locale=a(t.locale)),luminateExtend.global=e.extend(luminateExtend.global,t)))}},luminateExtend.init=function(a){var n=e.extend({apiCommon:{},auth:{type:"auth"},path:{}},a||{});(n.locale&&(n.locale=t(n.locale)),n.supportsCORS=!1,window.XMLHttpRequest)&&("withCredentials"in new XMLHttpRequest&&(n.supportsCORS=!0));return luminateExtend.global=e.extend(luminateExtend.global,n),luminateExtend},luminateExtend.api=function(e){luminateExtend.api.request(e||{})},luminateExtend.api.bind=function(t){return e(t=t||"form.luminateApi").length>0&&e(t).each(function(){"form"===this.nodeName.toLowerCase()&&e(this).bind("submit",function(t){t.cancelBubble=!0,t.returnValue=!1,t.stopPropagation&&(t.stopPropagation(),t.preventDefault()),e(this).attr("id")||e(this).attr("id","luminateApi-"+(new Date).getTime());var a,n=e(this).attr("action"),i=n.split("?"),l=e(this).data("luminateapi"),o=-1!==i[0].indexOf("/site/")?i[0].split("/site/")[1]:i[0],r=e(this).attr("enctype"),s=i.length>1?i[1]:"",u="#"+e(this).attr("id"),d=!1,c=!1;l&&(l.callback&&(a=luminateExtend.utils.stringToObj(l.callback)),l.requiresAuth&&"true"===l.requiresAuth&&(d=!0),(0===n.indexOf("https:")||"https:"===window.location.protocol&&-1===n.indexOf("http"))&&(c=!0)),luminateExtend.api.request({api:o,callback:a,contentType:r,data:s,form:u,requiresAuth:d,useHTTPS:c})})}),luminateExtend},luminateExtend.api.getAuth=function(t){var a=e.extend({useCache:!0,useHTTPS:!1},t||{});if(luminateExtend.api.getAuthLoad)if(luminateExtend.api.getAuthLoad=!1,a.useCache&&luminateExtend.global.auth.type&&luminateExtend.global.auth.token)luminateExtend.api.getAuthLoad=!0,a.callback&&a.callback();else{var i=function(e){luminateExtend.global.update(e),luminateExtend.api.getAuthLoad=!0,a.callback&&a.callback()};luminateExtend.global.supportsCORS?e.ajax({url:(a.useHTTPS?luminateExtend.global.path.secure:luminateExtend.global.path.nonsecure)+"CRConsAPI",data:"luminateExtend="+luminateExtend.library.version+(a.nonce&&""!==a.nonce?"&"+a.nonce:"")+"&api_key="+luminateExtend.global.apiKey+"&method=getLoginUrl&response_format=json&v=1.0",xhrFields:{withCredentials:!0},dataType:"json",success:function(e){var t=e.getLoginUrlResponse,a=t.url,n=t.routing_id,l=t.JSESSIONID;n||-1===a.indexOf("CRConsAPI;jsessionid=")||(n=a.split("CRConsAPI;jsessionid=")[1].split("?")[0]),i({auth:{type:"auth",token:t.token},routingId:n?"jsessionid="+n:"",sessionCookie:l?"JSESSIONID="+l:""})}}):e.ajax({url:n(a.useHTTPS,"action=getAuth&callback=?"),dataType:"jsonp",success:i})}else setTimeout(function(){luminateExtend.api.getAuth(a)},1e3)},luminateExtend.api.getAuthLoad=!0;var l=function(t){var a=e.extend({contentType:"application/x-www-form-urlencoded",data:"",requiresAuth:!1,useHTTPS:null},t||{});if(e.inArray(a.api.toLowerCase(),["addressbook","advocacy","connect","cons","content","datasync","donation","email","group","orgevent","recurring","survey","teamraiser"])>=0&&(a.api="CR"+a.api.charAt(0).toUpperCase()+a.api.slice(1).toLowerCase()+"API",a.api=a.api.replace("Addressbook","AddressBook").replace("Datasync","DataSync").replace("Orgevent","OrgEvent")),luminateExtend.global.path.nonsecure&&luminateExtend.global.path.secure&&luminateExtend.global.apiKey&&a.api){if("multipart/form-data"===a.contentType.split(";")[0]?a.contentType="multipart/form-data":a.contentType="application/x-www-form-urlencoded",a.contentType+="; charset=UTF-8",a.data="luminateExtend="+luminateExtend.library.version+(""===a.data?"":"&"+a.data),a.form&&e(a.form).length>0&&(a.data+="&"+e(a.form).eq(0).serialize()),-1===a.data.indexOf("&api_key=")&&(a.data+="&api_key="+luminateExtend.global.apiKey),luminateExtend.global.apiCommon.centerId&&-1===a.data.indexOf("¢er_id=")&&(a.data+="¢er_id="+luminateExtend.global.apiCommon.centerId),luminateExtend.global.apiCommon.categoryId&&-1===a.data.indexOf("&list_category_id=")&&(a.data+="&list_category_id="+luminateExtend.global.apiCommon.categoryId),-1!==a.data.indexOf("&response_format=xml")?a.data=a.data.replace(/&response_format=xml/g,"&response_format=json"):-1===a.data.indexOf("&response_format=")&&(a.data+="&response_format=json"),luminateExtend.global.apiCommon.source&&-1===a.data.indexOf("&source=")){var l=luminateExtend.global.apiCommon.source;l.length>255&&(l=l.substring(0,255)),a.data+="&source="+l}if(luminateExtend.global.apiCommon.subSource&&-1===a.data.indexOf("&sub_source=")){var o=luminateExtend.global.apiCommon.subSource;o.length>255&&(o=o.substring(0,255)),a.data+="&sub_source="+o}-1===a.data.indexOf("&suppress_response_codes=")&&(a.data+="&suppress_response_codes=true"),luminateExtend.global.locale&&-1===a.data.indexOf("&s_locale=")&&(a.data+="&s_locale="+luminateExtend.global.locale),-1===a.data.indexOf("&v=")&&(a.data+="&v=1.0");var r="http://",s=luminateExtend.global.path.nonsecure.split("http://")[1];"CRDonationAPI"===a.api||"CRTeamraiserAPI"===a.api||"CRConnectAPI"!==a.api&&("https:"===window.location.protocol&&null==a.useHTTPS||1==a.useHTTPS)?a.useHTTPS=!0:a.useHTTPS=!1,a.useHTTPS&&(r="https://",s=luminateExtend.global.path.secure.split("https://")[1]),r+=s+a.api;var u,d=!1,c=!1,p=!1;window.location.protocol===r.split("//")[0]&&document.domain===s.split("/")[0]?(d=!0,c=!0):luminateExtend.global.supportsCORS?c=!0:"postMessage"in window&&(p=!0),c?u=function(){luminateExtend.global.routingId&&""!==luminateExtend.global.routingId&&(r+=";"+luminateExtend.global.routingId),a.requiresAuth&&-1===a.data.indexOf("&"+luminateExtend.global.auth.type+"=")&&(a.data+="&"+luminateExtend.global.auth.type+"="+luminateExtend.global.auth.token),luminateExtend.global.sessionCookie&&""!==luminateExtend.global.sessionCookie&&(a.data+="&"+luminateExtend.global.sessionCookie),a.data+="&ts="+(new Date).getTime(),e.ajax({url:r,data:a.data,xhrFields:{withCredentials:!0},contentType:a.contentType,dataType:"json",type:"POST",success:function(e){i(a,e)}})}:p&&(u=function(){var t=(new Date).getTime(),l="luminateApiPostMessage"+t,o=n(a.useHTTPS,"action=postMessage");luminateExtend.global.routingId&&""!==luminateExtend.global.routingId&&(r+=";"+luminateExtend.global.routingId),a.requiresAuth&&-1===a.data.indexOf("&"+luminateExtend.global.auth.type+"=")&&(a.data+="&"+luminateExtend.global.auth.type+"="+luminateExtend.global.auth.token),luminateExtend.global.sessionCookie&&""!==luminateExtend.global.sessionCookie&&(a.data+="&"+luminateExtend.global.sessionCookie),a.data+="&ts="+t,luminateExtend.api.request.postMessageEventHandler||(luminateExtend.api.request.postMessageEventHandler={},luminateExtend.api.request.postMessageEventHandler.handler=function(t){if(-1!==luminateExtend.global.path.nonsecure.indexOf(t.origin)||-1!==luminateExtend.global.path.secure.indexOf(t.origin)){var a=e.parseJSON(t.data),n=a.postMessageFrameId,i=e.parseJSON(decodeURIComponent(a.response));luminateExtend.api.request.postMessageEventHandler[n]&&luminateExtend.api.request.postMessageEventHandler[n](n,i)}},void 0!==window.addEventListener?window.addEventListener("message",luminateExtend.api.request.postMessageEventHandler.handler,!1):void 0!==window.attachEvent&&window.attachEvent("onmessage",luminateExtend.api.request.postMessageEventHandler.handler)),luminateExtend.api.request.postMessageEventHandler[l]=function(t,n){i(a,n),e("#"+t).remove(),delete luminateExtend.api.request.postMessageEventHandler[t]},e("body").append(''),e("#"+l).bind("load",function(){var t='{"postMessageFrameId": "'+e(this).attr("id")+'", "requestUrl": "'+r+'", "requestContentType": "'+a.contentType+'", "requestData": "'+a.data+'"}',n=r.split("/site/")[0].split("/admin/")[0];document.getElementById(e(this).attr("id")).contentWindow.postMessage(t,n)}),e("#"+l).attr("src",o)}),a.requiresAuth||!c&&!d&&!luminateExtend.global.sessionCookie?luminateExtend.api.getAuth({callback:u,useHTTPS:a.useHTTPS}):u()}};luminateExtend.api.request=function(t){if(e.isArray(t)){t.reverse();var a=[];e.each(t,function(n){var i=e.extend({async:!0},this);if(i.async||n===t.length-1)a.push(i);else if((r=t[n+1]).callback&&"function"!=typeof r.callback){var o=r.callback.success||e.noop;r.callback.success=function(e){o(e),l(i)}}else{var r,s=(r=t[n+1]).callback||e.noop;r.callback={success:function(e){s(e),l(i)},error:function(e){s(e)}}}}),a.reverse(),e.each(a,function(){l(this)})}else l(t)},luminateExtend.sessionVars={set:function(e,t,a){var n={};a&&(n.callback=a),e&&(n.data="s_"+e+"="+(t||""),luminateExtend.utils.ping(n))}},luminateExtend.tags=function(e,t){luminateExtend.tags.parse(e,t)},luminateExtend.tags.parse=function(t,a){luminateExtend.widgets?luminateExtend.widgets(t,a):(t=t&&"all"!==t?luminateExtend.utils.ensureArray(t):["cons"],a=a||"body",e.each(t,function(t,n){if("cons"===n){var i=e(a).find(document.getElementsByTagName("luminate:cons"));if(i.length>0){luminateExtend.api.request({api:"cons",callback:function(t){i.each(function(){t.getConsResponse?e(this).replaceWith(luminateExtend.utils.stringToObj(e(this).attr("field"),t.getConsResponse)):e(this).remove()})},data:"method=getUser",requiresAuth:!0})}}}))},luminateExtend.utils={ensureArray:function(t){return e.isArray(t)?t:t?[t]:[]},stringToObj:function(e,t){var a=t||window;if(e)for(var n=e.split("."),i=0;i'),e("#"+n).bind("load",function(){e(this).remove(),a.callback&&a.callback()}),e("#"+n).attr("src",("https:"===window.location.protocol?luminateExtend.global.path.secure:luminateExtend.global.path.nonsecure)+"EstablishSession"+(luminateExtend.global.routingId&&""!==luminateExtend.global.routingId?";"+luminateExtend.global.routingId:"")+"?"+(null==a.data?"":a.data+"&")+"NEXTURL="+encodeURIComponent(("https:"===window.location.protocol?luminateExtend.global.path.secure:luminateExtend.global.path.nonsecure)+"PixelServer"))},simpleDateFormat:function(a,n,i){if(i=i||luminateExtend.global.locale,i=t(i),n=n||(e.inArray(i,["en_CA","fr_CA","en_GB","en_AU"])>=0?"d/M/yy":"M/d/yy"),!((a=a||new Date)instanceof Date)){var l=a.split("T")[0].split("-"),o=a.split("T").length>1?a.split("T")[1].split(".")[0].split("Z")[0].split("-")[0].split(":"):["00","00","00"];a=new Date(l[0],l[1]-1,l[2],o[0],o[1],o[2])}var r=function(e){return 0===(e=""+e).indexOf("0")&&"0"!==e?e.substring(1):e},s=function(e){return e=Number(e),isNaN(e)?"00":(e<10?"0":"")+e},u={month:s(a.getMonth()+1),date:s(a.getDate()),year:s(a.getFullYear()),day:a.getDay(),hour24:a.getHours(),hour12:a.getHours(),minutes:s(a.getMinutes()),ampm:"AM"};u.hour24>11&&(u.ampm="PM"),u.hour24=s(u.hour24),0===u.hour12&&(u.hour12=12),u.hour12>12&&(u.hour12=u.hour12-12),u.hour12=s(u.hour12);var d=function(e){var t=e.replace(/yy+(?=y)/g,"yy").replace(/MMM+(?=M)/g,"MMM").replace(/d+(?=d)/g,"d").replace(/EEE+(?=E)/g,"EEE").replace(/a+(?=a)/g,"").replace(/k+(?=k)/g,"k").replace(/h+(?=h)/g,"h").replace(/m+(?=m)/g,"m").replace(/yyy/g,u.year).replace(/yy/g,u.year.substring(2)).replace(/y/g,u.year).replace(/dd/g,u.date).replace(/d/g,r(u.date)),a=function(e,t,a){for(var n=1;n23&&(i=23);var l="+"===a?i:0-i;"kk"===t||"k"===t?(l=Number(u.hour24)+l)>24?l-=24:l<0&&(l+=24):((l=Number(u.hour12)+l)>24?l-=24:l<0&&(l+=24),l>12&&(l-=12)),l=""+l,"kk"!==t&&"hh"!==t||(l=s(l)),("h"===t&&0===l||"hh"===t&&"00"===l)&&(l="12"),e[n]=l+e[n]}return e.join("")};-1!==t.indexOf("k+")&&(t=a((t=a(t.split("kk+"),"kk","+")).split("k+"),"k","+")),-1!==t.indexOf("k-")&&(t=a((t=a(t.split("kk-"),"kk","-")).split("k-"),"k","-")),-1!==(t=t.replace(/kk/g,u.hour24).replace(/k/g,r(u.hour24))).indexOf("h+")&&(t=a((t=a(t.split("hh+"),"hh","+")).split("h+"),"h","+")),-1!==t.indexOf("h-")&&(t=a((t=a(t.split("hh-"),"hh","-")).split("h-"),"h","-")),t=(t=(t=t.replace(/hh/g,u.hour12<12&&u.hour12.indexOf&&0!==u.hour12.indexOf("0")?"0"+u.hour12:u.hour12).replace(/h/g,r(u.hour12))).replace(/mm/g,u.minutes).replace(/m/g,r(u.minutes))).replace(/a/g,"A");var n=["January","February","march","april","may","June","July","august","September","October","November","December"];"es_US"===i&&(n=["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]),"fr_CA"===i&&(n=["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]);var l=n[Number(u.month)-1].substring(0,3);"fr_CA"===i&&("f&#"===l?l="fév":"ao&"===l?l="aoû":"d&#"===l&&(l="déc")),t=t.replace(/MMMM/g,n[Number(u.month)-1]).replace(/MMM/g,l).replace(/MM/g,u.month).replace(/M/g,r(u.month));var o=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];"es_US"===i&&(o=["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]),"fr_CA"===i&&(o=["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]);var d=o[u.day].substring(0,3);return"es_US"===i&&("mi&"===d?d="mié":"s&a"===d&&(d="sáb")),t=(t=t.replace(/EEEE/g,o[u.day]).replace(/EEE/g,d).replace(/EE/g,d).replace(/E/g,d)).replace(/A/g,u.ampm).replace(/apr/g,"Apr").replace(/aug/g,"Aug"),"es_US"!==i&&"fr_CA"!==i&&(t=t.replace(/mar/g,"Mar").replace(/may/g,"May")),t};if(-1!==n.indexOf("'")){var c=n.replace(/\'+(?=\')/g,"''").split("''");if(1===c.length){c=n.split("'");for(var p=0;p 2 | 3 | 4 | 5 | 6 | 7 | Sign Up for News from American Health Society 8 | 9 | 10 | 11 | 29 | 30 | 31 | 32 | 33 |
34 | 81 |
82 |
83 |
84 |

Get AHS News

85 |
86 |

Sign up today to receive the American Health Society's weekly e-newsletter.

87 |
88 | 89 | 90 |
91 |
92 | 93 |
94 |
95 | 96 |
97 |
98 |
99 |
100 | 101 |
102 |
103 | 104 |
105 |
106 |
107 |
108 | 109 |
110 |
111 | 112 |
113 |
114 | 115 |
116 |
117 |
118 | By filling out this form, you'll be signed up to receive periodic updates from American Health Society. 119 |
120 |
121 |
122 |
123 |
124 | 125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |

© American Health Society 2015

134 |
135 |
136 |
137 |
138 |
139 |
140 | 141 | 146 | 147 | 150 | 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /examples/foundation/walk-for-health.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Walk for Health - American Health Society 8 | 9 | 10 | 11 | 20 | 21 | 22 | 23 | 24 |
25 | 72 |
73 |
74 |
75 |

Walk for Health

76 |
77 |

Form a team in the Walk for Health and help raise money for our important mission. To get started, use the form below to search for an event in your area.

78 |
79 | 80 |
81 | 82 |
83 |
84 | 91 |
92 | 93 |
94 | 95 |
96 |
97 |
98 |
99 |
100 |
101 |

© American Health Society 2015

102 |
103 |
104 |
105 |
106 |
107 |
108 | 109 | 114 | 115 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /luminateExtend.min.js: -------------------------------------------------------------------------------- 1 | /* luminateExtend.js | Version: 1.9.0 (07-AUG-2021) */ 2 | !function(e){var t=function(t){return t&&e.inArray(t,["es_US","en_CA","fr_CA","en_GB","en_AU"])<0&&(t="en_US"),t},a=function(e){return e&&(e=t(e),luminateExtend.sessionVars.set("locale",e)),e},n=function(e,t){return(e?luminateExtend.global.path.secure+"S":luminateExtend.global.path.nonsecure)+"PageServer"+(luminateExtend.global.routingId&&""!==luminateExtend.global.routingId?";"+luminateExtend.global.routingId:"")+"?pagename=luminateExtend_server&pgwrap=n"+(t?"&"+t:"")},i=function(t,a){if(t.responseFilter&&t.responseFilter.array&&t.responseFilter.filter&&luminateExtend.utils.stringToObj(t.responseFilter.array,a)){var n,i,l=t.responseFilter.filter.split("==")[0].split("!=")[0].replace(/^\s+|\s+$/g,"");if(-1!==t.responseFilter.filter.indexOf("!=")?(n="nequal",i=t.responseFilter.filter.split("!=")[1]):-1!==t.responseFilter.filter.indexOf("==")&&(n="equal",i=t.responseFilter.filter.split("==")[1]),n&&i){i=i.replace(/^\s+|\s+$/g,"");var o=[],r=!1;if(e.each(luminateExtend.utils.ensureArray(luminateExtend.utils.stringToObj(t.responseFilter.array,a)),function(){"nequal"===n&&this[l]===i||"equal"===n&&this[l]!==i?r=!0:o.push(this)}),r){var s=t.responseFilter.array.split(".");e.each(a,function(t,n){t===s[0]&&e.each(n,function(n,i){n===s[1]&&(2===s.length?a[t][n]=o:e.each(i,function(i,l){i===s[2]&&(3===s.length?a[t][n][i]=o:e.each(l,function(e,l){e===s[3]&&4===s.length&&(a[t][n][i][e]=o)}))}))})})}}}var u=e.noop;t.callback&&("function"==typeof t.callback?u=t.callback:t.callback.error&&a.errorResponse?u=t.callback.error:t.callback.success&&!a.errorResponse&&(u=t.callback.success));var d=-1!==t.data.indexOf("&method=login")&&-1===t.data.indexOf("&method=loginTest"),c=-1!==t.data.indexOf("&method=logout");if(d||c){var p={callback:function(){u(a)},useCache:!1,useHTTPS:t.useHTTPS};d&&a.loginResponse&&a.loginResponse.nonce&&(p.nonce="NONCE_TOKEN="+a.loginResponse.nonce),luminateExtend.api.getAuth(p)}else u(a)};window.luminateExtend=function(e){luminateExtend.init(e||{})},luminateExtend.library={version:"1.9.0"},luminateExtend.global={update:function(t,n){t&&(t.length?n&&("locale"===t&&(n=a(n)),luminateExtend.global[t]=n):(t.locale&&(t.locale=a(t.locale)),luminateExtend.global=e.extend(luminateExtend.global,t)))}},luminateExtend.init=function(a){var n=e.extend({apiCommon:{},auth:{type:"auth"},path:{}},a||{});(n.locale&&(n.locale=t(n.locale)),n.supportsCORS=!1,window.XMLHttpRequest)&&("withCredentials"in new XMLHttpRequest&&(n.supportsCORS=!0));return luminateExtend.global=e.extend(luminateExtend.global,n),luminateExtend},luminateExtend.api=function(e){luminateExtend.api.request(e||{})},luminateExtend.api.bind=function(t){return e(t=t||"form.luminateApi").length>0&&e(t).each(function(){"form"===this.nodeName.toLowerCase()&&e(this).bind("submit",function(t){t.cancelBubble=!0,t.returnValue=!1,t.stopPropagation&&(t.stopPropagation(),t.preventDefault()),e(this).attr("id")||e(this).attr("id","luminateApi-"+(new Date).getTime());var a,n=e(this).attr("action"),i=n.split("?"),l=e(this).data("luminateapi"),o=-1!==i[0].indexOf("/site/")?i[0].split("/site/")[1]:i[0],r=e(this).attr("enctype"),s=i.length>1?i[1]:"",u="#"+e(this).attr("id"),d=!1,c=!1;l&&(l.callback&&(a=luminateExtend.utils.stringToObj(l.callback)),l.requiresAuth&&"true"===l.requiresAuth&&(d=!0),(0===n.indexOf("https:")||"https:"===window.location.protocol&&-1===n.indexOf("http"))&&(c=!0)),luminateExtend.api.request({api:o,callback:a,contentType:r,data:s,form:u,requiresAuth:d,useHTTPS:c})})}),luminateExtend},luminateExtend.api.getAuth=function(t){var a=e.extend({useCache:!0,useHTTPS:!1},t||{});if(luminateExtend.api.getAuthLoad)if(luminateExtend.api.getAuthLoad=!1,a.useCache&&luminateExtend.global.auth.type&&luminateExtend.global.auth.token)luminateExtend.api.getAuthLoad=!0,a.callback&&a.callback();else{var i=function(e){luminateExtend.global.update(e),luminateExtend.api.getAuthLoad=!0,a.callback&&a.callback()};luminateExtend.global.supportsCORS?e.ajax({url:(a.useHTTPS?luminateExtend.global.path.secure:luminateExtend.global.path.nonsecure)+"CRConsAPI",data:"luminateExtend="+luminateExtend.library.version+(a.nonce&&""!==a.nonce?"&"+a.nonce:"")+"&api_key="+luminateExtend.global.apiKey+"&method=getLoginUrl&response_format=json&v=1.0",xhrFields:{withCredentials:!0},dataType:"json",success:function(e){var t=e.getLoginUrlResponse,a=t.url,n=t.routing_id,l=t.JSESSIONID;n||-1===a.indexOf("CRConsAPI;jsessionid=")||(n=a.split("CRConsAPI;jsessionid=")[1].split("?")[0]),i({auth:{type:"auth",token:t.token},routingId:n?"jsessionid="+n:"",sessionCookie:l?"JSESSIONID="+l:""})}}):e.ajax({url:n(a.useHTTPS,"action=getAuth&callback=?"),dataType:"jsonp",success:i})}else setTimeout(function(){luminateExtend.api.getAuth(a)},1e3)},luminateExtend.api.getAuthLoad=!0;var l=function(t){var a=e.extend({contentType:"application/x-www-form-urlencoded",data:"",requiresAuth:!1,useHTTPS:null},t||{});if(e.inArray(a.api.toLowerCase(),["addressbook","advocacy","connect","cons","content","datasync","donation","email","group","orgevent","recurring","survey","teamraiser"])>=0&&(a.api="CR"+a.api.charAt(0).toUpperCase()+a.api.slice(1).toLowerCase()+"API",a.api=a.api.replace("Addressbook","AddressBook").replace("Datasync","DataSync").replace("Orgevent","OrgEvent")),luminateExtend.global.path.nonsecure&&luminateExtend.global.path.secure&&luminateExtend.global.apiKey&&a.api){if("multipart/form-data"===a.contentType.split(";")[0]?a.contentType="multipart/form-data":a.contentType="application/x-www-form-urlencoded",a.contentType+="; charset=UTF-8",a.data="luminateExtend="+luminateExtend.library.version+(""===a.data?"":"&"+a.data),a.form&&e(a.form).length>0&&(a.data+="&"+e(a.form).eq(0).serialize()),-1===a.data.indexOf("&api_key=")&&(a.data+="&api_key="+luminateExtend.global.apiKey),luminateExtend.global.apiCommon.centerId&&-1===a.data.indexOf("¢er_id=")&&(a.data+="¢er_id="+luminateExtend.global.apiCommon.centerId),luminateExtend.global.apiCommon.categoryId&&-1===a.data.indexOf("&list_category_id=")&&(a.data+="&list_category_id="+luminateExtend.global.apiCommon.categoryId),-1!==a.data.indexOf("&response_format=xml")?a.data=a.data.replace(/&response_format=xml/g,"&response_format=json"):-1===a.data.indexOf("&response_format=")&&(a.data+="&response_format=json"),luminateExtend.global.apiCommon.source&&-1===a.data.indexOf("&source=")){var l=luminateExtend.global.apiCommon.source;l.length>255&&(l=l.substring(0,255)),a.data+="&source="+l}if(luminateExtend.global.apiCommon.subSource&&-1===a.data.indexOf("&sub_source=")){var o=luminateExtend.global.apiCommon.subSource;o.length>255&&(o=o.substring(0,255)),a.data+="&sub_source="+o}-1===a.data.indexOf("&suppress_response_codes=")&&(a.data+="&suppress_response_codes=true"),luminateExtend.global.locale&&-1===a.data.indexOf("&s_locale=")&&(a.data+="&s_locale="+luminateExtend.global.locale),-1===a.data.indexOf("&v=")&&(a.data+="&v=1.0");var r="http://",s=luminateExtend.global.path.nonsecure.split("http://")[1];"CRDonationAPI"===a.api||"CRTeamraiserAPI"===a.api||"CRConnectAPI"!==a.api&&("https:"===window.location.protocol&&null==a.useHTTPS||1==a.useHTTPS)?a.useHTTPS=!0:a.useHTTPS=!1,a.useHTTPS&&(r="https://",s=luminateExtend.global.path.secure.split("https://")[1]),r+=s+a.api;var u,d=!1,c=!1,p=!1;window.location.protocol===r.split("//")[0]&&document.domain===s.split("/")[0]?(d=!0,c=!0):luminateExtend.global.supportsCORS?c=!0:"postMessage"in window&&(p=!0),c?u=function(){luminateExtend.global.routingId&&""!==luminateExtend.global.routingId&&(r+=";"+luminateExtend.global.routingId),a.requiresAuth&&-1===a.data.indexOf("&"+luminateExtend.global.auth.type+"=")&&(a.data+="&"+luminateExtend.global.auth.type+"="+luminateExtend.global.auth.token),luminateExtend.global.sessionCookie&&""!==luminateExtend.global.sessionCookie&&(a.data+="&"+luminateExtend.global.sessionCookie),a.data+="&ts="+(new Date).getTime(),e.ajax({url:r,data:a.data,xhrFields:{withCredentials:!0},contentType:a.contentType,dataType:"json",type:"POST",success:function(e){i(a,e)}})}:p&&(u=function(){var t=(new Date).getTime(),l="luminateApiPostMessage"+t,o=n(a.useHTTPS,"action=postMessage");luminateExtend.global.routingId&&""!==luminateExtend.global.routingId&&(r+=";"+luminateExtend.global.routingId),a.requiresAuth&&-1===a.data.indexOf("&"+luminateExtend.global.auth.type+"=")&&(a.data+="&"+luminateExtend.global.auth.type+"="+luminateExtend.global.auth.token),luminateExtend.global.sessionCookie&&""!==luminateExtend.global.sessionCookie&&(a.data+="&"+luminateExtend.global.sessionCookie),a.data+="&ts="+t,luminateExtend.api.request.postMessageEventHandler||(luminateExtend.api.request.postMessageEventHandler={},luminateExtend.api.request.postMessageEventHandler.handler=function(t){if(-1!==luminateExtend.global.path.nonsecure.indexOf(t.origin)||-1!==luminateExtend.global.path.secure.indexOf(t.origin)){var a=e.parseJSON(t.data),n=a.postMessageFrameId,i=e.parseJSON(decodeURIComponent(a.response));luminateExtend.api.request.postMessageEventHandler[n]&&luminateExtend.api.request.postMessageEventHandler[n](n,i)}},void 0!==window.addEventListener?window.addEventListener("message",luminateExtend.api.request.postMessageEventHandler.handler,!1):void 0!==window.attachEvent&&window.attachEvent("onmessage",luminateExtend.api.request.postMessageEventHandler.handler)),luminateExtend.api.request.postMessageEventHandler[l]=function(t,n){i(a,n),e("#"+t).remove(),delete luminateExtend.api.request.postMessageEventHandler[t]},e("body").append(''),e("#"+l).bind("load",function(){var t='{"postMessageFrameId": "'+e(this).attr("id")+'", "requestUrl": "'+r+'", "requestContentType": "'+a.contentType+'", "requestData": "'+a.data+'"}',n=r.split("/site/")[0].split("/admin/")[0];document.getElementById(e(this).attr("id")).contentWindow.postMessage(t,n)}),e("#"+l).attr("src",o)}),a.requiresAuth||!c&&!d&&!luminateExtend.global.sessionCookie?luminateExtend.api.getAuth({callback:u,useHTTPS:a.useHTTPS}):u()}};luminateExtend.api.request=function(t){if(e.isArray(t)){t.reverse();var a=[];e.each(t,function(n){var i=e.extend({async:!0},this);if(i.async||n===t.length-1)a.push(i);else if((r=t[n+1]).callback&&"function"!=typeof r.callback){var o=r.callback.success||e.noop;r.callback.success=function(e){o(e),l(i)}}else{var r,s=(r=t[n+1]).callback||e.noop;r.callback={success:function(e){s(e),l(i)},error:function(e){s(e)}}}}),a.reverse(),e.each(a,function(){l(this)})}else l(t)},luminateExtend.sessionVars={set:function(e,t,a){var n={};a&&(n.callback=a),e&&(n.data="s_"+e+"="+(t||""),luminateExtend.utils.ping(n))}},luminateExtend.tags=function(e,t){luminateExtend.tags.parse(e,t)},luminateExtend.tags.parse=function(t,a){luminateExtend.widgets?luminateExtend.widgets(t,a):(t=t&&"all"!==t?luminateExtend.utils.ensureArray(t):["cons"],a=a||"body",e.each(t,function(t,n){if("cons"===n){var i=e(a).find(document.getElementsByTagName("luminate:cons"));if(i.length>0){luminateExtend.api.request({api:"cons",callback:function(t){i.each(function(){t.getConsResponse?e(this).replaceWith(luminateExtend.utils.stringToObj(e(this).attr("field"),t.getConsResponse)):e(this).remove()})},data:"method=getUser",requiresAuth:!0})}}}))},luminateExtend.utils={ensureArray:function(t){return e.isArray(t)?t:t?[t]:[]},stringToObj:function(e,t){var a=t||window;if(e)for(var n=e.split("."),i=0;i'),e("#"+n).bind("load",function(){e(this).remove(),a.callback&&a.callback()}),e("#"+n).attr("src",("https:"===window.location.protocol?luminateExtend.global.path.secure:luminateExtend.global.path.nonsecure)+"EstablishSession"+(luminateExtend.global.routingId&&""!==luminateExtend.global.routingId?";"+luminateExtend.global.routingId:"")+"?"+(null==a.data?"":a.data+"&")+"NEXTURL="+encodeURIComponent(("https:"===window.location.protocol?luminateExtend.global.path.secure:luminateExtend.global.path.nonsecure)+"PixelServer"))},simpleDateFormat:function(a,n,i){if(i=i||luminateExtend.global.locale,i=t(i),n=n||(e.inArray(i,["en_CA","fr_CA","en_GB","en_AU"])>=0?"d/M/yy":"M/d/yy"),!((a=a||new Date)instanceof Date)){var l=a.split("T")[0].split("-"),o=a.split("T").length>1?a.split("T")[1].split(".")[0].split("Z")[0].split("-")[0].split(":"):["00","00","00"];a=new Date(l[0],l[1]-1,l[2],o[0],o[1],o[2])}var r=function(e){return 0===(e=""+e).indexOf("0")&&"0"!==e?e.substring(1):e},s=function(e){return e=Number(e),isNaN(e)?"00":(e<10?"0":"")+e},u={month:s(a.getMonth()+1),date:s(a.getDate()),year:s(a.getFullYear()),day:a.getDay(),hour24:a.getHours(),hour12:a.getHours(),minutes:s(a.getMinutes()),ampm:"AM"};u.hour24>11&&(u.ampm="PM"),u.hour24=s(u.hour24),0===u.hour12&&(u.hour12=12),u.hour12>12&&(u.hour12=u.hour12-12),u.hour12=s(u.hour12);var d=function(e){var t=e.replace(/yy+(?=y)/g,"yy").replace(/MMM+(?=M)/g,"MMM").replace(/d+(?=d)/g,"d").replace(/EEE+(?=E)/g,"EEE").replace(/a+(?=a)/g,"").replace(/k+(?=k)/g,"k").replace(/h+(?=h)/g,"h").replace(/m+(?=m)/g,"m").replace(/yyy/g,u.year).replace(/yy/g,u.year.substring(2)).replace(/y/g,u.year).replace(/dd/g,u.date).replace(/d/g,r(u.date)),a=function(e,t,a){for(var n=1;n23&&(i=23);var l="+"===a?i:0-i;"kk"===t||"k"===t?(l=Number(u.hour24)+l)>24?l-=24:l<0&&(l+=24):((l=Number(u.hour12)+l)>24?l-=24:l<0&&(l+=24),l>12&&(l-=12)),l=""+l,"kk"!==t&&"hh"!==t||(l=s(l)),("h"===t&&0===l||"hh"===t&&"00"===l)&&(l="12"),e[n]=l+e[n]}return e.join("")};-1!==t.indexOf("k+")&&(t=a((t=a(t.split("kk+"),"kk","+")).split("k+"),"k","+")),-1!==t.indexOf("k-")&&(t=a((t=a(t.split("kk-"),"kk","-")).split("k-"),"k","-")),-1!==(t=t.replace(/kk/g,u.hour24).replace(/k/g,r(u.hour24))).indexOf("h+")&&(t=a((t=a(t.split("hh+"),"hh","+")).split("h+"),"h","+")),-1!==t.indexOf("h-")&&(t=a((t=a(t.split("hh-"),"hh","-")).split("h-"),"h","-")),t=(t=(t=t.replace(/hh/g,u.hour12<12&&u.hour12.indexOf&&0!==u.hour12.indexOf("0")?"0"+u.hour12:u.hour12).replace(/h/g,r(u.hour12))).replace(/mm/g,u.minutes).replace(/m/g,r(u.minutes))).replace(/a/g,"A");var n=["January","February","march","april","may","June","July","august","September","October","November","December"];"es_US"===i&&(n=["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]),"fr_CA"===i&&(n=["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]);var l=n[Number(u.month)-1].substring(0,3);"fr_CA"===i&&("f&#"===l?l="fév":"ao&"===l?l="aoû":"d&#"===l&&(l="déc")),t=t.replace(/MMMM/g,n[Number(u.month)-1]).replace(/MMM/g,l).replace(/MM/g,u.month).replace(/M/g,r(u.month));var o=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];"es_US"===i&&(o=["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]),"fr_CA"===i&&(o=["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]);var d=o[u.day].substring(0,3);return"es_US"===i&&("mi&"===d?d="mié":"s&a"===d&&(d="sáb")),t=(t=t.replace(/EEEE/g,o[u.day]).replace(/EEE/g,d).replace(/EE/g,d).replace(/E/g,d)).replace(/A/g,u.ampm).replace(/apr/g,"Apr").replace(/aug/g,"Aug"),"es_US"!==i&&"fr_CA"!==i&&(t=t.replace(/mar/g,"Mar").replace(/may/g,"May")),t};if(-1!==n.indexOf("'")){var c=n.replace(/\'+(?=\')/g,"''").split("''");if(1===c.length){c=n.split("'");for(var p=0;p::]]::]]]] -------------------------------------------------------------------------------- /src/luminateExtend_server.html: -------------------------------------------------------------------------------- 1 | [[?COMMENT:::::: 2 | luminateExtend_server.html 3 | Version: 1.9.0 (07-AUG-2021) 4 | ]] 5 | [[?xgetAuthx::x[[S334:action]]x:: 6 | [[U8:application/javascript]] 7 | [[? 8 | [[?,[[T5:[[E130:"[[T1:[[S0:CONVIO_API_CROSSDOMAINS_TRUSTED]]]]" "+" "" replaceall]]]],::,[[E130:"[[S50:Referer]]" dup dup "://" indexof 3 + swap length substring dup 0 swap "/" indexof substring]],::T::]] 9 | [[?,[[T5:[[E130:"[[T1:[[S0:CONVIO_API_CROSSDOMAINS_TRUSTED]]]]" "+" "" replaceall]]]],::,www.[[E130:"[[S50:Referer]]" dup dup "://" indexof 3 + swap length substring dup 0 swap "/" indexof substring]],::T::]] 10 | [[?,[[T5:[[E130:"[[T1:[[S0:CONVIO_API_CROSSDOMAINS_TRUSTED]]]]" "+" "" replaceall]]]],::,*.[[E130:"[[S50:Referer]]" dup dup "://" indexof 3 + swap length substring dup 0 swap "/" indexof substring]],::T::]] 11 | [[?,[[T5:[[E130:"[[T1:[[S0:CONVIO_API_CROSSDOMAINS_TRUSTED]]]]" "+" "" replaceall]]]],::,[[E130:"[[S50:Referer]]" dup dup "." indexof 1 + swap length substring dup 0 swap "/" indexof substring]],::T::]] 12 | [[?,[[T5:[[E130:"[[T1:[[S0:CONVIO_API_CROSSDOMAINS_TRUSTED]]]]" "+" "" replaceall]]]],::,*.[[E130:"[[S50:Referer]]" dup dup "." indexof 1 + swap length substring dup 0 swap "/" indexof substring]],::T::]] 13 | ::T:: 14 | [[?xx::x[[S334:callback]]x::::[[S334:callback]](]]{ 15 | "auth": { 16 | "token": "[[S86:true]]", 17 | "type": "auth" 18 | }, 19 | "routingId": "[[E130:"[[T7:PixelServer?action=getAuth]]" dup dup ";" indexof 1 + swap length substring dup 0 swap "?" indexof substring]]", 20 | "sessionCookie": "JSESSIONID=[[S29:SESSION_ID]]" 21 | }[[?xx::x[[S334:callback]]x::::)]] 22 | :: 23 | [[?xx::x[[S334:callback]]x::::[[S334:callback]](]]{ 24 | "error": "Requesting domain is not included in CONVIO_API_CROSSDOMAINS_TRUSTED" 25 | }[[?xx::x[[S334:callback]]x::::)]] 26 | ]] 27 | :: 28 | [[?xpostMessagex::x[[S334:action]]x:: 29 | [[? 30 | [[?,[[T5:[[E130:"[[T1:[[S0:CONVIO_API_CROSSDOMAINS_TRUSTED]]]]" "+" "" replaceall]]]],::,[[E130:"[[S50:Referer]]" dup dup "://" indexof 3 + swap length substring dup 0 swap "/" indexof substring]],::T::]] 31 | [[?,[[T5:[[E130:"[[T1:[[S0:CONVIO_API_CROSSDOMAINS_TRUSTED]]]]" "+" "" replaceall]]]],::,www.[[E130:"[[S50:Referer]]" dup dup "://" indexof 3 + swap length substring dup 0 swap "/" indexof substring]],::T::]] 32 | [[?,[[T5:[[E130:"[[T1:[[S0:CONVIO_API_CROSSDOMAINS_TRUSTED]]]]" "+" "" replaceall]]]],::,*.[[E130:"[[S50:Referer]]" dup dup "://" indexof 3 + swap length substring dup 0 swap "/" indexof substring]],::T::]] 33 | [[?,[[T5:[[E130:"[[T1:[[S0:CONVIO_API_CROSSDOMAINS_TRUSTED]]]]" "+" "" replaceall]]]],::,[[E130:"[[S50:Referer]]" dup dup "." indexof 1 + swap length substring dup 0 swap "/" indexof substring]],::T::]] 34 | [[?,[[T5:[[E130:"[[T1:[[S0:CONVIO_API_CROSSDOMAINS_TRUSTED]]]]" "+" "" replaceall]]]],::,*.[[E130:"[[S50:Referer]]" dup dup "." indexof 1 + swap length substring dup 0 swap "/" indexof substring]],::T::]] 35 | ::T:: 36 | 37 | 38 | 39 | 42 | 43 | 44 | 45 | 46 | 47 | 76 | 77 | 78 | :: 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | ]] 87 | ::]] 88 | ]] -------------------------------------------------------------------------------- /test/README.md: -------------------------------------------------------------------------------- 1 | luminateExtend.js - Tests 2 | ========================= 3 | 4 | Test suites built using [QUnit](http://qunitjs.com/). 5 | 6 | Running the tests 7 | ----------------- 8 | 9 | If you haven't already done so, you'll need to follow the [basic setup instructions](https://github.com/convio/luminateExtend#libSetup) 10 | for using luminateExtend.js. 11 | 12 | Once you've completed setup, download the HTML and JavaScript files found here to your desktop. You'll need to make a change to one of these files. 13 | 14 | At the very top of [setup.js](https://raw.github.com/convio/luminateExtend/master/tests/js/setup.js), you'll need to change the API Key and the non-secure and secure paths for your organization: 15 | 16 | ```js 17 | luminateExtend({ 18 | apiKey: '123456789', 19 | path: { 20 | nonsecure: 'http://shortname.convio.net/site/', 21 | secure: 'https://secure2.convio.net/shortname/site/' 22 | } 23 | }); 24 | ``` 25 | 26 | You'll also need to change the test Survey ID to the ID of any published Survey on your organization's Luminate Online site. This Survey ID is used in the luminateExtend.api test suite. 27 | 28 | ```js 29 | var apiTestSurveyId = '1'; 30 | ``` 31 | 32 | After you've made these changes, you can upload the files to a server of your choosing and begin testing. 33 | 34 | API tests 35 | --------- 36 | 37 | Some of the API tests require an active, logged in session to succeed. Before running the API tests, make sure you first navigate to the login page on your organization's Luminate Online site and login as a constituent. -------------------------------------------------------------------------------- /test/api.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | luminateExtend.api Test Suite 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/global.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | luminateExtend.global Test Suite 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/init.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | luminateExtend.init Test Suite 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/js/api.js: -------------------------------------------------------------------------------- 1 | asyncTest('luminateExtend.api.getAuth() defines luminateExtend.global.auth.type and luminateExtend.global.auth.token', function() { 2 | luminateExtend.api.getAuth({ 3 | callback: function() { 4 | var auth = luminateExtend.global.auth; 5 | 6 | ok(auth.type === 'auth' && 7 | auth.token); 8 | start(); 9 | } 10 | }); 11 | }); 12 | 13 | asyncTest('luminateExtend.api.request() allows "addressbook" shorthand', function() { 14 | luminateExtend.api.request({ 15 | api: 'addressbook', 16 | data: 'method=getAddressBookContacts&list_page_size=1', 17 | requiresAuth: true, 18 | useHTTPS: true, 19 | callback: function(response) { 20 | ok(response.getAddressBookContactsResponse, 21 | 'You must be logged in as a constituent for this test to succeed.'); 22 | start(); 23 | } 24 | }); 25 | }); 26 | 27 | asyncTest('luminateExtend.api.request() allows "advocacy" shorthand', function() { 28 | luminateExtend.api.request({ 29 | api: 'advocacy', 30 | data: 'method=getAdvocacyAlerts&list_page_size=1', 31 | callback: function(response) { 32 | ok(response.getAdvocacyAlertsResponse); 33 | start(); 34 | } 35 | }); 36 | }); 37 | 38 | asyncTest('luminateExtend.api.request() allows "cons" shorthand', function() { 39 | luminateExtend.api.request({ 40 | api: 'cons', 41 | data: 'method=listUserFields', 42 | callback: function(response) { 43 | ok(response.listConsFieldsResponse); 44 | start(); 45 | } 46 | }); 47 | }); 48 | 49 | asyncTest('luminateExtend.api.request() allows "content" shorthand', function() { 50 | luminateExtend.api.request({ 51 | api: 'content', 52 | data: 'method=listLinks&provider_id=42&list_page_size=1', 53 | callback: function(response) { 54 | ok(response.listLinksResponse); 55 | start(); 56 | } 57 | }); 58 | }); 59 | 60 | asyncTest('luminateExtend.api.request() allows "donation" shorthand', function() { 61 | luminateExtend.api.request({ 62 | api: 'donation', 63 | data: 'method=getDesignationTypes', 64 | callback: function(response) { 65 | ok(response.getDesignationTypesResponse); 66 | start(); 67 | } 68 | }); 69 | }); 70 | 71 | var today = new Date(); 72 | asyncTest('luminateExtend.api.request() allows "orgevent" shorthand', function() { 73 | luminateExtend.api.request({ 74 | api: 'orgevent', 75 | data: 'method=getMonthEvents&month=' + (today.getMonth() + 1) + '&year=' + today.getFullYear(), 76 | callback: function(response) { 77 | ok(response.getMonthEventsResponse); 78 | start(); 79 | } 80 | }); 81 | }); 82 | 83 | asyncTest('luminateExtend.api.request() allows "recurring" shorthand', function() { 84 | luminateExtend.api.request({ 85 | api: 'recurring', 86 | data: 'method=getRecurringGifts', 87 | requiresAuth: true, 88 | callback: function(response) { 89 | ok(response.getRecurringGiftsResponse, 90 | 'You must be logged in as a constituent for this test to succeed.'); 91 | start(); 92 | } 93 | }); 94 | }); 95 | 96 | asyncTest('luminateExtend.api.request() allows "survey" shorthand', function() { 97 | luminateExtend.api.request({ 98 | api: 'survey', 99 | data: 'method=listSurveys&list_page_size=1', 100 | callback: function(response) { 101 | ok(response.listSurveysResponse); 102 | start(); 103 | } 104 | }); 105 | }); 106 | 107 | asyncTest('luminateExtend.api.request() allows "teamraiser" shorthand', function() { 108 | luminateExtend.api.request({ 109 | api: 'teamraiser', 110 | data: 'method=getTeamraisersByInfo&name=%25&list_page_size=1', 111 | callback: function(response) { 112 | ok(response.getTeamraisersResponse); 113 | start(); 114 | } 115 | }); 116 | }); 117 | 118 | if(apiTestSurveyId) { 119 | asyncTest('luminateExtend.api.request() can call API methods which requires authentication but not a logged in user', function() { 120 | luminateExtend.api.request({ 121 | api: 'survey', 122 | data: 'method=getSurvey&survey_id=' + apiTestSurveyId, 123 | requiresAuth: true, 124 | callback: function(response) { 125 | ok(response.getSurveyResponse); 126 | start(); 127 | } 128 | }); 129 | }); 130 | } 131 | 132 | asyncTest('luminateExtend.api.request() can get info on logged in user', function() { 133 | luminateExtend.api.request({ 134 | api: 'cons', 135 | data: 'method=getUser', 136 | requiresAuth: true, 137 | callback: function(response) { 138 | ok(response.getConsResponse, 139 | 'You must be logged in as a constituent for this test to succeed.'); 140 | start(); 141 | } 142 | }); 143 | }); 144 | 145 | asyncTest('luminateExtend.api.request() can filter using equal statement', function() { 146 | luminateExtend.api.request({ 147 | api: 'cons', 148 | data: 'method=listUserFields', 149 | responseFilter: { 150 | array: 'listConsFieldsResponse.field', 151 | filter: 'required == true' 152 | }, 153 | callback: function(response) { 154 | var fields = luminateExtend.utils.ensureArray(response.listConsFieldsResponse.field), 155 | nonRequiredFields = []; 156 | $.each(fields, function() { 157 | if(this.required == 'false') { 158 | nonRequiredFields.push(this); 159 | } 160 | }); 161 | ok(nonRequiredFields.length === 0); 162 | start(); 163 | } 164 | }); 165 | }); 166 | 167 | asyncTest('luminateExtend.api.request() can filter using not equal statement', function() { 168 | luminateExtend.api.request({ 169 | api: 'cons', 170 | data: 'method=listUserFields', 171 | responseFilter: { 172 | array: 'listConsFieldsResponse.field', 173 | filter: 'required != false' 174 | }, 175 | callback: function(response) { 176 | var fields = luminateExtend.utils.ensureArray(response.listConsFieldsResponse.field), 177 | nonRequiredFields = []; 178 | $.each(fields, function() { 179 | if(this.required == 'false') { 180 | nonRequiredFields.push(this); 181 | } 182 | }); 183 | ok(nonRequiredFields.length === 0); 184 | start(); 185 | } 186 | }); 187 | }); 188 | 189 | test('luminateExtend.api.request() can make multiple requests asynchronously', function() { 190 | stop(2); 191 | 192 | luminateExtend.api.request([{ 193 | api: 'cons', 194 | data: 'method=listUserFields', 195 | requiresAuth: true, 196 | callback: function(response) { 197 | ok(response.listConsFieldsResponse); 198 | start(); 199 | } 200 | }, { 201 | api: 'cons', 202 | data: 'method=listUserFieldChoices&field=primary_address.state', 203 | requiresAuth: true, 204 | callback: function(response) { 205 | ok(response.listConsFieldChoicesResponse); 206 | start(); 207 | } 208 | }]); 209 | }); 210 | 211 | var listConsFieldsResponse; 212 | test('luminateExtend.api.request() can make multiple requests synchronously', function() { 213 | stop(2); 214 | 215 | luminateExtend.api.request([{ 216 | api: 'cons', 217 | data: 'method=listUserFields', 218 | requiresAuth: true, 219 | callback: function(response) { 220 | listConsFieldsResponse = response.listConsFieldsResponse; 221 | ok(listConsFieldsResponse); 222 | start(); 223 | } 224 | }, { 225 | async: false, 226 | api: 'cons', 227 | data: 'method=listUserFieldChoices&field=primary_address.state', 228 | requiresAuth: true, 229 | callback: function(response) { 230 | ok(listConsFieldsResponse && 231 | response.listConsFieldChoicesResponse); 232 | start(); 233 | } 234 | }]); 235 | }); -------------------------------------------------------------------------------- /test/js/global.js: -------------------------------------------------------------------------------- 1 | test('luminateExtend.global.update() can update one property', function() { 2 | luminateExtend.global.update('apiKey', 'abcdefg'); 3 | ok(luminateExtend.global.apiKey === 'abcdefg'); 4 | }); 5 | 6 | test('luminateExtend.global.update() can update multiple properties', function() { 7 | luminateExtend.global.update({ 8 | apiKey: 'hijklmnop', 9 | customVar: 'foo' 10 | }); 11 | ok(luminateExtend.global.apiKey === 'hijklmnop' && luminateExtend.global.customVar === 'foo'); 12 | }); 13 | 14 | test('luminateExtend.global.locale accepts "en_US"', function() { 15 | luminateExtend.global.update('locale', 'en_US'); 16 | ok(luminateExtend.global.locale === 'en_US'); 17 | }); 18 | 19 | test('luminateExtend.global.locale accepts "es_US"', function() { 20 | luminateExtend.global.update('locale', 'es_US'); 21 | ok(luminateExtend.global.locale === 'es_US'); 22 | }); 23 | 24 | test('luminateExtend.global.locale accepts "en_CA"', function() { 25 | luminateExtend.global.update('locale', 'en_CA'); 26 | ok(luminateExtend.global.locale === 'en_CA'); 27 | }); 28 | 29 | test('luminateExtend.global.locale accepts "fr_CA"', function() { 30 | luminateExtend.global.update('locale', 'fr_CA'); 31 | ok(luminateExtend.global.locale === 'fr_CA'); 32 | }); 33 | 34 | test('luminateExtend.global.locale accepts "en_GB"', function() { 35 | luminateExtend.global.update('locale', 'en_GB'); 36 | ok(luminateExtend.global.locale === 'en_GB'); 37 | }); 38 | 39 | test('luminateExtend.global.locale accepts "en_AU"', function() { 40 | luminateExtend.global.update('locale', 'en_AU'); 41 | ok(luminateExtend.global.locale === 'en_AU'); 42 | }); 43 | 44 | test('luminateExtend.global.locale defaults to "en_US" when unrecognized value is provided', function() { 45 | luminateExtend.global.update('locale', 'foo'); 46 | ok(luminateExtend.global.locale === 'en_US'); 47 | }); -------------------------------------------------------------------------------- /test/js/init.js: -------------------------------------------------------------------------------- 1 | test('luminateExtend is defined once library is included', function() { 2 | ok(luminateExtend); 3 | }); 4 | 5 | luminateExtend({ 6 | apiKey: '123456789', 7 | path: { 8 | nonsecure: 'http://shortname.convio.net/site/', 9 | secure: 'https://secure2.convio.net/shortname/site/' 10 | }, 11 | custom: { 12 | myCallback: function() {} 13 | } 14 | }); 15 | 16 | test('luminateExtend.global.apiKey is correct following init', function() { 17 | ok(luminateExtend.global.apiKey === '123456789'); 18 | }); 19 | 20 | test('luminateExtend.global.path.nonsecure is correct following init', function() { 21 | ok(luminateExtend.global.path.nonsecure === 'http://shortname.convio.net/site/'); 22 | }); 23 | 24 | test('luminateExtend.global.path.secure is correct following init', function() { 25 | ok(luminateExtend.global.path.secure === 'https://secure2.convio.net/shortname/site/'); 26 | }); 27 | 28 | test('luminateExtend.global.custom.myCallback is correct following init', function() { 29 | ok($.type(luminateExtend.global.custom.myCallback) === 'function'); 30 | }); 31 | 32 | test('luminateExtend.global.apiCommon defaults to empty object', function() { 33 | ok($.isEmptyObject(luminateExtend.global.apiCommon)); 34 | }); 35 | 36 | test('luminateExtend.global.auth.type defaults to "auth"', function() { 37 | ok(luminateExtend.global.auth.type === 'auth'); 38 | }); 39 | 40 | test('luminateExtend.global.auth.token defaults to undefined', function() { 41 | ok(!luminateExtend.global.auth.token); 42 | }); 43 | 44 | test('luminateExtend.global.locale defaults to undefined', function() { 45 | ok(!luminateExtend.global.locale); 46 | }); -------------------------------------------------------------------------------- /test/js/luminateExtend.js: -------------------------------------------------------------------------------- 1 | /* luminateExtend.js | Version: 1.9.0 (07-AUG-2021) */ 2 | !function(e){var t=function(t){return t&&e.inArray(t,["es_US","en_CA","fr_CA","en_GB","en_AU"])<0&&(t="en_US"),t},a=function(e){return e&&(e=t(e),luminateExtend.sessionVars.set("locale",e)),e},n=function(e,t){return(e?luminateExtend.global.path.secure+"S":luminateExtend.global.path.nonsecure)+"PageServer"+(luminateExtend.global.routingId&&""!==luminateExtend.global.routingId?";"+luminateExtend.global.routingId:"")+"?pagename=luminateExtend_server&pgwrap=n"+(t?"&"+t:"")},i=function(t,a){if(t.responseFilter&&t.responseFilter.array&&t.responseFilter.filter&&luminateExtend.utils.stringToObj(t.responseFilter.array,a)){var n,i,l=t.responseFilter.filter.split("==")[0].split("!=")[0].replace(/^\s+|\s+$/g,"");if(-1!==t.responseFilter.filter.indexOf("!=")?(n="nequal",i=t.responseFilter.filter.split("!=")[1]):-1!==t.responseFilter.filter.indexOf("==")&&(n="equal",i=t.responseFilter.filter.split("==")[1]),n&&i){i=i.replace(/^\s+|\s+$/g,"");var o=[],r=!1;if(e.each(luminateExtend.utils.ensureArray(luminateExtend.utils.stringToObj(t.responseFilter.array,a)),function(){"nequal"===n&&this[l]===i||"equal"===n&&this[l]!==i?r=!0:o.push(this)}),r){var s=t.responseFilter.array.split(".");e.each(a,function(t,n){t===s[0]&&e.each(n,function(n,i){n===s[1]&&(2===s.length?a[t][n]=o:e.each(i,function(i,l){i===s[2]&&(3===s.length?a[t][n][i]=o:e.each(l,function(e,l){e===s[3]&&4===s.length&&(a[t][n][i][e]=o)}))}))})})}}}var u=e.noop;t.callback&&("function"==typeof t.callback?u=t.callback:t.callback.error&&a.errorResponse?u=t.callback.error:t.callback.success&&!a.errorResponse&&(u=t.callback.success));var d=-1!==t.data.indexOf("&method=login")&&-1===t.data.indexOf("&method=loginTest"),c=-1!==t.data.indexOf("&method=logout");if(d||c){var p={callback:function(){u(a)},useCache:!1,useHTTPS:t.useHTTPS};d&&a.loginResponse&&a.loginResponse.nonce&&(p.nonce="NONCE_TOKEN="+a.loginResponse.nonce),luminateExtend.api.getAuth(p)}else u(a)};window.luminateExtend=function(e){luminateExtend.init(e||{})},luminateExtend.library={version:"1.9.0"},luminateExtend.global={update:function(t,n){t&&(t.length?n&&("locale"===t&&(n=a(n)),luminateExtend.global[t]=n):(t.locale&&(t.locale=a(t.locale)),luminateExtend.global=e.extend(luminateExtend.global,t)))}},luminateExtend.init=function(a){var n=e.extend({apiCommon:{},auth:{type:"auth"},path:{}},a||{});(n.locale&&(n.locale=t(n.locale)),n.supportsCORS=!1,window.XMLHttpRequest)&&("withCredentials"in new XMLHttpRequest&&(n.supportsCORS=!0));return luminateExtend.global=e.extend(luminateExtend.global,n),luminateExtend},luminateExtend.api=function(e){luminateExtend.api.request(e||{})},luminateExtend.api.bind=function(t){return e(t=t||"form.luminateApi").length>0&&e(t).each(function(){"form"===this.nodeName.toLowerCase()&&e(this).bind("submit",function(t){t.cancelBubble=!0,t.returnValue=!1,t.stopPropagation&&(t.stopPropagation(),t.preventDefault()),e(this).attr("id")||e(this).attr("id","luminateApi-"+(new Date).getTime());var a,n=e(this).attr("action"),i=n.split("?"),l=e(this).data("luminateapi"),o=-1!==i[0].indexOf("/site/")?i[0].split("/site/")[1]:i[0],r=e(this).attr("enctype"),s=i.length>1?i[1]:"",u="#"+e(this).attr("id"),d=!1,c=!1;l&&(l.callback&&(a=luminateExtend.utils.stringToObj(l.callback)),l.requiresAuth&&"true"===l.requiresAuth&&(d=!0),(0===n.indexOf("https:")||"https:"===window.location.protocol&&-1===n.indexOf("http"))&&(c=!0)),luminateExtend.api.request({api:o,callback:a,contentType:r,data:s,form:u,requiresAuth:d,useHTTPS:c})})}),luminateExtend},luminateExtend.api.getAuth=function(t){var a=e.extend({useCache:!0,useHTTPS:!1},t||{});if(luminateExtend.api.getAuthLoad)if(luminateExtend.api.getAuthLoad=!1,a.useCache&&luminateExtend.global.auth.type&&luminateExtend.global.auth.token)luminateExtend.api.getAuthLoad=!0,a.callback&&a.callback();else{var i=function(e){luminateExtend.global.update(e),luminateExtend.api.getAuthLoad=!0,a.callback&&a.callback()};luminateExtend.global.supportsCORS?e.ajax({url:(a.useHTTPS?luminateExtend.global.path.secure:luminateExtend.global.path.nonsecure)+"CRConsAPI",data:"luminateExtend="+luminateExtend.library.version+(a.nonce&&""!==a.nonce?"&"+a.nonce:"")+"&api_key="+luminateExtend.global.apiKey+"&method=getLoginUrl&response_format=json&v=1.0",xhrFields:{withCredentials:!0},dataType:"json",success:function(e){var t=e.getLoginUrlResponse,a=t.url,n=t.routing_id,l=t.JSESSIONID;n||-1===a.indexOf("CRConsAPI;jsessionid=")||(n=a.split("CRConsAPI;jsessionid=")[1].split("?")[0]),i({auth:{type:"auth",token:t.token},routingId:n?"jsessionid="+n:"",sessionCookie:l?"JSESSIONID="+l:""})}}):e.ajax({url:n(a.useHTTPS,"action=getAuth&callback=?"),dataType:"jsonp",success:i})}else setTimeout(function(){luminateExtend.api.getAuth(a)},1e3)},luminateExtend.api.getAuthLoad=!0;var l=function(t){var a=e.extend({contentType:"application/x-www-form-urlencoded",data:"",requiresAuth:!1,useHTTPS:null},t||{});if(e.inArray(a.api.toLowerCase(),["addressbook","advocacy","connect","cons","content","datasync","donation","email","group","orgevent","recurring","survey","teamraiser"])>=0&&(a.api="CR"+a.api.charAt(0).toUpperCase()+a.api.slice(1).toLowerCase()+"API",a.api=a.api.replace("Addressbook","AddressBook").replace("Datasync","DataSync").replace("Orgevent","OrgEvent")),luminateExtend.global.path.nonsecure&&luminateExtend.global.path.secure&&luminateExtend.global.apiKey&&a.api){if("multipart/form-data"===a.contentType.split(";")[0]?a.contentType="multipart/form-data":a.contentType="application/x-www-form-urlencoded",a.contentType+="; charset=UTF-8",a.data="luminateExtend="+luminateExtend.library.version+(""===a.data?"":"&"+a.data),a.form&&e(a.form).length>0&&(a.data+="&"+e(a.form).eq(0).serialize()),-1===a.data.indexOf("&api_key=")&&(a.data+="&api_key="+luminateExtend.global.apiKey),luminateExtend.global.apiCommon.centerId&&-1===a.data.indexOf("¢er_id=")&&(a.data+="¢er_id="+luminateExtend.global.apiCommon.centerId),luminateExtend.global.apiCommon.categoryId&&-1===a.data.indexOf("&list_category_id=")&&(a.data+="&list_category_id="+luminateExtend.global.apiCommon.categoryId),-1!==a.data.indexOf("&response_format=xml")?a.data=a.data.replace(/&response_format=xml/g,"&response_format=json"):-1===a.data.indexOf("&response_format=")&&(a.data+="&response_format=json"),luminateExtend.global.apiCommon.source&&-1===a.data.indexOf("&source=")){var l=luminateExtend.global.apiCommon.source;l.length>255&&(l=l.substring(0,255)),a.data+="&source="+l}if(luminateExtend.global.apiCommon.subSource&&-1===a.data.indexOf("&sub_source=")){var o=luminateExtend.global.apiCommon.subSource;o.length>255&&(o=o.substring(0,255)),a.data+="&sub_source="+o}-1===a.data.indexOf("&suppress_response_codes=")&&(a.data+="&suppress_response_codes=true"),luminateExtend.global.locale&&-1===a.data.indexOf("&s_locale=")&&(a.data+="&s_locale="+luminateExtend.global.locale),-1===a.data.indexOf("&v=")&&(a.data+="&v=1.0");var r="http://",s=luminateExtend.global.path.nonsecure.split("http://")[1];"CRDonationAPI"===a.api||"CRTeamraiserAPI"===a.api||"CRConnectAPI"!==a.api&&("https:"===window.location.protocol&&null==a.useHTTPS||1==a.useHTTPS)?a.useHTTPS=!0:a.useHTTPS=!1,a.useHTTPS&&(r="https://",s=luminateExtend.global.path.secure.split("https://")[1]),r+=s+a.api;var u,d=!1,c=!1,p=!1;window.location.protocol===r.split("//")[0]&&document.domain===s.split("/")[0]?(d=!0,c=!0):luminateExtend.global.supportsCORS?c=!0:"postMessage"in window&&(p=!0),c?u=function(){luminateExtend.global.routingId&&""!==luminateExtend.global.routingId&&(r+=";"+luminateExtend.global.routingId),a.requiresAuth&&-1===a.data.indexOf("&"+luminateExtend.global.auth.type+"=")&&(a.data+="&"+luminateExtend.global.auth.type+"="+luminateExtend.global.auth.token),luminateExtend.global.sessionCookie&&""!==luminateExtend.global.sessionCookie&&(a.data+="&"+luminateExtend.global.sessionCookie),a.data+="&ts="+(new Date).getTime(),e.ajax({url:r,data:a.data,xhrFields:{withCredentials:!0},contentType:a.contentType,dataType:"json",type:"POST",success:function(e){i(a,e)}})}:p&&(u=function(){var t=(new Date).getTime(),l="luminateApiPostMessage"+t,o=n(a.useHTTPS,"action=postMessage");luminateExtend.global.routingId&&""!==luminateExtend.global.routingId&&(r+=";"+luminateExtend.global.routingId),a.requiresAuth&&-1===a.data.indexOf("&"+luminateExtend.global.auth.type+"=")&&(a.data+="&"+luminateExtend.global.auth.type+"="+luminateExtend.global.auth.token),luminateExtend.global.sessionCookie&&""!==luminateExtend.global.sessionCookie&&(a.data+="&"+luminateExtend.global.sessionCookie),a.data+="&ts="+t,luminateExtend.api.request.postMessageEventHandler||(luminateExtend.api.request.postMessageEventHandler={},luminateExtend.api.request.postMessageEventHandler.handler=function(t){if(-1!==luminateExtend.global.path.nonsecure.indexOf(t.origin)||-1!==luminateExtend.global.path.secure.indexOf(t.origin)){var a=e.parseJSON(t.data),n=a.postMessageFrameId,i=e.parseJSON(decodeURIComponent(a.response));luminateExtend.api.request.postMessageEventHandler[n]&&luminateExtend.api.request.postMessageEventHandler[n](n,i)}},void 0!==window.addEventListener?window.addEventListener("message",luminateExtend.api.request.postMessageEventHandler.handler,!1):void 0!==window.attachEvent&&window.attachEvent("onmessage",luminateExtend.api.request.postMessageEventHandler.handler)),luminateExtend.api.request.postMessageEventHandler[l]=function(t,n){i(a,n),e("#"+t).remove(),delete luminateExtend.api.request.postMessageEventHandler[t]},e("body").append(''),e("#"+l).bind("load",function(){var t='{"postMessageFrameId": "'+e(this).attr("id")+'", "requestUrl": "'+r+'", "requestContentType": "'+a.contentType+'", "requestData": "'+a.data+'"}',n=r.split("/site/")[0].split("/admin/")[0];document.getElementById(e(this).attr("id")).contentWindow.postMessage(t,n)}),e("#"+l).attr("src",o)}),a.requiresAuth||!c&&!d&&!luminateExtend.global.sessionCookie?luminateExtend.api.getAuth({callback:u,useHTTPS:a.useHTTPS}):u()}};luminateExtend.api.request=function(t){if(e.isArray(t)){t.reverse();var a=[];e.each(t,function(n){var i=e.extend({async:!0},this);if(i.async||n===t.length-1)a.push(i);else if((r=t[n+1]).callback&&"function"!=typeof r.callback){var o=r.callback.success||e.noop;r.callback.success=function(e){o(e),l(i)}}else{var r,s=(r=t[n+1]).callback||e.noop;r.callback={success:function(e){s(e),l(i)},error:function(e){s(e)}}}}),a.reverse(),e.each(a,function(){l(this)})}else l(t)},luminateExtend.sessionVars={set:function(e,t,a){var n={};a&&(n.callback=a),e&&(n.data="s_"+e+"="+(t||""),luminateExtend.utils.ping(n))}},luminateExtend.tags=function(e,t){luminateExtend.tags.parse(e,t)},luminateExtend.tags.parse=function(t,a){luminateExtend.widgets?luminateExtend.widgets(t,a):(t=t&&"all"!==t?luminateExtend.utils.ensureArray(t):["cons"],a=a||"body",e.each(t,function(t,n){if("cons"===n){var i=e(a).find(document.getElementsByTagName("luminate:cons"));if(i.length>0){luminateExtend.api.request({api:"cons",callback:function(t){i.each(function(){t.getConsResponse?e(this).replaceWith(luminateExtend.utils.stringToObj(e(this).attr("field"),t.getConsResponse)):e(this).remove()})},data:"method=getUser",requiresAuth:!0})}}}))},luminateExtend.utils={ensureArray:function(t){return e.isArray(t)?t:t?[t]:[]},stringToObj:function(e,t){var a=t||window;if(e)for(var n=e.split("."),i=0;i'),e("#"+n).bind("load",function(){e(this).remove(),a.callback&&a.callback()}),e("#"+n).attr("src",("https:"===window.location.protocol?luminateExtend.global.path.secure:luminateExtend.global.path.nonsecure)+"EstablishSession"+(luminateExtend.global.routingId&&""!==luminateExtend.global.routingId?";"+luminateExtend.global.routingId:"")+"?"+(null==a.data?"":a.data+"&")+"NEXTURL="+encodeURIComponent(("https:"===window.location.protocol?luminateExtend.global.path.secure:luminateExtend.global.path.nonsecure)+"PixelServer"))},simpleDateFormat:function(a,n,i){if(i=i||luminateExtend.global.locale,i=t(i),n=n||(e.inArray(i,["en_CA","fr_CA","en_GB","en_AU"])>=0?"d/M/yy":"M/d/yy"),!((a=a||new Date)instanceof Date)){var l=a.split("T")[0].split("-"),o=a.split("T").length>1?a.split("T")[1].split(".")[0].split("Z")[0].split("-")[0].split(":"):["00","00","00"];a=new Date(l[0],l[1]-1,l[2],o[0],o[1],o[2])}var r=function(e){return 0===(e=""+e).indexOf("0")&&"0"!==e?e.substring(1):e},s=function(e){return e=Number(e),isNaN(e)?"00":(e<10?"0":"")+e},u={month:s(a.getMonth()+1),date:s(a.getDate()),year:s(a.getFullYear()),day:a.getDay(),hour24:a.getHours(),hour12:a.getHours(),minutes:s(a.getMinutes()),ampm:"AM"};u.hour24>11&&(u.ampm="PM"),u.hour24=s(u.hour24),0===u.hour12&&(u.hour12=12),u.hour12>12&&(u.hour12=u.hour12-12),u.hour12=s(u.hour12);var d=function(e){var t=e.replace(/yy+(?=y)/g,"yy").replace(/MMM+(?=M)/g,"MMM").replace(/d+(?=d)/g,"d").replace(/EEE+(?=E)/g,"EEE").replace(/a+(?=a)/g,"").replace(/k+(?=k)/g,"k").replace(/h+(?=h)/g,"h").replace(/m+(?=m)/g,"m").replace(/yyy/g,u.year).replace(/yy/g,u.year.substring(2)).replace(/y/g,u.year).replace(/dd/g,u.date).replace(/d/g,r(u.date)),a=function(e,t,a){for(var n=1;n23&&(i=23);var l="+"===a?i:0-i;"kk"===t||"k"===t?(l=Number(u.hour24)+l)>24?l-=24:l<0&&(l+=24):((l=Number(u.hour12)+l)>24?l-=24:l<0&&(l+=24),l>12&&(l-=12)),l=""+l,"kk"!==t&&"hh"!==t||(l=s(l)),("h"===t&&0===l||"hh"===t&&"00"===l)&&(l="12"),e[n]=l+e[n]}return e.join("")};-1!==t.indexOf("k+")&&(t=a((t=a(t.split("kk+"),"kk","+")).split("k+"),"k","+")),-1!==t.indexOf("k-")&&(t=a((t=a(t.split("kk-"),"kk","-")).split("k-"),"k","-")),-1!==(t=t.replace(/kk/g,u.hour24).replace(/k/g,r(u.hour24))).indexOf("h+")&&(t=a((t=a(t.split("hh+"),"hh","+")).split("h+"),"h","+")),-1!==t.indexOf("h-")&&(t=a((t=a(t.split("hh-"),"hh","-")).split("h-"),"h","-")),t=(t=(t=t.replace(/hh/g,u.hour12<12&&u.hour12.indexOf&&0!==u.hour12.indexOf("0")?"0"+u.hour12:u.hour12).replace(/h/g,r(u.hour12))).replace(/mm/g,u.minutes).replace(/m/g,r(u.minutes))).replace(/a/g,"A");var n=["January","February","march","april","may","June","July","august","September","October","November","December"];"es_US"===i&&(n=["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]),"fr_CA"===i&&(n=["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]);var l=n[Number(u.month)-1].substring(0,3);"fr_CA"===i&&("f&#"===l?l="fév":"ao&"===l?l="aoû":"d&#"===l&&(l="déc")),t=t.replace(/MMMM/g,n[Number(u.month)-1]).replace(/MMM/g,l).replace(/MM/g,u.month).replace(/M/g,r(u.month));var o=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];"es_US"===i&&(o=["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]),"fr_CA"===i&&(o=["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]);var d=o[u.day].substring(0,3);return"es_US"===i&&("mi&"===d?d="mié":"s&a"===d&&(d="sáb")),t=(t=t.replace(/EEEE/g,o[u.day]).replace(/EEE/g,d).replace(/EE/g,d).replace(/E/g,d)).replace(/A/g,u.ampm).replace(/apr/g,"Apr").replace(/aug/g,"Aug"),"es_US"!==i&&"fr_CA"!==i&&(t=t.replace(/mar/g,"Mar").replace(/may/g,"May")),t};if(-1!==n.indexOf("'")){var c=n.replace(/\'+(?=\')/g,"''").split("''");if(1===c.length){c=n.split("'");for(var p=0;p 2 | 3 | 4 | 5 | luminateExtend.utils Test Suite 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 | 18 | 19 | 20 | 21 | 22 | --------------------------------------------------------------------------------