Advertisement
Guest User

Facebook groups cleaner

a guest
Dec 14th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ARM 24.52 KB | None | 0 0
  1. var calledOnPage;
  2. var debug=false;
  3. var reallyDelete = true;
  4. var doDeleteActivity=false;
  5. var doDeleteGamePosts=false;
  6. var doHideAll=false;
  7. var doUnlike=false;
  8. var doDeleteAll=false;
  9. var olderThan=0;
  10. var youngerThan=0;
  11. var expandCount = 0;
  12. var expandLimit = true;
  13. var isActivityLog=false;
  14. var triggeredMap = {};
  15. var handledMap = {};
  16. var now = Math.round((new Date()).getTime() / 1000);
  17. var actions = 0;
  18. var delay = 200; // in milliseconds
  19. var keepRecent = 0;
  20.  
  21. // Detect whether we are using http or https ( secure browsing )
  22. if ("https:" == document.location.protocol) {
  23.     var protocol = "https://";
  24.     if(debug)console.log("Detected that we're running with secure browsing..");
  25. } else {
  26.     var protocol = "http://";
  27.     if(debug)console.log("Detected that we're not running with secure browsing..");
  28. }
  29.  
  30. unsafeWindow.console.log(console.log);
  31.  
  32. function parseUri (str) {
  33.     var o   = parseUri.options,
  34.         m   = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
  35.         uri = {},
  36.         i   = 14;
  37.  
  38.     while (i--) uri[o.key[i]] = m[i] || "";
  39.  
  40.     uri[o.q.name] = {};
  41.     uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
  42.         if ($1) uri[o.q.name][$1] = $2;
  43.     });
  44.  
  45.     return uri;
  46. };
  47.  
  48. parseUri.options = {
  49.     strictMode: false,
  50.     key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
  51.     q:   {
  52.         name:   "queryKey",
  53.         parser: /(?:^|&)([^&=]*)=?([^&]*)/g
  54.     },
  55.     parser: {
  56.         strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
  57.         loose:  /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
  58.     }
  59. };
  60.  
  61.                                                
  62. // To defeat certain security mechanisms facebook implemented
  63. var generatePhstamp = function(qs, dtsg) {
  64.     var input_len = qs.length;
  65.     numeric_csrf_value='';
  66.    
  67.     for(var ii=0;ii<dtsg.length;ii++) {
  68.         numeric_csrf_value+=dtsg.charCodeAt(ii);
  69.     }
  70.     return '1' + numeric_csrf_value + input_len;
  71. };
  72.  
  73.    
  74. window.addEventListener('load', function()  {
  75.    
  76.     var fb_dtsg = null;
  77.  
  78.     // Get the value of fb_dtsg
  79.     var getConstantParameters = function () {
  80.         if ( fb_dtsg !== null ) {
  81.             return true;
  82.         } else {
  83.            
  84.             if ( fb_dtsg === null ) {
  85.                 $('input[name="fb_dtsg"]').each(function(){
  86.                     fb_dtsg = $(this).attr("value");
  87.                 });
  88.             }
  89.             return (fb_dtsg !== null);
  90.         }
  91.     }
  92.    
  93.    
  94.     //Check if on activitylog
  95.     function checkForActivityLog()
  96.     {
  97.         isActivityLog=false;
  98.         var temp = /(groups)/g;
  99.         var result = temp.test( $(location).attr('href') );
  100.         if (result != false)
  101.         {
  102.             var keepRecentTxt=prompt("How many recent posts do you want to keep ?");
  103.             if (keepRecentTxt!=null)
  104.             {
  105.                 keepRecent = parseInt(keepRecentTxt);
  106.                 if(isNaN(keepRecent) || keepRecent < 0 )
  107.                 {
  108.                     alert("Wrong value: " + keepRecentTxt);
  109.                 }
  110.                 else
  111.                 {
  112.                     var answer = confirm("All posts except the most recent ("+keepRecent+") will be deleted, are you sure ?");
  113.                     if (answer)
  114.                     {
  115.                         expandMore();
  116.                         isActivityLog=true;
  117.                     }
  118.                 }
  119.             }
  120.         }
  121.     }
  122.  
  123.     //checkForActivityLog();
  124.     setTimeout (checkForActivityLog, 3000);
  125.    
  126.  
  127.     //expand activitylog
  128.     function expandMoreActivity ()
  129.     {
  130.         //console.log("Exp1");
  131.         //console.log(isActivityLog);
  132.         //console.log("Exp2");
  133.         //if(isActivityLog == false)
  134.          //   return;
  135.         /*var pager = $('#pagelet_group_pager');
  136.         console.log(pager);
  137.         pager.find('a[href]').each(function () {
  138.             console.log($(this));
  139.             if ( $(this).innerHTML === "Older Posts")
  140.             {
  141.                 console.log('clickit');
  142.                 $(this).click();
  143.             }
  144.         });
  145.         if ( !expandLimit || (expandLimit && expandCount >= 0) )
  146.         {*/
  147.             //console.log("in if");
  148.             //expandCount -= 1;
  149.             //setTimeout (expandMoreActivity, 10000);
  150.             scrollTo(0, 10000000);
  151.             //setTimeout (handleStories, 20000);
  152.         /*}
  153.         else
  154.         {
  155.             console.log("in else");
  156.             scrollTo(0, 0);
  157.             handleStories();
  158.         }*/
  159.     }
  160.    
  161.     function expandMore()
  162.     {
  163.         if (debug) console.log("in expandMore");
  164.         /*var pager = $('#pagelet_group_pager');
  165.         console.log(pager);
  166.         pager.find('a[href]').each(function () {
  167.             console.log($(this));
  168.             console.log('clickit');
  169.             //$(this).click();
  170.             var evt = document.createEvent("MouseEvents");
  171.             evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
  172.             $(this).context.dispatchEvent(evt);
  173.             $(this).context.dispatchEvent(evt);
  174.  
  175.         });
  176.         */
  177.         scrollTo(0, 10000000);
  178.         setTimeout (clickPosts, 1000);
  179.         if (debug) console.log("off expandMore");        
  180.     }
  181.  
  182.     var clickPosts = function ()
  183.     {  
  184.         if (debug)  console.log("in clickPosts");
  185.         getConstantParameters();
  186.         //console.log("before click");
  187.        
  188.         var ministory = $('#pagelet_group_mall');
  189.         //console.log(ministory);
  190.         //ministory.find('div.uiPopover').each(function () {
  191.         var popups = ministory.find('a._5pbj');
  192.         if (debug) console.log("loaded posts: " + popups.length);
  193.         popups.each(function () {
  194.             //console.log($(this));
  195.             var evt = document.createEvent("MouseEvents");
  196.             evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
  197.             $(this).context.dispatchEvent(evt);
  198.             $(this).context.dispatchEvent(evt);
  199.             $(this).remove();
  200.             //$(this).click();
  201.         });
  202.         setTimeout (function() {handleStories(ministory);} , 1000);
  203.         if (debug) console.log("off clickPosts");        
  204.     }
  205.    
  206.     //show options of stories and do stuff
  207.     var handleStories = function (ministory)
  208.     {
  209.         if (debug) console.log("in handleStories");
  210.         var counter = 0;
  211.         var ajaxifies = $(".uiContextualLayerPositioner").find('a[ajaxify]');        
  212.         ajaxifies.each(function () {
  213.             var ajaxify = parseUri(protocol+"facebook.com" + $(this).attr("ajaxify"));
  214.             if (ajaxify.file === "delete.php" && handledMap[ajaxify.queryKey['story_dom_id']] === undefined)
  215.             {
  216.                 actions++;
  217.                 if(actions <= keepRecent)
  218.                 {
  219.                     if(debug){console.log("Deleting: "+ ajaxify.queryKey['story_dom_id']  + " (Skipped)");}
  220.  
  221.                 }
  222.                 else
  223.                 {
  224.                     if(debug){console.log("Deleting: "+ ajaxify.queryKey['story_dom_id']);}
  225.                    
  226.                     var data = {
  227.                         'fb_dtsg'             : fb_dtsg,
  228.                         'confirmed'           : "true"
  229.                     };                         
  230.                    
  231.                     for ( var key in ajaxify.queryKey )
  232.                     {
  233.                         data[key] = ajaxify.queryKey[key];
  234.                     }
  235.                     counter++;
  236.                     if(debug)console.log("deletion after: " + delay*counter);
  237.                     setTimeout(function() {remove(ministory, data);},delay*counter+2000);
  238.                 }
  239.                 handledMap[ajaxify.queryKey['story_dom_id']] = true;
  240.             }
  241.        });
  242.        setTimeout (expandMore, 500);
  243.        if (debug) console.log("off handleStories");        
  244.     }
  245.    
  246.    
  247. // Convert a hash to a query string for posting
  248.     var toQueryString = function(o) {
  249.         if(typeof o !== 'object') {
  250.             return false;
  251.         }
  252.         var _p, _qs = [];
  253.         for(_p in o) {
  254.             _qs.push(encodeURIComponent(_p) + '=' + encodeURIComponent(o[_p]));
  255.         }
  256.         return _qs.join('&');
  257.     };
  258.  
  259.  
  260.     function remove(myministory, mydata)
  261.     {
  262.         $.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());
  263.         if(debug)console.log("Chrome detected.. using jquery ajax call..");
  264.         if($.browser.chrome){
  265.             $.ajax({
  266.                 type    : "POST",
  267.                 url     : protocol+"www.facebook.com/ajax/groups/mall/delete.php",
  268.                 data    : mydata,
  269.                 complete: function(jqXHR, textStatus) {
  270.                     if ( jqXHR.status === 200 ) {
  271.                         /*
  272.                         if ( $('#tlcleanmenu').attr('deletecount') === undefined || $('#tlcleanmenu').attr('deletecount') === null ) {
  273.                             $('#tlcleanmenu').attr('deletecount', '0');
  274.                         }
  275.                         var deleteCount = parseInt($('#tlcleanmenu').attr('deletecount')) + 1;
  276.                         if (document.documentElement.lang === "de")
  277.                         {
  278.                             $('#tlcleanmenu').html('<span class="uiButtonText"><font size="-5">Chronikaufräumer (' + deleteCount + ')</font></span>');
  279.                         }
  280.                         else
  281.                         {
  282.                             $('#tlcleanmenu').html('<span class="uiButtonText"><font size="-5">Clear Timeline (' + deleteCount + ')</font></span>');
  283.                         }
  284.                         $('#tlcleanmenu').attr('deletecount', '' + deleteCount);
  285.                         */
  286.                         if(reallyDelete){
  287.                             var storyID = mydata['story_dom_id'] ;
  288.                             var storyIDSplits = storyID.split("%");
  289.                             var findID = "#" + storyIDSplits[0] + "\\:6";                    
  290.                             myministory.find(findID).each (function () {
  291.                                 $(this).remove();
  292.                             })
  293.                         }
  294.                         if (debug){console.log("Deleted: " + mydata['story_dom_id']);}
  295.                        
  296.                     }
  297.                     else if ( jqXHR.status === 500 )
  298.                     {
  299.                         //console.log("Error " + jqXHR.status + " on Story " + mydata['story_fbid'] + ", retrying");
  300.                         //setTimeout(function(){remove(myministory,mydata)},1000);
  301.                         if(debug)console.log("Error removing content.. skipping, sorry.. I tried :(");
  302.                         if(reallyDelete){
  303.                             var storyID = mydata['story_dom_id'] ;
  304.                             var storyIDSplits = storyID.split("%");
  305.                             var findID = "#" + storyIDSplits[0] + "\\:6";                    
  306.                             myministory.find(findID).each (function () {
  307.                                 $(this).remove();
  308.                             })
  309.                         }
  310.                     }
  311.                     else
  312.                     {
  313.                         if (debug){console.log("Error " + jqXHR.status + " on Story " + mydata['story_dom_id']);}
  314.                     }
  315.                 }
  316.             });
  317.         } else {
  318.             if(debug)console.log("Firefox detected.. using GM_xmlhttpRequest ajax call..");
  319.             GM_xmlhttpRequest({
  320.               method: "POST",
  321.               url     : protocol+"facebook.com/ajax/groups/mall/delete.php",
  322.               data: toQueryString(mydata),
  323.               dataType : 'text',
  324.               headers: {
  325.                     'Content-Type'    : 'application/x-www-form-urlencoded; charset=UTF-8',
  326.                     'Referer'         : document.location,
  327.                     'Cookie'          : document.cookie,
  328.               },
  329.               onload: function(response) {
  330.                 if(debug)console.log(response.responseText);
  331.                 if ( response.status === 200 ) {
  332.                    
  333.                     if ( $('#tlcleanmenu').attr('deletecount') === undefined || $('#tlcleanmenu').attr('deletecount') === null ) {
  334.                         $('#tlcleanmenu').attr('deletecount', '0');
  335.                     }
  336.                     var deleteCount = parseInt($('#tlcleanmenu').attr('deletecount')) + 1;
  337.                     if (document.documentElement.lang === "de")
  338.                     {
  339.                         $('#tlcleanmenu').html('<span class="uiButtonText"><font size="-5">Chronikaufräumer (' + deleteCount + ')</font></span>');
  340.                     }
  341.                     else
  342.                     {
  343.                         $('#tlcleanmenu').html('<span class="uiButtonText"><font size="-5">Clear Timeline (' + deleteCount + ')</font></span>');
  344.                     }
  345.                     $('#tlcleanmenu').attr('deletecount', '' + deleteCount);
  346.                
  347.                     if(reallyDelete)myministory.remove();
  348.                     if (debug){console.log("Deleted: " + mydata['story_dom_id']);}
  349.                    
  350.                 }
  351.                 else if ( response.status === 500 )
  352.                 {
  353.                     //console.log("Error " + response.status + " on Story " + mydata['story_fbid'] + ", retrying");
  354.                     //setTimeout(function(){remove(myministory,mydata)},1000);
  355.                     if(debug)console.log("Error removing content.. skipping, sorry.. I tried :(");
  356.                     if(reallyDelete)myministory.remove();
  357.                 }
  358.                 else
  359.                 {
  360.                     if (debug){console.log("Error " + response.status + " on Story " + mydata['story_dom_id']);}
  361.                 }
  362.               }
  363.             });
  364.         }
  365.  
  366.     }  
  367.    
  368.     function hide(myministory, mydata)
  369.     {
  370.  
  371.         $.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());
  372.  
  373.         if($.browser.chrome){
  374.             if(debug)console.log("Chrome detected.. using jquery ajax call..");
  375.             $.ajax({
  376.                 type    : "POST",
  377.                 url     : protocol+"www.facebook.com/ajax/timeline/story_visibility.php?",
  378.                 data    : mydata,
  379.                 complete: function(jqXHR, textStatus) {
  380.                     if ( jqXHR.status === 200 ) {
  381.                         if ( $('#tlcleanmenu').attr('deletecount') === undefined || $('#tlcleanmenu').attr('deletecount') === null ) {
  382.                             $('#tlcleanmenu').attr('deletecount', '0');
  383.                         }
  384.                         var deleteCount = parseInt($('#tlcleanmenu').attr('deletecount')) + 1;
  385.                         if (document.documentElement.lang === "de")
  386.                         {
  387.                             $('#tlcleanmenu').html('<span class="uiButtonText"><font size="-5">Chronikaufräumer (' + deleteCount + ')</font></span>');
  388.                         }
  389.                         else
  390.                         {
  391.                             $('#tlcleanmenu').html('<span class="uiButtonText"><font size="-5">Clear Timeline (' + deleteCount + ')</font></span>');
  392.                         }
  393.                         $('#tlcleanmenu').attr('deletecount', '' + deleteCount);
  394.                         if(reallyDelete)myministory.remove();
  395.                         if (debug){console.log("Hidden: " + mydata['story_fbid']);}
  396.                     }
  397.                     else if ( jqXHR.status === 500 )
  398.                     {
  399.                         //console.log("Error " + jqXHR.status + " on Story " + mydata['story_fbid'] + ", retrying");
  400.                         //setTimeout(function(){hide(myministory,mydata)},1000);
  401.                         if(debug)console.log("Error removing content.. skipping, sorry.. I tried :(");
  402.                         if(reallyDelete)myministory.remove();
  403.                     }
  404.                     else
  405.                     {
  406.                         if (debug){console.log("Error " + jqXHR.status + " on Story " + mydata['story_fbid']);}
  407.                     }
  408.                 }
  409.             });
  410.         } else {
  411.             if(debug)console.log("Firefox detected.. using GM_xmlhttpRequest ajax call..");
  412.             GM_xmlhttpRequest({
  413.               method: "POST",
  414.               url     :  protocol+"facebook.com/ajax/timeline/story_visibility.php?",
  415.               data: toQueryString(mydata),
  416.               dataType : 'text',
  417.               headers: {
  418.                     'Content-Type'    : 'application/x-www-form-urlencoded; charset=UTF-8',
  419.                     'Referer'         : document.location,
  420.                     'Cookie'          : document.cookie,
  421.               },
  422.               onload: function(response) {
  423.                 if(debug)console.log(response.responseText);
  424.                 if ( response.status === 200 ) {
  425.                    
  426.                     if ( $('#tlcleanmenu').attr('deletecount') === undefined || $('#tlcleanmenu').attr('deletecount') === null ) {
  427.                         $('#tlcleanmenu').attr('deletecount', '0');
  428.                     }
  429.                     var deleteCount = parseInt($('#tlcleanmenu').attr('deletecount')) + 1;
  430.                     if (document.documentElement.lang === "de")
  431.                     {
  432.                         $('#tlcleanmenu').html('<span class="uiButtonText"><font size="-5">Chronikaufräumer (' + deleteCount + ')</font></span>');
  433.                     }
  434.                     else
  435.                     {
  436.                         $('#tlcleanmenu').html('<span class="uiButtonText"><font size="-5">Clear Timeline (' + deleteCount + ')</font></span>');
  437.                     }
  438.                     $('#tlcleanmenu').attr('deletecount', '' + deleteCount);
  439.                
  440.                     if(reallyDelete)myministory.remove();
  441.                     if (debug){console.log("Deleted: " + mydata['story_fbid']);}
  442.                    
  443.                 }
  444.                 else if ( response.status === 500 )
  445.                 {
  446.                     //console.log("Error " + response.status + " on Story " + mydata['story_fbid'] + ", retrying");
  447.                     //setTimeout(function(){remove(myministory,mydata)},1000);
  448.                     if(debug)console.log("Error removing content.. skipping, sorry.. I tried :(");
  449.                     if(reallyDelete)myministory.remove();
  450.                 }
  451.                 else
  452.                 {
  453.                     if (debug){console.log("Error " + response.status + " on Story " + mydata['story_fbid']);}
  454.                 }
  455.               }
  456.             });
  457.         }
  458.  
  459.     }
  460.    
  461.     function addButton()
  462.     {
  463.         if (isActivityLog==true)
  464.         {
  465.             if( document.getElementById("selectvalue") ) {
  466.                 //console.log("It's there");
  467.             } else {
  468.                 if(debug)console.log("injecting button...");
  469.                 if (document.documentElement.lang === "de")
  470.                 {
  471.                     if(debug)console.log("Found the list item, appending..");
  472.                     $('ul[class="uiSideNav"]:first').append('<span class="uiButtonGroupItem selectorItem"><div class="uiSelector inlineBlock sectionMenu uiSelectorNormal"><div class="wrap "><button class="hideToggler"></button><a id="tlcleanmenu" rel="toggle" data-length="500" aria-haspopup="1" href="#" role="button" class="uiSelectorButton uiButton uiButtonOverlay "><span class="uiButtonText"><font size="-1">Chronikaufräumer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span></a><div class="uiSelectorMenuWrapper uiToggleFlyout"><div class="uiMenu uiSelectorMenu" role="menu"><ul class="uiMenuInner"><li id="menuItem1" class="uiMenuItem uiSelectorOption"><a href="#" rel="ignore" class="itemAnchor" tabindex="0"><span class="itemLabel fsm">Alle Aktivitäten in bestimmtem Zeitfenster löschen</span></a></li><li id="menuItem2" class="uiMenuItem uiSelectorOption"><a href="#" rel="ignore" class="itemAnchor" id="menu2" tabindex="0"><span class="itemLabel fsm">Alle Spieleposts in bestimmtem Zeitfenster löschen</span></a></li><li id="menuItem3" class="uiMenuItem uiSelectorOption"><a href="#" rel="ignore" class="itemAnchor" id="menu3" tabindex="0"><span class="itemLabel fsm">Alles in bestimmtem Zeitfenster verstecken</span></a></li><li id="menuItem4" class="uiMenuItem uiSelectorOption"><a href="#" rel="ignore" class="itemAnchor" tabindex="0"><span class="itemLabel fsm">ALLES in bestimmtem Zeitfenster löschen</span></a></li><li><HR WIDTH="50"></li><li id="menuItem5" class="uiMenuItem uiSelectorOption"><a href="#" rel="ignore" class="itemAnchor" tabindex="0"><span class="itemLabel fsm">Alle Aktivitäten löschen</span></a></li><li id="menuItem6" class="uiMenuItem uiSelectorOption"><a href="#" rel="ignore" class="itemAnchor" tabindex="0"><span class="itemLabel fsm">Alle Spieleposts löschen</span></a></li><li id="menuItem7" class="uiMenuItem uiSelectorOption"><a href="#" rel="ignore" class="itemAnchor" tabindex="0"><span class="itemLabel fsm">Alles in der Chronik verstecken</span></a></li><li id="menuItem8" class="uiMenuItem uiSelectorOption"><a href="#" rel="ignore" class="itemAnchor" tabindex="0"><span class="itemLabel fsm">Alles "unliken"</span></a></li><li id="menuItem9" class="uiMenuItem uiSelectorOption"><a href="#" rel="ignore" class="itemAnchor" tabindex="0"><span class="itemLabel fsm">ALLES löschen</span></a></li></ul></div></div><button class="hideToggler"></button></div><select id="selectvalue"><option value=""></option><option value="DeleteActivityOlder"></option><option value="DeleteGamePostOlder"></option><option value="HideOlder"></option><option value="DeleteOlder"></option><option value="DeleteActivity" ></option><option value="DeleteGamePost" ></option><option value="Hide" ></option><option value="Unlike" ></option><option value="Delete" ></option></select></div></span>');
  473.                 }
  474.                 else
  475.                 {
  476.                      if ( $('ul.uiSideNav') ) {
  477.                         if(debug)console.log("Found the list item, appending..");
  478. //                      $('ul[class="uiSideNav"]:first').append('<span class="uiButtonGroupItem selectorItem"><div class="uiSelector inlineBlock sectionMenu uiSelectorNormal"><div class="wrap "><button class="hideToggler"></button><a id="tlcleanmenu" rel="toggle" data-length="500" aria-haspopup="1" href="#" role="button" class="uiSelectorButton uiButton uiButtonOverlay "><span class="uiButtonText"><font size="-1">Clear Timeline&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span></a><div class="uiSelectorMenuWrapper uiToggleFlyout"><div class="uiMenu uiSelectorMenu" role="menu"><ul class="uiMenuInner"><li id="menuItem1" class="uiMenuItem uiSelectorOption"><a href="#" rel="ignore" class="itemAnchor" tabindex="0"><span class="itemLabel fsm">Delete all activities in a selected timeframe</span></a></li><li id="menuItem2" class="uiMenuItem uiSelectorOption"><a href="#" rel="ignore" class="itemAnchor" id="menu2" tabindex="0"><span class="itemLabel fsm">Delete all gameposts in a selected timeframe</span></a></li><li id="menuItem3" class="uiMenuItem uiSelectorOption"><a href="#" rel="ignore" class="itemAnchor" id="menu3" tabindex="0"><span class="itemLabel fsm">Hide everything in a selected timeframe</span></a></li><li id="menuItem4" class="uiMenuItem uiSelectorOption"><a href="#" rel="ignore" class="itemAnchor" tabindex="0"><span class="itemLabel fsm">Delete EVERYTHING in a selected timeframe</span></a></li><li><HR WIDTH="50"></li><li id="menuItem5" class="uiMenuItem uiSelectorOption"><a href="#" rel="ignore" class="itemAnchor" tabindex="0"><span class="itemLabel fsm">Delete all activities</span></a></li><li id="menuItem6" class="uiMenuItem uiSelectorOption"><a href="#" rel="ignore" class="itemAnchor" tabindex="0"><span class="itemLabel fsm">Delete all gameposts</span></a></li><li id="menuItem7" class="uiMenuItem uiSelectorOption"><a href="#" rel="ignore" class="itemAnchor" tabindex="0"><span class="itemLabel fsm">Hide everything</span></a></li><li id="menuItem8" class="uiMenuItem uiSelectorOption"><a href="#" rel="ignore" class="itemAnchor" tabindex="0"><span class="itemLabel fsm">"Unlike" everything</span></a></li><li id="menuItem9" class="uiMenuItem uiSelectorOption"><a href="#" rel="ignore" class="itemAnchor" tabindex="0"><span class="itemLabel fsm">Delete EVERYTHING</span></a></li></ul></div></div><button class="hideToggler"></button></div><select id="selectvalue"><option value=""></option><option value="DeleteActivityOlder"></option><option value="DeleteGamePostOlder"></option><option value="HideOlder"></option><option value="DeleteOlder"></option><option value="DeleteActivity" ></option><option value="DeleteGamePost" ></option><option value="Hide" ></option><option value="Unlike" ></option><option value="Delete" ></option></select></div></span>');
  479.                          $('ul[class="uiSideNav"]:first').append('<span class="uiButtonGroupItem selectorItem"><div class="wrap "><button id="startBtn" onclick="{doDeleteAll = true;}">Clear group</button></div> </span>');
  480.                     }
  481.                 }
  482.             }
  483.         }
  484.     }
  485.    
  486.     //addButton();
  487.     //setTimeout(addButton, 2000);     
  488.  
  489.     function getClickables()
  490.     {
  491.         console.log("in getClickables");
  492.         var allElements = document.getElementsByTagName('*');
  493.         for ( var i = 0; i<allElements.length; i++ ) {
  494.             if ( allElements[i].className !== 'theClassNameYoureLookingFor' ) {
  495.             continue;
  496.             }
  497.             if ( typeof allElements[i].onclick === 'function' ) {
  498.             // do something with the element here
  499.             console.log( allElements[i] );
  500.             }
  501.         }
  502.     }
  503.    
  504.     function sendDelete ()
  505.     {
  506.         console.log("in sendDelete");
  507.         var allElements = document.getElementsByTagName('*');
  508.         for ( var i = 0; i<allElements.length; i++ ) {
  509.             if ( allElements[i].className === '_5jmm _5pat _5uch' ) {
  510.                 console.log( allElements[i] );
  511.             }
  512.         }
  513.         var mydata = {
  514.             'fb_dtsg'       : fb_dtsg,
  515.             'group_id'      : '218698534950950',
  516.             'message_id'    : '283963528424450',
  517.             'confirmed'     : '1',
  518.             'pending'       : '',
  519.             'source'        : '',
  520.             'story_dom_id'  : 'mall_post_283967615090708:6',
  521.             'revision_id'   : '',
  522.             '__user'        :'805715023',
  523.             '__a'           :'1',
  524.             '__dyn'         :'7n8a9EAMNpGudDgDxrHaHyG8qeyp9Esx6iWF3qGE',
  525.             '__req'         :'c',
  526.             'ttstamp'       :'26581687468745249',
  527.             '__rev'         :'1086044'
  528.         }
  529.         $.ajax({
  530.                 type    : "POST",
  531.                 url     : protocol+"www.facebook.com/ajax/groups/mall/delete.php",
  532.                 data    : mydata,
  533.                 complete: function(jqXHR, textStatus) {
  534.                     console.log(jqXHR);
  535.                     console.log(textStatus);
  536.                 }
  537.         })
  538.     }
  539.     //setTimeout(getClickables, 2000);
  540.     //console.log("testing testing ...");
  541.     //setTimeout(sendDelete, 5000);
  542.  
  543.     /*function checkForCommand()
  544.     {
  545.         checkForActivityLog();
  546.         //console.log($(location).attr('href'));
  547.         if (isActivityLog==true)
  548.         {
  549.             expandMoreActivity ();
  550.         }
  551.      
  552.         setTimeout(checkForCommand, 2000);
  553.     }*/
  554.  
  555.     //checkForActivityLog();
  556.  
  557.     //checkForCommand();
  558.     //setTimeout(checkForCommand, 5000);
  559.     //setTimeout(checkForCommand, 10000);
  560.  
  561. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement