la 图片地址复制

复制 hitoma.la notomi.la 图片链接到剪贴板

当前为 2018-08-30 提交的版本,查看 最新版本

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name                la-image-extractor
// @name:zh-CN          la 图片地址复制
// @description         copy image source in hitomi.la  notomi.la to clipboard
// @description:zh-CN   复制 hitoma.la  notomi.la 图片链接到剪贴板
// @version             0.1.2
// @author              jferroal
// @license             GPL-3.0
// @require             https://greasyfork.org/scripts/31793-jmul/code/JMUL.js?version=209567
// @include             https://hitomi.la/reader/*
// @include             https://nozomi.la/tag/*
// @run-at              document-end
// @namespace           https://greasyfork.org/users/34556-jferroal
// ==/UserScript==

(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function () {
  const href = window.location.href
  const isHitomi = /hitomi/gi.test(href)
  // prepare str2Paste
  let [imgSrcSelector, titleSelector] = ['.tag-list-img', 'h1']
  if (isHitomi) {
    imgSrcSelector = '.img-url'
    titleSelector = 'title'
  }
  let srcs = Array.from(document.querySelectorAll(imgSrcSelector))
  let title = document.querySelector(titleSelector).innerText
  if (isHitomi) {
    title = title.split(' | ')[0]
    const magic = parseInt(window.location.href.split('/').slice(-1)[0][1]) % 2
    if (Number.isNaN(magic)) {
      srcs = []
    } else {
      srcs = srcs.map(s => s.innerText.replace('//g.hitomi.la', `https://${String.fromCharCode(magic + 97)}a.hitomi.la`))
    }
  } else {
    srcs = srcs.map(s => s.src.replace('//tn', '//i').split('.').slice(0, 4).join('.'))
  }
  const str2paste = `${title}\n${srcs.join('\n')}${'\n = ='.repeat(20)}`
  // create button to click
  const btn = document.createElement('div')
  btn.innerText = 'Copy Sources'
  btn.style.textAlign = 'center'
  btn.style.width = '120px'
  btn.style.lineHeight = '40px'
  btn.style.backgroundColor = 'skyblue'
  btn.style.color = 'white'
  btn.style.cursor = 'pointer'
  btn.style.borderRadius = '8px'
  btn.style.boxShadow = '0px 0px 8px 4px rgba(0, 0, 0, .2)'
  btn.style.position = 'fixed'
  btn.style.right = '80px'
  btn.style.bottom = '80px'
  document.body.appendChild(btn)
  // bind copy event
  btn.addEventListener('click', () => {
    const el = document.createElement('textarea')
    el.value = str2paste
    document.body.appendChild(el)
    el.select()
    document.execCommand('copy')
    document.body.removeChild(el)
  })
})()

},{}]},{},[1]);