Community Support Forums — WordPress® ( Users Helping Users ) — 2011-12-20T09:51:06-05:00 http://www.primothemes.com/forums/feed.php?f=40&t=13146 2011-12-20T09:51:06-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13146&p=57892#p57892 <![CDATA[s2Member v111220 / Source Code: s2member\i...]]>
s2Member v111220
Source Code: s2member\includes\s2member.js
Docs updated: December 20, 2011, 9:51 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — December 20th, 2011, 9:51 am


]]>
2011-12-07T01:04:13-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13146&p=55574#p55574 <![CDATA[s2Member v111206 / Source Code: s2member\i...]]>
s2Member v111206
Source Code: s2member\includes\s2member.js
Docs updated: December 7, 2011, 1:04 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — December 7th, 2011, 1:04 am


]]>
2011-11-05T19:26:56-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13146&p=51948#p51948 <![CDATA[s2Member v111105 / Source Code: s2member\i...]]>
s2Member v111105
Source Code: s2member\includes\s2member.js
Docs updated: November 5, 2011, 8:27 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — November 5th, 2011, 7:26 pm


]]>
2011-10-29T20:36:19-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13146&p=50044#p50044 <![CDATA[s2Member v111029 / Source Code: s2member\i...]]>
s2Member v111029
Source Code: s2member\includes\s2member.js
Docs updated: October 29, 2011, 9:36 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 29th, 2011, 8:36 pm


]]>
2011-10-17T15:40:20-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13146&p=47838#p47838 <![CDATA[s2Member v111017 / Source Code: s2member\i...]]>
s2Member v111017
Source Code: s2member\includes\s2member.js
Docs updated: October 17, 2011, 1:40 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 17th, 2011, 3:40 pm


]]>
2011-10-11T14:36:11-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13146&p=46239#p46239 <![CDATA[s2Member v111011 / Source Code: s2member\i...]]>
s2Member v111011
Source Code: s2member\includes\s2member.js
Docs updated: October 11, 2011, 12:36 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 11th, 2011, 2:36 pm


]]>
2011-10-03T15:48:45-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13146&p=44369#p44369 <![CDATA[s2Member v111003 / Source Code: s2member\i...]]>
s2Member v111003
Source Code: s2member\includes\s2member.js
Docs updated: October 3, 2011, 1:48 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 3rd, 2011, 3:48 pm


]]>
2011-10-03T03:42:24-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13146&p=43076#p43076 <![CDATA[s2Member v111002 / Source Code: s2member\i...]]>
s2Member v111002
Source Code: s2member\includes\s2member.js
Docs updated: October 3, 2011, 1:42 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 3rd, 2011, 3:42 am


]]>
2011-09-27T05:27:27-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13146&p=41322#p41322 <![CDATA[s2Member v110927 / Source Code: s2member\i...]]>
s2Member v110927
Source Code: s2member\includes\s2member.js
Docs updated: September 27, 2011, 3:27 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 27th, 2011, 5:27 am


]]>
2011-09-26T21:04:05-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13146&p=40078#p40078 <![CDATA[s2Member v110926 / Source Code: s2member\i...]]>
s2Member v110926
Source Code: s2member\includes\s2member.js
Docs updated: September 26, 2011, 7:04 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 26th, 2011, 9:04 pm


]]>
2011-09-17T17:03:02-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13146&p=38222#p38222 <![CDATA[s2Member v110915 / Source Code: s2member\i...]]>
s2Member v110915
Source Code: s2member\includes\s2member.js
Docs updated: September 17, 2011, 3:03 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 17th, 2011, 5:03 pm


]]>
2011-09-14T01:28:38-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13146&p=36801#p36801 <![CDATA[s2Member v110913 / Source Code: s2member\i...]]>
s2Member v110913
Source Code: s2member\includes\s2member.js
Docs updated: September 13, 2011, 11:28 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 14th, 2011, 1:28 am


]]>
2011-09-13T12:03:40-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13146&p=35529#p35529 <![CDATA[s2Member v110912 / Source Code: s2member\i...]]>
s2Member v110912
Source Code: s2member\includes\s2member.js
Docs updated: September 13, 2011, 10:03 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 13th, 2011, 12:03 pm


]]>
2011-08-15T15:15:49-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13146&p=31640#p31640 <![CDATA[s2Member v110815 / Source Code: s2member\i...]]>
s2Member v110815
Source Code: s2member\includes\s2member.js
Docs updated: August 15, 2011, 4:16 pm

