daily pastebin goal
4%
SHARE
TWEET

Untitled

a guest Sep 19th, 2018 56 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1.   var uploadMetadata = function (event) {
  2.     var $content = $('#content');
  3.     var $elements = $(this).find('input,textarea,select');
  4.     var $button = $(this).find('.form-submit');
  5.     var $form = $(this);
  6.  
  7.     $elements.removeClass('form-error');
  8.  
  9.     // validate
  10.     var $select = $('#upload-form .form-select');
  11.     if ($select.val() === 0) {
  12.       $select.addClass('form-error');
  13.       event.preventDefault();
  14.       return false;
  15.     }
  16.  
  17.     $button.val('Please wait ...');
  18.  
  19.     var getData = {'action': 'metadata'};
  20.     $elements.each(function () {
  21.       getData[$(this).attr('name')] = $(this).val();
  22.     });
  23.  
  24.     $elements.prop('disabled', true);
  25.  
  26.     $.getJSON('/upload', getData, function (data) {
  27.       if (data['youTube']) {
  28.         var youtube = data['youTube'];
  29.  
  30.         if (youtube['url'] && youtube['token'] && data['id']) {
  31.           $form.find('[name="token"]').val(youtube['token']);
  32.           $form.find('[type="hidden"]').prop('disabled', false);
  33.  
  34.           var url = youtube['url'] + '?nexturl=' + encodeURIComponent(fURL.getDomain() + '/upload?hid=' + data['id']);
  35.           $form.attr('action', url);
  36.  
  37.           var $upload = $('<input id="edit-file" type="file" class="form-file" name="file" required/>');
  38.           var $container = $('<div class="form-file-container"/>');
  39.           $container.append($('<label for="edit-file">Select your video file</label>'));
  40.           $container.append($upload);
  41.           $container.insertBefore('#upload-form > .form-ops-container');
  42.  
  43.           $button.val('Finish');
  44.           $button.prop('disabled', false);
  45.  
  46.           $form.unbind('submit');
  47.  
  48.           $form.submit(function (event) {
  49.             if (!$upload.val()) {
  50.               $upload.addClass('form-error');
  51.               event.preventDefault();
  52.               return false;
  53.             }
  54.  
  55.             $button.val('Please wait ...');
  56.             $button.prop('disabled', true);
  57.           });
  58.         }
  59.         else {
  60.           getAuthSubToken($form.find('[name="title"]').val(), $form.find('[name="category_id"]').val(), $form.find('[name="tags"]').val());
  61.         }
  62.       }
  63.     }).error(errorOut);
  64.  
  65.     event.preventDefault();
  66.     return false;
  67.   };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top