IMDb.com enable right click on images

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

安装此脚本
作者推荐脚本

您可能也喜欢flickr Download Link

安装此脚本
  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.2
  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. // @match https://m.imdb.com/*
  12. // @grant GM.openInTab
  13. // ==/UserScript==
  14.  
  15. /* jshint asi: true, esversion: 8 */
  16.  
  17. (function () {
  18. 'use strict'
  19.  
  20. function highestQuality (ev) {
  21. if (!ev || ev.button !== 1) {
  22. return
  23. }
  24. const src = this.currentSrc.replace(/\.[^/.]*_[^/.]*\.+([^./]*)$/, '.$1')
  25. GM.openInTab(src)
  26. }
  27.  
  28. window.setInterval(function () {
  29. /* old before 2022-03-16 */
  30. document.querySelectorAll('div[class*="PortraitContainer"],div[class*="LandscapeContainer"]').forEach(function (div) {
  31. div.style.zIndex = 2
  32. })
  33.  
  34. /* new 2022-03-16 */
  35. document.querySelectorAll('.media-viewer div>img[srcset][data-image-id]').forEach(function (img) {
  36. img.removeEventListener('mouseup', highestQuality)
  37. if (img.clientWidth) {
  38. // Downsize the image container so it won't overlap the arrows for navigation
  39. img.parentNode.style.width = img.clientWidth + 'px'
  40. // Bring image container to the front
  41. img.parentNode.style.zIndex = 2
  42. // Try to load highest quality src on wheel click
  43. img.addEventListener('mouseup', highestQuality)
  44. img.title = 'Mouse wheel click to open highest quality\nRight click to open context menu'
  45. } else {
  46. // Reset if image size is not loaded yet
  47. img.parentNode.style.width = ''
  48. img.parentNode.style.zIndex = ''
  49. }
  50. })
  51. }, 700)
  52. })()