Open for public discussion.
(!-- s-words :: --)Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code jQuery(window).load(function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli'+location.hash).addClass('hilite'); }); jQuery(window).bind('hashchange', function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli').removeClass('hilite'); jQuery('olli'+location.hash).addClass('hilite'); }); [ full view ]s2member\includes\s2member.js /** * Core JavaScript file for the s2Member plugin. * * This is the development version of the code. * Which ultimately produces s2member-min.js. * * Copyright: © 2009-2011 * {@link http://www.websharks-inc.com/ WebSharks, Inc.} * ( coded in the USA ) * * Released under the terms of the GNU General Public License. * You should have received a copy of the GNU General Public License, * along with this software. In the main directory, see: /licensing/ * If not, see: {@link http://www.gnu.org/licenses/}. * * @package s2Member * @since 3.0 */ /* Scripting routines handled on document ready state. */ jQuery(document).ready (function($) { ws_plugin__s2member_uniqueFilesDownloaded = []; /* Real-time counts. */ /* This is used in case a user downloads multiple files from a single page. */ /**/ var bpRegisterSlug = '?php echo c_ws_plugin__s2member_utils_strings:: esc_sq ( preg_quote ( (c_ws_plugin__s2member_utils_conds:: bp_is_installed ( ) ) ? "/" . ltrim (BP_REGISTER_SLUG, "/" ) : "" ) , "/" ) ; ?'; var bpxProfileSlug = '?php echo c_ws_plugin__s2member_utils_strings:: esc_sq ( preg_quote ( (c_ws_plugin__s2member_utils_conds:: bp_is_installed ( ) ) ? "/" . ltrim (BP_XPROFILE_SLUG, "/" ) : "" ) , "/" ) ; ?'; /**/ if (S2MEMBER_CURRENT_USER_IS_LOGGED_IN && S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED) { $('a[href*="s2member_file_download"]').click (function() { if (!this.href.match (/s2member_file_download_key\=(.+)/i)) { var c = '** Please Confirm This File Download **\n\n'; c += 'You\'ve downloaded ' + S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY + ' protected file' + ((S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY !== 1) ? 's' : '') + ' in the last ' + S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS + ' days.\n\n'; c += 'You\'re entitled to ' + ((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED) ? 'UNLIMITED downloads though ( so, no worries ).' : S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED + ' unique downloads every ' + S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS + ' day period.'); /**/ if (this.href.match (/s2member_skip_confirmation/i) || confirm(c)) { if ($.inArray (this.href, ws_plugin__s2member_uniqueFilesDownloaded) === -1) /* Real-time counting. */ ws_plugin__s2member_uniqueFilesDownloaded.push (this.href), S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY++; return true; /* Allow. */ } else /* Disallow. */ return false; } else /* Allow. */ return true; }); } /* Deals with form field validation on Profile editing panels. `[s2Member-Profile /]` could appear on any Post/Page/Widget. */ if (!location.href.match (/\/wp-admin\//)) { $('input#ws-plugin--s2member-profile-password1, input#ws-plugin--s2member-profile-password2').keyup (function() { ws_plugin__s2member_passwordStrength($('input#ws-plugin--s2member-profile-login'), $('input#ws-plugin--s2member-profile-password1'), $('input#ws-plugin--s2member-profile-password2'), $('div#ws-plugin--s2member-profile-password-strength')); }); /**/ $('form#ws-plugin--s2member-profile').submit (function() { var context = this, label = '', error = '', errors = ''; /**/ var $password1 = $('input#ws-plugin--s2member-profile-password1', context); var $password2 = $('input#ws-plugin--s2member-profile-password2', context); /**/ var $submissionButton = $('input#ws-plugin--s2member-profile-submit', context); /**/ $(':input', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().children ('strong').first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ else if ($.trim ($password1.val ()) && $.trim ($password1.val ()) !== $.trim ($password2.val ())) { alert('— Oops, you missed something: —\n\nPasswords do not match up. Please try again.'); /**/ return false; } /**/ ws_plugin__s2member_animateProcessing($submissionButton); /**/ return true; }); } /* Attach form submission handler to `/wp-signup.php`. */ if (location.href.match (/\/wp-signup\.php/)) { $('div#content div.mu_register form#setupform').submit (function() { var context = this, label = '', error = '', errors = ''; /**/ $('input#user_email', context).attr ('data-expected', 'email'); /**/ var $submissionButton = $('p.submit input[type="submit"]', context); /**/ $('input#user_name, input#user_email, input#blogname, input#blog_title, input#captcha_code', context).attr ({'aria-required': 'true'}); /**/ $(':input', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ ws_plugin__s2member_animateProcessing($submissionButton); /**/ return true; }); } /* Attach form submission handler to `/wp-login.php?action=register`. */ else if (location.href.match (/\/wp-login\.php/)) { $('input#ws-plugin--s2member-custom-reg-field-user-pass1, input#ws-plugin--s2member-custom-reg-field-user-pass2').keyup (function() { ws_plugin__s2member_passwordStrength($('input#user_login'), $('input#ws-plugin--s2member-custom-reg-field-user-pass1'), $('input#ws-plugin--s2member-custom-reg-field-user-pass2'), $('div#ws-plugin--s2member-custom-reg-field-user-pass-strength')); }); /**/ $('div#login form#registerform input#wp-submit').attr ('tabindex', '1000'); /* Makes plenty of room ( i.e. tab indexes ) for Custom Registration Fields. */ /**/ $('div#login form#registerform').submit (function() { var context = this, label = '', error = '', errors = ''; /**/ $('input#user_email', context).attr ('data-expected', 'email'); /**/ var $pass1 = $('input#ws-plugin--s2member-custom-reg-field-user-pass1[aria-required="true"]', context); var $pass2 = $('input#ws-plugin--s2member-custom-reg-field-user-pass2', context); /**/ var $submissionButton = $('input#wp-submit', context); /* Registration submission button. */ /**/ $('input#user_login, input#user_email, input#captcha_code', context).attr ({'aria-required': 'true'}); /**/ $(':input', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if ($.inArray (id, ['user_login', 'user_email', 'captcha_code']) !== -1) /* No for="" attribute on these fields. */ { if ((label = $.trim ($(this).parent ('label').text ().replace (/[\r\n\t]+/g, ' ')))) /* Use label. */ { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } } else if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().children ('span').first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ else if ($pass1.length && $.trim ($pass1.val ()) !== $.trim ($pass2.val ())) { alert('— Oops, you missed something: —\n\nPasswords do not match up. Please try again.'); /**/ return false; } /**/ ws_plugin__s2member_animateProcessing($submissionButton); /**/ return true; }); } /* Attach form submission handler to `/wp-admin/(user/)?profile.php`. */ else if (location.href.match (/\/wp-admin\/(user\/)?profile\.php/)) { $('form#your-profile').submit (function() /* Validation. */ { var context = this, label = '', error = '', errors = ''; /**/ $('input#email', context).attr ('data-expected', 'email'); /**/ $(':input[id^="ws-plugin--s2member-profile-"]', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ return true; }); } /* Attach form submission handler to `/register` for BuddyPress. */ else if (bpRegisterSlug && location.href.match (bpRegisterSlug)) { $('body.registration form div#ws-plugin--s2member-custom-reg-fields-4bp-section').closest ('form').submit (function() { var context = this, label = '', error = '', errors = ''; /**/ $('input#signup_email', context).attr ('data-expected', 'email'); /**/ $('input#signup_username, input#signup_email, input#signup_password, input#field_1', context).attr ({'aria-required': 'true'}); /**/ $(':input', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ return true; }); } /* Attach form submission handler to `/profile/edit/` for BuddyPress. */ else if (bpxProfileSlug && location.href.match (bpxProfileSlug) && location.href.match (/\/edit\//)) { $('body.logged-in.profile.profile-edit input.ws-plugin--s2member-profile-field-4bp[type = "text"]').closest ('form').submit (function() { var context = this, label = '', error = '', errors = ''; /**/ $('input#field_1', context).attr ({'aria-required': 'true'}); /**/ $(':input', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ return true; }); } /* Password strength. Accecpts jQuery objects. */ ws_plugin__s2member_passwordStrength = function($username, $pass1, $pass2, $result) { if ($username instanceof jQuery && $pass1 instanceof jQuery && $pass2 instanceof jQuery && $result instanceof jQuery && typeof passwordStrength === 'function' && typeof pwsL10n === 'object') { $result.removeClass ('ws-plugin--s2member-password-strength-short ws-plugin--s2member-password-strength-bad ws-plugin--s2member-password-strength-good ws-plugin--s2member-password-strength-strong ws-plugin--s2member-password-strength-mismatch'); /**/ switch (passwordStrength($pass1.val (), $username.val (), $pass2.val ())) /* Uses WordPress® script: `password-strength-meter` and `pwsL10n`. */ { case 1: $result.addClass ('ws-plugin--s2member-password-strength-short').html (pwsL10n['short']); break; case 2: $result.addClass ('ws-plugin--s2member-password-strength-bad').html (pwsL10n['bad']); break; case 3: $result.addClass ('ws-plugin--s2member-password-strength-good').html (pwsL10n['good']); break; case 4: $result.addClass ('ws-plugin--s2member-password-strength-strong').html (pwsL10n['strong']); break; case 5: $result.addClass ('ws-plugin--s2member-password-strength-mismatch').html (pwsL10n['mismatch']); break; default: $result.addClass ('ws-plugin--s2member-password-strength-short').html (pwsL10n['short']); } } /**/ return; /* Return for uniformity. */ }; /* Handles JavaScript validation errors. */ ws_plugin__s2member_validationErrors = function(label, field, context, required, expected) { if (typeof label === 'string' && label && typeof field === 'object' && typeof context === 'object') if (typeof field.tagName === 'string' && field.tagName.match (/^(input|textarea|select)$/i) && !field.disabled) { var tag = field.tagName.toLowerCase (), $field = $(field), type = $.trim ($field.attr ('type')).toLowerCase (), name = $.trim ($field.attr ('name')), value = $field.val (); var required = ( typeof required === 'boolean') ? required : ($field.attr ('aria-required') === 'true'), expected = ( typeof expected === 'string') ? expected : $.trim ($field.attr ('data-expected')); /**/ var forcePersonalEmails = ('?php echo strlen ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "custom_reg_force_personal_emails" ] ) ; ?' 0) ? true : false; var nonPersonalEmailUsers = new RegExp('^(?php echo c_ws_plugin__s2member_utils_strings:: esc_sq ( implode ( "|" , preg_split ( "/[\r \n \t ;,]+/" , preg_quote ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "custom_reg_force_personal_emails" ] , "/" ) ) ) ) ; ?)@', 'i'); /**/ if (tag === 'input' && type === 'checkbox' && name.match (/\[\]$/)) { if (typeof field.id === 'string' && field.id.match (/-0$/)) if (required && !$('input[name="' + name.replace (/([\[\]])/g, '\$1') + '"]:checked', context).length) return label + '\nPlease check at least one of the boxes.'; } else if (tag === 'input' && type === 'checkbox') { if (required && !field.checked) return label + '\nRequired. This box must be checked.'; } else if (tag === 'input' && type === 'radio') { if (typeof field.id === 'string' && field.id.match (/-0$/)) if (required && !$('input[name="' + name.replace (/([\[\]])/g, '\$1') + '"]:checked', context).length) return label + '\nPlease select one of the options.'; } else if (tag === 'select' && $field.attr ('multiple')) { if (required && (!(value instanceof Array) || !value.length)) return label + '\nPlease select at least one of the options.'; } else if (typeof value !== 'string' || (required && !(value = $.trim (value)).length)) { return label + '\nThis is a required field, please try again.'; } else if ((value = $.trim (value)).length && ((tag === 'input' && type.match (/^(text|password)$/i)) || tag === 'textarea') && typeof expected === 'string' && expected.length) { if (expected === 'numeric-wp-commas' && (!value.match (/^[0-9\.,]+$/) || isNaN(value.replace (/,/g, '')))) { return label + '\nMust be numeric ( with or without decimals, commas allowed ).'; } else if (expected === 'numeric' && (!value.match (/^[0-9\.]+$/) || isNaN(value))) { return label + '\nMust be numeric ( with or without decimals, no commas ).'; } else if (expected === 'integer' && (!value.match (/^[0-9]+$/) || isNaN(value))) { return label + '\nMust be an integer ( a whole number, without any decimals ).'; } else if (expected === 'integer-gt-0' && (!value.match (/^[0-9]+$/) || isNaN(value) || value = 0)) { return label + '\nMust be an integer 0 ( whole number, no decimals, greater than 0 ).'; } else if (expected === 'float' && (!value.match (/^[0-9\.]+$/) || !value.match (/[0-9]/) || !value.match (/\./) || isNaN(value))) { return label + '\nMust be a float ( floating point number, decimals required ).'; } else if (expected === 'float-gt-0' && (!value.match (/^[0-9\.]+$/) || !value.match (/[0-9]/) || !value.match (/\./) || isNaN(value) || value = 0)) { return label + '\nMust be a float 0 ( floating point number, decimals required, greater than 0 ).'; } else if (expected === 'date' && !value.match (/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/)) { return label + '\nMust be a date ( required date format: dd/mm/yyyy ).'; } else if (expected === 'email' && !value.match (/^([a-z_~0-9\+\-]+)(((\.?)([a-z_~0-9\+\-]+))*)(@)([a-z0-9]+)(((-*)([a-z0-9]+))*)(((\.)([a-z0-9]+)(((-*)([a-z0-9]+))*))*)(\.)([a-z]{2,6})$/i)) { return label + '\nMust be a valid email address.'; } else if (expected === 'email' && forcePersonalEmails && value.match (nonPersonalEmailUsers)) { return label + '\nPlease use a personal email address.\nAddresses like ' + value.split ('@')[0] + '@ are problematic.'; } else if (expected === 'url' && !value.match (/^http(s?)\:\/\/(.{5,})$/i)) { return label + '\nMust be a full URL ( starting with http or https ).'; } else if (expected === 'domain' && !value.match (/^([a-z0-9]+)(((-*)([a-z0-9]+))*)(((\.)([a-z0-9]+)(((-*)([a-z0-9]+))*))*)(\.)([a-z]{2,6})$/i)) { return label + '\nMust be a domain name ( domain name only, without http ).'; } else if (expected === 'phone' && (!value.match (/^[0-9 \(\)\-]+$/) || value.replace (/[^0-9]/g, '').length !== 10)) { return label + '\nMust be a phone # ( 10 digits w/possible hyphens,spaces,brackets ).'; } else if (expected === 'uszip' && !value.match (/^[0-9]{5}(-[0-9]{4})?$/)) { return label + '\nMust be a US zipcode ( 5-9 digits w/possible hyphen ).'; } else if (expected === 'cazip' && !value.match (/^[0-9A-Z]{3}( ?)[0-9A-Z]{3}$/i)) { return label + '\nMust be a Canadian zipcode ( 6 alpha-numerics w/possible space ).'; } else if (expected === 'uczip' && !value.match (/^[0-9]{5}(-[0-9]{4})?$/) && !value.match (/^[0-9A-Z]{3}( ?)[0-9A-Z]{3}$/i)) { return label + '\nMust be a zipcode ( either a US or Canadian zipcode ).'; } else if (expected.match (/^alphanumerics-spaces-punctuation-([0-9]+)(-e)?$/) && !value.match (/^[a-z 0-9,\.\/\?\:;"'\{\}\[\]\|\\\+\=_\-\(\)\*&\^%\$#@\!`~]+$/i)) { return label + '\nPlease use alphanumerics, spaces & punctuation only.'; } else if (expected.match (/^alphanumerics-spaces-([0-9]+)(-e)?$/) && !value.match (/^[a-z 0-9]+$/i)) { return label + '\nPlease use alphanumerics & spaces only.'; } else if (expected.match (/^alphanumerics-punctuation-([0-9]+)(-e)?$/) && !value.match (/^[a-z0-9,\.\/\?\:;"'\{\}\[\]\|\\\+\=_\-\(\)\*&\^%\$#@\!`~]+$/i)) { return label + '\nPlease use alphanumerics & punctuation only ( no spaces ).'; } else if (expected.match (/^alphanumerics-([0-9]+)(-e)?$/) && !value.match (/^[a-z0-9]+$/i)) { return label + '\nPlease use alphanumerics only ( no spaces/punctuation ).'; } else if (expected.match (/^alphabetics-([0-9]+)(-e)?$/) && !value.match (/^[a-z]+$/i)) { return label + '\nPlease use alphabetics only ( no digits/spaces/punctuation ).'; } else if (expected.match (/^numerics-([0-9]+)(-e)?$/) && !value.match (/^[0-9]+$/i)) { return label + '\nPlease use numeric digits only.'; } else if (expected.match (/^(any|alphanumerics-spaces-punctuation|alphanumerics-spaces|alphanumerics-punctuation|alphanumerics|alphabetics|numerics)-([0-9]+)(-e)?$/)) { var split = expected.split ('-'), length = Number(split[1]), exactLength = (split.length 2) ? Number(split[2]) : ''; /**/ if (exactLength && value.length !== length) /* An exact length is required? */ return label + '\nMust be exactly ' + length + ' ' + ((split[0] === 'numerics') ? 'digit' : 'character') + ((length 1) ? 's' : '') + '.'; /**/ else if (value.length length) /* Otherwise, we interpret as the minimum length. */ return label + '\nMust be at least ' + length + ' ' + ((split[0] === 'numerics') ? 'digit' : 'character') + ((length 1) ? 's' : '') + '.'; } } } /**/ return ''; }; /**/ ws_plugin__s2member_animateProcessingConfig = {originalText: '', interval: null, speed: 100}, ws_plugin__s2member_animateProcessing = function($obj, reset) { if ($obj instanceof jQuery) /* This function expects a valid jQuery object. */ { if (reset) /* Resets back to originalText value ( also clears interval ). */ { clearInterval(ws_plugin__s2member_animateProcessingConfig.interval); /**/ if (ws_plugin__s2member_animateProcessingConfig.originalText) /* ? */ $obj.val (ws_plugin__s2member_animateProcessingConfig.originalText); /**/ return; /* No need to proceed any further. Return now upon reset. */ } /**/ $obj.first ().each (function() /* Interval routine configured here. */ { var $this = $(this), i = 0, dir = 'r', dots = ['.', '..', '...']; /**/ ws_plugin__s2member_animateProcessingConfig.originalText = $this.val (); /**/ clearInterval(ws_plugin__s2member_animateProcessingConfig.interval); /**/ ws_plugin__s2member_animateProcessingConfig.interval = setInterval(function() { if (dir === 'r') /* Right... */ { if (i + 1 = dots.length - 1) i = i + 1, dir = 'r'; else /* Switch direction. */ i = i - 1, dir = 'l'; } /**/ else if (dir === 'l') /* Left.. */ { if (i - 1 = 0) i = i - 1, dir = 'l'; else /* Switch direction. */ i = i + 1, dir = 'r'; } /**/ for (var _dots = dots[i], l = dots[i].length; l dots.length; l++) { _dots += ' '; /* Prevents jumping. */ } /**/ $this.val ('Processing' + _dots); }, ws_plugin__s2member_animateProcessingConfig.speed); }); } }; }); [ full view ]s2member\includes\s2member.js Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code(!-- :: s-words --)

Statistics: Posted by System Robot — August 15th, 2011, 3:15 pm


]]>
2011-07-11T17:32:33-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13146&p=27809#p27809 <![CDATA[s2Member v110710 / Source Code: s2member\i...]]>
s2Member v110710
Source Code: s2member\includes\s2member.js
Docs updated: July 11, 2011, 6:32 pm

Open for public discussion.
(!-- s-words :: --)Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code jQuery(window).load(function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli'+location.hash).addClass('hilite'); }); jQuery(window).bind('hashchange', function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli').removeClass('hilite'); jQuery('olli'+location.hash).addClass('hilite'); }); [ full view ]s2member\includes\s2member.js /** * Core JavaScript file for the s2Member plugin. * * This is the development version of the code. * Which ultimately produces s2member-min.js. * * Copyright: © 2009-2011 * {@link http://www.websharks-inc.com/ WebSharks, Inc.} * ( coded in the USA ) * * Released under the terms of the GNU General Public License. * You should have received a copy of the GNU General Public License, * along with this software. In the main directory, see: /licensing/ * If not, see: {@link http://www.gnu.org/licenses/}. * * @package s2Member * @since 3.0 */ /* Scripting routines handled on document ready state. */ jQuery(document).ready (function($) { ws_plugin__s2member_uniqueFilesDownloaded = []; /* Real-time counts. */ /* This is used in case a user downloads multiple files from a single page. */ /**/ var bpRegisterSlug = '?php echo c_ws_plugin__s2member_utils_strings:: esc_sq ( preg_quote ( ( defined ( "BP_VERSION" ) ) ? "/" . ltrim (BP_REGISTER_SLUG, "/" ) : "" ) , "/" ) ; ?'; var bpxProfileSlug = '?php echo c_ws_plugin__s2member_utils_strings:: esc_sq ( preg_quote ( ( defined ( "BP_VERSION" ) ) ? "/" . ltrim (BP_XPROFILE_SLUG, "/" ) : "" ) , "/" ) ; ?'; /**/ if (S2MEMBER_CURRENT_USER_IS_LOGGED_IN && S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED) { $('a[href*="s2member_file_download"]').click (function() { if (!this.href.match (/s2member_file_download_key\=(.+)/i)) { var c = '** Please Confirm This File Download **\n\n'; c += 'You\'ve downloaded ' + S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY + ' protected file' + ((S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY !== 1) ? 's' : '') + ' in the last ' + S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS + ' days.\n\n'; c += 'You\'re entitled to ' + ((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED) ? 'UNLIMITED downloads though ( so, no worries ).' : S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED + ' unique downloads every ' + S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS + ' day period.'); /**/ if (this.href.match (/s2member_skip_confirmation/i) || confirm(c)) { if ($.inArray (this.href, ws_plugin__s2member_uniqueFilesDownloaded) === -1) /* Real-time counting. */ ws_plugin__s2member_uniqueFilesDownloaded.push (this.href), S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY++; return true; /* Allow. */ } else /* Disallow. */ return false; } else /* Allow. */ return true; }); } /* Deals with form field validation on Profile editing panels. `[s2Member-Profile /]` could appear on any Post/Page/Widget. */ if (!location.href.match (/\/wp-admin\//)) { $('input#ws-plugin--s2member-profile-password1, input#ws-plugin--s2member-profile-password2').keyup (function() { ws_plugin__s2member_passwordStrength($('input#ws-plugin--s2member-profile-login'), $('input#ws-plugin--s2member-profile-password1'), $('input#ws-plugin--s2member-profile-password2'), $('div#ws-plugin--s2member-profile-password-strength')); }); /**/ $('form#ws-plugin--s2member-profile').submit (function() { var context = this, label = '', error = '', errors = ''; /**/ var $password1 = $('input#ws-plugin--s2member-profile-password1', context); var $password2 = $('input#ws-plugin--s2member-profile-password2', context); /**/ var $submissionButton = $('input#ws-plugin--s2member-profile-submit', context); /**/ $(':input', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().children ('strong').first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ else if ($.trim ($password1.val ()) && $.trim ($password1.val ()) !== $.trim ($password2.val ())) { alert('— Oops, you missed something: —\n\nPasswords do not match up. Please try again.'); /**/ return false; } /**/ ws_plugin__s2member_animateProcessing($submissionButton); /**/ return true; }); } /* Attach form submission handler to `/wp-signup.php`. */ if (location.href.match (/\/wp-signup\.php/)) { $('div#content div.mu_register form#setupform').submit (function() { var context = this, label = '', error = '', errors = ''; /**/ $('input#user_email', context).attr ('data-expected', 'email'); /**/ var $submissionButton = $('p.submit input[type="submit"]', context); /**/ $('input#user_name, input#user_email, input#blogname, input#blog_title, input#captcha_code', context).attr ({'aria-required': 'true'}); /**/ $(':input', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ ws_plugin__s2member_animateProcessing($submissionButton); /**/ return true; }); } /* Attach form submission handler to `/wp-login.php?action=register`. */ else if (location.href.match (/\/wp-login\.php/)) { $('input#ws-plugin--s2member-custom-reg-field-user-pass1, input#ws-plugin--s2member-custom-reg-field-user-pass2').keyup (function() { ws_plugin__s2member_passwordStrength($('input#user_login'), $('input#ws-plugin--s2member-custom-reg-field-user-pass1'), $('input#ws-plugin--s2member-custom-reg-field-user-pass2'), $('div#ws-plugin--s2member-custom-reg-field-user-pass-strength')); }); /**/ $('div#login form#registerform input#wp-submit').attr ('tabindex', '1000'); /* Makes plenty of room ( i.e. tab indexes ) for Custom Registration Fields. */ /**/ $('div#login form#registerform').submit (function() { var context = this, label = '', error = '', errors = ''; /**/ $('input#user_email', context).attr ('data-expected', 'email'); /**/ var $pass1 = $('input#ws-plugin--s2member-custom-reg-field-user-pass1[aria-required="true"]', context); var $pass2 = $('input#ws-plugin--s2member-custom-reg-field-user-pass2', context); /**/ var $submissionButton = $('input#wp-submit', context); /* Registration submission button. */ /**/ $('input#user_login, input#user_email, input#captcha_code', context).attr ({'aria-required': 'true'}); /**/ $(':input', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if ($.inArray (id, ['user_login', 'user_email', 'captcha_code']) !== -1) /* No for="" attribute on these fields. */ { if ((label = $.trim ($(this).parent ('label').text ().replace (/[\r\n\t]+/g, ' ')))) /* Use label. */ { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } } else if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().children ('span').first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ else if ($pass1.length && $.trim ($pass1.val ()) !== $.trim ($pass2.val ())) { alert('— Oops, you missed something: —\n\nPasswords do not match up. Please try again.'); /**/ return false; } /**/ ws_plugin__s2member_animateProcessing($submissionButton); /**/ return true; }); } /* Attach form submission handler to `/wp-admin/(user/)?profile.php`. */ else if (location.href.match (/\/wp-admin\/(user\/)?profile\.php/)) { $('form#your-profile').submit (function() /* Validation. */ { var context = this, label = '', error = '', errors = ''; /**/ $('input#email', context).attr ('data-expected', 'email'); /**/ $(':input[id^="ws-plugin--s2member-profile-"]', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ return true; }); } /* Attach form submission handler to `/register` for BuddyPress. */ else if (bpRegisterSlug && location.href.match (bpRegisterSlug)) { $('body.registration form div#ws-plugin--s2member-custom-reg-fields-4bp-section').closest ('form').submit (function() { var context = this, label = '', error = '', errors = ''; /**/ $('input#signup_email', context).attr ('data-expected', 'email'); /**/ $('input#signup_username, input#signup_email, input#signup_password, input#field_1', context).attr ({'aria-required': 'true'}); /**/ $(':input', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ return true; }); } /* Attach form submission handler to `/profile/edit/` for BuddyPress. */ else if (bpxProfileSlug && location.href.match (bpxProfileSlug) && location.href.match (/\/edit\//)) { $('body.logged-in.profile.profile-edit input.ws-plugin--s2member-profile-field-4bp[type = "text"]').closest ('form').submit (function() { var context = this, label = '', error = '', errors = ''; /**/ $('input#field_1', context).attr ({'aria-required': 'true'}); /**/ $(':input', context).each (function() /* Go through them all together. */ { var id = $.trim ($(this).attr ('id')).replace (/-[0-9]+$/g, ''); /* Remove numeric suffixes. */ /**/ if (id && (label = $.trim ($('label[for="' + id + '"]', context).first ().text ().replace (/[\r\n\t]+/g, ' ')))) { if (error = ws_plugin__s2member_validationErrors(label, this, context)) errors += error + '\n\n'; /* Collect errors. */ } }); /**/ if (errors = $.trim (errors)) { alert('— Oops, you missed something: —\n\n' + errors); /**/ return false; } /**/ return true; }); } /* Password strength. Accecpts jQuery objects. */ ws_plugin__s2member_passwordStrength = function($username, $pass1, $pass2, $result) { if ($username instanceof jQuery && $pass1 instanceof jQuery && $pass2 instanceof jQuery && $result instanceof jQuery && typeof passwordStrength === 'function' && typeof pwsL10n === 'object') { $result.removeClass ('ws-plugin--s2member-password-strength-short ws-plugin--s2member-password-strength-bad ws-plugin--s2member-password-strength-good ws-plugin--s2member-password-strength-strong ws-plugin--s2member-password-strength-mismatch'); /**/ switch (passwordStrength($pass1.val (), $username.val (), $pass2.val ())) /* Uses WordPress® script: `password-strength-meter` and `pwsL10n`. */ { case 1: $result.addClass ('ws-plugin--s2member-password-strength-short').html (pwsL10n['short']); break; case 2: $result.addClass ('ws-plugin--s2member-password-strength-bad').html (pwsL10n['bad']); break; case 3: $result.addClass ('ws-plugin--s2member-password-strength-good').html (pwsL10n['good']); break; case 4: $result.addClass ('ws-plugin--s2member-password-strength-strong').html (pwsL10n['strong']); break; case 5: $result.addClass ('ws-plugin--s2member-password-strength-mismatch').html (pwsL10n['mismatch']); break; default: $result.addClass ('ws-plugin--s2member-password-strength-short').html (pwsL10n['short']); } } /**/ return; /* Return for uniformity. */ }; /* Handles JavaScript validation errors. */ ws_plugin__s2member_validationErrors = function(label, field, context, required, expected) { if (typeof label === 'string' && label && typeof field === 'object' && typeof context === 'object') if (typeof field.tagName === 'string' && field.tagName.match (/^(input|textarea|select)$/i) && !field.disabled) { var tag = field.tagName.toLowerCase (), $field = $(field), type = $.trim ($field.attr ('type')).toLowerCase (), name = $.trim ($field.attr ('name')), value = $field.val (); var required = ( typeof required === 'boolean') ? required : ($field.attr ('aria-required') === 'true'), expected = ( typeof expected === 'string') ? expected : $.trim ($field.attr ('data-expected')); /**/ var forcePersonalEmails = ('?php echo strlen ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "custom_reg_force_personal_emails" ] ) ; ?' 0) ? true : false; var nonPersonalEmailUsers = new RegExp('^(?php echo c_ws_plugin__s2member_utils_strings:: esc_sq ( implode ( "|" , preg_split ( "/[\r \n \t ;,]+/" , preg_quote ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "custom_reg_force_personal_emails" ] , "/" ) ) ) ) ; ?)@', 'i'); /**/ if (tag === 'input' && type === 'checkbox' && name.match (/\[\]$/)) { if (typeof field.id === 'string' && field.id.match (/-0$/)) if (required && !$('input[name="' + name.replace (/([\[\]])/g, '\$1') + '"]:checked', context).length) return label + '\nPlease check at least one of the boxes.'; } else if (tag === 'input' && type === 'checkbox') { if (required && !field.checked) return label + '\nRequired. This box must be checked.'; } else if (tag === 'input' && type === 'radio') { if (typeof field.id === 'string' && field.id.match (/-0$/)) if (required && !$('input[name="' + name.replace (/([\[\]])/g, '\$1') + '"]:checked', context).length) return label + '\nPlease select one of the options.'; } else if (tag === 'select' && $field.attr ('multiple')) { if (required && (!(value instanceof Array) || !value.length)) return label + '\nPlease select at least one of the options.'; } else if (typeof value !== 'string' || (required && !(value = $.trim (value)).length)) { return label + '\nThis is a required field, please try again.'; } else if ((value = $.trim (value)).length && ((tag === 'input' && type.match (/^(text|password)$/i)) || tag === 'textarea') && typeof expected === 'string' && expected.length) { if (expected === 'numeric-wp-commas' && (!value.match (/^[0-9\.,]+$/) || isNaN(value.replace (/,/g, '')))) { return label + '\nMust be numeric ( with or without decimals, commas allowed ).'; } else if (expected === 'numeric' && (!value.match (/^[0-9\.]+$/) || isNaN(value))) { return label + '\nMust be numeric ( with or without decimals, no commas ).'; } else if (expected === 'integer' && (!value.match (/^[0-9]+$/) || isNaN(value))) { return label + '\nMust be an integer ( a whole number, without any decimals ).'; } else if (expected === 'integer-gt-0' && (!value.match (/^[0-9]+$/) || isNaN(value) || value = 0)) { return label + '\nMust be an integer 0 ( whole number, no decimals, greater than 0 ).'; } else if (expected === 'float' && (!value.match (/^[0-9\.]+$/) || !value.match (/[0-9]/) || !value.match (/\./) || isNaN(value))) { return label + '\nMust be a float ( floating point number, decimals required ).'; } else if (expected === 'float-gt-0' && (!value.match (/^[0-9\.]+$/) || !value.match (/[0-9]/) || !value.match (/\./) || isNaN(value) || value = 0)) { return label + '\nMust be a float 0 ( floating point number, decimals required, greater than 0 ).'; } else if (expected === 'date' && !value.match (/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/)) { return label + '\nMust be a date ( required date format: dd/mm/yyyy ).'; } else if (expected === 'email' && !value.match (/^([a-z_~0-9\+\-]+)(((\.?)([a-z_~0-9\+\-]+))*)(@)([a-z0-9]+)(((-*)([a-z0-9]+))*)(((\.)([a-z0-9]+)(((-*)([a-z0-9]+))*))*)(\.)([a-z]{2,6})$/i)) { return label + '\nMust be a valid email address.'; } else if (expected === 'email' && forcePersonalEmails && value.match (nonPersonalEmailUsers)) { return label + '\nPlease use a personal email address.\nAddresses like ' + value.split ('@')[0] + '@ are problematic.'; } else if (expected === 'url' && !value.match (/^http(s?)\:\/\/(.{5,})$/i)) { return label + '\nMust be a full URL ( starting with http or https ).'; } else if (expected === 'domain' && !value.match (/^([a-z0-9]+)(((-*)([a-z0-9]+))*)(((\.)([a-z0-9]+)(((-*)([a-z0-9]+))*))*)(\.)([a-z]{2,6})$/i)) { return label + '\nMust be a domain name ( domain name only, without http ).'; } else if (expected === 'phone' && (!value.match (/^[0-9 \(\)\-]+$/) || value.replace (/[^0-9]/g, '').length !== 10)) { return label + '\nMust be a phone # ( 10 digits w/possible hyphens,spaces,brackets ).'; } else if (expected === 'uszip' && !value.match (/^[0-9]{5}(-[0-9]{4})?$/)) { return label + '\nMust be a US zipcode ( 5-9 digits w/possible hyphen ).'; } else if (expected === 'cazip' && !value.match (/^[0-9A-Z]{3}( ?)[0-9A-Z]{3}$/i)) { return label + '\nMust be a Canadian zipcode ( 6 alpha-numerics w/possible space ).'; } else if (expected === 'uczip' && !value.match (/^[0-9]{5}(-[0-9]{4})?$/) && !value.match (/^[0-9A-Z]{3}( ?)[0-9A-Z]{3}$/i)) { return label + '\nMust be a zipcode ( either a US or Canadian zipcode ).'; } else if (expected.match (/^alphanumerics-spaces-punctuation-([0-9]+)(-e)?$/) && !value.match (/^[a-z 0-9,\.\/\?\:;"'\{\}\[\]\|\\\+\=_\-\(\)\*&\^%\$#@\!`~]+$/i)) { return label + '\nPlease use alphanumerics, spaces & punctuation only.'; } else if (expected.match (/^alphanumerics-spaces-([0-9]+)(-e)?$/) && !value.match (/^[a-z 0-9]+$/i)) { return label + '\nPlease use alphanumerics & spaces only.'; } else if (expected.match (/^alphanumerics-punctuation-([0-9]+)(-e)?$/) && !value.match (/^[a-z0-9,\.\/\?\:;"'\{\}\[\]\|\\\+\=_\-\(\)\*&\^%\$#@\!`~]+$/i)) { return label + '\nPlease use alphanumerics & punctuation only ( no spaces ).'; } else if (expected.match (/^alphanumerics-([0-9]+)(-e)?$/) && !value.match (/^[a-z0-9]+$/i)) { return label + '\nPlease use alphanumerics only ( no spaces/punctuation ).'; } else if (expected.match (/^alphabetics-([0-9]+)(-e)?$/) && !value.match (/^[a-z]+$/i)) { return label + '\nPlease use alphabetics only ( no digits/spaces/punctuation ).'; } else if (expected.match (/^numerics-([0-9]+)(-e)?$/) && !value.match (/^[0-9]+$/i)) { return label + '\nPlease use numeric digits only.'; } else if (expected.match (/^(any|alphanumerics-spaces-punctuation|alphanumerics-spaces|alphanumerics-punctuation|alphanumerics|alphabetics|numerics)-([0-9]+)(-e)?$/)) { var split = expected.split ('-'), length = Number(split[1]), exactLength = (split.length 2) ? Number(split[2]) : ''; /**/ if (exactLength && value.length !== length) /* An exact length is required? */ return label + '\nMust be exactly ' + length + ' ' + ((split[0] === 'numerics') ? 'digit' : 'character') + ((length 1) ? 's' : '') + '.'; /**/ else if (value.length length) /* Otherwise, we interpret as the minimum length. */ return label + '\nMust be at least ' + length + ' ' + ((split[0] === 'numerics') ? 'digit' : 'character') + ((length 1) ? 's' : '') + '.'; } } } /**/ return ''; }; /**/ ws_plugin__s2member_animateProcessingConfig = {originalText: '', interval: null, speed: 100}, ws_plugin__s2member_animateProcessing = function($obj, reset) { if ($obj instanceof jQuery) /* This function expects a valid jQuery object. */ { if (reset) /* Resets back to originalText value ( also clears interval ). */ { clearInterval(ws_plugin__s2member_animateProcessingConfig.interval); /**/ if (ws_plugin__s2member_animateProcessingConfig.originalText) /* ? */ $obj.val (ws_plugin__s2member_animateProcessingConfig.originalText); /**/ return; /* No need to proceed any further. Return now upon reset. */ } /**/ $obj.first ().each (function() /* Interval routine configured here. */ { var $this = $(this), i = 0, dir = 'r', dots = ['.', '..', '...']; /**/ ws_plugin__s2member_animateProcessingConfig.originalText = $this.val (); /**/ clearInterval(ws_plugin__s2member_animateProcessingConfig.interval); /**/ ws_plugin__s2member_animateProcessingConfig.interval = setInterval(function() { if (dir === 'r') /* Right... */ { if (i + 1 = dots.length - 1) i = i + 1, dir = 'r'; else /* Switch direction. */ i = i - 1, dir = 'l'; } /**/ else if (dir === 'l') /* Left.. */ { if (i - 1 = 0) i = i - 1, dir = 'l'; else /* Switch direction. */ i = i + 1, dir = 'r'; } /**/ for (var _dots = dots[i], l = dots[i].length; l dots.length; l++) { _dots += ' '; /* Prevents jumping. */ } /**/ $this.val ('Processing' + _dots); }, ws_plugin__s2member_animateProcessingConfig.speed); }); } }; }); [ full view ]s2member\includes\s2member.js Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code(!-- :: s-words --)

Statistics: Posted by System Robot — July 11th, 2011, 5:32 pm


]]>
2011-07-09T06:12:53-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13146&p=25441#p25441 <![CDATA[s2Member v111220 / Source Code: s2member\i...]]>
s2Member v111220
Source Code: s2member\includes\s2member.js
Docs updated: December 20, 2011, 9:51 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — July 9th, 2011, 6:12 am


]]>