Advertisement
Guest User

Untitled

a guest
Apr 6th, 2015
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name       2ch pastebin
  3. // @version    0.2.1
  4. // @include     *2ch.*/*
  5. // @grant       none
  6. // ==/UserScript==
  7.  
  8. $(document).ready(getIframe);
  9.  
  10. $('.posts').bind('DOMSubtreeModified', getIframe);
  11.  
  12. function getIframe() {
  13.   $('a[href^="http://pastebin.com/"]').each(function() {
  14.     var id = this.href.match(/pastebin.com\/(\w+)/)[1];
  15.  
  16.     if ($(this).next().is('.pastebin')) return;
  17.  
  18.     $('<div>', {
  19.       class: 'pastebin',
  20.       html: '<iframe src="https://pastebin.com/embed_iframe.php?i='+id+'" style="border:none;width:500px;height:500px"></iframe>'
  21.     }).insertAfter($(this));
  22.   });
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement