stuppid_bot

Untitled

Apr 23rd, 2013
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. gid('editForm').onsubmit = function() {
  2.         var data = gid('result').toDataURL('image/jpeg');
  3.         var binary = atob( data.substr( data.indexOf(',') + 1 ) );
  4.         var i = binary.length;
  5.         var view = new Uint8Array(i);
  6.        
  7.         while (i--) {
  8.             view[i] = binary.charCodeAt(i);
  9.         }
  10.        
  11.         VK.api('photos.getWallUploadServer', function(serverInfo) {
  12.             ajax.put('upload.php?url=' + encodeURIComponent(serverInfo.response.upload_url), new Blob([view]), {            
  13.                 done: function(uploadInfo) {
  14.                     eval('uploadInfo=' + uploadInfo);
  15.                    
  16.                     VK.api('photos.saveWallPhoto', uploadInfo, function(saveInfo) {
  17.                         VK.api('wall.post', {
  18.                             message: 'Я создал свой мем в приложении vk.com/app' + query.api_id,
  19.                             attachments: saveInfo.response[0].id + ',http://' + location.host
  20.                         }, function(result) {
  21.                             console.log(result);
  22.                             nextFrame();
  23.                         });
  24.                     });
  25.  
  26.                 }
  27.             });                  
  28.         });
  29.        
  30.         return false;
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment