Guest User

whotwi.js

a guest
Sep 25th, 2021
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript:
  2. /*
  3.     whotwi script
  4.     todo: wrap in turbolinks; detect changes to not break the page again
  5. */
  6. $('.media_list li').each(
  7.     (i, li) => {
  8.         /*
  9.             make image date bottom bar point to nitter tweet
  10.         */
  11.         var tw_url = li.firstElementChild.href.replace('twitter.com', 'nitter.net');
  12.         $(li).find('.date').html(
  13.             `<a target="_blank" style="color: orange" href="${tw_url}">${$(li).find('.date').text()}</a>`
  14.         );
  15.        
  16.         /*
  17.             make image links to open original images
  18.         */
  19.         li.firstElementChild.href = li.querySelector('img').src + '?name=orig';
  20.     }
  21. );
  22. /*
  23.     replace sidebar users to galleries
  24. */        
  25. $('.sidebar_column:contains("People often in conversation") li a').each(
  26.     (i, a) => {
  27.         a.href = `${location.origin}/${a.href.split('/').pop()}/tweets/media`;
  28.         a.target = '_blank';
  29.     }
  30. );
  31. $('#main.container').css('background-color', '#dcf5f4');
  32.  
  33.  
Advertisement
Add Comment
Please, Sign In to add comment