IMDb.com enable right click on images

Enable right click on images in the IMDb.com media viewer

Installer dette scriptet?
Skaperens foreslåtte skript

Du vil kanskje også like flickr Download Link.

Installer dette scriptet
  1. // ==UserScript==
  2. // @name IMDb.com enable right click on images
  3. // @namespace https://openuserjs.org/users/cuzi
  4. // @license GPL-3.0-or-later
  5. // @copyright 2020, cuzi (https://openuserjs.org/users/cuzi)
  6. // @version 1.1.1
  7. // @description Enable right click on images in the IMDb.com media viewer
  8. // @author cuzi
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=imdb.com
  10. // @match https://www.imdb.com/*
  11. // @grant GM.openInTab
  12. // ==/UserScript==
  13.  
  14. /* jshint asi: true, esversion: 8 */
  15.  
  16. (function () {
  17. 'use strict'
  18.  
  19. function highestQuality (ev) {
  20. if (!ev || ev.button !== 1) {
  21. return
  22. }
  23. const src = this.currentSrc.replace(/\.[^/.]*_[^/.]*\.+([^./]*)$/, '.$1')
  24. GM.openInTab(src)
  25. }
  26.  
  27. window.setInterval(function () {
  28. /* old before 2022-03-16 */
  29. document.querySelectorAll('div[class*="PortraitContainer"],div[class*="LandscapeContainer"]').forEach(function (div) {
  30. div.style.zIndex = 2
  31. })
  32.  
  33. /* new 2022-03-16 */
  34. document.querySelectorAll('.media-viewer div>img[srcset][data-image-id]').forEach(function (img) {
  35. img.removeEventListener('mouseup', highestQuality)
  36. if (img.clientWidth) {
  37. // Downsize the image container so it won't overlap the arrows for navigation
  38. img.parentNode.style.width = img.clientWidth + 'px'
  39. // Bring image container to the front
  40. img.parentNode.style.zIndex = 2
  41. // Try to load highest quality src on wheel click
  42. img.addEventListener('mouseup', highestQuality)
  43. img.title = 'Mouse wheel click to open highest quality\nRight click to open context menu'
  44. } else {
  45. // Reset if image size is not loaded yet
  46. img.parentNode.style.width = ''
  47. img.parentNode.style.zIndex = ''
  48. }
  49. })
  50. }, 700)
  51. })()