Greasy Fork is available in English.

IMDb fullscreen imageviewer

Fix the new layout to make it look more like the old design. Display old & new layout fullscreen.

  1. // ==UserScript==
  2. // @name IMDb fullscreen imageviewer
  3. // @namespace https://github.com/Procyon-b
  4. // @version 0.3
  5. // @description Fix the new layout to make it look more like the old design. Display old & new layout fullscreen.
  6. // @author Achernar
  7. // @match https://www.imdb.com/*/mediaviewer/*
  8. // @run-at document-start
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. "use strict";
  14.  
  15. addSt('.mediaviewer__head-banner:not(.media-viewer__action-bar) {height: 0;} .mediaviewer__head-banner + div > div {height: calc(100% + 65px) !important;} nav, footer, button[aria-label="Open"] {display: none !important;} div[data-testid="media-viewer"] {height: 100vh !important;} .media-viewer__action-bar {position: absolute; left: 0; z-index: 10; background:rgba(20, 20, 20, 0.85); border-bottom: 1px solid rgba(255,255,255,0.2);}');
  16.  
  17. function addSt(s,t) {
  18. let st=document.createElement('style');
  19. try{
  20. (document.head || document.documentElement).appendChild(st);
  21. st.textContent=s;
  22. }catch(e){
  23. if (t) document.addEventListener('DOMContentLoaded',function(){addSt(s);});
  24. else setTimeout(function(){addSt(s,t);},0);
  25. }
  26. }
  27.  
  28. function init(){
  29. window.dispatchEvent(new MouseEvent('resize'));
  30. var ms=document.querySelector('[data-testid="media-sheet"]'),
  31. ab=document.querySelector('[data-testid="action-bar"]');
  32. if (!ms || !ab) return;
  33. var obs=new MutationObserver(function(muts){
  34. for (let mut of muts) {
  35. if (mut.attributeName!='aria-hidden') continue;
  36. let t=mut.target;
  37. if (!t || !(t.tagName=='DIV' && ( t.className.includes('MediaPanel') || (t.dataset.testid=='media-sheet'))) ) continue;
  38. ab.style.display= t.style.visibility=='hidden' ? 'none' : '';
  39. }
  40. });
  41.  
  42. obs.observe(ms.closest('[data-testid="media-viewer"]'),
  43. {attributes: true, childList: false, subtree: true});
  44. }
  45. if (document.readyState != 'loading') init();
  46. else document.addEventListener('DOMContentLoaded', init);
  47.  
  48. })();