Pixeldrain video viewer

Sometimes Pixeldrain does not shows online player for video files and asks to download them. This script forces video player to appear.

  1. // ==UserScript==
  2. // @name Pixeldrain video viewer
  3. // @description Sometimes Pixeldrain does not shows online player for video files and asks to download them. This script forces video player to appear.
  4. // @namespace bo.gd.an@rambler.ru
  5. // @version 0.1.2
  6. // @author Bogudan
  7. // @match https://pixeldrain.com/u/*
  8. // @license For personal use only
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. // body#body
  15. // div#file_viewer.file_viewer.svelte-1ofgsf6
  16. // div.file_preview_row.svelte-1ofgsf6
  17. // div.file_preview.svelte-1ofgsf6.checkers.toolbar_visible
  18. // div.container.svelte-1vb3mev
  19. // div.player.svelte-1vb3mev
  20. // video.video.drop_shadow.svelte-1vb3mev[controls][autoplay]
  21. const int = setInterval (function () {
  22. if (document.getElementsByTagName ('video').length > 0) {
  23. clearInterval (int);
  24. return console.log ('video detected');
  25. }
  26. function TryClass (cls) {
  27. const q = document.getElementsByClassName (cls);
  28. return q && q.length && q [0];
  29. }
  30. const preview = TryClass ('checkers');
  31. if (!preview)
  32. return console.log ('container not found');
  33. clearInterval (int);
  34. while (preview.lastChild)
  35. preview.removeChild (preview.lastChild);
  36. const src = document.createElement ('source');
  37. src.setAttribute ('type', 'video/mp4');
  38. src.setAttribute ('src', '/api/file/' + document.location.pathname.substring (3));
  39. const video = document.createElement ('video');
  40. video.setAttribute ('style', 'position: relative; display: block; margin: auto; max-width: 100%; max-height: 100%; top: 50%; transform: translateY(-50%); box-shadow: 1px 1px 6px var(--shadow_color)');
  41. video.setAttribute ('controls', '');
  42. video.setAttribute ('autoplay', '');
  43. video.append (src);
  44. const pl = document.createElement ('div');
  45. pl.setAttribute ('style', 'flex: 1 1 auto; overflow: hidden');
  46. pl.append (video);
  47. const cnt = document.createElement ('div');
  48. cnt.setAttribute ('style', 'display: flex; flex-direction: column; height: 100%; width: 100%');
  49. cnt.append (pl);
  50. preview.append (cnt);
  51. }, 1000);
  52. })();

QingJ © 2025

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