Advertisement
Guest User

Hootsuite greasemonkey fixes

a guest
Jan 29th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        Hootsuite Fixes
  3. // @namespace   hootsuite
  4. // @description Personalized fixes
  5. // @include     http://hootsuite.com/dashboard
  6. // @version     1
  7. // @author  JB Braendel
  8. // @date    Jan, 29. 2013
  9. // ==/UserScript==
  10.  
  11.  
  12. // jQuery regex selection
  13. // source: http://james.padolsey.com/javascript/regex-selector-for-jquery/
  14. jQuery.expr[':'].regex = function(elem, index, match) {
  15.     var matchParams = match[3].split(','),
  16.         validLabels = /^(data|css):/,
  17.         attr = {
  18.             method: matchParams[0].match(validLabels) ?
  19.                         matchParams[0].split(':')[0] : 'attr',
  20.             property: matchParams.shift().replace(validLabels,'')
  21.         },
  22.         regexFlags = 'ig',
  23.         regex = new RegExp(matchParams.join('').replace(/^\s+|\s+$/g,''), regexFlags);
  24.     return regex.test(jQuery(elem)[attr.method](attr.property));
  25. }
  26.  
  27.  
  28. /******************************************************************/
  29. /** Settings **/
  30.  
  31. // Which streams are specific to Facebook? (these are the ones that will be searched)
  32. var fb_boxes=[59982602,55962668]; // right click on the box title, click 'Inspect Element', find the part that says <div id="box55962668" class"_boxstream" data-boxid="55962668" ...>   the data-boxid is the number you want. Place that in here
  33.  
  34. // Which users have BAD profile pictures (usually girls kissing their boyfriends, or posting half-naked pics of their bf's....damn girls -_-)
  35. var fb_user_images=[100000565688978]; // Right click their picture, click 'Inspect Element', find the part that says <a class="_userInfoDropdown networkAvatarLink _userInfoPopupHere _dropDownCreated" userid="user|100000565688978" ...>   the userid number is the one you want. Place that in here
  36.  
  37. // Timers (in milliseconds)
  38. // wait_to_start: how long to wait before loading this script (you want to set this to however long it takes for things to properly load up; otherwise nothing will work)
  39. // update_timer: how long to wait before checking if the stream is updating (500 is probably good)
  40. // initial_timer: how long to wait before initially clearing the images and apps
  41. var wait_to_start = 5000, update_timer=500;
  42. var initial_timer=wait_to_start+2000;
  43.    
  44.  
  45.  
  46. /******************************************************************/
  47. /** Functionaliy **/
  48.  
  49. clear_images = function() {
  50.     // People with annoying profile pics
  51.     for (var i=0; i<fb_boxes.length; i++) {
  52.         for (var j=0; j<fb_user_images.length; j++) {
  53.             $('div[data-boxid="'+fb_boxes[i]+'"] div[externaluserid="user|'+fb_user_images[j]+'"] img').attr('src','');
  54.         }
  55.     }
  56. };
  57.  
  58. clear_apps = function() {
  59.     // Clear annoying app-posts
  60.     for (var i=0; i<fb_boxes.length; i++) {
  61.         $('div[data-boxid="'+fb_boxes[i]+'"] a:regex(href,apps.facebook.com.*)').parent().parent().remove();
  62.         $('div[data-boxid="'+fb_boxes[i]+'"] a:regex(href,platform.ak.fbcdn.net.*)').parent().parent().remove();
  63.         $('div[data-boxid="'+fb_boxes[i]+'"] a:regex(href,schoolfeed.classmates.*)').parent().parent().remove();
  64.  
  65.     }
  66. };
  67.  
  68.  
  69. is_updating = null;
  70.  
  71. setTimeout((function(){
  72.     is_updating = (function() {
  73.         // Global update
  74.         var global_stream = $('div.controls span[class="icon-19 refresh"]').parent(),
  75.             individual_streams = $('div.message-more');
  76.         return function() {
  77.             if (global_stream.css('display')=='none') return true;
  78.             for (var i=0; i<individual_streams.length; i++) {
  79.                 if ($(individual_streams[i]).hasClass('_tweetMoreHidden')) {
  80.                     return true;
  81.                 }
  82.             }
  83.         }
  84.     }());
  85. }), wait_to_start);
  86.  
  87.  
  88. /******************************************************************/
  89. /** Clearing **/
  90.  
  91.  
  92.    
  93.     var update = function(force) {
  94.         if (force || is_updating()) {
  95.             console.log('updating!');
  96.             clear_images();
  97.             clear_apps();
  98.         }
  99.         setTimeout(update, update_timer);
  100.     };
  101.  
  102.     setTimeout(function(){ update(true); }, initial_timer);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement