Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/html/webitects_2_3step.html |
— | — | @@ -0,0 +1,488 @@ |
| 2 | +<!-- load styles from original first steps --> |
| 3 | +<link rel="stylesheet" href="@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/css/lp1.css" /> |
| 4 | +<!--[if lt IE 7]><style type="text/css">body{behavior:url("/w/skins-1.17/vector/csshover.min.htc")}</style><![endif]--> |
| 5 | +<!-- start Webitects styles --> |
| 6 | +<link rel="stylesheet" href="@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/css/Webitects.css" /> |
| 7 | +<style type="text/css"> |
| 8 | + #errorMessages { font-size: 0.75em; color: #FF0000; } |
| 9 | + /* Force vertical scrollbar |
| 10 | + html { overflow-y: scroll; } |
| 11 | + */ |
| 12 | + /* Accordion */ |
| 13 | + #accordion h3 { background: #FFFFFF; border: none; font-size: 1.1em; margin: 0; padding: 0.5em 0.9em; outline: 0; } |
| 14 | + .accordion-content { padding: 0.9em; } |
| 15 | + #step2accordion { display:none; } |
| 16 | + |
| 17 | + /* Callouts */ |
| 18 | + .call-l, .call-r { width: 270px; } |
| 19 | + |
| 20 | + /* Layout */ |
| 21 | + #appeal { float: left; width: 100%; } |
| 22 | + #appeal-content { padding-right: 380px; } |
| 23 | + .clear { clear: both; } |
| 24 | + #donate { float: left; margin-left: -350px; width: 350px; } |
| 25 | + #donate-content { background-color: #FFFFFF; border: 1px solid #000000; padding: 1em 0; |
| 26 | + font-size: 0.95em; |
| 27 | + /* Maybe */ width: 348px; |
| 28 | + } |
| 29 | + #amount-table-white label { font-size: 1.1em; } |
| 30 | + |
| 31 | + #donate-body { width: 348px; } |
| 32 | + #donate-body h3 { font-size: 17px; } |
| 33 | + |
| 34 | + #step1wrapper, #step2wrapper, #step3wrapper { width: 325px; } |
| 35 | + /* Initially hide steps 2 and 3 */ |
| 36 | + #step2wrapper, #step2header, #step3wrapper, #step3header { display: none; } |
| 37 | + #where-content { font-size: 13px; line-height: 19px; width: 325px; } |
| 38 | + |
| 39 | + #amountErrorMessages, #billingErrorMessages, #paymentErrorMessages { color: #F00; } |
| 40 | + |
| 41 | +</style> |
| 42 | +<!--[if lt IE 7]><style> |
| 43 | +/* style for IE6 + IE5.5 + IE5.0 */ |
| 44 | +.gainlayout { height: 0; } |
| 45 | +</style><![endif]--> |
| 46 | + |
| 47 | +<!--[if IE 7]><style> |
| 48 | +.gainlayout { zoom: 1; height: 1%; } |
| 49 | +</style><![endif]--> |
| 50 | + |
| 51 | +<div class="ltr"> |
| 52 | + <div id="appeal"> |
| 53 | + <div id="appeal-content"> |
| 54 | + <h2 id="appeal-head"> <span class="mw-headline" id="From_Wikipedia_programmer_Brandon_Harris">From Wikipedia programmer Brandon Harris</span></h2> |
| 55 | + <div id="appeal-body" class="plainlinks"> |
| 56 | + <p>I feel like I'm living the first line of my obituary.</p> |
| 57 | + <p>I don't think there will be anything else that I do in my life as important as what I do now for Wikipedia. We're not just building an encyclopedia, we're working to make people free. When we have access to free knowledge, we are better people. We understand the world is bigger than us, and we become infected with tolerance and understanding.</p> |
| 58 | + <p>Wikipedia is the 5th largest website in the world. I work at the small non-profit that keeps it on the web. We don't run ads because doing so would sacrifice our independence. The site is not and should never be a propaganda tool.</p> |
| 59 | + <p>Our work is possible because of donations from our readers. Will you help protect Wikipedia by donating $5, $10, $20 or whatever you can afford?</p> |
| 60 | + <p>I work at the Wikimedia Foundation because everything in my soul tells me it's the right thing to do. I've worked at huge tech companies, doing some job to build some crappy thing that's designed to steal money from some kid who doesn't know it. I would come home from work crushed.</p> |
| 61 | + <p>You might not know this, but the Wikimedia Foundation operates with a very small staff. Most other top-ten sites have tens of thousands of people and massive budgets. But they produce a fraction of what we pull off with sticks and wire.</p> |
| 62 | + <p>When you give to Wikipedia, you're supporting free knowledge around the world. You're not only leaving a legacy for your children and for their children, you're elevating people around the world who have access to this treasure. You're assuring that one day everyone else will too.</p> |
| 63 | + <p>Thank you,</p> |
| 64 | + <p><strong>Brandon Harris</strong><br /></p> |
| 65 | + <p>Programmer, Wikimedia Foundation</p> |
| 66 | + </div> |
| 67 | + </div> |
| 68 | + </div> |
| 69 | + |
| 70 | + <div id="donate"> |
| 71 | + <div id="donate-content"> |
| 72 | + <div id="donate-body" style="padding: 0 1em;"> |
| 73 | + <div id="step1header"><h3>Donation amount <span id="selected-amount"></span> <span class="mute" id="change-amount" style="display: none;">(<a href="#">Change</a>)</span></h3></div> |
| 74 | + |
| 75 | + <form method="post" name="paypalcontribution"> |
| 76 | + <div id="step1wrapper"> |
| 77 | + <div id="amountErrorMessages" class="small"></div> |
| 78 | + <table id="amount-table-white"> |
| 79 | + <tr> |
| 80 | + <td><label><input type="radio" name="amountRadio" value="5" /> $5</label></td> |
| 81 | + <td><label><input type="radio" name="amountRadio" value="10" /> $10</label></td> |
| 82 | + <td><label><input type="radio" name="amountRadio" value="20" /> $20</label></td> |
| 83 | + <td><label><input type="radio" name="amountRadio" value="35" /> $35</label></td> |
| 84 | + </tr> |
| 85 | + <tr> |
| 86 | + <td><label><input type="radio" name="amountRadio" value="50" /> $50</label></td> |
| 87 | + <td><label><input type="radio" name="amountRadio" value="100" /> $100</label></td> |
| 88 | + <td><label><input type="radio" name="amountRadio" value="250" /> $250</label></td> |
| 89 | + <td><label><input type="radio" name="amountRadio" id="input_amount_other" value="other" /> $<input type="text" class="txt-sm hint" name="amountGiven" size="4" id="other-amount" title="Other..." onfocus="this.form.input_amount_other.checked=true;"/></label></td> |
| 90 | + </tr> |
| 91 | + </table> |
| 92 | + |
| 93 | + <p class="donate-options"> |
| 94 | + <input class="btn" id="cc" type="button" value="Donate by Credit Card" /><br /> |
| 95 | + <input class="btn" id="pp" type="button" value="Donate via PayPal"/><span id='loading'></span> |
| 96 | + </p> |
| 97 | + </div> |
| 98 | + <div id="step2header"><h3>Billing Address <span class="mute" id="change-billing" style="display: none;">(<a href="#">Change</a>)</span></h3></div> |
| 99 | + <div id="step2wrapper"> |
| 100 | + <div id="billing-content" class="gainlayout"> |
| 101 | + <div id="billingErrorMessages" class="small"></div> |
| 102 | + <div class="name-fields"> |
| 103 | + <span class="name-first"><input class="txt hint" id="fname" name="fname" title="First name" value="@fname" /></span> |
| 104 | + <span class="name-last"><input class="txt hint" id="lname" name="lname" title="Last name" value="@lname" /></span> |
| 105 | + </div> |
| 106 | + <div class="loc-fields"> |
| 107 | + <span class="loc-street"><input class="txt hint" id="street" name="street" title="Street address" value="@street" /></span> |
| 108 | + <span class="loc-city"><input class="txt hint" id="city" name="city" title="City" value="@city" /></span> |
| 109 | + <span class="loc-state"> |
| 110 | + <select id="state" name="state" class="txt" value="@state" > |
| 111 | + <option value=""></option> |
| 112 | + <option value="AK">AK</option><option value="AL">AL</option><option value="AR">AR</option><option value="AZ">AZ</option><option value="CA">CA</option><option value="CO">CO</option><option value="CT">CT</option><option value="DC">DC</option><option value="DE">DE</option><option value="FL">FL</option><option value="GA">GA</option><option value="HI">HI</option><option value="IA">IA</option><option value="ID">ID</option><option value="IL">IL</option><option value="IN">IN</option><option value="KS">KS</option><option value="KY">KY</option><option value="LA">LA</option><option value="MA">MA</option><option value="MD">MD</option><option value="ME">ME</option><option value="MI">MI</option><option value="MN">MN</option><option value="MO">MO</option><option value="MS">MS</option><option value="MT">MT</option><option value="NC">NC</option><option value="ND">ND</option><option value="NE">NE</option><option value="NH">NH</option><option value="NJ">NJ</option><option value="NM">NM</option><option value="NV">NV</option><option value="NY">NY</option><option value="OH">OH</option><option value="OK">OK</option><option value="OR">OR</option><option value="PA">PA</option><option value="PR">PR</option><option value="RI">RI</option><option value="SC">SC</option><option value="SD">SD</option><option value="TN">TN</option><option value="TX">TX</option><option value="UT">UT</option><option value="VA">VA</option><option value="VT">VT</option><option value="WA">WA</option><option value="WI">WI</option><option value="WV">WV</option><option value="WY">WY</option><option value="AA">AA</option><option value="AE">AE</option><option value="AP">AP</option> |
| 113 | + </select> |
| 114 | + </span> |
| 115 | + <span class="loc-postal"><input class="txt hint" id="zip" name="zip" title="Zip" value="@zip"/></span> |
| 116 | + </div> |
| 117 | + <p><input class="txt hint" title="Email address" id="emailAdd" name="emailAdd" value="@emailAdd"/></p> |
| 118 | + |
| 119 | + <dl class=""> |
| 120 | + <dt><span class="label">Select credit card</span></dt> |
| 121 | + <dd class="field" style="margin-bottom: 0;"> |
| 122 | + <ul class="options-h" id="cards" style="margin: 0;"> |
| 123 | + <li><input id="cc-visa" name="cardtype" type="radio" value="Visa" class="cardradio" /> <label for="cc-visa"><img alt="Visa" src="@script_path/extensions/DonationInterface/payflowpro_gateway/includes/card-visa.png" /></label></li> |
| 124 | + <li><input id="cc-mastercard" name="cardtype" type="radio" value="MasterCard" class="cardradio" /> <label for="cc-mastercard"><img alt="MasterCard" src="@script_path/extensions/DonationInterface/payflowpro_gateway/includes/card-mastercard.png" /></label></li> |
| 125 | + <li><input id="cc-amex" name="cardtype" type="radio" value="American Express" class="cardradio" /> <label for="cc-amex"><img alt="American Express" src="@script_path/extensions/DonationInterface/payflowpro_gateway/includes/card-amex.png" /></label></li> |
| 126 | + <li><input id="cc-discover" name="cardtype" type="radio" value="Discover" class="cardradio" /> <label for="cc-discover"><img alt="Discover" src="@script_path/extensions/DonationInterface/payflowpro_gateway/includes/card-discover.png" /></label></li> |
| 127 | + </ul> |
| 128 | + <div id="paymentContinue" style="margin-top: 10px; display: none;"> <input class="btn" id="paymentContinueBtn" type="button" value="Continue" /></div> |
| 129 | + </dd> |
| 130 | + </dl> |
| 131 | + </div> |
| 132 | + </div> |
| 133 | + <div id="step3header"><h3>Payment Information <span class="mute" id="change-payment" style="display: none;">(<a href="#">Change</a>)</span></h3></div> |
| 134 | + <div id="step3wrapper" style="display: none;"> |
| 135 | + <div id="payment" class="gainlayout"> |
| 136 | + <div id="paymentErrorMessages" class="small"></div> |
| 137 | + <dl class="form"> |
| 138 | + <dt><span class="label"><label for="card_num">Card number</label></span></dt> |
| 139 | + <dd class="field"><input class="txt" id="card_num" name="card_num" value="@card_num"/></dd> |
| 140 | + |
| 141 | + <dt></dt> |
| 142 | + <dd class="field"> |
| 143 | + <div class="l" style="margin-right: 5%;"> |
| 144 | + <span class="label">Expiration date</span> |
| 145 | + <select id="mos" name="mos"> |
| 146 | + <option value="">Month</option> |
| 147 | + <option value="01">01 - January</option> |
| 148 | + <option value="02">02 - February</option> |
| 149 | + <option value="03">03 - March</option> |
| 150 | + <option value="04">04 - April</option> |
| 151 | + <option value="05">05 - May</option> |
| 152 | + <option value="06">06 - June</option> |
| 153 | + <option value="07">07 - July</option> |
| 154 | + <option value="08">08 - August</option> |
| 155 | + <option value="09">09 - September</option> |
| 156 | + <option value="10">10 - October</option> |
| 157 | + <option value="11">11 - November</option> |
| 158 | + <option value="12">12 - December</option> |
| 159 | + </select> |
| 160 | + |
| 161 | + <select id="year" name="year"> |
| 162 | + <option value="">Year</option> |
| 163 | + <option value="2011">2011</option> |
| 164 | + <option value="2012">2012</option> |
| 165 | + <option value="2013">2013</option> |
| 166 | + <option value="2014">2014</option> |
| 167 | + <option value="2015">2015</option> |
| 168 | + <option value="2016">2016</option> |
| 169 | + <option value="2017">2017</option> |
| 170 | + <option value="2018">2018</option> |
| 171 | + <option value="2019">2019</option> |
| 172 | + <option value="2020">2020</option> |
| 173 | + </select> |
| 174 | + </div> |
| 175 | + <div class="l"> |
| 176 | + <label class="label" for="cvv">Security code</label> |
| 177 | + <input class="txt-sm" id="cvv" name="cvv" value="@cvv"/> |
| 178 | + <a class="mute" href="#" id="where">Where?</a> |
| 179 | + </div> |
| 180 | + |
| 181 | + <div class="clear" id="codes" style="display: none;"><img alt="Security codes" src="@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/images/security-code.png" /></div> |
| 182 | + </dd> |
| 183 | + |
| 184 | + <dt></dt> |
| 185 | + <dd class="field"> |
| 186 | + <input id="submitcreditcard" class="btn" type="button" value="Submit donation" /> |
| 187 | + <p class="mute"><img alt="" src="@script_path/extensions/DonationInterface/payflowpro_gateway/includes/padlock.gif" /> Your credit card will be securely processed.</p> |
| 188 | + </dd> |
| 189 | + </dl> |
| 190 | + </div> |
| 191 | + </div> |
| 192 | + |
| 193 | + <input type="hidden" name="gateway" value="payflowpro" id="gateway" /> |
| 194 | + <input type="hidden" name="returnto" value="Thank_You/en" /> |
| 195 | + <input type="hidden" value="0" name="PaypalRedirect" id="PaypalRedirect"> |
| 196 | + <input type="hidden" value="@card" name="card" id="card"> |
| 197 | + |
| 198 | + <input type="hidden" value="@amount" name="amount" /> |
| 199 | + <input type="hidden" value="US" name="country" id="country" /> |
| 200 | + <input type="hidden" value="@expiration" name="expiration" id="expiration"/> |
| 201 | + <input type="hidden" value="@currency_code" name="currency_code" /> |
| 202 | + <input type="hidden" value="@utm_source" name="utm_source"/> |
| 203 | + <input type="hidden" value="@utm_medium" name="utm_medium"/> |
| 204 | + <input type="hidden" value="@utm_campaign" name="utm_campaign"/> |
| 205 | + <input type="hidden" value="@language" name="language"/> |
| 206 | + <input type="hidden" value="@referrer" name="referrer"/> |
| 207 | + <input type="hidden" value="@comment" name="comment"/> |
| 208 | + <input type="hidden" value="@comment-option" name="comment-option"/> |
| 209 | + <input type="hidden" value="@email-opt" name="email-opt"/> |
| 210 | + <input type="hidden" value="processed" name="payment_method"/> |
| 211 | + <input type="hidden" value="@token" name="token"/> |
| 212 | + <input type="hidden" value="@order_id" name="order_id"/> |
| 213 | + <input type="hidden" value="@numAttempt" name="numAttempt"/> |
| 214 | + <input type="hidden" value="@contribution_tracking_id" name="contribution_tracking_id"/> |
| 215 | + <input type="hidden" value="@data_hash" name="data_hash"/> |
| 216 | + <input type="hidden" value="@owa_session" name="owa_session"/> |
| 217 | + <input type="hidden" value="@owa_ref" name="owa_ref"/> |
| 218 | + </form> |
| 219 | + <div id="where-content"> |
| 220 | + <hr> |
| 221 | + <h3>Where your donation goes</h3> |
| 222 | + <p><strong>Technology:</strong> Servers, bandwidth, maintenance, development. Wikipedia is the #5 website in the world and it runs on a fraction of what other top websites spend.</p> |
| 223 | + <p><strong>People:</strong> The other top 10 website have thousands of employees. We have fewer than 100, making your donation a great investment in a highly-efficient not-for-profit organization.</p> |
| 224 | + </div> |
| 225 | + </div> |
| 226 | + </div> |
| 227 | + <p>We do not store your credit card information, and your personal data is subject to our <a target="_blank" href="https://www.mediawiki.org//wikimediafoundation.org/wiki/Donor_policy"> donor privacy policy</a>.</p> |
| 228 | + <p><a target="_blank" href="https://www.mediawiki.org//wikimediafoundation.org/wiki/Ways_to_Give/en">More information or other ways to give</a><br /><a target="_blank" href="https://www.mediawiki.org//wikimediafoundation.org/wiki/FAQ/en">Answers to frequently asked questions</a></p> |
| 229 | + </div> |
| 230 | +</div> |
| 231 | + |
| 232 | + <!-- load jquery (newer) --> |
| 233 | + <script type='text/javascript' src='@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/js/jquery.js'></script> |
| 234 | + <script type='text/javascript' src='@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/js/jquery.ui.core.js'></script> |
| 235 | + <script type='text/javascript' src='@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/js/jquery.ui.widget.js'></script> |
| 236 | + <script type='text/javascript' src='@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/js/jquery.ui.accordion.js'></script> |
| 237 | + <script type='text/javascript' src='@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/js/jquery.ezpz_hint.js'></script> |
| 238 | + <script type="text/javascript"> |
| 239 | + ( function( $ ){ |
| 240 | + window.onload = function (){ |
| 241 | + // ensure all jQuery instances are set to 1.4.2 |
| 242 | + jQuery = $; |
| 243 | + $j = $; |
| 244 | + |
| 245 | + // This form is radically broken in IE6 |
| 246 | + // Redirecting them to another page |
| 247 | + // TODO: handle this in the banner |
| 248 | + if (jQuery.browser.msie && jQuery.browser.version.substr(0,1)<7){ |
| 249 | + //get the current querystring |
| 250 | + var qs = window.location.search.substring(1); |
| 251 | + // redirect IE6 people to another form |
| 252 | + window.location.replace("https://wikimediafoundation.org/wiki/Special:LandingCheck?language=en&landing_page=L11_ExtraInfo_0902_N&utm_campaign=C_0916_Webitects_US_ie6&utm_source=B_BR_0916_US&country_code=US&referrer=webitects2"); |
| 253 | + } |
| 254 | + |
| 255 | + |
| 256 | + // check for RapidHtml errors and display, if any |
| 257 | + var amountErrors = ['#general|escape','#retryMsg|escape','#amount|escape'], |
| 258 | + amountErrorString = ""; |
| 259 | + var billingErrors = ['#fname|escape','#lname|escape','#city|escape','#country|escape', |
| 260 | + '#street|escape','#state|escape','#zip|escape','#emailAdd|escape'], |
| 261 | + billingErrorString = ""; |
| 262 | + var paymentErrors = ['#card_num|escape','#card|escape','#cvv|escape'], |
| 263 | + paymentErrorString = ""; |
| 264 | + |
| 265 | + // generate formatted errors to display |
| 266 | + var temp = [] |
| 267 | + for( var e in amountErrors ) |
| 268 | + if( amountErrors[e] != "" ) |
| 269 | + temp[temp.length] = amountErrors[e]; |
| 270 | + amountErrorString = temp.join( "<br />" ); |
| 271 | + |
| 272 | + temp = [] |
| 273 | + for( var e in billingErrors ) |
| 274 | + if( billingErrors[e] != "" ) |
| 275 | + temp[temp.length] = billingErrors[e]; |
| 276 | + billingErrorString = temp.join( "<br />" ); |
| 277 | + |
| 278 | + temp = [] |
| 279 | + for( var e in paymentErrors ) |
| 280 | + if( paymentErrors[e] != "" ) |
| 281 | + temp[temp.length] = paymentErrors[e]; |
| 282 | + paymentErrorString = temp.join( "<br />" ); |
| 283 | + |
| 284 | + // show the errors |
| 285 | + var prevError = false; |
| 286 | + if( amountErrorString != ""){ |
| 287 | + $("#amountErrorMessages").html( amountErrorString ); |
| 288 | + prevError = true; |
| 289 | + showStep1(); // should be default, but ensure |
| 290 | + } |
| 291 | + if( billingErrorString != ""){ |
| 292 | + $("#billingErrorMessages").html( billingErrorString ); |
| 293 | + if( !prevError ){ |
| 294 | + showStep2(); |
| 295 | + prevError = true; |
| 296 | + } |
| 297 | + showAmount( $('input[name="amount"]') ); // lets go ahead and assume there is something to show |
| 298 | + } |
| 299 | + if( paymentErrorString != ""){ |
| 300 | + $("#paymentErrorMessages").html( paymentErrorString ); |
| 301 | + if( !prevError ) |
| 302 | + showStep3(); |
| 303 | + showAmount( $('input[name="amount"]') ); // lets go ahead and assume there is something to show |
| 304 | + } |
| 305 | + |
| 306 | + // Init inline labels |
| 307 | + $(".hint").ezpz_hint(); |
| 308 | + |
| 309 | + $("#cc").click(function(){ |
| 310 | + if ( validateAmount() ){ |
| 311 | + showAmount( $('input[name="amount"]') ); |
| 312 | + showStep2(); |
| 313 | + } |
| 314 | + }); |
| 315 | + |
| 316 | + $("#pp").click(function(){ |
| 317 | + if ( validateAmount() ){ |
| 318 | + // set the action to go to PayPal |
| 319 | + $('input[name="gateway"]').val("paypal"); |
| 320 | + $('input[name="PaypalRedirect"]').val("1"); |
| 321 | + $("#loading").html("<img src='../images/loading.gif' /> Redirecting to PayPal…"); |
| 322 | + document.paypalcontribution.action = "@action"; |
| 323 | + document.paypalcontribution.submit(); |
| 324 | + } |
| 325 | + }); |
| 326 | + $("#paymentContinueBtn").live("click", function() { |
| 327 | + if ( validate_personal( document.paypalcontribution ) ){ |
| 328 | + showStep3(); |
| 329 | + } |
| 330 | + }); |
| 331 | + // Set the cards to progress to step 3 |
| 332 | + $(".cardradio").live("click", function() { |
| 333 | + if ( validate_personal( document.paypalcontribution ) ){ |
| 334 | + showStep3(); |
| 335 | + } |
| 336 | + else { |
| 337 | + // show the continue button to indicate how to get to step 3 since they |
| 338 | + // have already clicked on a card image |
| 339 | + $("#paymentContinue").show(); |
| 340 | + } |
| 341 | + }); |
| 342 | + |
| 343 | + $("#submitcreditcard").click(function(){ |
| 344 | + // set country to US TODO: make this dynamic |
| 345 | + $('input[name="country"]').val("US"); |
| 346 | + |
| 347 | + if ( validate_cc() ){ |
| 348 | + // set the hidden expiration date input from the two selects |
| 349 | + $('input[name="expiration"]').val( |
| 350 | + $("select[name=mos]").val() + $('select[name="year"]').val().substring(2,4) |
| 351 | + ); |
| 352 | + document.paypalcontribution.action = "@action"; |
| 353 | + document.paypalcontribution.submit(); |
| 354 | + } |
| 355 | + }) |
| 356 | + |
| 357 | + // init all of the header actions |
| 358 | + $("#step1header").click(function(){ |
| 359 | + showStep1(); |
| 360 | + }); |
| 361 | + $("#step2header").click(function(){ |
| 362 | + showStep2(); |
| 363 | + }); |
| 364 | + $("#step3header").click(function(){ |
| 365 | + showStep3(); |
| 366 | + }); |
| 367 | + |
| 368 | + function showStep1(){ |
| 369 | + // show the correct sections |
| 370 | + $("#step1wrapper").slideDown(); |
| 371 | + $("#step2wrapper").slideUp(); |
| 372 | + $("#step3wrapper").slideUp(); |
| 373 | + $("#change-amount").hide(); |
| 374 | + $("#change-billing").show(); |
| 375 | + $("#change-payment").show(); |
| 376 | + $("#step1header").show(); // just in case |
| 377 | + } |
| 378 | + function showStep2(){ |
| 379 | + // show the correct sections |
| 380 | + $("#step1wrapper").slideUp(); |
| 381 | + $("#step2wrapper").slideDown(); |
| 382 | + $("#step3wrapper").slideUp(); |
| 383 | + $("#change-amount").show(); |
| 384 | + $("#change-billing").hide(); |
| 385 | + $("#change-payment").show(); |
| 386 | + $("#step2header").show(); // just in case |
| 387 | + } |
| 388 | + function showStep3(){ |
| 389 | + // show the correct sections |
| 390 | + $("#step1wrapper").slideUp(); |
| 391 | + $("#step2wrapper").slideUp(); |
| 392 | + $("#step3wrapper").slideDown(); |
| 393 | + $("#change-amount").show(); |
| 394 | + $("#change-billing").show(); |
| 395 | + $("#change-payment").hide(); |
| 396 | + $("#step3header").show(); // just in case |
| 397 | + } |
| 398 | + |
| 399 | + |
| 400 | + // Fix behavior of images in labels |
| 401 | + // TODO: check that disabling this is okay in things other than Chrome |
| 402 | +// $("label img").live("click", function() { $("#" + $(this).parents( "label" ).attr( "for" )).click(); }); |
| 403 | + |
| 404 | + // Display selected amount |
| 405 | + function showAmount(e){ |
| 406 | + $("#selected-amount").html( "($" + e.val() + ")" ); |
| 407 | + $("#change-amount").show(); |
| 408 | + } |
| 409 | + |
| 410 | + // Set selected amount to amount |
| 411 | + $('input[name="amountRadio"]').click( function(){ |
| 412 | + setAmount( $(this) ); |
| 413 | + }); |
| 414 | + // reset the amount field when "other" is changed |
| 415 | + $("#other-amount").change(function(){ |
| 416 | + setAmount( $(this) ); |
| 417 | + }); |
| 418 | + // set the hidden amount input to the value of the selected element |
| 419 | + function setAmount(e){ |
| 420 | + $("input[name=amount]").val( e.val() ); |
| 421 | + } |
| 422 | + |
| 423 | + // show the CVV help image on click |
| 424 | + $("#where").click(function(){ |
| 425 | + $("#codes").toggle(); |
| 426 | + return false; |
| 427 | + }); |
| 428 | + |
| 429 | + function validateAmount(){ |
| 430 | + var minimums = { |
| 431 | + 'USD' : 1 |
| 432 | + }; |
| 433 | + var error = true; |
| 434 | + var amount = $('input[name="amount"]').val(); // get the amount |
| 435 | + amount = amount.replace(/[,.](\d)$/, '\:$10'); |
| 436 | + amount = amount.replace(/[,.](\d)(\d)$/, '\:$1$2'); |
| 437 | + amount = amount.replace(/[,.]/g, ''); |
| 438 | + amount = amount.replace(/:/, '.'); |
| 439 | + $('input[name="amount"]').val( amount ); // set the new amount back into the form |
| 440 | + |
| 441 | + // Check amount is a real number, sets error as true (good) if no issues |
| 442 | + error = ( amount == null || isNaN( amount ) || amount.value <= 0 ); |
| 443 | + |
| 444 | + // Check amount is at least the minimum |
| 445 | + var currency_code = 'USD'; // hard-coded for these forms and tests |
| 446 | + $('input[name="currency_code"]').val( currency_code ); |
| 447 | + if ( typeof( minimums[currency_code] ) == 'undefined' ) { |
| 448 | + minimums[currency_code] = 1; |
| 449 | + } |
| 450 | + if ( amount < minimums[currency_code] || error ) { |
| 451 | + alert( 'You must contribute at least $1'.replace('$1', minimums[currency_code] + ' ' + currency_code ) ); |
| 452 | + error = true; |
| 453 | + } |
| 454 | + return !error; |
| 455 | + } |
| 456 | + function validate_cc(){ |
| 457 | + // reset the errors |
| 458 | + $("#paymentErrorMessages").html(''); |
| 459 | + var error = false; |
| 460 | + if( $('input[name="card_num"]').val() == '' ){ |
| 461 | + $("#paymentErrorMessages").append( "Please enter a valid credit card number" ); |
| 462 | + error = true; |
| 463 | + } |
| 464 | + if( $('select[name="mos"]').val() == '' ){ |
| 465 | + if( $("#paymentErrorMessages").html() != "" ) |
| 466 | + $("#paymentErrorMessages").append( "<br />" ); |
| 467 | + $("#paymentErrorMessages").append( "Please enter a valid month for the expiration date" ); |
| 468 | + error = true; |
| 469 | + } |
| 470 | + if( $('select[name="year"]').val() == '' ){ |
| 471 | + if( $("#paymentErrorMessages").html() != "" ) |
| 472 | + $("#paymentErrorMessages").append( "<br />" ); |
| 473 | + $("#paymentErrorMessages").append( "Please enter a valid year for the expiration date" ); |
| 474 | + error = true; |
| 475 | + } |
| 476 | + if( $('input[name="cvv"]').val() == '' ){ |
| 477 | + if( $("#paymentErrorMessages").html() != "" ) |
| 478 | + $("#paymentErrorMessages").append( "<br />" ); |
| 479 | + $("#paymentErrorMessages").append( "Please enter a valid security code" ); |
| 480 | + error = true; |
| 481 | + } |
| 482 | + return !error; |
| 483 | + } |
| 484 | + } |
| 485 | + })(jQuery); |
| 486 | + </script> |
| 487 | +<!-- Wikimedia Project logo |
| 488 | +<li id="footer-copyrightico"><a href="https://www.mediawiki.org//wikimediafoundation.org/"><img src="//bits.wikimedia.org/images/wikimedia-button.png" width="88" height="31" alt="Wikimedia Foundation"/></a></li> |
| 489 | + --> |
\ No newline at end of file |