Guest User

Untitled

a guest
Apr 11th, 2016
459
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function _action_paid(obj) {
  2.     var _is_paid = 0;
  3.     if ($(obj)['data']('is_paid') == '0') {
  4.         _is_paid = 1;
  5.     };
  6.     var _link = $(obj)['attr']('href');
  7.     var _user_id = $(obj)['data']('user_id');
  8.     $(obj)['removeClass']('estcs-ctrl-paid estcs-ctrl-notpaid');
  9.     $(obj)['addClass']('estcs-ctrl-paid-undefined');
  10.     XenForo['ajax'](_link, {
  11.         is_paid: _is_paid,
  12.         user_id: _user_id
  13.     }, function(ajax_data, text_status) {
  14.         if (XenForo['hasResponseError'](ajax_data)) {
  15.             $(obj)['removeClass']('estcs-ctrl-paid-undefined');
  16.             if (_is_paid) {
  17.                 $(obj)['addClass']('estcs-ctrl-notpaid');
  18.             } else {
  19.                 $(obj)['addClass']('estcs-ctrl-paid');
  20.             };
  21.             return false;
  22.         };
  23.         if (!ajax_data['participant']) {
  24.             return false;
  25.         };
  26.         $(obj)['removeClass']('estcs-ctrl-paid estcs-ctrl-notpaid estcs-ctrl-paid-undefined');
  27.         if (ajax_data['participant']['is_payed']) {
  28.             $(obj)['addClass']('estcs-ctrl-paid');
  29.             $(obj)['data']('is_paid', '1');
  30.         } else {
  31.             $(obj)['addClass']('estcs-ctrl-notpaid');
  32.             $(obj)['data']('is_paid', '0');
  33.         };
  34.     });
  35. };
  36. $(function() {
  37.     $('.estcs-participant-ctrl')['click'](function(e) {
  38.         switch ($(this)['data']('action')) {
  39.             case 'paid':
  40.                 _action_paid($(this));
  41.                 break;;
  42.             default:
  43.                 ;
  44.         };
  45.         return false;
  46.     });
  47. });
Advertisement
Add Comment
Please, Sign In to add comment