Advertisement
rejuancse

main.js

Sep 19th, 2018
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Start: donation js
  2.     var donation_input = $('.politist-addon-donation .donation-ammount-wrap > input');
  3.     donation_input.on('click', function(){
  4.         // remove previous active class and add class
  5.         donation_input.removeClass('active');
  6.         $(this).addClass('active');
  7.  
  8.         var currency = $(".politist-addon-donation .donation-ammount-wrap").data('currency'),
  9.         crncy_code = currency.split(':'),
  10.         pid = $(".politist-addon-donation .donation-ammount-wrap").data('pid'),
  11.         this_val = $(this).val(),
  12.         amt = this_val.split('$');
  13.  
  14.         if (amt[1]) {
  15.             var amt = amt[1];
  16.         } else{
  17.             var amt = this_val;
  18.         };
  19.  
  20.         if (amt != '' && amt > 0) {
  21.             $(".politist-addon-donation .donation-button .donation-button-link").attr("href", "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business="+pid+"&item_name=donation&amount="+amt+"&currency_code="+crncy_code[0]+"");
  22.         };
  23.        
  24.     });
  25.  
  26.     //donation custom onkeyup change value
  27.     $('.politist-addon-donation .donation-ammount-wrap > input.input-text').on('keyup', function(event) {
  28.         var this_val = $(this).val(),
  29.         pid = $(".politist-addon-donation .donation-ammount-wrap").data('pid'),
  30.         currency = $(".politist-addon-donation .donation-ammount-wrap").data('currency'),
  31.         crncy_code = currency.split(':');
  32.  
  33.         if (this_val != '' && this_val > 0) {
  34.             $(".politist-addon-donation .donation-button .donation-button-link").attr("href", "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business="+pid+"&item_name=donation&amount="+this_val+"&currency_code="+crncy_code[0]+"");
  35.         };
  36.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement