Inviter

facebook invite

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Inviter
// @namespace    http://codeot.com
// @version      0.1
// @description  facebook invite
// @author       Talha Habib
// @email        [email protected]
// @match        *://*.facebook.com/*
// ==/UserScript==

// -- start

function inviteAll(){
    console.log("firing");
    appendHTML(document.querySelector(".status_mt"),"<p>Firing inviter</p>");
for(var i=0; i<=document.querySelectorAll('._5i_q span ._42ft:not(._42fr):not(._59pe)').length;i++){
  setTimeout(Inviter,3000*i,i,document.querySelectorAll('._5i_q span ._42ft:not(._42fr):not(._59pe)').length);
 }
}
function Inviter(i,l){
     console.log("Invited "+ parseInt(i+1) +" Out of "+l);
     appendHTML(document.querySelector(".status_mt"),"<p>Invited "+ parseInt(i+1) +" Out of "+l+"</p>");
     if(parseInt(i+1)==l){
         console.log("Trigger new");
         appendHTML(document.querySelector(".status_mt"),"<p>Reached End of Block</p>");
         if(document.querySelectorAll("a[rel='async'].pam").length==1){
             loadMore();
             console.log("Got some more");
             appendHTML(document.querySelector(".status_mt"),"<p>Got some more</p>");
             setTimeout(inviteAll,5000);
         }else{
             console.log("--------------Closing-----------------");
             console.log("Invited all of them");
             appendHTML(document.querySelector(".status_mt"),"<p>Invited all of them</p>");
             appendHTML(document.querySelector(".status_mt"),"<p>Closing in 2 seconds</p>");
             setTimeout(function(){
                 document.querySelector(".status_mt").remove();
             },2000);
         }
     }else{
         if(document.querySelectorAll('._5i_q span ._42ft:not(._42fr):not(._59pe)').length>0){
             document.querySelectorAll('._5i_q span ._42ft:not(._42fr):not(._59pe)')[i].click();
         }else{
             console.log("Nothing to invite");
             appendHTML(document.querySelector(".status_mt"),"<p>Nothing to invite</p>");
             console.log("Checking more entries");
             appendHTML(document.querySelector(".status_mt"),"<p>Checking more entries</p>");
             if(document.querySelectorAll("a[rel='async'].pam").length==1){
                 console.log("Loading more");
                 appendHTML(document.querySelector(".status_mt"),"<p>Loading more...</p>");
                 loadMore();
                 setTimeout(inviteAll,5000);
             }else{
                 console.log("Nothing found");
                 appendHTML(document.querySelector(".status_mt"),"<p>Nothing found</p>");
                 return false;
             }
         }
     }
}
function loadMore(){
    document.querySelectorAll("a[rel='async'].pam")[0].click();
}
document.addEventListener ("keydown", function (zEvent) {
    if (zEvent.ctrlKey  &&  zEvent.altKey  &&  zEvent.code === "KeyG") {
       if(document.querySelectorAll(".status_mt").length==0){
         appendHTML(document.body,'<div class="status_mt" style="overflow:auto;position:absolute;top:0;left:0;width:300px;height:300px;background:white;z-index:99999;padding:10px"></div>');
       }
       appendHTML(document.querySelector(".status_mt"),"<p>Key Detected</p>");
       console.log("Key Detected");
       inviteAll();
    }
});

function appendHTML(element,html){
    var t = parseHTML(html);
    element.insertBefore(t, element.firstChild);
}
function parseHTML(html) {
    var t = document.createElement('template');
    t.innerHTML = html;
    return t.content.cloneNode(true);
}
// -- end