hijav 快速预览

collect hijav preview images quickly

질문, 리뷰하거나, 이 스크립트를 신고하세요.
// ==UserScript==
// @name         hijav 快速预览
// @namespace    http://tampermonkey.net/
// @version      0.35.1
// @description  collect hijav preview images quickly
// @author       miles
// @match        https://hijav.net/*
// @match        https://pics-view.com/*
// @license      MIT
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAACBUExURUxpcWB9i2B9i2B9i2B9i2B9i2B9i2B9i2B9i2B9i2B9i2B9i2B9i2B9i2B9i////198il17idng49DY3PT297/K0MTP1M3X27rHzaCxupmstbTByK69xOfr7bfFy3WOmqi4wPz9/X+XomSBjqW1vZOmsN/l6GmFkomeqe7x8vn6+kv+1vUAAAAOdFJOUwDsAoYli9zV+lIqAZEDwV05SQAAAUZJREFUOMuFk+eWgjAUhGPBiLohjZACUqTp+z/gJkqJy4rzg3Nn+MjhwB0AANjv4BEtdITBHjhtQ4g+CIZbC4Qb9FGb0J4P0YrgCezQqgIA14EDGN8fYz+f3BGMASFkTJ+GDAYMUSONzrFL7SVvjNQIz4B9VERRmV0rbJWbrIwidnsd6ACMlEoip3uad3X2HJmqb3gCkkJELwk5DExRDxA6HnKaDEPSsBnAsZoANgJaoAkg12IJqBiPACImXQKF9IDULIHUkOk7kDpeAMykHqCEWACy8ACdSM7LGSg5F3HtAU1rrkaK9uGAshXS2lZ5QH/nVhmlD8rKlmbO3ZsZwLe8qnpdxJRnLaci1X1V5R32fjd5CndVkfYdGpy3D+htU952C/ypzPtdt3JflzZYBy7fi/O1euvl/XH1Pp+Cw3/1P1xOZwB+AWMcP/iw0AlKAAAAV3pUWHRSYXcgcHJvZmlsZSB0eXBlIGlwdGMAAHic4/IMCHFWKCjKT8vMSeVSAAMjCy5jCxMjE0uTFAMTIESANMNkAyOzVCDL2NTIxMzEHMQHy4BIoEouAOoXEXTyQjWVAAAAAElFTkSuQmCC
// @grant        none
// ==/UserScript==
(function () {
  'use strict'
  const runHiJAV = () => {
    if (!location.href.includes('hijav.net')) {
      return
    }

    const dialog = document.createElement('dialog')
    dialog.align = 'center'
    dialog.open = false
    dialog.style.zIndex = 1000

    const div = document.createElement('div')
    div.style.display = 'grid'
    div.style.gap = '4vh'
    div.style.overflowY = 'scroll'
    div.style.maxHeight = '94vh'
    div.style.padding = '0 1vh'
    const getElements = () => {
      const post = [...document.querySelectorAll('.post.type-post ')]
      const postLinks = post.map((i) => {
        const image = i.children[3].children[0]
        const link = [...i.children[1].children].find((i) => i.tagName === 'A').href
        const a = document.createElement('a')
        a.href = link
        a.appendChild(image.cloneNode())

        const images = [...i.children[5].children].filter((i) => i.tagName === 'A')
        return [a, ...images]
      })
      return postLinks.flat()
    }

    const createElements = (action) => {
      const elements = getElements()
      elements.forEach((e) => {
        const node = e.cloneNode(true)
        node.target = '_blank'
        action?.(node)
        div.append(node)
      })
    }

    const btnOpen = document.createElement('button')
    btnOpen.style.marginLeft = '5px'
    btnOpen.innerText = 'open source'
    btnOpen.onclick = () => {
      div.style.gridTemplateColumns = '1fr 1fr 1fr 1fr 1fr 1fr'
      createElements()
      dialog.open = true
    }

    const btnOpenLarge = document.createElement('button')
    btnOpenLarge.style.marginLeft = '5px'
    btnOpenLarge.innerText = 'open large'
    btnOpenLarge.onclick = () => {
      div.style.gridTemplateColumns = '1fr 1fr'
      createElements((node) => {
        node.style.display = 'flex'
        node.style.alignItems = 'center'
        node.style.justifyContent = 'center'
        const image = node.firstChild
        image.src = image.src.replace('.th.', '.')
        image.style.maxHeight = '94vh'
        image.style.maxWidth = '40vw'
      })
      dialog.open = true
    }

    const btnClose = document.createElement('button')
    btnClose.innerText = 'close'
    btnClose.onclick = () => {
      dialog.close()
      div.innerHTML = ''
    }

    dialog.append(btnClose)
    dialog.append(div)

    document.body.prepend(btnOpen)
    document.body.prepend(btnOpenLarge)
    document.body.prepend(dialog)
  }
  const runPicView = () => {
    if (!location.href.includes('pics-view.com')) {
      return
    }
    const maybeKeyword = location.href.split('/').pop().split('.')[0]
    const maybeWordList = maybeKeyword.split('-')
    if (maybeWordList[maybeWordList.length - 1].length < 2) {
      maybeWordList.pop()
    }
    const keyword = maybeWordList.join('-')
    const btn = document.createElement('button')
    btn.style.marginLeft = '5px'
    btn.innerText = 'search'
    btn.onclick = () => {
      window.open(`https://google.com/search?q=${keyword}`)
    }
    document.body.prepend(btn)

    const btnSearchInNJAV = document.createElement('button')
    btnSearchInNJAV.style.marginLeft = '5px'
    btnSearchInNJAV.innerText = 'searchNJAV'
    btnSearchInNJAV.onclick = () => {
      window.open(`https://123av.com/en/search?keyword=${maybeWordList[maybeWordList.length - 1]}`)
    }
    document.body.prepend(btnSearchInNJAV)

    const searchInMagnet = document.createElement('button')
    searchInMagnet.style.marginLeft = '5px'
    searchInMagnet.innerText = 'searchMagnet'
    searchInMagnet.onclick = () => {
      window.open(`https://getmag.net/search?q=${keyword}`)
    }
    document.body.prepend(searchInMagnet)
  }
  runPicView()
  runHiJAV()
})()