FXP pastebin

מוסיף iframe של pastebin לתוך הפוסטים

  1. // ==UserScript==
  2. // @name FXP pastebin
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description מוסיף iframe של pastebin לתוך הפוסטים
  6. // @author You
  7. // @match https://www.fxp.co.il/showthread.php*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=fxp.co.il
  9. // ==/UserScript==
  10. (function() {
  11. 'use strict';
  12. const regex = /https?:\/\/pastebin\.com\/([\w+]*)/g;
  13. const posts = document.querySelectorAll('#posts .postbody a[href*="pastebin.com"]');
  14. const observer = new IntersectionObserver(function(entries, observer) {
  15. entries.forEach(function({isIntersecting, target}) {
  16. if (isIntersecting) {
  17. const pastebin_id = target.text.replace(regex, '$1')
  18. console.log(pastebin_id);
  19. target.replaceWith(Object.assign(document.createElement('iframe'), {
  20. src: 'https://pastebin.com/embed_iframe.php?i=' + pastebin_id,
  21. style: 'border:none;width:100%;height:200px'
  22. }));
  23. observer.unobserve(target);
  24. }
  25. })
  26. })
  27. posts.forEach(function(post) {
  28. observer.observe(post);
  29. })
  30. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址