Skip to main content
Date :

Script to confirm Facebook friend's request all at once.

Run the following command in Console of the browser.


Facebook = {

    config: {

        actionDelay: 1000,

        scrollDelay: 5000,

        // set to -1 for no limit

        maxRequestsToAccept: -1,

        totalRequestsAccepted: 0,

        // set string to be present in names to be accepted, leave empty to accept all

        mustIncludeInName: [],

    },

    inspect: function (data, config) {

        console.info("INFO: script initialized on the page data...");

        console.debug("DEBUG: finding confirm buttons...");

        var confirmDivEles = document.querySelectorAll('[aria-label="Confirm"]');

        data = [];


        for (var i = 0; i < confirmDivEles.length; i++) {

            if (confirmDivEles[i].getAttribute("aria-disabled") == null && confirmDivEles[i].innerText.includes("Confirm")) {

                data.push(confirmDivEles[i]);

            }

        }

        var totalRows = data.length; 

        console.debug("DEBUG: total confirm buttons found on page are " + totalRows);

        if (totalRows > 0) {

            this.confirm(data, config);

        } else {

            console.warn("INFO: end of friend requests!");

            this.complete(config);

        }

    },

    confirm: function(data, config) {

        if (data.length === 0){

            console.info("INFO: Current friend request list exhausted! Scrolling for more...");

            console.debug("DEBUG: scrolling to bottom in " + config.actionDelay + " ms");

            setTimeout(() => this.scrollBottom(data, config), config.actionDelay);

        } else {

            var friendRequest = data.shift();

            try {

                var friendRequestName = friendRequest.parentElement.parentElement.parentElement.parentElement.parentElement.textContent.toLowerCase().split(" ")[0];


                if (config.mustIncludeInName.length <= 0 || config.mustIncludeInName.some(x => friendRequestName.match(x.toLowerCase()))) {

                    friendRequest.click();

                    config.totalRequestsAccepted += 1;

                    config.maxRequestsToAccept -= 1;

                    if (config.maxRequestsToAccept === 0) {

                        this.complete(config);

                    } else {

                        console.info("INFO: " + config.totalRequestsAccepted + " friend requests accepted!");

                        console.debug("DEBUG: Accepting next friend request in " + config.actionDelay);

                        setTimeout(() => this.confirm(data, config), config.actionDelay);

                    }

                } else {

                    console.debug("DEBUG: Ignoring friend request from " + friendRequestName);

                    console.debug("DEBUG: Accepting next friend request in " + config.actionDelay);

                    setTimeout(() => this.confirm(data, config), config.actionDelay);

                }

            } catch (e) {

                console.debug("DEBUG: Accepting next friend request in " + config.actionDelay);

                setTimeout(() => this.confirm(data, config), config.actionDelay);

            }

            

        }

    },

    scrollBottom: function (data, config) {

        window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' });

        console.debug("DEBUG: waiting for scroll data to load, then finding buttons in " + config.scrollDelay + " ms");

        setTimeout(() => this.inspect(data, config), config.scrollDelay);

    },

    complete: function (config) {

        console.info('INFO: script completed after accepting ' + config.totalRequestsAccepted + ' friend requests');

    }

}


Facebook.inspect([], Facebook.config);

Comments

Popular posts from this blog

Create a Header

Header Header My supercool header Create a Header Step 1) Add HTML: Example < div  class ="header" >    < h1 > Header < /h1 >    < p > My supercool header < /p > < /div Step 2) Add CSS: Style the header with a large padding, centered text, a specific background-color and a big sized text: Example .header  {   padding :  60px ;   text-align :  center ;   background :  #1abc9c ;   color :  white ;   font-size :  30px ; }

View PC localhost on your mobile phone

Very Simple Method to see your localhost on your mobile phone.  Serve over your wifi via local IP This sounds complicated but its actually really easy. IMPORTANT: Make sure that your dev computer and your mobile device are connected to the same wifi network. Step 1: Serve to Localhost On your dev machine, serve your application in whatever way you usually do that serves it over a  localhost  address. Make sure to note what port number its being served on. In the image below, we’re noting  8080 . Once you are able to view your app locally on your computer via localhost, you can move to step 2. Step 2: Find your Local IP Address Open  System Preferences  >  Network . Select “Wifi” in the left pane if it isn’t already selected. Under “Status: Connected”, you should see “Wi-Fi is connected to <network name> and has the IP address < local IP address >.” Take note of that IP address! Note: It’s common for your Local IP Address to change automa...

Code for Digital clock

Click here to see Digital Clock <!DOCTYPE html> <html> <head>   <title>Digital Clock</title> //Add following CSS    <style>     body {       font-family: sans-serif;     }     .clock {       position: absolute;       top: 50%;       left: 50%;       transform: translate(-50%, -50%);       font-size: 60px;       color: black;     }   </style> </head>