Advertisement
Guest User

Kotaku GIF Toggler

a guest
Feb 19th, 2015
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Kotaku GIF Display Toggle
  3. // @namespace    http://your.homepage/
  4. // @version      0.1
  5. // @description  Add togglelink to GIFs
  6. // @author       You
  7. // @include      https://www.kotaku.com.au/20*
  8. // @include      http://www.kotaku.com.au/20*
  9. // @grant        none
  10. // ==/UserScript==
  11.  
  12. $('div.media_wrap.image.xlarge>a>img[src$=".gif"]').each(
  13.     function(i, el) {
  14.         var id = 'random-element-id-'+i;
  15.     var img_div = $(el).parent('a').parent('div').attr('id', id);
  16.     img_div.before(
  17.         $('<div>').html(
  18.             $('<a>Toggle GIF</a>').click(function() {
  19.                 $('#'+id).toggle();
  20.             })
  21.         )
  22.     );
  23.         img_div.hide();
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement