Nyaa.si - Load More Thumbnail

Load image from cover/screenshot links.

21.10.2023 itibariyledir. En son verisyonu görün.

  1. // ==UserScript==
  2. // @name Nyaa.si - Load More Thumbnail
  3. // @name:zh-CN Nyaa.si - 自动加载更多预览图
  4. // @namespace none
  5. // @description Load image from cover/screenshot links.
  6. // @description:zh-CN 从封面/截图链接加载图片并显示。
  7. // @version 0.8.3
  8. // @license MIT
  9. // @author York Wang
  10. // @match https://sukebei.nyaa.si/*
  11. // @match https://pics.dmm.co.jp/*
  12. // @match https://imgrock.pw/*
  13. // @match https://picrok.com/*
  14. // @match https://picbaron.com/*
  15. // @match https://imgbaron.com/*
  16. // @match https://kvador.com/*
  17. // @match https://kropic.com/*
  18. // @match https://imgsto.com/*
  19. // @match https://imgsen.com/*
  20. // @match https://imgstar.eu/*
  21. // @match https://picdollar.com/*
  22. // @match https://pics4you.net/*
  23. // @match https://silverpic.com/*
  24. // @match https://fotokiz.com/*
  25. // @match https://premalo.com/*
  26. // @match https://piczhq.com/*
  27. // @match https://trypicz.com/*
  28. // @match http://imglord.com/*
  29. // @match https://croea.com/*
  30. // @match https://imgtaxi.com/*
  31. // @match https://imgadult.com/*
  32. // @match https://imgdrive.net/*
  33. // @match https://xxxwebdlxxx.org/*
  34. // @match https://uvonahaze.xyz/*
  35. // @match https://trans.firm.in/*
  36. // @match https://imgdawgknuttz.com/*
  37. // @match https://imagetwist.netlify.app/*
  38. // @match https://imagetwist.com/*
  39. // @match https://imagexport.com/*
  40. // @match https://hentai4free.net/*
  41. // @match https://pixhost.to/*
  42. // @match https://imgair.net/*
  43. // @match http://imgair.net/*
  44. // @match http://imgfrost.net/*
  45. // @match http://imgblaze.net/*
  46. // @match https://pig69.com/*
  47. // @match https://ai18.pics/*
  48. // @match https://porn4f.com/*
  49. // @match https://javball.com/*
  50. // @match https://ovabee.com/*
  51. // @match https://idol69.net/*
  52. // @run-at document-end
  53. // @grant unsafeWindow
  54. // @grant GM_xmlhttpRequest
  55. // ==/UserScript==
  56.  
  57. (function() {
  58. 'use strict';
  59.  
  60. function Handler(pattern, process, processNyaa) {
  61. this.pattern = pattern
  62. this.process = process
  63. this.processNyaa = processNyaa
  64. }
  65. Handler.prototype.canHandle = function(url) {
  66. return this.pattern.test(url)
  67. }
  68. Handler.prototype.handle = function() {
  69. this.process(url => {
  70. document.location.href = url
  71. unsafeWindow.top.postMessage({"LMT": url}, '*')
  72. })
  73. }
  74. const handlers = []
  75. const addHandler = (pattern, process, processNyaa) => handlers.push(new Handler(pattern, process, processNyaa))
  76.  
  77. addHandler(/^https?:\/\/pics\.dmm\.co\.jp(\/[\w]+)+\.jpg.*/, callback => {
  78. callback(document.location.href.match(/^https?:\/\/pics\.dmm\.co\.jp(\/[\w]+)+\.jpg/)[0])
  79. })
  80. addHandler(/^https?:\/\/(imgrock\.pw)(\/[\w\-]+)+(\.[\w\-]+)+/, callback => {
  81. // pause on CAPTCHA
  82. const iframe = document.querySelector('iframe')
  83. if(iframe && iframe.src.indexOf('captcha') > -1) return
  84.  
  85. const img = document.querySelector('.picview')
  86. if(img) {
  87. callback(img.src)
  88. } else {
  89. const btns = document.querySelectorAll('input[name=fnext]')
  90. for(let i=0;i<btns.length;i++) {if(!btns[i].style.display) btns[i].click()}
  91. const forms = document.querySelectorAll('form')
  92. for(let i=0;i<forms.length;i++) {if(forms[i].hito) {forms[i].submit()}}
  93. }
  94. })
  95. addHandler(/^https?:\/\/(picrok\.com)(\/[\w\-]+)+\.php/, callback => {
  96. // pause on CAPTCHA
  97. const iframe = document.querySelector('iframe')
  98. if(iframe && iframe.src.indexOf('captcha') > -1) return
  99.  
  100. const img = document.querySelector('.picview')
  101. if(img) {
  102. callback(img.src)
  103. } else {
  104. unsafeWindow.setTimeout(() => {
  105. const forms = document.querySelectorAll('form')
  106. const btns = document.querySelectorAll('form>button')
  107. // for(let i=0;i<btns.length;i++) {if(btns[i].style.display) forms[i-1].submit()}
  108. }, 5000)
  109. }
  110. })
  111. addHandler(/^https?:\/\/(picbaron\.com|imgbaron\.com|kvador\.com|kropic\.com|imgsto\.com|imgsen\.com|imgstar\.eu|picdollar\.com|pics4you\.net|silverpic\.com|fotokiz\.com|premalo\.com|piczhq\.com|trypicz\.com|imglord\.com)(\/.+)+(\.[\w\-]+)+/, callback => {
  112. const img = document.querySelector('.pic')
  113. if(img) {
  114. callback(img.src)
  115. } else {
  116. const form = document.querySelector('form')
  117. form && form.submit()
  118. }
  119. })
  120. addHandler(/^https?:\/\/(croea\.com)(\/\w+)+/, callback => {
  121. const img = document.querySelector('.pic')
  122. if(img) {
  123. callback(img.src)
  124. } else {
  125. const form = document.querySelector('form')
  126. form && form.submit()
  127. }
  128. }, url => {
  129. GM_xmlhttpRequest({
  130. method: 'GET',
  131. url: url,
  132. onload: res => {
  133. const src = res.responseText.match(/src="(.*)" class="pic img img-responsive"/)
  134. if(src.length > 1) {
  135. GM_xmlhttpRequest({
  136. method: 'GET',
  137. responseType: "blob",
  138. url: src[1],
  139. onload: res => {
  140. const reader = new FileReader()
  141. reader.onload = () => {
  142. window.postMessage({"LMT": reader.result}, '*')
  143. }
  144. reader.readAsDataURL(res.response)
  145. }
  146. })
  147. }
  148. }
  149. })
  150. })
  151. addHandler(/^https?:\/\/(imgtaxi\.com|imgadult\.com|imgdrive\.net)(\/\w+)+/, callback => {
  152. unsafeWindow.ctipops = []
  153. unsafeWindow.adbctipops = []
  154. const img = document.querySelector('img.centred') || document.querySelector('img.centred_resized')
  155. if(img) {
  156. callback(img.src)
  157. } else {
  158. unsafeWindow.setTimeout(() => {
  159. const btn = document.querySelector('.overlay_ad_link')
  160. if(btn) {
  161. btn.focus()
  162. btn.click()
  163. }
  164. }, 1000)
  165. }
  166. }, url => {
  167. GM_xmlhttpRequest({
  168. method: 'GET',
  169. url: url,
  170. onload: res => {
  171. const src = res.responseText.match(/og:image:secure_url" content="(.*)"/)
  172. if(src.length > 1) window.postMessage({"LMT": src[1].replace('small','big')}, '*')
  173. }
  174. })
  175. })
  176. addHandler(/^https?:\/\/(xxxwebdlxxx\.org)(\/\w+)+/, callback => {
  177. unsafeWindow.ctipops = []
  178. unsafeWindow.adbctipops = []
  179. const img = document.querySelector('img.centred') || document.querySelector('img.centred_resized')
  180. if(img) {
  181. callback(img.src)
  182. } else {
  183. unsafeWindow.setTimeout(() => {
  184. const btn = document.querySelector('.overlay_ad_link')
  185. if(btn) {
  186. btn.focus()
  187. btn.click()
  188. }
  189. }, 1000)
  190. }
  191. })
  192. addHandler(/^https?:\/\/(uvonahaze\.xyz|trans\.firm\.in||imgdawgknuttz\.com)(\/\w+)+/, callback => {
  193. const img = document.querySelector('img.centred') || document.querySelector('img.centred_resized')
  194. if(img) {
  195. callback(img.src)
  196. } else {
  197. const btn = document.querySelector('input[name=imgContinue]')
  198. btn && btn.click()
  199. }
  200. })
  201. addHandler(/^https?:\/\/(imagetwist\.netlify\.app)(\/\w+)+/, callback => {
  202. if(unsafeWindow.targetURL) document.location.href = unsafeWindow.targetURL
  203. const btn = document.querySelector('a.btn')
  204. btn && btn.click()
  205. })
  206. addHandler(/^https?:\/\/(imagetwist\.com|imagexport\.com)(\/\w+)+/, callback => {
  207. const img = document.querySelector('.img-responsive')
  208. if(img) {
  209. callback(img.src)
  210. }
  211. })
  212. addHandler(/^https?:\/\/hentai4free\.net(\/\w+)+/, callback => {
  213. unsafeWindow.wuLu && unsafeWindow.wuLu()
  214. const img = document.querySelector('#image-viewer-container>img')
  215. if(img) {
  216. callback(img.src)
  217. }
  218. })
  219. addHandler(/^https?:\/\/pixhost\.to(\/\w+)+/, callback => {
  220. const img = document.querySelector('img.image-img')
  221. if(img) {
  222. callback(img.src)
  223. } else {
  224. const btn = document.querySelector('a.continue')
  225. btn && btn.click()
  226. }
  227. })
  228. addHandler(/^https?:\/\/(imgair\.net|imgfrost\.net|imgblaze\.net)(\/\w+)+/, callback => {
  229. unsafeWindow.wuLu && unsafeWindow.wuLu()
  230. const img = document.querySelector('#newImgE')
  231. if(img) {
  232. callback(img.src)
  233. }
  234. }, url => {
  235. GM_xmlhttpRequest({
  236. method: 'GET',
  237. url: url.replace(/^https?:\/\/(imgfrost\.net|imgblaze\.net)/, 'https://imgair.net'),
  238. onload: res => {
  239. const src = res.responseText.match(/document\.getElementById\("newImgE"\)\.src = "(.*)"/)
  240. if(src.length > 1) window.postMessage({"LMT": src[1]}, '*')
  241. }
  242. })
  243. })
  244. addHandler(/^https?:\/\/(pig69\.com|ai18\.pics|porn4f\.com|javball\.com|ovabee\.com|idol69\.net)(\/\w+)+/, callback => {
  245. const img = document.querySelector('#fileOriginalModal img')
  246. if(img) {
  247. callback(img.src)
  248. } else {
  249. const btn = document.querySelector('a.continue')
  250. btn && btn.click()
  251. }
  252. }, url => {
  253. GM_xmlhttpRequest({
  254. method: 'GET',
  255. url: url,
  256. onload: res => {
  257. const src = res.responseText.match(/"https?:\/\/((pig69\.com|ai18\.pics|porn4f\.com|javball\.com|ovabee\.com|idol69\.net)\/upload\/Application\/storage\/app\/public\/uploads\/users\/.*)"/)
  258. if(src.length > 1) window.postMessage({"LMT": "http://"+src[1]}, '*')
  259. }
  260. })
  261. })
  262.  
  263. const href = document.location.href
  264. if(/^https?:\/\/(sukebei\.nyaa\.si).+/g.test(href)) {
  265. if(document.title === '502 Bad Gateway') {
  266. document.location.href = document.location.href
  267. return
  268. }
  269. if(/^https?:\/\/(sukebei\.nyaa\.si\/view\/).+/g.test(href)) {
  270. const desc = document.querySelector('#torrent-description')
  271. const links = desc.querySelectorAll('a')
  272. if(!desc || !links) return
  273.  
  274. const list = []
  275. for(let i in links) {
  276. if(!links[i].href) continue
  277. handlers.forEach(h=>{h.canHandle(links[i].href) && list.push({href:links[i].href,handler:h})})
  278. }
  279.  
  280. let LMT_Wrap, LMT_Frame, LMT_Loading
  281. function createWrap() {
  282. desc.parentNode.insertAdjacentHTML('afterend', '<div class="panel panel-default"><div class="panel-body" id="LMT_Wrap"></div></div>')
  283. LMT_Wrap = document.querySelector('#LMT_Wrap')
  284.  
  285. LMT_Loading = document.createElement('div')
  286. LMT_Loading.textContent = 'Loading Images...'
  287. LMT_Wrap.appendChild(LMT_Loading)
  288.  
  289. LMT_Frame = document.createElement('iframe')
  290. LMT_Frame.id = 'LMT_Frame'
  291. LMT_Frame.sandbox = 'allow-forms allow-scripts allow-same-origin'
  292. LMT_Frame.style.display = 'none'
  293. LMT_Wrap.appendChild(LMT_Frame)
  294. }
  295.  
  296. function process() {
  297. if(list.length) {
  298. if(!LMT_Frame) createWrap()
  299. let url = list.shift()
  300. if(url.handler.processNyaa) {
  301. url.handler.processNyaa(url.href)
  302. } else {
  303. LMT_Frame.src = url.href
  304. }
  305. } else {
  306. if(LMT_Frame) {
  307. LMT_Wrap.removeChild(LMT_Frame)
  308. LMT_Wrap.removeChild(LMT_Loading)
  309. }
  310. }
  311. }
  312.  
  313. unsafeWindow.addEventListener('message', function (e) {
  314. if(e.data.LMT) {
  315. LMT_Frame.src = ''
  316. const img = document.createElement('img')
  317. img.src = e.data.LMT
  318. img.style['max-width'] = '100%'
  319. LMT_Wrap.appendChild(img)
  320. process()
  321. }
  322. })
  323.  
  324. process()
  325. }
  326. } else {
  327. handlers.forEach(h=>{h.canHandle(href) && h.handle()})
  328. }
  329. })();