// ==UserScript== // @name Poke everyone! // @description Pokes everyone you specify. // @author Sebastian Paaske Tørholm // @include http://*.facebook.com/* // @include https://*.facebook.com/* // @match http://*.facebook.com/* // @match https://*.facebook.com/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js // @version 1.0 // ==/UserScript== (function () { var allFriends = [ // Write the URLs of all the FB profiles of your friends here: 'http://www.facebook.com/profile.php?id=xxxxxxxx', 'http://www.facebook.com/profile.php?id=yyyyyyyy', 'http://www.facebook.com/zzzzzusernamezzzzz' ]; var maxIFrames = 6; var iFrames = []; function pokeThem (i) { if (i >= allFriends.length) { return; } var statusText = $('span#pokeallfriends_statustext'); var pokeFrame = $(document.createElement('iframe')); pokeFrame.attr('style', 'display: none'); pokeFrame.attr('src', allFriends[i] + '#pokeme'); statusText.after(pokeFrame); statusText.text('Status: ' + (i+1) + '/' + allFriends.length); iFrames.push(pokeFrame); while (iFrames.length > maxIFrames) { var oldFrame = iFrames.shift(); $(oldFrame).remove(); } setTimeout(function () { pokeThem(i+1) }, 3000); } function pokeAllFriends () { var pokeAllLink = $('a.poke_all_link'); pokeAllLink.attr('style', 'display: none'); var statusText = $(document.createElement('span')); statusText.attr('id', 'pokeallfriends_statustext'); statusText.text('Status: 0/' + allFriends.length); pokeAllLink.after(statusText); pokeThem(0); } $('h4:contains("Pokes")').each( function () { var pokeHeader = $(this); var pokeAllLink = $(document.createElement('a')); pokeAllLink.text('Poke all friends!'); pokeAllLink.attr('href', '#'); pokeAllLink.attr('class', 'poke_all_link'); pokeAllLink.click(pokeAllFriends); pokeHeader.after(pokeAllLink); pokeAllLink.before(' - '); pokeHeader.attr('style', 'display: inline !important;'); }); if (location.href.indexOf('pokeme') > -1) { $('a.uiButton#profile_action_poke').click(); function confirmPoke(i) { var btn = $('input[name = "pk01"]'); if (btn.size() > 0) { btn.click(); } else { if (i >= 10 || $('input[name = "ok"]').size() > 0) { return; } setTimeout( function () { confirmPoke(i+1); }, 1000); } } setTimeout( function () { confirmPoke(0); }, 1000); } })();