Link to large screenshots on apps.apple.com

19/11/2022, 2:23:02 pm

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Link to large screenshots on apps.apple.com
// @namespace   Violentmonkey Scripts
// @match       https://apps.apple.com/*/app/*
// @grant       none
// @version     1.1
// @author      -
// @description 19/11/2022, 2:23:02 pm
// @license MIT
// ==/UserScript==


function addLargeScreenshotLinks(){
  if(document.querySelector('.large-screenshot-links')) return
  Array.from(document.querySelectorAll('div[class*="screenshot"] picture source')).forEach(pic => {
    const src = pic.getAttribute('srcset').split(' ').at(-2)
    const largeSrc = src.slice(0, src.lastIndexOf('/')) + '/1600x0w.jpg'

    const aLink = document.createElement('a')
    aLink.setAttribute('class', 'large-screenshot-links')
    aLink.setAttribute('href', largeSrc)
    aLink.setAttribute('target', '_blank')

    pic.parentNode.insertAdjacentElement('beforebegin', aLink)

    aLink.appendChild(pic.parentNode)
  })
}

addLargeScreenshotLinks()

// The apps.apple.com site uses html5 history if you click to another app, so re-check about every second.
setInterval(addLargeScreenshotLinks, 800)