Handy Image

Shows just fullsize Image with hotkeys & without pop-ups on many image-hosting sites

目前為 2025-02-13 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Handy Image
  3. // @version 2025.02.13
  4. // @author Owyn
  5. // @contributor ubless607, bitst0rm
  6. // @namespace handyimage
  7. // @description Shows just fullsize Image with hotkeys & without pop-ups on many image-hosting sites
  8. // @homepage https://github.com/Owyn/HandyImage
  9. // @supportURL https://github.com/Owyn/HandyImage/issues
  10. // @icon https://i.ibb.co/znz0hry/W9zir-OUGo1.png
  11. // @run-at document-start
  12. // @grant GM.getValue
  13. // @grant GM.setValue
  14. // @grant GM_registerMenuCommand
  15. // @grant GM_unregisterMenuCommand
  16. // @grant GM_getValue
  17. // @grant GM_setValue
  18. // @grant GM_download
  19. // @grant GM_addElement
  20. // @grant unsafeWindow
  21. // @sandbox JavaScript
  22. // @compatible Chrome
  23. // @compatible Firefox
  24. // @match https://www.imagebam.com/image/*
  25. // @match https://www.imagebam.com/view/*
  26. // @match http://imgchili.net/show*
  27. // @match *://imgbox.com/*
  28. // @match *://*.imagetwist.com/*
  29. // @match *://imagexport.com/*
  30. // @match https://*.imagevenue.com/*
  31. // @match *://*.imageshack.com/i/*
  32. // @match *://*.imageshack.com/f/*
  33. // @match *://*.image2you.ru/*/*/
  34. // @exclude *://image2you.ru/cabinet/*
  35. // @exclude *://www.image2you.ru/cabinet/*
  36. // @match https://imageban.ru/show*
  37. // @match *://fastpic.ru/view*
  38. // @match *://fastpic.ru/fullview*
  39. // @match https://fastpic.org/view/*
  40. // @match https://fastpic.org/fullview/*
  41. // @match *://pixhost.to/show/*
  42. // @match http://*.picpicture.com/image/*
  43. // @match http://*.pic5you.ru/*/*/
  44. // @match http://*.tinypic.com/view*
  45. // @match http://radical-foto.ru/*
  46. // @match http://radikal-foto.ru/*
  47. // @match https://radikal.ru/*
  48. // @exclude https://radikal.ru/video/*
  49. // @match http://f-page.ru/*
  50. // @match http://f-picture.net/*
  51. // @match https://*.pimpandhost.com/image*
  52. // @match https://*.pixroute.com/*/*
  53. // @match https://*.picforall.ru/*/*/
  54. // @match *://*.imagecurl.com/view*
  55. // @match *://*.imagecurl.org/view*
  56. // @match http://*.euro-pic.eu/*share*
  57. // @match http://*.xxxhost.me/view*
  58. // @match http://*.imadul.com/?*
  59. // @match *://postimg.org/image/*
  60. // @match *://postimg.cc/*
  61. // @match http://*.niceimage.pl/*.html
  62. // @match http://*.pics-money.ru/*
  63. // @match http://*.freeimgup.com/*.*
  64. // @match http://imgtiger.com/view*
  65. // @match https://*.imgspice.com/*/*
  66. // @match http://*.picage.ru/*/*
  67. // @match http://*.imgserve.net/img*
  68. // @match http://*.images-host.biz/*/*
  69. // @match http://*.imgfantasy.com/*
  70. // @match http://*.platimzafoto.ru/full/
  71. // @match http://*.platimzafoto.ru/*.html
  72. // @match http://imgdino.com/view*
  73. // @match http://*.pic-money.ru/*.html
  74. // @match http://*.pic-money.ru/full/
  75. // @match http://*.imgcandy.net/img*
  76. // @match http://*.imagefolks.com/img*
  77. // @match *://*.pzy.be/v*
  78. // @match https://www.turboimagehost.com/p*
  79. // @match http://*.subirimagenes.com/*.html
  80. // @match http://*.screenlist.ru/details.php?image_id=*
  81. // @match http://qrrro.com/images*
  82. // @match http://imgmade.com/images*
  83. // @match http://www.pic-upload.de/view*
  84. // @match http://picshare.geenza.com/pics*
  85. // @match https://www.imgbabes.com/*/*.htm*
  86. // @match http://ibunker.us/f*
  87. // @match http://ichan.org/image.php?path=*
  88. // @match http://*.imagearn.com/*
  89. // @match http://www.dumppix.com/view*
  90. // @match http://www.bilder-upload.eu/show*
  91. // @match http://www.bilder-hochladen.net/file*
  92. // @match http://www.bild.me/bild.php?*
  93. // @match *://www.imagesnake.com/show*
  94. // @match *://www.imagesnake.com/img*
  95. // @match *://www.imagesnake.com/view*
  96. // @match http://www.imagesnake.org/show*
  97. // @match http://www.imagesnake.org/img*
  98. // @match http://www.imagesnake.org/view*
  99. // @match https://www.freebunker.com/show*
  100. // @match https://www.freebunker.com/img*
  101. // @match https://www.freebunker.com/view*
  102. // @match http://bayimg.com/*
  103. // @match http://*.directupload.net/file*
  104. // @match http://*.imagecherry.com/*
  105. // @match https://funkyimg.com/view*
  106. // @match http://*.abload.de/image.php?*
  107. // @match http://*.picfox.org/share*
  108. // @match http://*.pixup.us/img-*
  109. // @match http://*.imagecarry.com/*/*
  110. // @match http://*.imagedunk.com/*/*
  111. // @match http://*.imageswitch.com/*/*
  112. // @match http://*.piclambo.net/*/*
  113. // @match http://*.picleet.com/*/*
  114. // @match http://*.yankoimages.net/*/*
  115. // @match http://*.picturedip.com/*/*
  116. // @match https://*.imagedecode.com/img-*
  117. // @match https://*.imagefruit.com/img*
  118. // @match https://*.imagefruit.com/show*
  119. // @match https://*.miragepics.com/view*
  120. // @match http://*.freeimagehosting.net/*
  121. // @match http://*.keptarolo.hu/*
  122. // @match http://www.uploadhouse.com/view*
  123. // @match http://*.dumpt.com/img/view*
  124. // @match http://imagezilla.net/show/*
  125. // @match https://*.imageup.ru/img*
  126. // @match http://*.casimages.com/photos/*/*/*
  127. // @match http://*.casimages.com/img*
  128. // @match http://*.cyberpics.net/p*
  129. // @match *://vvcap.com/*
  130. // @match https://*.freeimage.us/share*
  131. // @match http://*.pix-x.net/*/*
  132. // @match http://*.shareimages.com/image*
  133. // @match http://www.xtremeshack.com/image/*
  134. // @match http://*.mrjh.org/gallery.php?entry=*
  135. // @match http://*.itmages.ru/image/view*
  136. // @match http://shrani.najdi.si/*
  137. // @match http://*.iv.pl/view*
  138. // @match http://*.image18.org/show/*
  139. // @match http://*.pic4you.ru/*
  140. // @match http://picload.org/view*
  141. // @match http://*.thebestpichost.com/picture/*
  142. // @match *://*.lostpic.net/image/*
  143. // @match http://subefotos.com/ver/*
  144. // @exclude http://subefotos.com/ver/*#codigos
  145. // @match http://*.pixsor.com/share*
  146. // @match http://*.pixsor.com/XXX/share*
  147. // @match http://*.image-share.com/i*html
  148. // @match http://*.npicture.net/share-*
  149. // @match http://*.overpic.net/view*
  150. // @match http://*.imagecross.com/*
  151. // @match http://*.mojoimage.com/*
  152. // @match http://www.use.com/*
  153. // @match http://www.hostingpics.net/view*
  154. // @match http://*.pictureshoster.com/view*
  155. // @match http://*.imageshost.ru/photo*
  156. // @match http://*.imagestime.com/show*
  157. // @match http://sharenxs.com/view*
  158. // @match http://sharenxs.com/gallery/*/*
  159. // @match http://img4.imagetitan.com/img*
  160. // @match *://*.imagenpic.com/*
  161. // @match http://*.stuffed.ru/images*
  162. // @match http://*.wstaw.org/w/*
  163. // @match http://www.imagesocket.com/photos*
  164. // @match http://www.imagesocket.com/social*
  165. // @match http://imageban.net/show*
  166. // @match http://*.otofotki.pl/*
  167. // @match http://*.imgsin.com/view*
  168. // @match http://*.imagenetz.de/*
  169. // @match http://pix.toile-libre.org/?img*
  170. // @match *://servimg.com/view/*
  171. // @match http://*.upix.me/files/*
  172. // @match http://*.upix.me/i/v/?q=*
  173. // @match http://*.pixelup.net/image*
  174. // @match http://*.pixelup.net/image*
  175. // @match http://*.picsee.net/*
  176. // @match http://www.fotosik.pl/pokaz_obrazek/pelny*
  177. // @match https://*.depic.me/*
  178. // @match http://www.xup.in/dl*
  179. // @match http://*.hotchyx.com/d*
  180. // @match http://*.imageupper.com/i/*
  181. // @match *://beeimg.com/view*
  182. // @match http://www.noelshack.com/*.*
  183. // @match http://www.turbopix.fr/v/*
  184. // @match http://thumbsnap.com/*
  185. // @match http://deffe.com/image/*
  186. // @match http://*.imageno.com/*.html
  187. // @match http://*.imagehousing.com/image*
  188. // @match http://www.picfront.org/d/*
  189. // @match http://*.imagehost.thasnasty.com/?*
  190. // @match http://*.imagilive.com/*.htm*
  191. // @match http://*.picturevip.com/*
  192. // @exclude http://*.picturevip.com/x/clean/
  193. // @match http://img.3ezy.net/*.htm
  194. // @match http://*.xximg.net/img-*
  195. // @match http://*.zaslike.com/view*
  196. // @match http://www.zimagez.com/zimage*
  197. // @match http://*.pictureturn.com/*.html
  198. // @match http://*.cubeupload.com/im/*
  199. // @match http://www.photo-host.org/view-image/*
  200. // @match http://www.fotoszok.pl/show*
  201. // @match http://*.imglink.ru/show*
  202. // @match http://zapodaj.net/*.html
  203. // @match http://www.pixic.ru/view*
  204. // @match http://www.imagesup.de/picture.php?code=*
  205. // @match https://www.pornbus.org/show*
  206. // @match http://www.bilder-space.de/bild-*
  207. // @match *://www.imgcarry.com/show*
  208. // @match http://*.saveimg.ru/show*
  209. // @match http://www.fotos-hochladen.net/view*
  210. // @match http://simplest-image-hosting.net/*
  211. // @match http://jpegbay.com/gallery/*.html
  212. // @match https://www.hostpic.org/view*
  213. // @match *://imagik.fr/image/*
  214. // @match http://www.image-load.net/show*
  215. // @match http://*.sxpics.nl/img-*
  216. // @match http://*.gallerycloud.net/image/*
  217. // @match http://tryimg.com/image/*
  218. // @match http://bilder.nixhelp.de/display-*
  219. // @match http://*.funextra.hostzi.com/view*
  220. // @match http://*.freakimage.com/view*
  221. // @match http://*.fotoo.pl/show.php?img=*.html
  222. // @match http://*.rapid-img.de/img.php?f=*
  223. // @match http://*.upload.djmaster.fr/?v=*
  224. // @match http://img.pereslavl.ru/share*
  225. // @match http://*.dwimg.com/view*
  226. // @match http://www.imageurlhost.com/view*
  227. // @match http://*.imagesup.net/*
  228. // @match http://*.superkipje.com/view*
  229. // @match https://*.2i.sk/i/*
  230. // @match https://imgadult.com/img-*
  231. // @match http://imagebic.com/?v=*
  232. // @match http://www.picshot.pl/public/view*
  233. // @match http://*.imagesmax.de/display-*
  234. // @match http://*.ifotos.pl/zobacz/*
  235. // @match http://www.zimage.fr/photo.php?id=*
  236. // @match http://www.zimage.fr/taillereel.php?id=*
  237. // @match http://ngarko.online.fr/view*
  238. // @match http://*.b4he.com/?v=*
  239. // @match http://*.oxily.com/?*
  240. // @match http://ghanaimages.co/?*
  241. // @match http://*.imgplus.info/view*
  242. // @match http://firepic.org/?v=*
  243. // @match http://savepic.org/*.htm
  244. // @match http://*.fastimages.ru/p*
  245. // @match http://ipic.su/?page=img&pic=*
  246. // @match http://*.jpegshare.net/*.html
  247. // @match http://*.overdream.cz/*
  248. // @match http://*.fastpics.net/?v=*
  249. // @match http://www.ii4.ru/image-*
  250. // @match http://*.picuploader.de/*
  251. // @match http://*.rupict.ru/share*
  252. // @match http://bildr.no/view*
  253. // @match http://www.subeimagenes.com/img*
  254. // @match http://screenshot.ru/*
  255. // @match http://*.hostpix.de/show.php?img*
  256. // @match http://*.freeuploadimages.org/view*
  257. // @match http://smages.com/?v=*
  258. // @match https://*.hostingkartinok.com/show-image.php?id=*
  259. // @match http://*.4put.ru/*max*
  260. // @match http://www.pictureshack.ru/view*
  261. // @match http://*.host99.byethost4.com/share.php?id=*
  262. // @match http://*.eazypics.net/share*
  263. // @match http://xtupload.com/share.php?id=*
  264. // @match http://t.williamgates.net/share*
  265. // @match *://photosex.biz/v.php?id=*
  266. // @match http://*.imageteam.org/img-*
  267. // @match http://*.hostimage.ru/photo*
  268. // @match http://www.loaditup.de/*.html
  269. // @match http://*.imgbox.de/show/img*
  270. // @match http://*.picszone.net/view*
  271. // @match http://*.images.share-films.net/view*
  272. // @match http://www.uploadking.biz/show*
  273. // @match http://foto.xhost.lv/show.php?img=*
  274. // @match http://*.imagefile.org/view*
  275. // @match http://*.onimage.net/show*
  276. // @match http://*.uploadagent.de/show*
  277. // @match http://*.bildjunkies.de/view*
  278. // @match http://*.foto.hcfor.pl/view*
  279. // @match http://*.pic.tooptarinha.com/view*
  280. // @match http://*.poopr.org/view*
  281. // @match http://*.xp-images.hi2.ro/view*
  282. // @match http://*.dayzeddesigns.com/view*
  283. // @match http://*.freeimghosting.co.uk/view*
  284. // @match http://*.123poze.3x.ro/view*
  285. // @match http://*.upload.removed.us/view*
  286. // @match http://*.ximg.co.uk/view*
  287. // @match http://sl-images.ath.cx/view*
  288. // @match http://*.picatom.com/*
  289. // @match https://*.picshare.ru/image/*
  290. // @match http://*.imghost.pl/index.php?id=*
  291. // @match http://*.udostepniaj.pl/view*
  292. // @match http://*.hosting-zdjec.pl/view*
  293. // @match http://*.zapisz.net/view*
  294. // @match http://www.imagehosting.cz/?v=*
  295. // @match http://www.dumparump.com/view*
  296. // @match http://*.myxpic.com/showpic*
  297. // @match http://*.picness.com/image/*
  298. // @match http://h4z.it/View*
  299. // @match http://*.freeamateurteens.net/view*
  300. // @match http://*.fotoshack.us/foto*
  301. // @match https://*.imagebin.ca/v/*
  302. // @match http://*.loadpix.de/*.html
  303. // @match http://www.public-pic.de/image/show/*
  304. // @match http://*.9foto.ru/photo/*
  305. // @match http://uploads.ru/*
  306. // @match http://*.storepic.com/show*
  307. // @match http://www.myimg.de/?img=*
  308. // @match http://*.root-space.eu/file*
  309. // @match http://*.hot-file.org/p*
  310. // @match http://*.hostarea.de/show*
  311. // @match http://mepic.ru/view/?id=*
  312. // @match http://*.upislam.com/view*
  313. // @match http://*.ngarko.free.fr/view*
  314. // @match http://*.add-screen.com/view*
  315. // @match http://image.siroro.co.uk/p*
  316. // @match http://thaisharing.online.fr/view*
  317. // @match http://*.images.collectiontricks.it/view*
  318. // @match http://*.my-collection.ru/view*
  319. // @match http://img.schattorie.nl/view*
  320. // @match http://*.forexrainbow.com/view*
  321. // @match http://*.imgupload.pl/view*
  322. // @match http://*.1y9y.com/view*
  323. // @match http://*.addpix.net/view*
  324. // @match http://www.myuploadedimages.com/view*
  325. // @match http://multihoster.saxonia-fighter.de/view*
  326. // @match http://knecht.novarata.net/?*
  327. // @match http://*.img.irandeliver.com/?*
  328. // @match http://*.xferz.com/?*
  329. // @match http://*.up.kfesfahan.com/?*
  330. // @match http://upload.khontai.com/?*
  331. // @match http://*.image.pantyhosemania.info/?*
  332. // @match http://*.addyourpics.com/image*
  333. // @match http://*.imgnext.com/img-*
  334. // @match http://*.qattach.com/p*
  335. // @match http://*.host4images.com/view*
  336. // @match http://*.imgbank.cz/*
  337. // @match http://*.nyanimg.com/*
  338. // @match http://*.geekpics.in/*
  339. // @match http://*.imagesloading.altervista.org/?*
  340. // @match http://*.showmyimage.com/*
  341. // @match http://*.phpbbmods.it/immaggini*
  342. // @match http://upload.supreme-elite.fr/?*
  343. // @match http://*.fotohelp.kz/image*
  344. // @match https://*.myimg.me/*
  345. // @match http://*.heberg-hush.org/?*
  346. // @match http://*.oltaciyukle.com/*
  347. // @match http://*.pichost.name/*
  348. // @match *://*.fsfiles.org/flightsimshotsv2/image/*
  349. // @match http://*.imagend.com/*
  350. // @match http://*.imagerocket.com/*
  351. // @match http://*.hyyathost.com/*
  352. // @match http://images.reptilescanada.com/*
  353. // @match http://*.lakhdaria.net/imagebank/?*
  354. // @match http://*.webjardiner.com/hebergement_images_photos/image*
  355. // @match http://*.intergranada.com/images/?*
  356. // @match http://*.partizansk.eu/foto/image*
  357. // @match http://*.xenopix.com/?*
  358. // @match http://*.wepic.ru/*
  359. // @match http://*.imgup.com/images*
  360. // @match http://*.picturepush.com/public*
  361. // @match http://*.upload-image.fr/*
  362. // @match http://*.iezz.com/?*
  363. // @match https://*.images.baconbits.org/?*
  364. // @match http://*.upanh.ovo.vn/*
  365. // @match http://*.wrzucaj.net/*
  366. // @match http://*.heberge-images.com/?*
  367. // @match http://www.image.kg/*
  368. // @match http://*.savemyimage.com/*
  369. // @match http://*.img.dramacafe.tv/*
  370. // @match http://*.hosturimage.com/img-*
  371. // @match http://*.pic-mir.ru/*/*
  372. // @match http://*.244pix.com/view*
  373. // @match http://*.uploadimage.ro/view*
  374. // @match https://*.imgflare.com/*/*
  375. // @match https://www.imagefap.com/photo/*
  376. // @match https://www.imagefap.com/video.php?vid=*
  377. // @match http://filefap.com/view*
  378. // @match https://imgur.com/*
  379. // @match https://m.imgur.com/*
  380. // @exclude https://imgur.com/a/*
  381. // @exclude https://m.imgur.com/a/*
  382. // @match https://motherless.com/*
  383. // @match https://*.tumblr.com/image/*
  384. // @match https://*.media.tumblr.com/*.*
  385. // @match http://*.imageporter.com/*
  386. // @match http://*.damimage.com/img-*
  387. // @match https://fapping.empornium.sx/image/*
  388. // @match http://imgboxxx.com/view*
  389. // @match http://*.imghere.net/view*
  390. // @match http://*.sharepic.biz/show-image.php?id=*
  391. // @match http://f-lite.ru/*
  392. // @match http://*.picturescream.com/*
  393. // @match http://*.imgdone.com/view*
  394. // @match https://*.2i.cz/i/*
  395. // @match http://awesomescreenshot.com/*
  396. // @match https://www.flickr.com/photos/*/*/*
  397. // @exclude https://www.flickr.com/photos/*/galleries/*
  398. // @exclude https://www.flickr.com/photos/*/albums/*
  399. // @exclude https://www.flickr.com/photos/sets/*
  400. // @exclude https://www.flickr.com/photos/tags/*
  401. // @exclude https://www.flickr.com/photos/page*
  402. // @exclude https://www.flickr.com/photos/with*
  403. // @exclude https://www.flickr.com/photos*favorites*
  404. // @match http://www.amateri.cz/g*/*
  405. // @match *://*.wikipedia.org/wiki/*:*.jp*
  406. // @match *://*.wikipedia.org/wiki/*:*.png
  407. // @match *://*.wikimedia.org/wiki/*:*.jp*
  408. // @match *://*.wikimedia.org/wiki/*:*.pn*
  409. // @match *://*.xxxscreens.com/img-*
  410. // @match http://avenuexxx.com/*-*
  411. // @match http://avenuexxx.com/archives/*/*
  412. // @exclude http://avenuexxx.com/archives/category/*
  413. // @match http://www.bilderhoster.net/*.html
  414. // @match http://*.xxxscreens.com/img-*
  415. // @match http://*.imgdope.com/view*
  416. // @match http://*.imagehost.eu/*
  417. // @match http://*.aveimage.com/view*
  418. // @match *://*.fappic.com/*
  419. // @match http://*.imagenimage.com/*/*
  420. // @match http://*.adultur.com/img-*
  421. // @match https://*.imageshimage.com/*/*
  422. // @match http://*.imgswift.com/*/*
  423. // @match http://*.imageporn.eu/?v=*
  424. // @match https://*.500px.com/photo/*
  425. // @match http://*.greenpiccs.com/images/*.html
  426. // @match http://*.hostmat.eu/view*
  427. // @match http://*.photobucket.com/user/*/media/*.htm*
  428. // @match https://www.imgshots.com/img*
  429. // @match https://www.imgshots.com/show/*
  430. // @match https://*.3xplanet.com/view*
  431. // @match https://*.3xplanet.net/view*
  432. // @match http://*.imgmega.com/*.html
  433. // @match *://img.yt/img-*
  434. // @match http://*.payforpic.ru/*/*/
  435. // @match http://*.keep4u.ru/full/*
  436. // @match http://*.pic.re/*.html
  437. // @match http://*.freshpics.ru/*/*/
  438. // @match *://*.imgseeds.com/img-*
  439. // @match https://*.pronpic.org/*/*
  440. // @match https://prnt.sc/*
  441. // @match http://*.imgdream.net/view*
  442. // @match http://*.imgtab.net/*
  443. // @match http://*.kephost.com/image/*
  444. // @match http://i.ruspotting.net/image/*
  445. // @match https://*.gifyu.com/image/*
  446. // @match http://celebimg.com/image/*
  447. // @match http://*.sharepic.org/image/*
  448. // @match http://*.zuly.de/image/*
  449. // @match http://upload.vstanced.com/image/*
  450. // @match http://*.thro.bz/image/*
  451. // @match http://*.qoou.net/image/*
  452. // @match http://brightpic.tk/image/*
  453. // @match http://*.cweb-pix.com/image/*
  454. // @match http://hosting.webspell.fr/image/*
  455. // @match http://*.i-pict.ru/image/*
  456. // @match http://*.images.woh.to/image/*
  457. // @match http://*.imghaze.com/image/*
  458. // @match http://*.imgup.nl/image/*
  459. // @match http://*.nium.co/image/*
  460. // @match http://pix.hostux.net/image/*
  461. // @match http://*.pixoload.de/image/*
  462. // @match http://*.primeimg.co/image/*
  463. // @match http://pic.xtream-reallife.de/image/*
  464. // @match http://*.ultraimg.com/image/*
  465. // @match http://demo.chevereto.com/image/*
  466. // @match *://imgclick.net/*/*
  467. // @match http://*.gogoimage.org/img-*
  468. // @match http://imgmoney.ru/*.html
  469. // @match http://imgmoney.ru/full/
  470. // @match http://*.imglooks.com/img-*
  471. // @match http://*.you-logo.ru/show*
  472. // @match http://*.uploadimagex.com/view*
  473. // @match http://*.powerlogo.ru/show*
  474. // @match http://youpicture.org/?v=*
  475. // @match http://*.all-poster.ru/?v=*
  476. // @match http://*.picbug.ru/share*
  477. // @match http://*.sxpix.nl/img-*
  478. // @match http://*.hotflick.net/u/v/?q=*
  479. // @match http://*.hotflick.net/f/v/?q=*
  480. // @match http://vavvi.com/images/*.html
  481. // @match https://www.deviantart.com/*/art/*
  482. // @match http://*.myceleb.net/u/v/?q=*
  483. // @match http://*.imageblinks.com/img-*
  484. // @match *://*.gelbooru.com/index.php?page=post&s=view&id=*
  485. // @match *://*.youhate.us/index.php?page=post&s=view&id=*
  486. // @match https://safebooru.org/index.php?page=post&s=view&id=*
  487. // @match https://danbooru.donmai.us/posts/*
  488. // @match http://konachan.com/post/show/*
  489. // @match http://konachan.net/post/show/*
  490. // @match https://yande.re/post/show/*
  491. // @match https://chan.sankakucomplex.com/*posts/*
  492. // @match https://idol.sankakucomplex.com/*posts/*
  493. // @match https://yande.re/post/show/*
  494. // @match http://www.zerochan.net/*
  495. // @match http://imgzap.com/view*
  496. // @match http://*.olivepix.com/view/*
  497. // @match http://*.ocaload.com/img-*
  498. // @match http://*.imghit.com/img-*
  499. // @match http://*.imageon.org/img-*
  500. // @match http://*.imgcentral.com/view*
  501. // @match http://*.chronos.to/*
  502. // @match http://picspornfree.me/img-*
  503. // @match http://*.pic-you.com/p*
  504. // @match http://*.image-bugs.com/*mage/*
  505. // @match https://*.imgdrive.net/img-*
  506. // @match https://www.pixiv.net/*/artworks/*
  507. // @match http://*.scrin.org/?v=*
  508. // @match http://*.thumbnailus.com/img-*
  509. // @match http://*.nimplus.com/img-*
  510. // @match https://*.imgtaxi.com/img-*
  511. // @match http://*.imgstudio.org/img-*
  512. // @match http://goimge.com/img-*
  513. // @match http://*.safeimage.biz/image/*
  514. // @match http://*.imgbase.online/*/*/
  515. // @match http://*.picpays.ru/*/*/
  516. // @match http://*.imgclover.com/image/*
  517. // @match http://*.imgz.pw/share-*
  518. // @match http://*.imgz.pw/ch/image/*
  519. // @match *://*.imgking.co/img*
  520. // @match http://ask.fm/*/photo/original
  521. // @match http://*.newimagepost.com/img-*
  522. // @match http://*.imageho.me/img-*
  523. // @match http://myimg.club/*
  524. // @match https://www.hotimage.uk/*mg-*
  525. // @match http://*.10.imageleon.com/i-*
  526. // @match https://www.dropbox.com/s/*/*
  527. // @match http://imgor.net/img-*
  528. // @match http://*.imagedax.net/*/*.html
  529. // @match https://*.imgmonkey.com/*/*.html
  530. // @match http://*.fapat.me/img-*
  531. // @match http://photo.weibo.com/*/large/photo_id/*
  532. // @match https://*.crazyimg.com/images/*.html
  533. // @match http://imgbe.com/img-*
  534. // @match https://*.imgextra.uk/image/*
  535. // @match http://*.extraimago.com/image/*
  536. // @match http://*.fireimg.cc/img-*
  537. // @match http://www.pornimagex.com/image/*
  538. // @match http://*.imgboom.net/*
  539. // @match http://*.img24.org/*.html
  540. // @match http://*.img24.org/full/
  541. // @match http://*.pic-maniac.com/*
  542. // @match https://*.instagram.com/p/*
  543. // @exclude https://instagram.com/p/*/embed/*
  544. // @exclude https://*.instagram.com/p/*/embed/*
  545. // @match http://*.imgsay.com/?v=*
  546. // @match http://*.imgsmile.com/?v=*
  547. // @match http://*.balkanelite.org/MultiHoster/view*
  548. // @match https://twitter.com/*/photo/*
  549. // @match https://mobile.twitter.com/*/photo/*
  550. // @match https://x.com/*/photo/*
  551. // @match https://mobile.x.com/*/photo/*
  552. // @match http://*.icezap.com/img-*
  553. // @match *://*.rapidimg.net/img-*
  554. // @match http://*.imgtornado.com/img-*
  555. // @match http://*.daily-img.com/image/*
  556. // @match http://*.imageab.com/image/*
  557. // @match http://*.erimge.com/img-*
  558. // @match http://*.imgtrial.com/img-*
  559. // @match https://imgtown.net/*.php
  560. // @match http://ameblo.jp/*/image-*
  561. // @match http://*.loftlm.ru/img-*
  562. // @match http://*.imgdragon.com/*/*.html
  563. // @match http://ftop.ru/*/*
  564. // @match http://*.imgurx.net/share*
  565. // @match http://savepic.ru/*.htm
  566. // @match http://*.imgmaid.net/*
  567. // @match http://*.imggold.org/*/*.html
  568. // @match http://*.imgcredit.xyz/img-*
  569. // @match http://*.imgcredit.xyz/p/img-*
  570. // @match http://*.imgcredit.xyz/image/*
  571. // @match http://*.dimtus.com/img-*
  572. // @match http://*.coreimg.net/*
  573. // @match http://sfwimg.com/image/*
  574. // @match http://*.img3x.com/image/*
  575. // @match http://*.imguniversal.com/*
  576. // @match http://*.imagepearl.com/view/*
  577. // @match http://*.imagepearl.com/verify/*
  578. // @match http://*.tinizo.com/img-*
  579. // @match *://*.imgkings.com/img*
  580. // @match http://*.imagerar.com/img*
  581. // @match http://*.sendpic.org/view/*
  582. // @match *://www.porncomix.info/*/*/
  583. // @exclude *://www.porncomix.info/gallery/*
  584. // @exclude *://www.porncomix.info/artist/*
  585. // @match *://*.picclock.ru/*/*/
  586. // @match http://*.svetmonet.ru/*.html
  587. // @match http://*.svetmonet.ru/full/
  588. // @match http://*.imgpix.net/*
  589. // @match http://*.freeimagehostin.com/img-*
  590. // @match http://www.mixbase.net/gallery/image.*
  591. // @match https://www.adultimages.xyz/*/image*.html
  592. // @match http://*.pic4share.ru/*.html
  593. // @match http://*.pic4share.ru/full/
  594. // @match http://*.sximg.nl/img-*
  595. // @match http://*.0img.net/?v=*
  596. // @match https://ss.movierls.net/image/*
  597. // @match http://www.xxximagetpb.org/image/*
  598. // @match http://www.pixsense.net/site/v/*
  599. // @match http://www.imgsky.net/*
  600. // @match http://www.imagespicy.site/site/v/*
  601. // @match https://outletpic.com/*.php
  602. // @match http://*.pix.ac/image/*
  603. // @match *://*.imgmak.com/image/*
  604. // @match http://*.freephotohostin.com/img-*
  605. // @match http://*.imgcat.pw/img-*
  606. // @match http://*.levinpic.org/*.html
  607. // @match https://www.sparrowpics.com/image/*
  608. // @match http://*.imgmax.com/image/*
  609. // @match https://lostpix.com/?v=*
  610. // @match https://extraimago.com/image/*
  611. // @match http://www.joblo.com/hollywood-celebrities/hottie-profile/*/image-gallery/*.jpg
  612. // @match *://extraimage.net/image/
  613. // @match *://www.bellazon.com/main/attachment/*
  614. // @match *://extraimage.net/image/*
  615. // @match https://www.artstation.com/artwork/*
  616. // @match http://bcy.net/illust/detail/*
  617. // @match http://*.imgpics.nl/img-*
  618. // @match http://*.imagexxx18.com/image/*
  619. // @match http://*.imagepics.xyz/img-*
  620. // @match *://postto.me/*
  621. // @match http://*.imgskull.xyz/image/*
  622. // @match http://*.imgskull.com/image/*
  623. // @match *://*.ninjaimages.com/*.html
  624. // @match *://*.imgprime.com/img*
  625. // @match *://*.piccash.net/*/*/
  626. // @exclude *://piccash.net/cabinets/*
  627. // @exclude *://www.piccash.net/cabinets/*
  628. // @match http://imgwo.com/img-*
  629. // @match http://luxpic.ru/images/*.html
  630. // @match http://*.pic-images.ru/full/
  631. // @match http://*.pic-images.ru/*.html
  632. // @match http://*.imgspic.ru/full/
  633. // @match http://*.imgspic.ru/*.html
  634. // @match http://imgleveret.com/img-*
  635. // @match http://porn84.org/img-*
  636. // @match https://*.ima.gy/i/*
  637. // @match http://picpower.ru/full/
  638. // @match http://picpower.ru/*.html
  639. // @match http://piccloud.ru/full/
  640. // @match http://piccloud.ru/*.html
  641. // @match https://imgbase.ru/*/*/
  642. // @match http://*.sexybabepics.net/img-*.html
  643. // @match http://*.sexybabepics.net/x/image/*
  644. // @match http://*.imagecrest.com/verify/*
  645. // @match http://*.imagecrest.com/view/*
  646. // @match https://*.picz.site/img-*.html
  647. // @match http://*.allxpix.com/img-*.html
  648. // @match http://pixxsees.ru/full/
  649. // @match http://pixxsees.ru/*.html
  650. // @match http://imgblank.com/img-*.html
  651. // @match http://imgtrex.com/*/*
  652. // @match https://imgwallet.com/img-*.html
  653. // @match http://2picsun.ru/full/
  654. // @match http://2picsun.ru/*.html
  655. // @match http://picpie.org/image/*
  656. // @match *://*.xeimg.yt/img-*.html
  657. // @match *://*.imagedisco.net/?v=*
  658. // @match http://*.imgmain.com/img-*.html
  659. // @match http://*.imgvisits.com/*
  660. // @match *://pixxxels.org/image/*
  661. // @match http://img-pika.ru/full/
  662. // @match http://img-pika.ru/*.html
  663. // @match http://imgcach.ru/*/*/
  664. // @match https://*.xhamster19.com/photos/gallery/*/*
  665. // @match https://*.xhamster11.com/photos/gallery/*/*
  666. // @match https://*.xhamster4.com/photos/gallery/*/*
  667. // @match https://*.xhamster3.com/photos/gallery/*/*
  668. // @match https://*.xhamster.com/photos/gallery/*/*
  669. // @match https://*.xhamster.desi/photos/gallery/*/*
  670. // @exclude /^https://(.*\.)?xhamster(\d{1,2})?\.(com|desi)/photos/gallery/.*/\d{1,3}$/
  671. // @match http://*.imghall.com/?v=*
  672. // @match https://*.acidimg.cc/img-*
  673. // @match https://imgcloud.pw/image/*
  674. // @match https://z4a.net/image/*
  675. // @match https://t.hogor.net/?pm=*
  676. // @match http://xxxwebdlxxx.org/*.html
  677. // @match https://www.sizzlingclicks.com/image/*
  678. // @match http://wwxxww.ru/*.html
  679. // @match http://wwxxww.ru/full/
  680. // @match http://passpix.com/images/*
  681. // @match http://*.imgseed.com/img-*.html
  682. // @match http://img.folluo.me/image/*
  683. // @match *://imgpart.com/img-*
  684. // @match https://picstate.com/view/full/*
  685. // @match https://jerking.empornium.ph/image/*
  686. // @match https://truepic.org/*
  687. // @match https://www.jiopic.com/image/*
  688. // @match https://imx.to/img-*
  689. // @match https://imx.to/i/*
  690. // @match https://pixxxels.cc/*
  691. // @match http://picpic.online/*/*/
  692. // @match http://imgking.xyz/*.html
  693. // @match http://moreimage.pw/image/*
  694. // @match https://imgsha.com/i/*
  695. // @match https://www.pic-upload.de/view-*/*.html
  696. // @match http://pic3you.org/*.html
  697. // @match http://pic3you.org/full/
  698. // @match *://*.vipix.pw/images/*.html
  699. // @match https://*.imgazure.com/*.html
  700. // @match https://*.imgazure.com/full/
  701. // @match *://*.dpic.me/*
  702. // @match *://*.picmoza.com//img-*.html
  703. // @match *://suckmypic.net/*
  704. // @match *://pic.hotimg.site/img-*.html
  705. // @match http://*.shaggyimg.pro/*.html
  706. // @match http://*.shaggyimg.pro/full/
  707. // @match https://*.imgjazz.xyz/img-*.html
  708. // @match https://22pixx.xyz/i*-*/*.html
  709. // @match https://22pixx.xyz/i-*/*.html
  710. // @match https://22pixx.xyz/x-*/*.html
  711. // @match https://22pixx.xyz/y-*/*.html
  712. // @match *://trueimg.xyz/u-*/*.html
  713. // @match *://imgsmarts.info/*.html
  714. // @match *://imgsmarts.info/full/
  715. // @match *://www.keepimg.com/image/*
  716. // @match https://ibb.co/*
  717. // @match http://*.imgsee.net/*
  718. // @match *://*.picbaron.com/*/*.html
  719. // @match *://*.imgbaron.com/*/*
  720. // @match https://kvador.com/*/*.html
  721. // @match http://picshost.info//img-*.html
  722. // @match *://imagescanner.cc/images/*.html
  723. // @match http://batpic.com/image/*
  724. // @match http://*.1pic.org/view/*.html
  725. // @match *://lookimg.com/image/*
  726. // @match http://*.xfap.fun/img-*.html
  727. // @match *://*.hdmoza.com//img-*.html
  728. // @match *://trans.firm.in/images/*.html
  729. // @match http://*.imgtorrnt.in/view.php?id=*
  730. // @match https://*.dailyimages.xyz/*.html
  731. // @match https://*.dailyimages.xyz/full/
  732. // @match http://*.petrovixxxjav.com//img-*.html
  733. // @match *://*.placeimg.net/img-*.html
  734. // @match https://subefotos.com/ver/?*
  735. // @match http://*.imageshtorm.com/img-*.html
  736. // @match https://*.blameless.work/img-*.html
  737. // @match https://trumbhost.com/images/*.html
  738. // @match http://*.xxx.kodiak.top/img-*.html
  739. // @match *://*.your-pictures.net/p*/*.html
  740. // @match https://*.xaoutchouc.live/img-*.html
  741. // @match https://*.picusha.net/?v=*
  742. // @match https://e621.net/posts/*
  743. // @match https://rule34.xxx/index.php?page=post&s=view&id=*
  744. // @match https://*.rule34hentai.net/post/view/*
  745. // @match https://pixs.cx/*
  746. // @match *://mshelxxx.ru.com//img-*.html
  747. // @match *://www.hentai-foundry.com/pictures/*
  748. // @exclude *://www.hentai-foundry.com/pictures/user/*/page/*
  749. // @match *://imgcredit.xyz/image/*
  750. // @match *://drlink.online/*/*/
  751. // @match https://savepice.ru/full/*.html
  752. // @match https://kropic.com/*/*.html
  753. // @match http://*.imgzong.xyz/*
  754. // @match https://www.furaffinity.net/view/*
  755. // @match http://imageking.xyz/*
  756. // @match http://imgxx.xyz/*
  757. // @match http://imgao.xyz/*
  758. // @match http://imgweng.xyz/*
  759. // @match http://imgkes.xyz/*
  760. // @match https://imgair.net/*
  761. // @match https://imgtgd.shop/*
  762. // @match https://*.imgsto.com/*/*.html
  763. // @match https://*.pics4you.net/*/*.html
  764. // @match https://vipr.im/*
  765. // @match https://*.trans.firm.in/img-*.html
  766. // @match https://*.imgdawgknuttz.com/img-*.html
  767. // @match https://*.xxxwebdlxxx.top/img-*.html
  768. // @match https://*.olarixas.xyz/img-*.html
  769. // @match http://imgkoi.xyz/*
  770. // @match https://imagehaha.com/*/*
  771. // @match https://picshick.com/*/*
  772. // @match https://imgsen.com/*/*.html
  773. // @match https://premalo.com/*/*.html
  774. // @match https://picdollar.com/*/*.html
  775. // @match https://fotokiz.com/*/*.html
  776. // @match https://silverpic.com/*/*.html
  777. // @match http://imglin.xyz/*
  778. // @match *://*.crownimg.com/*/*.html*
  779. // @match http://imgkr.xyz/*
  780. // @match *://*.xxxwebdlxxx.org/img-*.html
  781. // @match http://imgbird.xyz/*
  782. // @match https://*.pornhd720p.com//img-*.html
  783. // @match http://imgwewo.xyz/*
  784. // @match https://*.rintor.space/image/*
  785. // @match http://imgirx.xyz/*
  786. // @match http://*.imgalor.xyz/*
  787. // @match http://imgjut.buzz/*
  788. // @match http://imgtrw.buzz/*
  789. // @match http://imglina.xyz/*
  790. // @match http://imgkuiw.xyz/*
  791. // @match http://imgwang.buzz/*
  792. // @match https://imgbb.com/*
  793. // @match *://vfl.ru/fotos/*.html
  794. // @match https://*.imgstar.eu/*/*.html
  795. // @match https://dewimg.com/*.php
  796. // @match https://pictwn.com/*.php
  797. // @match https://comment-cdn.9gag.com/image?*
  798. // @match https://t.me/*/*
  799. // @match https://telegram.me/*/*
  800. // @match *://piccy.info/view3/*/*/
  801. // @match http://imgmeno.buzz/*
  802. // @match https://*.pics4upload.com/*/*.html
  803. // @match http://imgpekele.buzz/*
  804. // @match http://imglqw.buzz/*
  805. // @match http://imgyng.buzz/*
  806. // @match http://imgbbd.buzz/*
  807. // @match http://imgwia.buzz/*
  808. // @match http://imgowk.buzz/*
  809. // @match http://imgokr.buzz/*
  810. // @match http://imgoiu.buzz/*
  811. // @match https://picmoney.org/image/*
  812. // @match *://skrinshoter.ru/s/*/*
  813. // @match https://photo-screen.ru/i/*
  814. // @match https://postlmg.cc/*
  815. // @match https://pasteboard.co/*
  816. // @match https://*.picklik.ru/image/*
  817. // @match https://*.jpg.church/img/*
  818. // @match https://rule34.us/index.php?r=posts/view&id=*
  819. // @match https://*.imghub.ru/i/*
  820. // @match https://imgeza.buzz/*
  821. // @match http://mrlzqoe.buzz/*
  822. // @match https://radikal.host/i/*
  823. // @match https://*.slowpic.xyz//img-*.html
  824. // @match https://yapx.ru/*/*
  825. // @match https://imgpukxxr.site/*
  826. // @match https://picngt.shop/*
  827. // @match https://realbooru.com/index.php?page=post&s=view&id=*
  828. // @match *://imgutkr.store/*
  829. // @match *://imghhr.online/*
  830. // @match *://imglaiw.store/*
  831. // @match https://meetimgz.com/*.php
  832. // @match *://imgvue.online/*
  833. // @match *://imgxgf.store/*
  834. // @match *://imgbibam.online/*
  835. // @match https://imgsh.net/a/*
  836. // @match *://imgqaz.online/*
  837. // @match *://imgurt.online/*
  838. // @match https://jpg.fish/img/*
  839. // @match https://jpg1.su/img/*
  840. // @match https://jpg2.su/img/*
  841. // @match https://jpg3.su/img/*
  842. // @match https://jpg4.su/img/*
  843. // @match https://jpg5.su/img/*
  844. // @match *://imgwxr.online/*
  845. // @match *://imgyre.online/*
  846. // @match https://pixl.li/image/*
  847. // @match https://pixlev.store/*
  848. // @match https://pixmax.store/*
  849. // @match https://imgxqy.online/*
  850. // @match https://skr.sh/*
  851. // @match https://i.redd.it/*
  852. // @match https://preview.redd.it/*
  853. // @match https://www.reddit.com/media?url=*
  854. // @match https://vsco.co/*/media/*
  855. // @match https://www.gettyimages.com/detail*photo*
  856. // @match https://www.gettyimages.com/detail*video*
  857. // @match https://jpg.pet/img/*
  858. // @match https://jpeg.pet/img/*
  859. // @match https://imgnmh.cfd/*
  860. // @match https://im.ge/i/*
  861. // @match https://piczel.tv/gallery/image/*
  862. // @match https://www.screencast.com/t/*
  863. // @match https://slushe.com/galleries/*.html
  864. // @match https://img.trafficimage.club/image/*
  865. // @match https://*.picturedent.org/image/*
  866. // @match https://pig69.com/upload/*
  867. // @match https://javball.com/upload/*
  868. // @match https://idol69.net/upload/*
  869. // @match https://picqaxs.cfd/*
  870. // @match https://www.zupimages.net/viewer.php?id=*
  871. // @match https://porn4f.com/upload/*
  872. // @match https://ovabee.com/upload/*
  873. // @match https://ai18.pics/upload/*
  874. // @match https://paste.pics/*
  875. // @match https://cnxx.me/upload/*
  876. // @match https://cnpics.org/upload/*
  877. // @match https://picvvvd.sbs/*
  878. // @match https://civitai.com/images/*
  879. // @match https://civitai.com/posts/*
  880. // @match https://cosplay18.pics/upload/*
  881. // @match https://*.mjj.today/i/*
  882. // @match https://adult-images.ru/*/*/
  883. // @match https://imgfoto.host/i/*
  884. // @match https://picabox.ru/pic/*
  885. // @match https://snipboard.io/*
  886. // @match https://www.seaart.ai/explore/detail/*
  887. // @match https://tensor.art/images/*
  888. // @match https://freeimage.host/i/*
  889. // @match https://imgjjtr.sbs/*
  890. // @match https://tezzpic.com/*.php
  891. // @match https://clip2net.com/s/*
  892. // @match https://4fuk.me/upload/*
  893. // @match https://555fap.com/upload/*
  894. // @match https://kin8-av.com/upload/*
  895. // @match https://javsunday.com/upload/*
  896. // @match https://*.redgifs.com/watch/*
  897. // @match https://hentaicovid.com/uploads/*
  898. // @match https://hentaipig.com/upload/*
  899. // ==/UserScript==
  900.  
  901. "use strict";
  902.  
  903. console.debug("HandyImage Script running");
  904.  
  905. if (typeof unsafeWindow === "undefined")
  906. {
  907. unsafeWindow = window;
  908. console.warn("unsafeWindow missing");
  909. }
  910.  
  911. if (typeof GM_registerMenuCommand !== "undefined")
  912. {
  913. GM_registerMenuCommand("Handy Image Configuration", cfg, "C");
  914. }
  915.  
  916. if(window.location.href.lastIndexOf(window.location.hostname) + window.location.hostname.length + 1 == window.location.href.length)
  917. {
  918. console.warn("we are on website's main page, aren't we?");
  919. return false;
  920. }
  921. let type = document.contentType.substring(0,document.contentType.indexOf("/"));
  922. if (type === "image" || type === "video")
  923. {
  924. console.warn("Handy isn't needed for directly opened images or videos (if you want it this way - use CenterImage userscript");
  925. return false;
  926. }
  927. if(history.length !== 1 && document.referrer)
  928. {
  929. if(document.referrer.lastIndexOf(window.location.hostname) != -1 && document.referrer.lastIndexOf(window.location.hostname) +1 == document.referrer.length - window.location.hostname.length)
  930. {
  931. console.warn("Handy Image: userscript stopped itself from running INTENTIONALLY: cuz your previous page is websites mainpage so you probably have just uploaded a picture yourself");
  932. return false;
  933. }
  934. }
  935. if (document.title == "Attention Required! | Cloudflare" || document.title == "Just a moment...")
  936. {
  937. console.warn("Cloudflare MITM guard page. Stopping.");
  938. return false;
  939. }
  940. if(sessionStorage.length)
  941. {
  942. if(sessionStorage.hji)
  943. {
  944. if(sessionStorage.hji.indexOf(window.location.href) != -1) // check address in case page failed to load b4
  945. {
  946. console.warn("Handy Image: userscript stopped itself from running INTENTIONALLY");
  947. setTimeout(function() {sessionStorage.removeItem("hji");},1000); // for frames
  948. return false;
  949. }
  950. sessionStorage.removeItem("hji");
  951. }
  952. else if(sessionStorage.hji_back)
  953. {
  954. if(Date.now() < parseInt(sessionStorage.hji_back)) // 2 sec not yet passed
  955. {
  956. console.warn("Handy Image: userscript now helps you go to previous page automatically");
  957. sessionStorage.removeItem("hji_back");
  958. window.history.go(-1);
  959. return false;
  960. }
  961. sessionStorage.removeItem("hji_back");
  962. }
  963. }
  964.  
  965. function q(s){if(document.body){return document.body.querySelector(s);}return null;}
  966. var cfg_direct = false;
  967. var cfg_bgclr ="grey";
  968. var cfg_fitWH = true;
  969. var cfg_fitB = false;
  970. var cfg_fitS = true;
  971. var cfg_fitOS = false;
  972. var cfg_js;
  973. var cfg_vol = "0.5";
  974. var referrer_policy = "strict-origin-when-cross-origin"; // default browser behavior
  975. var dp = false;
  976. let orgImgWidth;
  977. let orgImgHeight;
  978. var rescaled = 0;
  979. var tb = 0;
  980. var timeout = 1000;
  981. var FireFox = ((navigator.userAgent.indexOf('Firefox') != -1) ? true : false);
  982. var i;
  983. var j;
  984. var bStopScripts = false;
  985. var bUseCustomFilename = true;
  986. var filename = "";
  987. var filename_ext = "";
  988. var skip_by = 5;
  989. var is_video = false;
  990. var is_gallery = false;
  991. var ext_list_not_image = ['zip', '7z', 'rar', 'psd', 'swf', 'doc', 'rtf', 'pdf'];
  992. var ext_list_video = ['webm', 'mp4', 'm4v', 'avi', 'flv', 'ogg'];
  993. var iurl = window.location.hostname;
  994. if(!iurl.indexOf("www."))
  995. {
  996. iurl = iurl.substr(4);
  997. }
  998. var host = iurl;
  999. if(window.location.pathname.indexOf("//") == 0)
  1000. {
  1001. iurl += "/";
  1002. }
  1003.  
  1004. function ws()
  1005. {
  1006. if(!FireFox) // NOT firefox
  1007. {
  1008. window.stop();
  1009. }
  1010. }
  1011.  
  1012. function sanitize() // lol I'm such a hacker
  1013. {
  1014. removeAllListeners();
  1015. let lasttask = unsafeWindow.setTimeout(function() {},0);
  1016. for(let n = lasttask; n > 0; n--)
  1017. {
  1018. //if(n !== tg) // unsafeWindow.clear can't clear window.tasks set in the userscript but lets be safe
  1019. //{
  1020. unsafeWindow.clearTimeout(n); // only unsafeWindow has access to clear page tasks
  1021. //}
  1022. }
  1023. }
  1024.  
  1025. const protected_createElement = Document.prototype.createElement.bind(document);
  1026. protected_addEventListener.originalF = Element.prototype.addEventListener;
  1027. function protected_addEventListener (el, event, handler, capture = false)
  1028. {
  1029. return protected_addEventListener.originalF.call(el, event, handler, capture);
  1030. }
  1031.  
  1032. var _eventHandlers = {};
  1033. var origAdd = unsafeWindow.Element.prototype.addEventListener; // page's one
  1034. if(FireFox && typeof exportFunction === "function")
  1035. {
  1036. wrapper_addEventListener = exportFunction(wrapper_addEventListener, unsafeWindow); // TM magic
  1037. }
  1038. // addEventListener inside userscript's `window` doesn't change
  1039. unsafeWindow.Window.prototype.addEventListener = wrapper_addEventListener;
  1040. unsafeWindow.Document.prototype.addEventListener = wrapper_addEventListener;
  1041. unsafeWindow.Element.prototype.addEventListener = wrapper_addEventListener;
  1042.  
  1043. function wrapper_addEventListener (event, handler, capture = false)
  1044. {
  1045. //if (typeof _eventHandlers === "undefined") unsafeWindow._eventHandlers = {};
  1046. if (bStopScripts)
  1047. {
  1048. console.debug("HJI: stopped 1 addEventListener: " + event);
  1049. return null;
  1050. }
  1051. if (!(event in _eventHandlers)) _eventHandlers[event] = [];
  1052.  
  1053. _eventHandlers[event].push({ node: this || unsafeWindow, handler: handler, capture: capture });
  1054. console.debug("HJI: wrapped 1 addEventListener: " + event + ", "+ Object.keys(_eventHandlers).length);
  1055. return origAdd.call(this, event, handler, capture);
  1056. }
  1057.  
  1058. function removeAllListeners ()
  1059. {
  1060. console.debug("HJI: removed "+ Object.keys(_eventHandlers).length + " event listeners: " + Object.keys(_eventHandlers));
  1061. for(let event in _eventHandlers)
  1062. {
  1063. _eventHandlers[event].forEach(({ node, handler, capture }) => node.removeEventListener(event, handler, capture));
  1064. delete _eventHandlers[event];
  1065. }
  1066. }
  1067.  
  1068. function onVisibilityChange()
  1069. {
  1070. if (document.visibilityState === 'visible')
  1071. {
  1072. if(i && i.src)
  1073. {
  1074. window.removeEventListener('visibilitychange', onVisibilityChange);
  1075. onWindowResize();
  1076. autoresize();
  1077. }
  1078. }
  1079. }
  1080.  
  1081. const AddElementToPage = typeof GM_addElement === "function" ? GM_addElement : function (node, type, content)
  1082. {
  1083. let el = protected_createElement(type);
  1084. el.textContent = content.textContent;
  1085. node.appendChild(el);
  1086. }; // stupid adGuard
  1087.  
  1088. function DeleteAllCookies()
  1089. {
  1090. document.cookie.split(";").forEach(function(c) {
  1091. document.cookie = c.replace(/^ +/, "").replace(/=.*/, "=;expires=" + new Date().toUTCString() + ";path=/");
  1092. });
  1093. }
  1094.  
  1095. function onscript(e)
  1096. {
  1097. //console.debug( "STOPPED: " + e.target.src + e.target.innerHTML);
  1098. console.debug( "HJI: onscript stopped 1 script from loading");
  1099. e.preventDefault();
  1100. e.stopImmediatePropagation();
  1101. }
  1102.  
  1103. function onbeforeunload() // back helper
  1104. {
  1105. sessionStorage.hji_back = Date.now() + 2000; // 2 sec to help back from double-pages
  1106. }
  1107.  
  1108. function makeimage()
  1109. {
  1110. if(typeof cfg_js !== "string") { console.log("waiting for settings to load to makeimage()"); if(!loadCfg_callbacks.includes(makeimage)){loadCfg_callbacks.push(makeimage);} return false;} // lets wait for stupd async
  1111. if(cfg_direct === true){let a = protected_createElement('a'); a.setAttribute('href',i.src); a.click(); return false;}
  1112. let css
  1113. = `:root, body
  1114. {
  1115. height: 100%;
  1116. width: 100%;
  1117. margin: 0px;
  1118. display: grid;
  1119. }
  1120. img, video
  1121. {
  1122. margin: auto;
  1123. outline: none;
  1124. max-width: unset;
  1125. max-height: unset;
  1126. image-orientation: from-image;
  1127. }
  1128. video::-webkit-media-controls-panel
  1129. {
  1130. background-image: linear-gradient(transparent, transparent) !important;
  1131. }
  1132. :root, body, img, video
  1133. {
  1134. min-width: 0px;
  1135. min-height: 0px;
  1136. background-color: ${cfg_bgclr};
  1137. }`; // don't mind the broken identation, multiline string demands it
  1138. AddElementToPage(document.documentElement, 'style', {textContent: css});
  1139. ws();
  1140. let isrc = i.src;
  1141. i = protected_createElement(is_video? "video" : "img");
  1142. i.src = isrc;
  1143. document.body.appendChild(i);
  1144. if(!is_video)
  1145. {
  1146. protected_addEventListener(i, "click", rescale, true);
  1147. }
  1148. else
  1149. {
  1150. i.volume = cfg_vol;
  1151. protected_addEventListener(i, "volumechange", onvolumechange, true);
  1152. i.controls = true;
  1153. i.loop = true;
  1154. i.preload = "auto";
  1155. i.focus(); // so video volume built-in hotkeys would work (until you unfocus it)
  1156. }
  1157. protected_addEventListener(i, "auxclick", rescale, true);
  1158. protected_addEventListener(i, "mousedown", mousedown, true); // chrome old fix - still needed
  1159. window.addEventListener("keydown", onkeydown, true);
  1160. window.addEventListener("resize", onWindowResize);
  1161. window.addEventListener("visibilitychange", onVisibilityChange);
  1162. onVisibilityChange(); // if tab is already active when opening image
  1163. if(dp){console.warn("you are on a double-page image hosting (probably)");window.addEventListener("beforeunload", onbeforeunload, true);}
  1164. if (typeof GM_registerMenuCommand !== "undefined")
  1165. {
  1166. GM_registerMenuCommand("Handy Image Download image", download_image, "N");
  1167. GM_registerMenuCommand("Handy Image Re-Load page normally", () => {sessionStorage.hji = window.location.href; window.location.reload();}, "R");
  1168. }
  1169. }
  1170.  
  1171. function find_text_in_scripts(text, stopword, start_from_top = null, search_after_word = null, content_type = "img")
  1172. {
  1173. let s = document.getElementsByTagName("script");
  1174. for(let c=0;c<s.length;c++)
  1175. {
  1176. if(search_after_word && s[c].innerHTML.indexOf(search_after_word) != -1){s[c].innerHTML = s[c].innerHTML.substring(0, s[c].innerHTML.indexOf(search_after_word));}
  1177. let start_pos = start_from_top ? s[c].innerHTML.indexOf(text) : s[c].innerHTML.lastIndexOf(text);
  1178. if(start_pos == -1){continue;}
  1179. start_pos += text.length;
  1180. let found_content = s[c].innerHTML.substring(start_pos,s[c].innerHTML.indexOf(stopword,start_pos));
  1181. found_content = JSON.parse('"' + found_content.replace('"', '\\"') + '"'); // unescape it
  1182. found_content = decodeURIComponent(found_content);
  1183. i = protected_createElement(content_type);
  1184. i.src = found_content;
  1185. console.debug("found url in the script: " + found_content);
  1186. return true;
  1187. }
  1188. return false;
  1189. }
  1190.  
  1191. function post(path, params, method)
  1192. {
  1193. method = method || "post";
  1194. let form = protected_createElement("form");
  1195. form.setAttribute("method", method);
  1196. form.setAttribute("action", path);
  1197. for(let key in params)
  1198. {
  1199. if(Object.hasOwn(params, key)) // hasOwnProperty
  1200. {
  1201. let hiddenField = protected_createElement("input");
  1202. hiddenField.setAttribute("type", "hidden");
  1203. hiddenField.setAttribute("name", key);
  1204. hiddenField.setAttribute("value", params[key]);
  1205.  
  1206. form.appendChild(hiddenField);
  1207. }
  1208. }
  1209. document.body.appendChild(form);
  1210. form.submit();
  1211. }
  1212.  
  1213. function makeworld()
  1214. {
  1215. let f;
  1216. if(i){return;}
  1217. // per-host image detection
  1218. switch (host)
  1219. {
  1220. case "simplest-image-hosting.net":
  1221. case "hostimage.ru":
  1222. case "imgchili.net":
  1223. case "adultimages.xyz":
  1224. i = q('img');
  1225. break;
  1226. case "myceleb.net":
  1227. case "depic.me":
  1228. case "dpic.me":
  1229. i = q('img#pic');
  1230. break;
  1231. case "imagebin.ca":
  1232. i = q('a img');
  1233. if(i){i.src = i.parentNode.href;}
  1234. break;
  1235. case "i.redd.it":
  1236. case "preview.redd.it":
  1237. i = q('faceplate-img, img');
  1238. if(i){i.src = i.getAttribute("src");}
  1239. break;
  1240. case "savepic.org":
  1241. case "savepic.ru":
  1242. i = q('a img:not([src*="/images/"])');
  1243. break;
  1244. case "motherless.com":
  1245. j = true;
  1246. i = q('div#media-media div a img');
  1247. break;
  1248. case "awesomescreenshot.com":
  1249. i = q('img#screenshot');
  1250. break;
  1251. case "zupimages.net":
  1252. i = q('img#img_size');
  1253. break;
  1254. case "dropbox.com":
  1255. j = true;
  1256. i = q('img.preview-image');
  1257. if(i)
  1258. {
  1259. i.src = i.src.replace(/(size_mode)=\d+/, '$1=5');
  1260. }
  1261. break;
  1262. case "img.3ezy.net":
  1263. case "image-bugs.com":
  1264. case "imgclover.com":
  1265. case "demo.chevereto.com":
  1266. case "daily-img.com":
  1267. case "celebimg.com":
  1268. case "sfwimg.com":
  1269. case "img3x.com":
  1270. case "imgskull.xyz":
  1271. case "imgskull.com":
  1272. case "2i.sk":
  1273. case "2i.cz":
  1274. case "deffe.com":
  1275. case "imagik.fr":
  1276. case "gallerycloud.net":
  1277. case "tryimg.com":
  1278. case "fsfiles.org":
  1279. case "picpicture.com":
  1280. case "picpie.org":
  1281. case "lostpic.net":
  1282. case "batpic.com":
  1283. //chevereto 3.x
  1284. i = document.head.querySelector('link[rel="image_src"]');
  1285. if(i)
  1286. {
  1287. i.src = i.href;
  1288. i.src = i.src.replace('_800.', '.'); //img.3ezy.net
  1289. }
  1290. break;
  1291. case "imagebam.com":
  1292. i = q("#continue a");
  1293. if(i)
  1294. {
  1295. let expires = '';
  1296. let date = new Date();
  1297. date.setTime(date.getTime() + (6 * 60 * 60 * 1000));
  1298. expires = "; expires=" + date.toUTCString();
  1299. document.cookie = "nsfw_inter=1" + expires + "; path=/";
  1300. i.click();
  1301. break
  1302. }
  1303. i = q("img.main-image");
  1304. break;
  1305. case "directupload.net":
  1306. case "bilderhoster.net":
  1307. case "noelshack.com":
  1308. case "kephost.com":
  1309. case "i.ruspotting.net":
  1310. case "gifyu.com":
  1311. case "sharepic.org":
  1312. case "zuly.de":
  1313. case "upload.vstanced.com":
  1314. case "thro.bz":
  1315. case "qoou.net":
  1316. case "brightpic.tk":
  1317. case "cweb-pix.com":
  1318. case "hosting.webspell.fr":
  1319. case "i-pict.ru":
  1320. case "images.woh.to":
  1321. case "imghaze.com":
  1322. case "imgup.nl":
  1323. case "nium.co":
  1324. case "pix.hostux.net":
  1325. case "pixoload.de":
  1326. case "primeimg.co":
  1327. case "pic.xtream-reallife.de":
  1328. case "ultraimg.com":
  1329. case "safeimage.biz":
  1330. case "imgextra.uk":
  1331. case "ss.movierls.net":
  1332. case "xxximagetpb.org":
  1333. case "pix.ac":
  1334. case "sparrowpics.com":
  1335. case "prnt.sc":
  1336. case "imgmax.com":
  1337. case "extraimago.com":
  1338. case "extraimage.net":
  1339. case "imgcloud.pw":
  1340. case "z4a.net":
  1341. case "jiopic.com":
  1342. case "wwv.imgcredit.xyz":
  1343. case "moreimage.pw":
  1344. case "lookimg.com":
  1345. case "subefotos.com":
  1346. case "imgcredit.xyz":
  1347. case "rintor.space":
  1348. case "imgbb.com":
  1349. case "servimg.com":
  1350. case "picmoney.org":
  1351. case "skrinshoter.ru":
  1352. case "imgmak.com":
  1353. case "picklik.ru":
  1354. case "jpg.church":
  1355. case "imghub.ru":
  1356. case "radikal.host":
  1357. case "imgsh.net":
  1358. case "jpg.fish":
  1359. case "pixl.li":
  1360. case "skr.sh":
  1361. case "jpg.pet":
  1362. case "jpeg.pet":
  1363. case "im.ge":
  1364. case "screencast.com":
  1365. case "picshare.ru":
  1366. case "jpg1.su":
  1367. case "jpg2.su":
  1368. case "jpg3.su":
  1369. case "jpg4.su":
  1370. case "jpg5.su":
  1371. case 'img.trafficimage.club':
  1372. case 'pig69.com':
  1373. case 'javball.com':
  1374. case 'idol69.net':
  1375. case 'porn4f.com':
  1376. case 'ovabee.com':
  1377. case 'ai18.pics':
  1378. case "paste.pics":
  1379. case 'cnxx.me':
  1380. case 'cnpics.org':
  1381. case 'cosplay18.pics':
  1382. case 'mjj.today':
  1383. case "imgfoto.host":
  1384. case "picabox.ru":
  1385. case "snipboard.io":
  1386. case "seaart.ai":
  1387. case "freeimage.host":
  1388. case "clip2net.com":
  1389. case "4fuk.me":
  1390. case "555fap.com":
  1391. case "kin8-av.com":
  1392. case "javsunday.com":
  1393. case "hentaipig.com":
  1394. case "hentaicovid.com":
  1395. i = document.querySelector('meta[property="og:image"], [name="og:image"]');
  1396. if(i)
  1397. {
  1398. i.src = i.content;
  1399. }
  1400. else
  1401. {
  1402. i = q('a[download]');
  1403. if(i){i.src = i.href;}
  1404. }
  1405. break;
  1406. case "vsco.co":
  1407. i = document.querySelector('meta[property="og:image"]');
  1408. if(i)
  1409. {
  1410. i.src = i.content.substring(0, i.content.indexOf("?"));
  1411. }
  1412. break;
  1413. case "civitai.com":
  1414. j = true;
  1415. i = document.querySelector('meta[property="og:image"], [name="og:image"]');
  1416. if(i)
  1417. {
  1418. i.src = i.content.replace("width=1200","width=3840"); // 4k
  1419. }
  1420. break;
  1421. case "tensor.art":
  1422. j = true;
  1423. i = document.querySelector('meta[property="og:image"], [name="og:image"]');
  1424. if(i)
  1425. {
  1426. i.src = i.content.replace("w=600","w=3840"); // 4k (if available)
  1427. }
  1428. break;
  1429. case "mobile.twitter.com":
  1430. case "twitter.com":
  1431. case "mobile.x.com":
  1432. case "x.com":
  1433. j = true;
  1434. unsafeWindow.history.replaceState = unsafeWindow.console.log;
  1435. i = q('a[href*="'+window.location.href.match("status\/([^\/]+)")[1]+'/photo/' + Number(window.location.href.at(-1)) + '"] img');
  1436. if(i)
  1437. {
  1438. i.src = i.src.substring(0, i.src.indexOf("&name=")) + '&name=orig';
  1439. filename = "by " + document.head.querySelector('meta[property="og:title"]').content;
  1440. filename_ext = i.src.substring(i.src.indexOf("format=")+7 ,i.src.indexOf("&"));
  1441. }
  1442. break;
  1443. case "m.imgur.com":
  1444. j = true;
  1445. i = q('img.Image');
  1446. break;
  1447. case "imgur.com":
  1448. j = true;
  1449. f = document.querySelectorAll(".image-placeholder,.post-image-placeholder,.image.post-image > img"); // for beta and non-beta
  1450. if(f.length)
  1451. {
  1452. if(f.length != 1)
  1453. {
  1454. is_gallery = true;
  1455. }
  1456. else
  1457. {
  1458. i = f[0];
  1459. let fi;
  1460. if((fi = i.src.indexOf("_d.webp")) != -1)
  1461. {
  1462. i.src = i.src.substr(0, fi) + ".jpg"; // png files will be named jpg too here
  1463. console.log("Handy Image: imgur replaced a LQ preview image with original one");
  1464. }
  1465. }
  1466. }
  1467. break;
  1468. case "ameblo.jp":
  1469. j = true;
  1470. i = q('img#imgItem');
  1471. break;
  1472. case "instagram.com":
  1473. j = true;
  1474. // find_text_in_scripts('"url":"', '"', false, '"image_versions2"')
  1475. if(q("header"))
  1476. {
  1477. f = document.querySelectorAll("div[role=button] > div > div img")
  1478. if(f.length === 1)
  1479. {
  1480. i = f[0];
  1481. }
  1482. else
  1483. {
  1484. is_gallery = true;
  1485. }
  1486. }
  1487. break;
  1488. case "flickr.com":
  1489. case "secure.flickr.com":
  1490. find_text_in_scripts('"descendingSizes":[{"displayUrl":"', '"', false, '');
  1491. break;
  1492. case "artstation.com":
  1493. j = true;
  1494. f = document.querySelectorAll('a[href*="&dl="]')
  1495. if(f.length === 1)
  1496. {
  1497. i = f[0];
  1498. i.src = i.href;
  1499. }
  1500. break;
  1501. case "redgifs.com":
  1502. if(!j) // once
  1503. {
  1504. console.debug("HJI: setting up wrapper_JSON_parse");
  1505. let wrapper_JSON_parse = function (json, ...args)
  1506. {
  1507. if (typeof json === 'string' && json.includes('"gif":') && document.head && !document.head.querySelector('link[rel="handy_image"]'))
  1508. {
  1509. const parsed = wrapper_JSON_parse.originalF(json, ...args);
  1510. let link = protected_createElement('link');
  1511. link.rel = 'handy_image';
  1512. link.href = parsed.gif.urls.hd || parsed.gif.urls.sd;
  1513. document.head.appendChild(link);
  1514. console.debug("found redgifs url: " + link.href);
  1515. console.debug(parsed.gif.urls);
  1516. filename = "by " + parsed.gif.userName + " - " + parsed.gif.niches.join(" ") + " - " + parsed.gif.tags.join(" ");
  1517. unsafeWindow.JSON.parse = wrapper_JSON_parse.originalF; // doesn't work for some reason
  1518. return parsed;
  1519. }
  1520. return wrapper_JSON_parse.originalF(json, ...args);
  1521. }
  1522. if(FireFox && typeof exportFunction === "function")
  1523. {
  1524. wrapper_JSON_parse = exportFunction(wrapper_JSON_parse, unsafeWindow); // TM magic
  1525. }
  1526. wrapper_JSON_parse.originalF = unsafeWindow.JSON.parse;
  1527. unsafeWindow.JSON.parse = wrapper_JSON_parse;
  1528. }
  1529. else if(document.head)
  1530. {
  1531. i = document.head.querySelector('link[rel="handy_image"]');
  1532. if(i) i.src = i.href;
  1533. }
  1534. j = true;
  1535. break;
  1536. case "piczel.tv":
  1537. j = true;
  1538. f = document.querySelector("a.GalleryImage_SingleTag");
  1539. if(f)
  1540. {
  1541. i = q('a[href*="/gallery_image/"]');
  1542. if(i)
  1543. {
  1544. if(i.parentNode.previousSibling === null)
  1545. {
  1546. filename = f.parentNode.textContent.substring(1);
  1547. i.src = i.href;
  1548. }
  1549. else
  1550. {
  1551. is_gallery = true;
  1552. }
  1553. }
  1554. }
  1555. break;
  1556. case "pixiv.net":
  1557. j = true;
  1558. i = document.head.querySelector('meta[name="preload-data"]');
  1559. if (i)
  1560. {
  1561. let a = JSON.parse(i.getAttribute('content')).illust;
  1562. let b = a[Object.keys(a)[0]];
  1563. if(b.pageCount !== 1)
  1564. {
  1565. console.warn("Manga page with multiple images, no action taken further");
  1566. return;
  1567. }
  1568. else if(b.illustType == 2)
  1569. {
  1570. console.warn("Animated ugoira image found, no action taken further");
  1571. return;
  1572. }
  1573. i.src = b.urls.original;
  1574. filename = b.title + " by " + b.userName;
  1575. b.tags.tags.forEach(el => filename = filename + " " + el.tag);
  1576. }
  1577. break;
  1578. case "idol.sankakucomplex.com":
  1579. case "chan.sankakucomplex.com":
  1580. i = q('a[itemprop="contentUrl"]');
  1581. if(i)
  1582. {
  1583. use_booru_tags_in_dl_filename();
  1584. i.src = i.href;
  1585. referrer_policy = "no-referrer";
  1586. }
  1587. break;
  1588. case "bcy.net":
  1589. f = document.querySelectorAll("img.detail_clickable");
  1590. if(f.length == 1)
  1591. {
  1592. i = f[0];
  1593. i.src = f[0].src.replace('/w650', '');
  1594. }
  1595. break;
  1596. case "imageshack.com":
  1597. i = q('input[value*="' + iurl + '/f/"]');
  1598. if(i){window.location.href = i.value.replace('/f/', '/i/');}
  1599. i = q('img[data-width]');
  1600. break;
  1601. case "22pixx.xyz":
  1602. case "trueimg.xyz":
  1603. f = window.location.href.match(/[a-z]+-([a-z].+(?:\.jpe?g|png|gif|webp))/i);
  1604. if(f)
  1605. {
  1606. i = {src : window.location.origin + "/" + f[1]};
  1607. }
  1608. break;
  1609. case "h4z.it":
  1610. i = document.images[2];
  1611. if(i){i.src = i.parentNode.href;}
  1612. break;
  1613. case "thumbsnap.com":
  1614. i = q('img#thepic');
  1615. if(i && i.parentNode.href){i.src = i.src.replace('/s/', '/i/');}
  1616. break;
  1617. case "imgbox.com":
  1618. case "imageupper.com":
  1619. case "hotflick.net":
  1620. case "upix.me":
  1621. i = q('img#img');
  1622. if(!i && window.location.hash) // upix.me
  1623. {
  1624. i = q('a');
  1625. i.src = window.location.href.replace("#","");
  1626. }
  1627. break;
  1628. case "imagesnake.com":
  1629. case "imagesnake.org":
  1630. case "freebunker.com":
  1631. case "imagefruit.com":
  1632. case "imagestime.com":
  1633. case "imgcarry.com":
  1634. case "pornbus.org":
  1635. case "fotoo.pl":
  1636. case "hostpix.de":
  1637. case "uploadking.biz":
  1638. case "foto.xhost.lv":
  1639. case "onimage.net":
  1640. case "storepic.com":
  1641. case "hostarea.de":
  1642. case "imgshots.com":
  1643. i = q('img#img_obj');
  1644. break;
  1645. case "abload.de":
  1646. i = document.body.querySelectorAll('img#image');
  1647. if(i)
  1648. {
  1649. i = i[i.length-1];
  1650. }
  1651. break;
  1652. case "imagecrest.com":
  1653. case "imagepearl.com":
  1654. case "imageup.ru":
  1655. i = q('#verify2');
  1656. if(i)
  1657. {
  1658. let w = screen.width;
  1659. let h = screen.height;
  1660. let u = q('#i').value;
  1661. let r = q('#r').value;
  1662. let xhttp = new XMLHttpRequest();
  1663. xhttp.onreadystatechange = function() {
  1664. if (xhttp.readyState == 4 && xhttp.status == 200) {
  1665. location.reload();
  1666. }
  1667. };
  1668. xhttp.open("GET", "verify.php?w=" + w + "&h=" + h + "&i=" + u + "&r=" + r + "", false);
  1669. xhttp.send();
  1670. break;
  1671. }
  1672. i = q('img#image');
  1673. break;
  1674. case "fastpic.ru":
  1675. case "fastpic.org":
  1676. case "slowpic.xyz":
  1677. i = q('img[src*="/big/"]');
  1678. break;
  1679. case "bayimg.com":
  1680. i = q('img#mainImage');
  1681. break;
  1682. case "imageban.ru":
  1683. case "imageban.net":
  1684. i = q('img[src*="' + iurl + '/out/"]');
  1685. break;
  1686. case "xup.in":
  1687. i = q('img[src*="/exec/"]');
  1688. break;
  1689. case "jpegbay.com":
  1690. i = q('a[class]');
  1691. if(i){i.src = i.href;}
  1692. break;
  1693. case "keep4u.ru":
  1694. i = q('img[src*="/b/"]');
  1695. break;
  1696. case "euro-pic.eu":
  1697. case "picfox.org":
  1698. case "freeimage.us":
  1699. case "xxx.freeimage.us":
  1700. case "pixsor.com":
  1701. case "img.pereslavl.ru":
  1702. case "rupict.ru":
  1703. case "host99.byethost4.com":
  1704. case "eazypics.net":
  1705. case "xtupload.com":
  1706. case "t.williamgates.net":
  1707. case "imgz.pw":
  1708. case "imgurx.net":
  1709. //i = q('img#iimg');
  1710. if(!find_text_in_scripts("<img src='", "'"))
  1711. {
  1712. i = q('a[download]'); // imgz.pw
  1713. if(i){i.src = i.href;}
  1714. }
  1715. break;
  1716. case "amateri.cz":
  1717. if(find_text_in_scripts('var orig_url="', '"'))
  1718. {
  1719. i.src = i.src.replace('http://www.amateri.cz/orig.php?&img=', 'http://img2.amateri.cz/users/');
  1720. }
  1721. break;
  1722. case "imgtgd.shop":
  1723. j = true;
  1724. case "pixlev.store":
  1725. case "pixmax.store":
  1726. case "imgair.net":
  1727. case "imgxqy.online":
  1728. case "imgnmh.cfd":
  1729. case "imgpukxxr.site":
  1730. case "picngt.shop":
  1731. find_text_in_scripts('.src = "', '"');
  1732. break;
  1733. case "pix-x.net":
  1734. case "picclock.ru":
  1735. case "imgcach.ru":
  1736. case "picpic.online":
  1737. case "drlink.online":
  1738. i = q('img[onclick*="mshow"]');
  1739. if(i){i.src = i.src.replace('-thumb', '');i.src = i.src.replace('img_thumb', 'img_full');}
  1740. break;
  1741. case "pics-money.ru":
  1742. i = q('img[src*="/full/"]');if(i){break;}
  1743. case "pic5you.ru":
  1744. case "pic4you.ru":
  1745. case "picforall.ru":
  1746. case "adult-images.ru":
  1747. case "picage.ru":
  1748. case "images-host.biz":
  1749. case "pic-mir.ru":
  1750. case "payforpic.ru":
  1751. case "freshpics.ru":
  1752. case "imgbase.online":
  1753. case "picpays.ru":
  1754. case "piccash.net":
  1755. case "imgbase.ru":
  1756. i = q('img[src*="thumb"]');
  1757. if(i){i.src = i.src.replace('-thumb', '');i.src = i.src.replace('img_thumb', 'img_full');i.src = i.src.replace('_thumb', '');}
  1758. break;
  1759. case "tinypic.com":
  1760. i = q('img#imgElement');
  1761. break;
  1762. case "picshot.pl":
  1763. i = q('img[src*="' + iurl + '/p"]');
  1764. if(i){i.src = i.src.replace('thumb', 'file');}
  1765. break;
  1766. case "sharenxs.com":
  1767. i = q('img.view_photo');
  1768. if(i){i.src = i.src.replace('/thumbnails/', '/images/');
  1769. i.src = i.src.replace('/tn-', '/');
  1770. i.src = i.src.replace('/mid/', '/wz/');
  1771. f = q('div.alert.alert-info.nomargin.photo_name span');
  1772. if(f)
  1773. {
  1774. let url = i.src;
  1775. i.src = url.substring(0,url.lastIndexOf('/')+1) + f.textContent + url.substring(url.lastIndexOf('.'));
  1776. }}
  1777. break;
  1778. case "gettyimages.com":
  1779. j = true;
  1780. find_text_in_scripts('"largeMainImageURL":"', '"') || find_text_in_scripts('"filmCompUrl":"', '"',null,null,"video");
  1781. break;
  1782. case "radikal.ru":
  1783. case "radical-foto.ru":
  1784. case "radikal-foto.ru":
  1785. case "f-page.ru":
  1786. case "f-lite.ru":
  1787. case "f-picture.net":
  1788. find_text_in_scripts('"Url":"', '"');
  1789. break;
  1790. case "jerking.empornium.ph":
  1791. find_text_in_scripts(' url: "', '"', true);
  1792. break;
  1793. case "bilder-space.de":
  1794. case "imagesup.de":
  1795. i = q('img.picture');
  1796. break;
  1797. case "pix.toile-libre.org":
  1798. case "photo-host.org":
  1799. case "myxpic.com":
  1800. case "picness.com":
  1801. i = q('a[href*="original"]');
  1802. if(i){i.src = i.href;}
  1803. break;
  1804. case "pimpandhost.com":
  1805. i = q('div.main-image-wrapper');
  1806. if(i){i.src = i.dataset.src;}
  1807. break;
  1808. case "postlmg.cc":
  1809. i = q('img#main-image');
  1810. break;
  1811. case "sexybabepics.net":
  1812. case "keepimg.com":
  1813. case "ibb.co":
  1814. i = document.head.querySelector('meta[property="og:image"]');
  1815. if(i){i.src = i.content; break;}
  1816. case "pasteboard.co":
  1817. i = document.head.querySelector('meta[name="twitter:image"]');
  1818. if(i){i.src = i.content; break;}
  1819. case "picsee.net":
  1820. i = q('a[href*="/upload"]');
  1821. if(i){i.src = i.href;}
  1822. break;
  1823. case "imagevenue.com":
  1824. i = q('img#main-image');
  1825. break;
  1826. case "slushe.com":
  1827. j = true;
  1828. if(q('footer')){ i = q('img.big-photo'); }
  1829. if(i){use_booru_tags_in_dl_filename(); }
  1830. break;
  1831. case "hentai-foundry.com":
  1832. j = true;
  1833. i = q('.boxbody img');
  1834. if(i && i.onclick)
  1835. {
  1836. i.click();
  1837. }
  1838. break;
  1839. case "realbooru.com":
  1840. i = q('img#image');
  1841. if(!i)
  1842. {
  1843. i = q('video#gelcomVideoPlayer');
  1844. if(i && i.currentSrc){i.src = i.currentSrc;}
  1845. }
  1846. if(i){use_booru_tags_in_dl_filename(); }
  1847. break;
  1848. case "rule34.xxx":
  1849. case "rule34.us":
  1850. j = true;
  1851. i = q('a[href*="/images/"][href*="' + host + '/"]');
  1852. if(i){use_booru_tags_in_dl_filename(); i.src = i.href;}
  1853. break;
  1854. // case "rule34.paheal.net":
  1855. // j = true;
  1856. // bUseCustomFilename = false; // broken currently, again
  1857. // i = q('#main_image');
  1858. // if(i && i.currentSrc){i.src = i.currentSrc;}
  1859. // break;
  1860. case "rule34hentai.net":
  1861. case "danbooru.donmai.us":
  1862. i = q('a[download]');
  1863. if(i){use_booru_tags_in_dl_filename(); i.src = i.href;}
  1864. break;
  1865. case "e621.net":
  1866. i = q('div#image-download-link a');
  1867. if(i){use_booru_tags_in_dl_filename(); i.src = i.href;}
  1868. break;
  1869. case "gelbooru.com":
  1870. case "youhate.us":
  1871. case "safebooru.org":
  1872. j = true;
  1873. i = q('a[href*="/images/"][style]');
  1874. if(i){use_booru_tags_in_dl_filename(); i.src = i.href;}
  1875. break;
  1876. case "deviantart.com":
  1877. j = true;
  1878. if(q('div[role="complementary"]')) // page loaded enough
  1879. {
  1880. i = q('a[download]');
  1881. if(i && i.href.indexOf("deviantart.com/users/outgoing?") == -1){i.src = i.href;console.log("found download link");}
  1882. else
  1883. {
  1884. if(parseInt(window.location.pathname.substring(window.location.pathname.lastIndexOf("-")+1)) <= 790677560) // max resolution hax (available only for old images - sadly)
  1885. {
  1886. i = document.head.querySelector('link[rel="preload"][as="image"]');
  1887. if(i)
  1888. {
  1889. i = q('img[src="' + i.href + '"]'); // need to check its cursor now
  1890. if(i)
  1891. {
  1892. if(getComputedStyle(i).cursor === "zoom-in")
  1893. {
  1894. f = i.src.search(/\/f\/[^\/]+\/[^\/]+/); // no idea what this code was for
  1895. if(f !== -1)
  1896. {
  1897. i.src = i.src.substring(0,f+i.src.match(/\/f\/[^\/]+\/[^\/]+/)[0].length);
  1898. }
  1899. //
  1900. i.src = i.src.replace('/f/', '/intermediary/f/');
  1901. console.log("hacked image resolution to maximum");
  1902. }
  1903. else
  1904. {
  1905. console.log("found very old and small image - no higher resolution to look for")
  1906. }
  1907. }
  1908. }
  1909. }
  1910. else
  1911. {
  1912. i = q('div[role="dialog"] div img'); // zoomed in
  1913. if(i)
  1914. {
  1915. console.log("found zoomed-in image");
  1916. f = i.src.match(/,q_\d\d,/);
  1917. if(f !== null)
  1918. {
  1919. i.src = i.src.replace(f[0], ',q_100,'); // max quality hax
  1920. console.log("hacked image quality to maximum (but not resolution)");
  1921. }
  1922. break;
  1923. }
  1924. i = q('div[data-hook="art_stage"] div div div img'); // not zoomed in yet
  1925. if(i){console.log("found un-zoomed image, clicked it");i.click();i=null;break;}
  1926. }
  1927. }
  1928. if(i)
  1929. {
  1930. filename = document.title.replace(" on DeviantArt","");
  1931. }
  1932. }
  1933. break;
  1934. case "furaffinity.net":
  1935. j = true;
  1936. i = q('div.download a');
  1937. if(i){i.src = i.href; filename = document.title;}
  1938. break;
  1939. case "imagehost.eu":
  1940. i = q('a#image');
  1941. if(i){i.src = i.href;}
  1942. break;
  1943. case "imgplus.info":
  1944. i = q('img[src*="full"]');
  1945. break;
  1946. case "zerochan.net":
  1947. i = q('a[href*="full"]');
  1948. if(i){i.src = i.href;}
  1949. break;
  1950. case "wstaw.org":
  1951. i = q('a[href*="/m/"]');
  1952. if(i){i.src = i.href;}
  1953. break;
  1954. case "imageshost.ru":
  1955. case "lostpix.com":
  1956. i = q('a[href*="/img/"]');
  1957. if(i){i.src = i.href;}
  1958. break;
  1959. case "uploadimage.ro":
  1960. i = q('img[src*="img.php"]');
  1961. break;
  1962. case "imageno.com":
  1963. i = q('img[src*="image.php"]');
  1964. break;
  1965. case "loadpix.de":
  1966. i = q('img[src*="bild.php"]');
  1967. break;
  1968. case "bildr.no":
  1969. i = q('img[src*="image"]');
  1970. break;
  1971. case "iv.pl":
  1972. case "funextra.hostzi.com":
  1973. case "freakimage.com":
  1974. case "imageurlhost.com":
  1975. case "superkipje.com":
  1976. case "ximg.co.uk":
  1977. case "sl-images.ath.cx":
  1978. case "hosting-zdjec.pl":
  1979. case "upislam.com":
  1980. case "add-screen.com":
  1981. case "my-collection.ru":
  1982. case "img.schattorie.nl":
  1983. case "forexrainbow.com":
  1984. case "imgupload.pl":
  1985. case "addpix.net":
  1986. case "myuploadedimages.com":
  1987. case "multihoster.saxonia-fighter.de":
  1988. case "imgdone.com":
  1989. case "greenpiccs.com":
  1990. case "balkanelite.org":
  1991. case "qrrro.com":
  1992. case "vipix.pw":
  1993. case "imagecurl.com":
  1994. case "imagecurl.org":
  1995. case "imagescanner.cc":
  1996. i = q('a[href*="images/"]');
  1997. if(i){i.src = i.href;}
  1998. break;
  1999. case "fotoshack.us":
  2000. i = q('img[src*="/fotos/"]');
  2001. break;
  2002. case "subefotos.com":
  2003. j = true;
  2004. i = q('img[src*="fotos.' + iurl + '"]');
  2005. break;
  2006. case "pictureshoster.com":
  2007. case "zaslike.com":
  2008. case "dwimg.com":
  2009. case "uploadagent.de":
  2010. i = q('a[href*="files/"]');
  2011. if(i){i.src = i.href;}
  2012. break;
  2013. case "photosex.biz":
  2014. i = q('img[src*="/pic"]');
  2015. break;
  2016. case "pronpic.org":
  2017. i = q('img#small_img[src*="/pic/"]');
  2018. if(i){i.src = i.src.replace('th_', '');}
  2019. break;
  2020. case "imadul.com":
  2021. i = q('div.img_box a');
  2022. if(i){i.src = i.href;}
  2023. break;
  2024. case "imgmega.com":
  2025. case "pic.re":
  2026. case "picbaron.com":
  2027. case "imgbaron.com":
  2028. case "kvador.com":
  2029. case "pics4you.net":
  2030. i = q('input[type="submit"]');
  2031. dp=true;
  2032. if(i)
  2033. {
  2034. i.click();
  2035. break;
  2036. }
  2037. case "screenlist.ru":
  2038. case "picshare.geenza.com":
  2039. case "mojoimage.com":
  2040. case "imagecherry.com":
  2041. case "10.imageleon.com":
  2042. case "img4.imagetitan.com":
  2043. case "ninjaimages.com":
  2044. case "3xplanet.com":
  2045. case "3xplanet.net":
  2046. i = q('img[onload*="scale"]');
  2047. break;
  2048. case "bild.me":
  2049. case "imagecarry.com":
  2050. case "imagedunk.com":
  2051. case "imageswitch.com":
  2052. case "piclambo.net":
  2053. case "picleet.com":
  2054. case "yankoimages.net":
  2055. case "picturedip.com":
  2056. case "imagezilla.net":
  2057. case "hotchyx.com":
  2058. case "imagehousing.com":
  2059. case "cubeupload.com":
  2060. case "dumparump.com":
  2061. case "uploads.ru":
  2062. case "myimg.de":
  2063. case "root-space.eu":
  2064. case "mepic.ru":
  2065. case "postto.me":
  2066. i = q('img[src*="' + iurl + '"]');
  2067. break;
  2068. case "ask.fm":
  2069. i = q('img[src*="' + iurl + '"][id]');
  2070. i.src = i.src.replace('/original/', '/large/'); //ask.fm
  2071. break;
  2072. case "photo.weibo.com":
  2073. i = q('img[src*="/large/"]');
  2074. break;
  2075. case "picfront.org":
  2076. j = true;
  2077. i = q('img[src*="' + iurl + '"][title]');
  2078. break;
  2079. case "platimzafoto.ru":
  2080. case "pic-money.ru":
  2081. case "imgmoney.ru":
  2082. case "img24.org":
  2083. case "svetmonet.ru":
  2084. case "pic4share.ru":
  2085. case "pic-images.ru":
  2086. case "imgspic.ru":
  2087. case "picpower.ru":
  2088. case "piccloud.ru":
  2089. case "pixxsees.ru":
  2090. case "2picsun.ru":
  2091. case "img-pika.ru":
  2092. case "wwxxww.ru":
  2093. case "pic3you.org":
  2094. case "shaggyimg.pro":
  2095. case "imgsmarts.info":
  2096. case "dailyimages.xyz":
  2097. case "imgazure.com":
  2098. f = document.getElementsByTagName("button");
  2099. if(f.length)
  2100. {
  2101. f[f.length-1].click();
  2102. }
  2103. dp=true;
  2104. i = q('img[src*="/pic.jpeg"]');
  2105. break;
  2106. case "imagerar.com":
  2107. if(window.location.href.indexOf("img-") != -1)
  2108. {
  2109. window.location.href = window.location.href.replace("img-","img2-");
  2110. break;
  2111. }
  2112. case "imgprime.com":
  2113. if(window.location.href.indexOf("img-") != -1)
  2114. {
  2115. window.location.href = window.location.href.replace("img-","img3-");
  2116. break;
  2117. }
  2118. else if (window.location.href.indexOf("/imga-u/") != -1)
  2119. {
  2120. window.location.href = window.location.href.replace("/imga-u/","/imgb-u/");
  2121. break;
  2122. }
  2123. else if(window.location.href.indexOf("/imgb-u/") != -1)
  2124. {
  2125. i = q('img[src*="/u/b/"]');
  2126. break;
  2127. }
  2128. case "freeimagehosting.net":
  2129. case "uploadhouse.com":
  2130. case "fotos-hochladen.net":
  2131. case "imgtab.net":
  2132. i = q('img[src*="uploads/"]');
  2133. break;
  2134. case "xtremeshack.com":
  2135. i = q('img[src*="/photos/"]');
  2136. break;
  2137. case "500px.com":
  2138. j = true;
  2139. i = q('#copyrightTooltipContainer img');
  2140. if (i) {
  2141. var m = i.src.match('/photo/(\\d+)/');
  2142. if (m) {
  2143. var xhttp = new XMLHttpRequest();
  2144. xhttp.open('GET', 'https://api.500px.com/v1/photos?ids=' + m[1] + '&image_size=4096');
  2145. xhttp.onload = function() {
  2146. if (xhttp.status == 200) {
  2147. try {
  2148. i.src = JSON.parse(xhttp.response)['photos'][m[1]]['images'][0]['url'];
  2149. console.log("hacked image resolution to maximum");
  2150. } catch (e) {console.warn(e);}
  2151. }
  2152. }
  2153. xhttp.send();
  2154. }
  2155. }
  2156. break;
  2157. case "picturepush.com":
  2158. i = q('img[src*="/photo/"]');
  2159. break;
  2160. case "keptarolo.hu":
  2161. i = q('img[src*="/kep/"]');
  2162. break;
  2163. case "truepic.org":
  2164. i = q('img[src*="/u/"]');
  2165. break;
  2166. case "imagearn.com":
  2167. i = q('img[src*="/imags/"]');
  2168. break;
  2169. case "ichan.org":
  2170. i = q('img[src*="/src/"]');
  2171. break;
  2172. case "ibunker.us":
  2173. case "hostingpics.net":
  2174. i = q('img[src*="pics/"]');
  2175. break;
  2176. case "dewimg.com":
  2177. case "subirimagenes.com":
  2178. case "tezzpic.com":
  2179. j = true;
  2180. dp = true;
  2181. f = document.querySelectorAll("input[type='submit']");
  2182. if(f.length)
  2183. {
  2184. let n;
  2185. for(n=f.length-1; n >= 0; n--)
  2186. {
  2187. if(window.getComputedStyle(f[n]).visibility != "hidden" && f[n].offsetWidth != 0 && f[n].value.indexOf("eply") == -1 && f[n].value.indexOf("Log") == -1)
  2188. {
  2189. f[n].removeAttribute("disabled");
  2190. f[n].click();
  2191. i = 1;
  2192. return;
  2193. }
  2194. }
  2195. }
  2196. i = q('img[onload*="scale"]');
  2197. break;
  2198. case "crownimg.com":
  2199. i = q('button');
  2200. dp=true;
  2201. j =true;
  2202. if(i)
  2203. {
  2204. i.click();
  2205. break;
  2206. }
  2207. case "myimg.club":
  2208. case "imgmonkey.com":
  2209. case "imgdragon.com":
  2210. case "imggold.org":
  2211. case "levinpic.org":
  2212. case "imgtown.net":
  2213. case "pixs.cx":
  2214. case "kropic.com":
  2215. case "outletpic.com":
  2216. case "pictwn.com":
  2217. case "meetimgz.com":
  2218. j = true;
  2219. dp=true;
  2220. f = document.querySelectorAll("input[type='submit']");
  2221. if(f.length)
  2222. {
  2223. let n;
  2224. for(n=f.length-1; n >= 0; n--)
  2225. {
  2226. if(window.getComputedStyle(f[n]).visibility != "hidden" && f[n].offsetWidth != 0 && f[n].value.indexOf("eply") == -1 && f[n].value.indexOf("Log") == -1)
  2227. {
  2228. //f[n].removeAttribute("disabled"); ok, let's wait
  2229. f[n].click();
  2230. break;
  2231. }
  2232. }
  2233. }
  2234. case "casimages.com":
  2235. case "thebestpichost.com":
  2236. case "ifotos.pl":
  2237. case "subeimagenes.com":
  2238. case "vvcap.com":
  2239. case "imgtrex.com":
  2240. case "pic-upload.de":
  2241. case "picusha.net":
  2242. i = q('img[src*="/img/"]');
  2243. break;
  2244. case "imagenetz.de":
  2245. i = q('img[src*="/img"]');
  2246. break;
  2247. case "picatom.com":
  2248. i = q('img[src*="img/"]');
  2249. break;
  2250. case "imgking.xyz":
  2251. case "imgazure.com":
  2252. i = q('img[src*="/img/"]');
  2253. if(i){i.src = i.src.replace('p.', '.');}
  2254. break;
  2255. case "imgbabes.com":
  2256. case "imgflare.com":
  2257. i = q('input[type="submit"]');
  2258. dp=true;
  2259. j=true;
  2260. if(i)
  2261. {
  2262. i.click();
  2263. i=null;
  2264. }
  2265. else
  2266. {
  2267. i = q('img[src*="i.php?"]');
  2268. }
  2269. break;
  2270. case "xxxhost.me":
  2271. case "bilder-hochladen.net":
  2272. case "dumpt.com":
  2273. case "imgsin.com":
  2274. case "loaditup.de":
  2275. case "123poze.3x.ro":
  2276. case "thaisharing.online.fr":
  2277. case "filefap.com":
  2278. case "imgswift.com":
  2279. case "1pic.org":
  2280. i = q('img[src*="/files/"]');
  2281. break;
  2282. case "image18.org":
  2283. i = q('img[src*="/file"]');
  2284. break;
  2285. case "picstate.com":
  2286. i = q('#image_container a img');
  2287. break;
  2288. case "zimagez.com":
  2289. i = q('img[src*="/full/"]');
  2290. break;
  2291. case "niceimage.pl":
  2292. i = q('img[src*="/uploaded/"]');
  2293. break;
  2294. case "imagefap.com":
  2295. j = true;
  2296. //find_text_in_scripts('"contentUrl": "', '"');
  2297. i = q('#slideshow img[src*="/full/"],#video-html5_html5_api');
  2298. break;
  2299. case "olivepix.com":
  2300. i = q('img[src*="view/"]');
  2301. break;
  2302. case "imgkings.com":
  2303. i = q('img[src*="uploads/"]');
  2304. if(i) break;
  2305. if(find_text_in_scripts('linkid="', '"', false))
  2306. {
  2307. window.location.href = i.src;
  2308. break;
  2309. }
  2310. else if(window.location.href.indexOf("imgs") != -1) // not sure if needed anymore
  2311. {
  2312. window.location.href = window.location.href.replace("imgs","imgv");
  2313. break;
  2314. }
  2315. else if(window.location.href.indexOf("img3") != -1) // not sure if needed anymore
  2316. {
  2317. window.location.href = window.location.href.replace("img3","img4");
  2318. break;
  2319. }
  2320. break;
  2321. case "imgadult.com":
  2322. j = true;
  2323. i = q('a.overlay_ad_link');
  2324. if(i)
  2325. {
  2326. i.click();
  2327. break;
  2328. }
  2329. case "imagefolks.com":
  2330. case "imgcandy.net":
  2331. case "imageteam.org":
  2332. case "imgnext.com":
  2333. case "hosturimage.com":
  2334. case "pixup.us":
  2335. case "xximg.net":
  2336. case "x.xximg.net":
  2337. case "sxpics.nl":
  2338. case "sxpix.nl":
  2339. case "img.yt":
  2340. case "xxxscreens.com":
  2341. case "i.sxpics.nl":
  2342. case "imageon.org":
  2343. case "nimplus.com":
  2344. case "imag.nimplus.com":
  2345. case "newimagepost.com":
  2346. case "fapat.me":
  2347. case "imgbe.com":
  2348. case "fireimg.cc":
  2349. case "rapidimg.net":
  2350. case "imgtornado.com":
  2351. case "erimge.com":
  2352. case "loftlm.ru":
  2353. case "tinizo.com":
  2354. case "imgpix.net":
  2355. case "freeimagehostin.com":
  2356. case "sximg.nl":
  2357. case "freephotohostin.com":
  2358. case "imgpics.nl":
  2359. case "imagepics.xyz":
  2360. case "imgwo.com":
  2361. case "ima.gy":
  2362. case "picz.site":
  2363. case "allxpix.com":
  2364. case "imgblank.com":
  2365. case "xeimg.yt":
  2366. case "imgmain.com":
  2367. case "acidimg.cc":
  2368. case "imgpart.com":
  2369. case "picmoza.com":
  2370. case "imgjazz.xyz":
  2371. case "picshost.info":
  2372. case "petrovixxxjav.com":
  2373. case "placeimg.net":
  2374. case "imageshtorm.com":
  2375. case "blameless.work":
  2376. case "xxx.kodiak.top":
  2377. case "xaoutchouc.live":
  2378. case "mshelxxx.ru.com":
  2379. case "trans.firm.in":
  2380. case "xxxwebdlxxx.top":
  2381. case "imgdawgknuttz.com":
  2382. case "olarixas.xyz":
  2383. case "pornhd720p.com":
  2384. dp=true;
  2385. f = document.getElementsByTagName("input");
  2386. if(f.length)
  2387. {
  2388. f[f.length-1].removeAttribute("disabled");
  2389. f[f.length-1].click();
  2390. }
  2391. case "fotoszok.pl":
  2392. case "damimage.com":
  2393. case "adultur.com":
  2394. case "imagedecode.com":
  2395. case "gogoimage.org":
  2396. case "imageblinks.com":
  2397. case "imglooks.com":
  2398. case "ocaload.com":
  2399. case "imgstudio.org":
  2400. case "goimge.com":
  2401. case "imageho.me":
  2402. case "imgor.net":
  2403. case "icezap.com":
  2404. case "imgtrial.com":
  2405. case "dimtus.com":
  2406. case "imgcat.pw":
  2407. case "imgseed.com":
  2408. case "imgcredit.xyz":
  2409. case "pic.hotimg.site":
  2410. case "xfap.fun":
  2411. case "xxxwebdlxxx.org":
  2412. i = q('img[src*="' + iurl + '/upload/"]');
  2413. break;
  2414. case "imgboom.net":
  2415. if(window.location.href.indexOf("img-") != -1)
  2416. {
  2417. window.location.href = "http://imgboom.net/view.php";
  2418. break;
  2419. }
  2420. case "thumbnailus.com":
  2421. case "imgleveret.com":
  2422. case "porn84.org":
  2423. i = q('input[type="submit"]');
  2424. dp=true;
  2425. if(i)
  2426. {
  2427. i.click();
  2428. break;
  2429. }
  2430. i = q('img[src*="' + iurl + '/upload/"].centred');
  2431. break;
  2432. case "imgking.co":
  2433. if(window.location.href.indexOf("img-") != -1)
  2434. {
  2435. window.location.href = window.location.href.replace("img-","img2-");
  2436. break;
  2437. }
  2438. i = q('img[src*="' + iurl + '/upload/"]');
  2439. break;
  2440. case "imgsky.net":
  2441. case "imgsee.net":
  2442. case "imgzong.xyz":
  2443. case "imageking.xyz":
  2444. case "imgxx.xyz":
  2445. case "imgao.xyz":
  2446. case "imgweng.xyz":
  2447. case "imgkes.xyz":
  2448. case "imgkoi.xyz":
  2449. case "imglin.xyz":
  2450. case "imgkr.xyz":
  2451. case "imgbird.xyz":
  2452. case "imgwewo.xyz":
  2453. case "imgirx.xyz":
  2454. case "imgalor.xyz":
  2455. case "imgjut.buzz":
  2456. case "imgtrw.buzz":
  2457. case "imglina.xyz":
  2458. case "imgkuiw.xyz":
  2459. case "imgwang.buzz":
  2460. case "imgmeno.buzz":
  2461. case "imgpekele.buzz":
  2462. case "imglqw.buzz":
  2463. case "imgyng.buzz":
  2464. case "imgbbd.buzz":
  2465. case "imgwia.buzz":
  2466. case "imgowk.buzz":
  2467. case "imgokr.buzz":
  2468. case "imgoiu.buzz":
  2469. case "imgeza.buzz":
  2470. case "mrlzqoe.buzz":
  2471. case "imgutkr.store":
  2472. case "imghhr.online":
  2473. case "imglaiw.store":
  2474. case "imgvue.online":
  2475. case "imgxgf.store":
  2476. case "imgbibam.online":
  2477. case "imgqaz.online":
  2478. case "imgurt.online":
  2479. case "imgwxr.online":
  2480. case "imgyre.online":
  2481. case "picqaxs.cfd":
  2482. case "picvvvd.sbs":
  2483. case "imgjjtr.sbs":
  2484. i = q('button');
  2485. dp=true;
  2486. j = true;
  2487. if(i)
  2488. {
  2489. i.click();
  2490. }
  2491. i = q('.big_img_box img[src*="http"]');
  2492. break;
  2493. case "picspornfree.me":
  2494. case "hotimage.uk":
  2495. case "xxxwebdlxxx.org":
  2496. case "hdmoza.com":
  2497. i = q('input[type="submit"]');
  2498. dp=true;
  2499. if(i)
  2500. {
  2501. i.click();
  2502. break;
  2503. }
  2504. case "avenuexxx.com":
  2505. case "uploadimagex.com":
  2506. case "hostingkartinok.com":
  2507. case "bellazon":
  2508. case "savepice.ru":
  2509. i = q('img[src*="/upload"]');
  2510. break;
  2511. case "imgseeds.com":
  2512. i = q('input');
  2513. if(i)
  2514. {
  2515. i.click();
  2516. break;
  2517. }
  2518. case "imghit.com":
  2519. i = q('img[alt="image"]');
  2520. break;
  2521. case "image-share.com":
  2522. i = q('img[src*="upload/"]');
  2523. break;
  2524. case "bilder-upload.eu":
  2525. i = q('input[src*="upload/"]');
  2526. break;
  2527. case "picload.org":
  2528. case "imagecross.com":
  2529. case "npicture.net":
  2530. case "public-pic.de":
  2531. case "picbug.ru":
  2532. i = q('img[src*="' + iurl + '/image"]');
  2533. break;
  2534. case "yande.re":
  2535. case "konachan.com":
  2536. case "konachan.net":
  2537. i = q('a[href*="' + iurl + '/image"]');
  2538. if(i){i.src = i.href;}
  2539. break;
  2540. case "imagesup.net":
  2541. i = q('a[href*="/di-"]');
  2542. if(i)
  2543. {
  2544. i.src = i.href;
  2545. }
  2546. break;
  2547. case "cyberpics.net":
  2548. case "fastimages.ru":
  2549. case "hot-file.org":
  2550. case "image.siroro.co.uk":
  2551. case "qattach.com":
  2552. case "fotohelp.kz":
  2553. case "pic-you.com":
  2554. i = q('a[href*="/di/"]');
  2555. if(i)
  2556. {
  2557. i.src = i.href;
  2558. }
  2559. break;
  2560. case "imagehost.thasnasty.com":
  2561. case "oxily.com":
  2562. case "ghanaimages.co":
  2563. case "knecht.novarata.net":
  2564. case "img.irandeliver.com":
  2565. case "xferz.com":
  2566. case "up.kfesfahan.com":
  2567. case "upload.khontai.com":
  2568. case "image.pantyhosemania.info":
  2569. case "t.hogor.net":
  2570. case "your-pictures.net":
  2571. i = q('a[href*="?di="]');
  2572. if(i)
  2573. {
  2574. i.src = i.href;
  2575. }
  2576. break;
  2577. case "pixxxels.org":
  2578. case "postimg.org":
  2579. case "postimg.cc":
  2580. case "pixxxels.cc":
  2581. j = true;
  2582. i = q('a[href*="?dl="]');
  2583. if(i)
  2584. {
  2585. i.src = i.href;
  2586. }
  2587. break;
  2588. case "zimage.fr":
  2589. i = q('img[src*="images.php"]');
  2590. if(i)
  2591. {
  2592. i.src = i.src.replace('.php?nom=', '/');
  2593. break;
  2594. }
  2595. case "dumppix.com":
  2596. i = q('a[href*="enter"]');
  2597. if(i)
  2598. {
  2599. window.location.href = i.href;
  2600. break;
  2601. }
  2602. case "mrjh.org":
  2603. case "stuffed.ru":
  2604. case "rapid-img.de":
  2605. case "ngarko.online.fr":
  2606. case "freeuploadimages.org":
  2607. case "picszone.net":
  2608. case "images.share-films.net":
  2609. case "bildjunkies.de":
  2610. case "foto.hcfor.pl":
  2611. case "pic.tooptarinha.com":
  2612. case "poopr.org":
  2613. case "xp-images.hi2.ro":
  2614. case "dayzeddesigns.com":
  2615. case "freeimghosting.co.uk":
  2616. case "upload.removed.us":
  2617. case "imghost.pl":
  2618. case "udostepniaj.pl":
  2619. case "ngarko.free.fr":
  2620. case "images.collectiontricks.it":
  2621. case "244pix.com":
  2622. case "imgboxxx.com":
  2623. case "imghere.net":
  2624. case "imgdope.com":
  2625. case "hostmat.eu":
  2626. case "imgdream.net":
  2627. case "imgcentral.com":
  2628. i = q('img[src*="images/"]');
  2629. break;
  2630. case "use.com":
  2631. i = q('img[src*="images/"][onload]');
  2632. if(i){i.src = i.src.replace('/s_2/', '/s_5/');}
  2633. break;
  2634. case "1y9y.com":
  2635. case "host4images.com":
  2636. case "aveimage.com":
  2637. i = q('img#photo');
  2638. break;
  2639. case "freeimgup.com":
  2640. case "picturevip.com":
  2641. case "image-load.net":
  2642. case "upload.djmaster.fr":
  2643. case "b4he.com":
  2644. case "firepic.org":
  2645. case "overdream.cz":
  2646. case "fastpics.net":
  2647. case "ii4.ru":
  2648. case "picuploader.de":
  2649. case "smages.com":
  2650. case "pictureshack.ru":
  2651. case "imgbox.de":
  2652. case "imagehosting.cz":
  2653. case "9foto.ru":
  2654. case "imagesloading.altervista.org":
  2655. case "phpbbmods.it":
  2656. case "lakhdaria.net":
  2657. case "partizansk.eu":
  2658. case "webjardiner.com":
  2659. case "imgup.com":
  2660. case "iezz.com":
  2661. case "picturescream.com":
  2662. case "all-poster.ru":
  2663. case "extraimage.net":
  2664. case "imagexxx18.com":
  2665. case "imgvisits.com":
  2666. case "imghall.com":
  2667. case "picturedent.org":
  2668. i = q('img[src*="/images/"]');
  2669. break;
  2670. case "intergranada.com":
  2671. i = q('img[src*="/images/images/"]');
  2672. break;
  2673. case "pixelup.net":
  2674. i = q('center img[src*="/images/"]');
  2675. break;
  2676. case "saveimg.ru":
  2677. case "imglink.ru":
  2678. case "4put.ru":
  2679. case "sharepic.biz":
  2680. case "you-logo.ru":
  2681. case "powerlogo.ru":
  2682. i = q('img[src*="pictures/"]');
  2683. break;
  2684. case "xenopix.com":
  2685. i = q('img[src*="/pix/"]');
  2686. break;
  2687. case "chronos.to":
  2688. case "imgmaid.net":
  2689. case "pic-maniac.com":
  2690. case "coreimg.net":
  2691. case "imx.to":
  2692. j = true;
  2693. i = q('input[type="submit"]');
  2694. dp=true;
  2695. if(i)
  2696. {
  2697. i.click();
  2698. break;
  2699. }
  2700. case "imgspice.com":
  2701. case "imagetwist.com":
  2702. case "dev.imagetwist.com":
  2703. case "imagexport.com":
  2704. case "pixroute.com":
  2705. case "pzy.be":
  2706. case "funkyimg.com":
  2707. case "itmages.ru":
  2708. case "imagenpic.com":
  2709. case "turbopix.fr":
  2710. case "pictureturn.com":
  2711. case "pixic.ru":
  2712. case "nyanimg.com":
  2713. case "geekpics.in":
  2714. case "imageporter.com":
  2715. case "imagenimage.com":
  2716. case "imageshimage.com":
  2717. case "imagedax.net":
  2718. case "pornimagex.com":
  2719. case "sendpic.org":
  2720. case "imagehaha.com":
  2721. case "picshick.com":
  2722. case "photo-screen.ru":
  2723. i = q('img[src*="/i/"]');
  2724. break;
  2725. case "imguniversal.com":
  2726. case "imgclick.net": // no submits
  2727. case "imgsto.com":
  2728. case "fappic.com":
  2729. case "imgsen.com":
  2730. case "premalo.com":
  2731. case "picdollar.com":
  2732. case "fotokiz.com":
  2733. case "silverpic.com":
  2734. case "pics4upload.com":
  2735. case "imgstar.eu":
  2736. i = q("form input[type='submit'][value*='continue to image' i]");
  2737. dp = true;
  2738. if(i)
  2739. {
  2740. i.click();
  2741. }
  2742. i = q("img.pic[src*='/i/'], img.pic[src*='/img/']");
  2743. break;
  2744. case "scrin.org":
  2745. i = q('a[href*="/i/"]');
  2746. if(i)
  2747. {
  2748. i.src = i.href;
  2749. break;
  2750. }
  2751. i = q('img[src*="/i/"]');
  2752. break;
  2753. case "miragepics.com":
  2754. i = q('input[value*="' + iurl + '/images/"]');
  2755. if(i){i.src = i.value;}
  2756. break;
  2757. case "ipic.su":
  2758. i = q('input[value*="' + iurl + ' img/"]');
  2759. if(i){i.src = i.value;}
  2760. break;
  2761. case "mixbase.net":
  2762. i = q('img[src*="media/storage/"]');
  2763. break;
  2764. case "image2you.ru":
  2765. i = q('img[src*="images/"]');
  2766. if(i){i.src = i.src.replace('2_', '');}
  2767. break;
  2768. case "imgmade.com":
  2769. i = q('form');
  2770. dp=true;
  2771. if(i)
  2772. {
  2773. i.submit();
  2774. break;
  2775. }
  2776. case "imgdrive.net":
  2777. case "imgtaxi.com":
  2778. case "imgwallet.com":
  2779. j = true;
  2780. i = q("a.overlay_ad_link");
  2781. if(i)
  2782. {
  2783. i.click();
  2784. break;
  2785. }
  2786. case "pixhost.to":
  2787. case "imgtiger.com":
  2788. case "imgserve.net":
  2789. case "imgdino.com":
  2790. case "overpic.net":
  2791. case "imagesocket.com":
  2792. case "hostpic.org":
  2793. case "zapodaj.net":
  2794. case "jpegshare.net":
  2795. case "screenshot.ru":
  2796. case "imagefile.org":
  2797. case "zapisz.net":
  2798. case "addyourpics.com":
  2799. case "imgbank.cz":
  2800. case "showmyimage.com":
  2801. case "upload.supreme-elite.fr":
  2802. case "myimg.me":
  2803. case "heberg-hush.org":
  2804. case "oltaciyukle.com":
  2805. case "pichost.name":
  2806. case "imagend.com":
  2807. case "imagerocket.com":
  2808. case "hyyathost.com":
  2809. case "images.reptilescanada.com":
  2810. case "wepic.ru":
  2811. case "upload-image.fr":
  2812. case "images.baconbits.org":
  2813. case "upanh.ovo.vn":
  2814. case "wrzucaj.net":
  2815. case "heberge-images.com":
  2816. case "image.kg":
  2817. case "savemyimage.com":
  2818. case "img.dramacafe.tv":
  2819. case "fapping.empornium.sx":
  2820. case "beeimg.com":
  2821. case "youpicture.org":
  2822. case "vavvi.com":
  2823. case "imgzap.com":
  2824. case "crazyimg.com":
  2825. case "extraimago.com":
  2826. case "ftop.ru":
  2827. case "porncomix.info":
  2828. case "luxpic.ru":
  2829. case "passpix.com":
  2830. case "trumbhost.com":
  2831. //Chevereto 2.x
  2832. i = q('img[src*="' + iurl + '/images/"]');
  2833. break;
  2834. case "shareimages.com":
  2835. case "imagesmax.de":
  2836. case "bilder.nixhelp.de":
  2837. i = q('img[src*="' + iurl + '/images"]');
  2838. break;
  2839. case "imgfantasy.com":
  2840. case "imageporn.eu":
  2841. case "imgsmile.com":
  2842. case "imgsay.com":
  2843. case "0img.net":
  2844. case "imagedisco.net":
  2845. //IMGReserve
  2846. j = true;
  2847. dp=true;
  2848. i = q('input[value="YES"]');
  2849. if(i){i.onclick();break;}
  2850. case "pic-upload.de":
  2851. case "shrani.najdi.si":
  2852. case "imageab.com":
  2853. case "turboimagehost.com":
  2854. i = q('img[onclick*="(this"]');
  2855. break;
  2856. case "joblo.com":
  2857. i = q('img');
  2858. if(i)
  2859. {
  2860. i.src = "http://www.joblo.com/moviehotties/images/profile-gallery/orig" + window.location.href.substr(window.location.href.lastIndexOf("/"));
  2861. }
  2862. break;
  2863. case "img.folluo.me":
  2864. case "sizzlingclicks.com":
  2865. case "imgsha.com":
  2866. i = q('img[data-load="full"]');
  2867. break;
  2868. case "yapx.ru":
  2869. j = true;
  2870. if(q("footer"))
  2871. {
  2872. f = document.body.querySelectorAll("[data-gallery-index]");
  2873. if(f.length === 1)
  2874. {
  2875. //i = f[0];
  2876. i = document.head.querySelector('meta[property="og:image:secure_url"]');
  2877. if(i)
  2878. {
  2879. i.src = i.content;
  2880. }
  2881. }
  2882. else
  2883. {
  2884. is_gallery = true;
  2885. }
  2886. }
  2887. break;
  2888. case "vfl.ru":
  2889. i = q('img[src*="/ii/"]');
  2890. break;
  2891. case "suckmypic.net":
  2892. i = q('#theImage');
  2893. break;
  2894. case "piccy.info":
  2895. i = q('a[href*="/orig/"]');
  2896. if(i){i.click();return;}
  2897. else{i = q('img#mainim');}
  2898. break;
  2899. case "t.me":
  2900. case "telegram.me":
  2901. j = true;
  2902. if(document.querySelector("body.body_widget_post"))
  2903. {
  2904. f = document.querySelectorAll('.tgme_widget_message_photo_wrap[style*="/file/"]');
  2905. if(f.length === 1)
  2906. {
  2907. i = f[0];
  2908. i.src = i.style.backgroundImage.slice(4, -1).replace(/"/g, "");
  2909. if(window.self !== window.top)
  2910. {
  2911. window.top.location.href = window.self.location.href;
  2912. }
  2913. }
  2914. }
  2915. break;
  2916. case "comment-cdn.9gag.com":
  2917. i = q('img');
  2918. if(i) {i.src = window.location.hash.substring(1,window.location.hash.length);}
  2919. break;
  2920. case "xhamster.com":
  2921. case "xhamster.desi":
  2922. case "xhamster3.com":
  2923. case "xhamster4.com":
  2924. case "xhamster11.com":
  2925. case "xhamster19.com":
  2926. j = true;
  2927. i = q('div.fotorama__active>img.fotorama__img');
  2928. break;
  2929. case "imgtorrnt.in":
  2930. window.location.replace("https://i.imgur.com/" + window.location.href.substr(window.location.href.lastIndexOf('=') + 1));
  2931. case "trans.firm.in":
  2932. if(window.location.href.search(/\.(?:jpe?g|png|gif|webp)\.html$/i) != -1)//check whether it's a valid image url
  2933. {
  2934. i = { src : window.location.href.replace(".html", "") };
  2935. }
  2936. case "vipr.im":
  2937. j = true;
  2938. i = q("a.ddownloader[download]");
  2939. if(i)
  2940. {
  2941. i.src = i.href;
  2942. break;
  2943. }
  2944. break;
  2945. default: // dynamic subdomain
  2946. switch(host.substr(host.indexOf(".")+1))
  2947. {
  2948. case "xhamster.com":
  2949. case "xhamster.desi":
  2950. case "xhamster3.com":
  2951. case "xhamster4.com":
  2952. case "xhamster11.com":
  2953. case "xhamster19.com":
  2954. j = true;
  2955. i = q('div.fotorama__active>img.fotorama__img');
  2956. break;
  2957. case "tumblr.com":
  2958. case "media.tumblr.com":
  2959. f = document.head.querySelectorAll('meta[property="og:image"]');
  2960. if(f.length === 1)
  2961. {
  2962. i = document.head.querySelector('meta[property="og:video"]');
  2963. if(!i)
  2964. {
  2965. i = f[0];
  2966. i.src = f[0].content;
  2967. }
  2968. else
  2969. {
  2970. i.src = i.content;
  2971. }
  2972. }
  2973. else if(f.length > 1)
  2974. {
  2975. is_gallery = true;
  2976. }
  2977. else
  2978. {
  2979. i = document.querySelector('div#base-container > div > div > div > div > img');
  2980. }
  2981. break;
  2982. case "wikipedia.org":
  2983. case "wikimedia.org":
  2984. i = q('a[href*="/upload"]');
  2985. if(i){i.src = i.href;}
  2986. break;
  2987. case "imgcredit.xyz":
  2988. i = q('img[src*="/upload/"]');
  2989. break;
  2990. case "photobucket.com":
  2991. find_text_in_scripts('originalUrl":"', '"');
  2992. break;
  2993. case "lostpic.net":
  2994. //chevereto 3.x
  2995. i = document.head.querySelector('link[rel="image_src"]');
  2996. if(i)
  2997. {
  2998. i.src = i.href;
  2999. }
  3000. break;
  3001. case "freeamateurteens.net":
  3002. i = q('img[src*="images/"]');
  3003. break;
  3004. case "otofotki.pl":
  3005. i = q('img[src*="/obrazki/"]');
  3006. break;
  3007. case "tinypic.com":
  3008. i = q('img#imgElement');
  3009. break;
  3010. case "imagilive.com":
  3011. i = q('a.button');
  3012. if(i)
  3013. {
  3014. dp=true;
  3015. i.click();
  3016. break;
  3017. }
  3018. i = q('img[src*="' + iurl + '"]');
  3019. break;
  3020. default: // for user-added sites
  3021. j = true;
  3022. console.warn("HJI is running on a custom website");
  3023.  
  3024. if(document.readyState !== "loading") // DOM loaded
  3025. {
  3026. f = document.querySelectorAll("img");
  3027. if(f.length !== 0)
  3028. {
  3029. let b = 0;
  3030. for(let n = 0; n < f.length; n++)
  3031. {
  3032. if(f[n].naturalWidth == 0 && !f[n].complete) // not yet loaded
  3033. {
  3034. if(timeout < 4000)
  3035. {
  3036. console.warn("waiting for this image to start loading to see its size and compare with others: ", f[n]);
  3037. b = -1;
  3038. break;
  3039. }
  3040. else // waited for 3+ sec, that's enough
  3041. {
  3042. console.warn("skipping broken images");
  3043. continue; // skip the broken image
  3044. }
  3045. }
  3046. else if(f[n].naturalWidth * f[n].naturalHeight >= f[b].naturalWidth * f[b].naturalHeight)
  3047. {
  3048. b = n;
  3049. }
  3050. }
  3051. if(b !== -1){i = f[b]; console.warn("showing biggest image");}
  3052. }
  3053. }
  3054. break;
  3055. }
  3056. break;
  3057. }
  3058. //
  3059. //firefox handmade noscript
  3060. if(!j)
  3061. {
  3062. j = true;
  3063. window.addEventListener('beforescriptexecute', onscript, true); // useless, but let it be
  3064. bStopScripts = true; // actually better than the event above, blocks more stuff for some reason
  3065. }
  3066. //
  3067. if(tb){window.clearTimeout(tb);}
  3068. if(is_gallery)
  3069. {
  3070. console.log("Handy Image: userscript stopped itself INTENTIONALLY, - cuz it is not just a single image on the page to fullsize but a gallery");
  3071. observer.disconnect();
  3072. return;
  3073. }
  3074. if(i && i.src)
  3075. {
  3076. bStopScripts = true; // in case JS was allowed before
  3077. observer.disconnect();
  3078. function clr_pgn()
  3079. {
  3080. unsafeWindow.open = null;
  3081. unsafeWindow.onload = null;
  3082. unsafeWindow.onbeforeunload = null;
  3083. document.replaceChild(document.importNode(document.implementation.createHTMLDocument("").documentElement, true), document.documentElement);
  3084. unsafeWindow.document.createElement = unsafeWindow.console.debug;
  3085. document.head.innerHTML = '<meta name="referrer" content="'+referrer_policy+'">';
  3086. }
  3087. if (i.nodeName === "VIDEO" || ext_list_video.indexOf(i.src.split('.').pop().split('?')[0].toLowerCase()) >= 0)
  3088. {
  3089. console.log("Found a video");
  3090. is_video = true;
  3091. }
  3092. else if (ext_list_not_image.indexOf(i.src.split('.').pop().split('?')[0].toLowerCase()) >= 0)
  3093. {
  3094. console.warn("What we found is not an image or a video");
  3095. i = null;
  3096. return false;
  3097. }
  3098. ws();
  3099. sanitize();
  3100. clr_pgn();
  3101. window.removeEventListener('beforescriptexecute', onscript, true);
  3102. makeimage();
  3103. }
  3104. else // try again
  3105. {
  3106. //console.warn("Didnt find image, trying again in " + timeout + " ms");
  3107. tb = window.setTimeout(function() { console.warn("Didnt find image, waited " + timeout + " ms to try again. page: " + window.location.href); tb=0; timeout*=2; i=0; makeworld(); }, timeout);
  3108. }
  3109. }
  3110.  
  3111. var grab_fav_tags = []; // set in Custom JS
  3112. function use_booru_tags_in_dl_filename()
  3113. {
  3114. let artist = document.querySelectorAll(".tag-type-artist a:not([href*='/books?'])[href*='tags='],.tag-type-idol a:not([href*='/books?'])[href*='tags='], .artist-tag > a, a.search-tag[itemprop='author'], a.model, .user-info-box .username > a");
  3115. for(let n = 0; n < artist.length; n++)
  3116. {
  3117. if(artist[n].text == "?") continue;
  3118. filename = "by " + artist[n].text.replaceAll(" ", "_") + " " + filename;
  3119. }
  3120.  
  3121. let character = document.querySelectorAll(".tag-type-character a:not([href*='/books?'])[href*='tags='], .character-tag > a, .character-tag-list a.search-tag, a.character");
  3122. for(let n = 0; n < character.length; n++)
  3123. {
  3124. if(character[n].text == "?") continue;
  3125. filename = character[n].text.replaceAll(" ", "_") + " " + filename;
  3126. }
  3127.  
  3128. /*if(character.length === 0)
  3129. {
  3130. let franchise = document.querySelectorAll(".tag-type-copyright > a, .copyright-tag > a, .copyright-tag-list a.search-tag");
  3131. for(let n = 0; n < franchise.length; n++)
  3132. {
  3133. if(franchise[n].text == "?") continue;
  3134. filename = franchise[n].text.replaceAll(" ", "_") + " " + filename;
  3135. break; // just one cuz else it'd get long
  3136. }
  3137. }*/
  3138. let general_tags = document.querySelectorAll(".tag-link, .tag-type-general a:not([href*='/books?'])[href*='tags='], .tag-type-genre > a, .general-tag > a, .general-tag-list > .tag-type-0 > a.search-tag, a.search-tag, div#tagLink > a,.tags-list a");
  3139. let general_tags_text = [];
  3140. for(let n = 0; n < general_tags.length; n++)
  3141. {
  3142. general_tags_text.push(general_tags[n].text);
  3143. }
  3144.  
  3145. function process_grabbed_tags()
  3146. {
  3147. if(typeof cfg_js !== "string")
  3148. {
  3149. console.log("waiting for async setting loading of cfg_js: " + (typeof cfg_js));
  3150. if(!loadCfg_callbacks.includes(process_grabbed_tags)){loadCfg_callbacks.push(process_grabbed_tags);}
  3151. return;
  3152. }
  3153. if(cfg_js && cfg_js.indexOf("grab_fav_tags") != -1) {grab_fav_tags = cfg_js.substring(cfg_js.indexOf("[")+1,cfg_js.indexOf("]")).replaceAll(" ", "").replaceAll("_", " ").replaceAll(/\n/g, '').replaceAll(/(?<!\\)'/g, "").replaceAll("\\'","'").replaceAll('"','').toLowerCase().split(",");} // load custom tags // also bypass CSP
  3154. console.debug("your favorite tags: "+ grab_fav_tags);
  3155. if(grab_fav_tags.length)
  3156. {
  3157. for(let n = 0; n < general_tags_text.length; n++)
  3158. {
  3159. if(general_tags_text[n] == "?") continue;
  3160. if(grab_fav_tags.indexOf(general_tags_text[n].toLowerCase().replaceAll("_", " ")) != -1)
  3161. {
  3162. filename = general_tags_text[n].replaceAll(" ", "_") + " " +filename;
  3163. }
  3164. }
  3165. }
  3166. filename = filename.replaceAll("_(", " ("); // but not the space before franchise
  3167. }
  3168. process_grabbed_tags();
  3169. }
  3170.  
  3171. function onvolumechange()
  3172. {
  3173. GM.setValue("vid_volume", (i.muted? "0" : i.volume));
  3174. }
  3175.  
  3176. function changeCursor()
  3177. {
  3178. /*if(i.scrollHeight > iViewHeight) // image pushing out-of-screen browser fix
  3179. {
  3180. i.style.margin = "0px auto";
  3181. }
  3182. else
  3183. {
  3184. i.style.margin = "auto";
  3185. }*/
  3186.  
  3187. if(is_video) return;
  3188.  
  3189. if(rescaled === 0) // original
  3190. {
  3191. if((orgImgWidth == viewWidth && orgImgHeight <= viewHeight) || (orgImgWidth <= viewWidth && orgImgHeight == viewHeight)) // perfect fit on one side, can't resize
  3192. { // with zoom there might be a 1 pixel difference and it's not a matter of rounding, e.g. image is 501.03 width and the window is 501.55 width so there won't be a perfect fit even tho both the image and your screen (window) are 1920px wide
  3193. i.style.cursor = "";
  3194. }
  3195. else if (orgImgWidth > viewWidth || orgImgHeight > viewHeight)
  3196. {
  3197. i.style.cursor = "zoom-out";
  3198. }
  3199. else
  3200. {
  3201. i.style.cursor = "zoom-in";
  3202. }
  3203. }
  3204. else if(rescaled === 2) // fill
  3205. {
  3206. if(orgImgWidth == viewWidth && orgImgHeight == viewHeight) // perfect fit, can't resize
  3207. {
  3208. i.style.cursor = "";
  3209. }
  3210. else if (orgImgWidth > i.scrollWidth)
  3211. {
  3212. i.style.cursor = "zoom-in";
  3213. }
  3214. else
  3215. {
  3216. i.style.cursor = "zoom-out";
  3217. }
  3218. }
  3219. else // if(rescaled === 1) // fit
  3220. {
  3221. if((orgImgWidth == viewWidth && orgImgHeight <= viewHeight) || (orgImgWidth <= viewWidth && orgImgHeight == viewHeight)) // perfect fit on one side, can't resize
  3222. {
  3223. i.style.cursor = "";
  3224. }
  3225. else if (orgImgWidth > i.scrollWidth)
  3226. {
  3227. i.style.cursor = "zoom-in";
  3228. }
  3229. else
  3230. {
  3231. i.style.cursor = "zoom-out";
  3232. }
  3233. }
  3234. }
  3235.  
  3236. function mousedown(event) // chrome scroll-wheel
  3237. {
  3238. if(event.which === 2) // middle mouse
  3239. {
  3240. event.preventDefault();
  3241. event.stopImmediatePropagation();
  3242. return;
  3243. }
  3244. }
  3245.  
  3246. // Firefox 90- support
  3247. if(typeof window.visualViewport === "undefined")
  3248. {
  3249. window.visualViewport = {
  3250. get pageTop(){return window.scrollY},
  3251. get pageLeft(){return window.scrollX}
  3252. };
  3253. }
  3254.  
  3255. let viewHeight;
  3256. let viewWidth;
  3257.  
  3258. function onWindowResize()
  3259. {
  3260. viewHeight = window.innerHeight; //Math.round(window.visualViewport.height);
  3261. viewWidth = window.innerWidth; //Math.round(window.visualViewport.width);
  3262. //console.debug("not including scrollbar: iViewHeight: " + window.visualViewport.height + ", iViewWidth:" +window.visualViewport.width );
  3263. //console.debug("including scrollbar: iViewHeight: " + window.innerHeight + ", iViewWidth:" +window.innerWidth );
  3264. }
  3265.  
  3266. let bZoomCenterOnCursor = true; // setting to change in custom JS
  3267.  
  3268. function rescale(oEvent, isFilling)
  3269. {
  3270. let click_X, click_Y;
  3271. if(oEvent) // mouse click
  3272. {
  3273. if(oEvent.which === 3) // right mouse
  3274. {
  3275. return;
  3276. }
  3277. else if(oEvent.which === 2) // middle mouse
  3278. {
  3279. isFilling = true;
  3280. oEvent.preventDefault(); // drag scroll
  3281. oEvent.stopImmediatePropagation();
  3282. }
  3283. click_X = oEvent.clientX - i.offsetLeft;
  3284. click_Y = oEvent.clientY - i.offsetTop;
  3285. }
  3286. //let unFilling = false;
  3287. //document.body.style.overflowX = '';
  3288. //document.body.style.overflowY = '';
  3289. //let iScrollMax_V = document.documentElement.scrollHeight - iViewHeight; // FireFox (only) has window.scrollMaxY
  3290. //let iScrollMax_H = document.documentElement.scrollWidth - iViewWidth;
  3291.  
  3292. let imgPrevWidth = i.scrollWidth;
  3293. let imgPrevHeight = i.scrollHeight;
  3294. let prevScroll_Y = Math.round(window.visualViewport.pageTop);
  3295. let prevScroll_X = Math.round(window.visualViewport.pageLeft);
  3296.  
  3297. let bSidesCMP;
  3298. if(isFilling)
  3299. {
  3300. if(rescaled === 2) // to original
  3301. {
  3302. rescaled = 0;
  3303. i.style.width = orgImgWidth + "px";
  3304. i.style.height = orgImgHeight + "px";
  3305. }
  3306. else // fill
  3307. {
  3308. bSidesCMP = (orgImgWidth / orgImgHeight) < (viewWidth / viewHeight);
  3309. rescaled = 2;
  3310. }
  3311. }
  3312. else
  3313. {
  3314. if(rescaled != 0) // to original
  3315. {
  3316. //if(rescaled === 2) {unFilling = true;}
  3317. rescaled = 0;
  3318. i.style.width = orgImgWidth + "px";
  3319. i.style.height = orgImgHeight + "px";
  3320. }
  3321. else // fit
  3322. {
  3323. bSidesCMP = (orgImgWidth / orgImgHeight) > (viewWidth / viewHeight);
  3324. rescaled = 1;
  3325. }
  3326. }
  3327.  
  3328. if(rescaled != 0)
  3329. {
  3330. if(bSidesCMP)
  3331. {
  3332. i.style.width = "100%";
  3333. i.style.height = "auto";
  3334. //document.body.style.overflowX = 'hidden'; // we don't need unscrollable scrollbars if they appear
  3335. }
  3336. else
  3337. {
  3338. i.style.height = "100%";
  3339. i.style.width = "auto";
  3340. //document.body.style.overflowY = 'hidden'; // we don't need unscrollable scrollbars if they appear
  3341. }
  3342. }
  3343.  
  3344. changeCursor();
  3345. let newToOldImgScale_X = i.scrollWidth / imgPrevWidth;
  3346. let newToOldImgScale_Y = i.scrollHeight / imgPrevHeight;
  3347. click_X *= newToOldImgScale_X;
  3348. click_Y *= newToOldImgScale_Y;
  3349. prevScroll_X *= newToOldImgScale_X;
  3350. prevScroll_Y *= newToOldImgScale_Y;
  3351. if(oEvent)
  3352. {
  3353. if(bZoomCenterOnCursor)
  3354. { // scroll to the place our mouse was on the image (including scroll progress) (that place will now be in the top left corner) then try to shift it back to under the mouse cursor (if there is enough space)
  3355. window.scrollTo(click_X + prevScroll_X - oEvent.clientX, click_Y + prevScroll_Y - oEvent.clientY);
  3356. }
  3357. else
  3358. { // scroll to the place our mouse was on the image (including scroll progress) (that place will now be in the top left corner) then try to shift it to the center of the screen (if there is enough space)
  3359. window.scrollTo(click_X + prevScroll_X - viewWidth / 2, click_Y + prevScroll_Y - viewHeight / 2);
  3360. }
  3361. }
  3362. else // keep percentage scroll progress for KB hotkeys
  3363. { // the top pixel of the image which is seen is the same after resizing so we can't keep the scrool at the max bottom - it's a feature, not a bug
  3364. window.scrollTo(prevScroll_X, prevScroll_Y);
  3365. }
  3366. }
  3367.  
  3368. var ARC = 0;
  3369. function autoresize()
  3370. {
  3371. if((!is_video && i.naturalHeight) || i.videoHeight)
  3372. {
  3373. orgImgWidth = Math.round((is_video ? i.videoWidth : i.naturalWidth) / window.devicePixelRatio);
  3374. orgImgHeight = Math.round((is_video ? i.videoHeight : i.naturalHeight) / window.devicePixelRatio);
  3375. i.style.width = orgImgWidth + "px";
  3376. i.style.height = orgImgHeight + "px";
  3377. let title = i.src.substr(i.src.lastIndexOf("/")+1);
  3378. if(title.indexOf("?") != -1)
  3379. {
  3380. title = title.substr(0, title.indexOf("?"));
  3381. }
  3382. title = decodeURIComponent(title);
  3383. if(is_video)
  3384. {
  3385. document.title = title + " (" + i.videoWidth + "x" + i.videoHeight + ")";
  3386. }
  3387. else
  3388. {
  3389. document.title = title + " (" + i.naturalWidth + "x" + i.naturalHeight + ")";
  3390. }
  3391. if(filename && filename.lastIndexOf(" ") != filename.length-1) {filename += " ";}
  3392. if(filename_ext) {filename_ext = "." + filename_ext;}
  3393. filename = filename + title + filename_ext;
  3394. /*let link = protected_createElement('link');
  3395. link.rel = 'icon';
  3396. link.href = i.src;
  3397. document.head.appendChild(link);*/ // big lag in general from this feature
  3398. let InitRescale = false;
  3399. if(cfg_fitWH && orgImgHeight > viewHeight && orgImgWidth > viewWidth) // both scrollbars
  3400. {
  3401. InitRescale = true;
  3402. }
  3403. else if(cfg_fitB && (orgImgHeight > viewHeight || orgImgWidth > viewWidth)) // one scrollbar
  3404. {
  3405. InitRescale = true;
  3406. }
  3407. else if(cfg_fitS && orgImgHeight <= viewHeight && orgImgWidth <= viewWidth) // no scrollbars
  3408. {
  3409. InitRescale = true;
  3410. }
  3411. if(InitRescale)
  3412. {
  3413. rescale(null, cfg_fitOS ? true : false);
  3414. }
  3415. else
  3416. {
  3417. changeCursor();
  3418. }
  3419. bStopScripts = false; // should be safe now, right?
  3420. if(cfg_js){eval(cfg_js);}
  3421. }
  3422. else // no onloadstart event for images, sadge
  3423. {
  3424. ARC++;
  3425. if(ARC < 1000)
  3426. {
  3427. if(ARC == 75 || ARC == 300 || ARC == 999) // about 1sec, 5sec, 15sec
  3428. {
  3429. i.src = i.src; // lol fix
  3430. console.warn("HJI: Trying to reload the image, " + ARC);
  3431. }
  3432. window.setTimeout(autoresize, 10);
  3433. }
  3434. else
  3435. {
  3436. console.warn("HJI: Gave up trying to reload the image, it is broken");
  3437. i.onload = autoresize; // not really gave up
  3438. }
  3439. }
  3440. }
  3441.  
  3442. var observer = new MutationObserver((mutations) => {
  3443.  
  3444. makeworld();
  3445.  
  3446. if(bStopScripts) // Chrome handmade NoScript
  3447. {
  3448. for (const m of mutations)
  3449. {
  3450. for (const n of m.addedNodes)
  3451. {
  3452. if(n.tagName === "SCRIPT")
  3453. {
  3454. //console.debug("HJI: Script was stopped from loading: ", n);
  3455. console.debug( "HJI: stopped 1 script from loading ");
  3456. n.textContent = "";
  3457. n.remove();
  3458. }
  3459. }
  3460. }
  3461. }
  3462. });
  3463. observer.observe(document, {subtree: true, childList: true});
  3464.  
  3465. // hotkeys
  3466. if (typeof KeyEvent === "undefined") // only defined in FireFox
  3467. {
  3468. window.KeyEvent = {
  3469. DOM_VK_SPACE: 32,
  3470. DOM_VK_LEFT: 37,
  3471. DOM_VK_UP: 38,
  3472. DOM_VK_RIGHT: 39,
  3473. DOM_VK_DOWN: 40,
  3474. DOM_VK_A: 65,
  3475. DOM_VK_D: 68,
  3476. DOM_VK_P: 80,
  3477. DOM_VK_Q: 81,
  3478. DOM_VK_R: 82,
  3479. DOM_VK_S: 83,
  3480. DOM_VK_W: 87,
  3481. DOM_VK_M: 77,
  3482. DOM_VK_F: 70,
  3483. DOM_VK_NUMPAD2: 98,
  3484. DOM_VK_NUMPAD4: 100,
  3485. DOM_VK_NUMPAD5: 101,
  3486. DOM_VK_NUMPAD6: 102,
  3487. DOM_VK_NUMPAD8: 104,
  3488. DOM_VK_F5: 116,
  3489. DOM_VK_TAB: 9,
  3490. DOM_VK_ENTER: 13
  3491. };
  3492. }
  3493.  
  3494. function cancelEvent(a)
  3495. {
  3496. a = a ? a : window.event;
  3497. if (a.stopPropagation)
  3498. {
  3499. a.stopPropagation();
  3500. }
  3501. if (a.stopImmediatePropagation)
  3502. {
  3503. a.stopImmediatePropagation();
  3504. }
  3505. if (a.preventDefault)
  3506. {
  3507. a.preventDefault();
  3508. }
  3509. a.cancelBubble = true;
  3510. a.cancel = true;
  3511. a.returnValue = false;
  3512. return false;
  3513. }
  3514.  
  3515. function scroll_space(a, b)
  3516. {
  3517. let by = Math.round((b ? viewHeight : viewWidth) * 0.50 * (a ? -1 : 1));
  3518. if(!b)
  3519. {
  3520. window.scrollBy(0, by);
  3521. }
  3522. else
  3523. {
  3524. window.scrollBy(by, 0);
  3525. }
  3526. }
  3527.  
  3528. function download_image()
  3529. {
  3530. if(i && i.src)
  3531. {
  3532. filename = filename.replace(/[/\\?%*:|"<>]/g, '_'); // characters you can't use in filenames
  3533. let details = { url: i.src,
  3534. headers: referrer_policy !== "no-referrer" ? {'Referer': window.location.href} : {}, // doesn't fully follow the page's referer policy but ok
  3535. name: bUseCustomFilename !== false ? filename : null,
  3536. saveAs: true };
  3537. console.log('downloading: ' + filename + " from: " + i.src);
  3538. details.onload = () => { console.log('download complete'); };
  3539. details.ontimeout = () => { console.error('download timeout'); };
  3540. details.onerror = (error, errorDetails) => { console.error('download failed', error, errorDetails); };
  3541. GM_download(details);
  3542. }
  3543. }
  3544.  
  3545. function onkeydown (b)
  3546. {
  3547. let a = (window.event) ? b.keyCode : b.which;
  3548.  
  3549. if(b.ctrlKey && a == KeyEvent.DOM_VK_S)
  3550. {
  3551. cancelEvent(b);
  3552. download_image();
  3553. return;
  3554. }
  3555. if (b.altKey || b.metaKey || (b.ctrlKey && a != KeyEvent.DOM_VK_SPACE && a != KeyEvent.DOM_VK_F5 && a != KeyEvent.DOM_VK_R))
  3556. {
  3557. return;
  3558. }
  3559.  
  3560. let by = Math.round(viewHeight * 0.10);
  3561.  
  3562. switch (a)
  3563. {
  3564. case KeyEvent.DOM_VK_RIGHT:
  3565. case KeyEvent.DOM_VK_D:
  3566. case KeyEvent.DOM_VK_NUMPAD6:
  3567. if(!is_video)
  3568. {
  3569. window.scrollBy(by, 0);
  3570. cancelEvent(b);
  3571. }
  3572. else
  3573. {
  3574. i.currentTime += skip_by;
  3575. }
  3576. break;
  3577. case KeyEvent.DOM_VK_LEFT:
  3578. case KeyEvent.DOM_VK_A:
  3579. case KeyEvent.DOM_VK_NUMPAD4:
  3580. if(!is_video)
  3581. {
  3582. window.scrollBy(by * -1, 0);
  3583. cancelEvent(b);
  3584. }
  3585. else
  3586. {
  3587. i.currentTime -= skip_by;
  3588. }
  3589. break;
  3590. case KeyEvent.DOM_VK_W:
  3591. case KeyEvent.DOM_VK_NUMPAD8:
  3592. window.scrollBy(0, by * -1);
  3593. cancelEvent(b);
  3594. break;
  3595. case KeyEvent.DOM_VK_S:
  3596. case KeyEvent.DOM_VK_NUMPAD2:
  3597. window.scrollBy(0, by);
  3598. cancelEvent(b);
  3599. break;
  3600. case KeyEvent.DOM_VK_SPACE:
  3601. if(!is_video)
  3602. {
  3603. scroll_space(b.shiftKey, b.ctrlKey);
  3604. }
  3605. else if(i.paused || i.ended)
  3606. {
  3607. i.play();
  3608. }
  3609. else
  3610. {
  3611. i.pause();
  3612. }
  3613. cancelEvent(b);
  3614. break;
  3615. case KeyEvent.DOM_VK_M:
  3616. i.muted = !i.muted;
  3617. cancelEvent(b);
  3618. break;
  3619. case KeyEvent.DOM_VK_F:
  3620. i.requestFullscreen();
  3621. cancelEvent(b);
  3622. break;
  3623. case KeyEvent.DOM_VK_TAB:
  3624. case KeyEvent.DOM_VK_ENTER:
  3625. rescale(null, true);
  3626. cancelEvent(b);
  3627. break;
  3628. case KeyEvent.DOM_VK_Q:
  3629. case KeyEvent.DOM_VK_NUMPAD5:
  3630. rescale(null, false);
  3631. cancelEvent(b);
  3632. break;
  3633. case KeyEvent.DOM_VK_P:
  3634. cfg();
  3635. cancelEvent(b);
  3636. break;
  3637. case KeyEvent.DOM_VK_R:
  3638. if(!b.ctrlKey)
  3639. {
  3640. sessionStorage.hji = window.location.href;
  3641. window.location.reload();
  3642. cancelEvent(b);
  3643. }
  3644. else
  3645. {
  3646. window.removeEventListener("beforeunload", onbeforeunload, true);
  3647. }
  3648. break;
  3649. case KeyEvent.DOM_VK_F5:
  3650. window.removeEventListener("beforeunload", onbeforeunload, true);
  3651. break;
  3652. }
  3653. }
  3654.  
  3655. function cfg()
  3656. {
  3657. if (typeof GM.setValue !== "undefined")
  3658. {
  3659. function saveCfg()
  3660. {
  3661. GM.setValue("directImage", q("#hji_cfg_1_direct").checked);
  3662. GM.setValue("bgColor", q("#hji_cfg_2_bgclr").value);
  3663. GM.setValue("fitWH", q("#hji_cfg_3_fitWH").checked);
  3664. GM.setValue("fitB", q("#hji_cfg_4_fitB").checked);
  3665. GM.setValue("fitS", q("#hji_cfg_5_fitS").checked);
  3666. GM.setValue("fitOS", q("#hji_cfg_7_fitOS").checked);
  3667. GM.setValue("js", q("#hji_cfg_6_js").value);
  3668. alert("Configuration Saved");
  3669. if(q("#hji_cfg_2_bgclr").value){document.body.style.backgroundColor = q("#hji_cfg_2_bgclr").value;}else{document.body.style.backgroundColor = "";}
  3670. }
  3671. if(i && i.src)
  3672. {
  3673. i.removeEventListener("click", rescale, true);
  3674. i.removeEventListener("auxclick", rescale, true);
  3675. i.removeEventListener("mousedown", mousedown, true);
  3676. }
  3677. window.removeEventListener("keydown", onkeydown, true);
  3678. document.head.innerHTML = "";
  3679. document.body.innerHTML = "";
  3680. ws();
  3681. let div = protected_createElement("div");
  3682. div.style = "margin: auto; width: fit-content; height: fit-content; border: 2px solid black; color: white; background: #5a5757; position: absolute; inset: 0;"; // chrome "force dark mode" ignores our colors and just makes text white... great
  3683. div.innerHTML = "<b><center>Configuration</center></b><br><input id='hji_cfg_1_direct' type='checkbox'> Open images directly with browser (disables Handy)"
  3684. + "<br><br><input id='hji_cfg_2_bgclr' style='color: inherit; background: inherit;' type='text' size='6'> Background color (empty = default)"
  3685. + "<br><br>Fit to window images:" + " ( Fill to window instead <input id='hji_cfg_7_fitOS' type='checkbox'> )"
  3686. + "<br><br><input id='hji_cfg_3_fitWH' type='checkbox'> Larger than window both vertically and horizontally"
  3687. + "<br><br><input id='hji_cfg_4_fitB' type='checkbox'> Larger than window either vertically or horizontally"
  3688. + "<br><br><input id='hji_cfg_5_fitS' type='checkbox'> Smaller than window"
  3689. + "<br><br><center>Custom JS Action:<br><textarea id='hji_cfg_6_js' style='margin: 0px; width: 400px; height: 50px; color: inherit; background: inherit;'></textarea>"
  3690. + "<br><input id='hji_cfg_save' style='color: inherit; background: inherit;' type='button' value='Save configuration'></center>";
  3691. document.body.appendChild(div);
  3692. q("#hji_cfg_1_direct").checked = cfg_direct;
  3693. q("#hji_cfg_2_bgclr").value = cfg_bgclr;
  3694. q("#hji_cfg_3_fitWH").checked = cfg_fitWH;
  3695. q("#hji_cfg_4_fitB").checked = cfg_fitB;
  3696. q("#hji_cfg_5_fitS").checked = cfg_fitS;
  3697. q("#hji_cfg_7_fitOS").checked = cfg_fitOS;
  3698. q("#hji_cfg_6_js").value = cfg_js;
  3699. q("#hji_cfg_save").addEventListener("click", saveCfg, true);
  3700. }
  3701. else
  3702. {
  3703. alert("Sorry, userscripts in browser native mode (without a script manager) can't have configurations! Install TamperMonkey extension. (it's a very good userscript manager)");
  3704. }
  3705. }
  3706.  
  3707. var loadCfg;
  3708. var loadCfg_callbacks = [];
  3709. if (typeof GM === 'undefined') // GM3 or native
  3710. {
  3711. if (typeof GM_getValue !== "undefined")
  3712. {
  3713. console.warn("using synchronous GM setting loading");
  3714. window.GM = {};
  3715. GM.getValue = GM_getValue;
  3716. GM.setValue = GM_setValue;
  3717. loadCfg = function()
  3718. {
  3719. cfg_direct = GM.getValue("directImage", false);
  3720. cfg_bgclr = GM.getValue("bgColor", "grey");
  3721. cfg_fitWH = GM.getValue("fitWH", true);
  3722. cfg_fitB = GM.getValue("fitB", false);
  3723. cfg_fitS = GM.getValue("fitS", true);
  3724. cfg_fitOS = GM.getValue("fitOS", false);
  3725. cfg_js = GM.getValue("js", "");
  3726. cfg_vol = GM.getValue("vid_volume", "0.5");
  3727. }
  3728. loadCfg();
  3729. loadCfg_callbacks.forEach(function(item) {item()}); // likely not needed here
  3730. }
  3731. else
  3732. {
  3733. cfg_js = "";
  3734. console.warn("no script manager found - using default settings mode");
  3735. }
  3736. }
  3737. else
  3738. {
  3739. loadCfg = async function ()
  3740. {
  3741. Promise.all([
  3742. GM.getValue("directImage", false).then( function(result) { cfg_direct = result; } , console.error),
  3743. GM.getValue("bgColor", "grey").then( function(result) { cfg_bgclr = result; } , console.error),
  3744. GM.getValue("fitWH", true).then( function(result) { cfg_fitWH = result; } , console.error),
  3745. GM.getValue("fitB", false).then( function(result) { cfg_fitB = result; } , console.error),
  3746. GM.getValue("fitS", true).then( function(result) { cfg_fitS = result; } , console.error),
  3747. GM.getValue("fitOS", false).then( function(result) { cfg_fitOS = result; } , console.error),
  3748. GM.getValue("js", "").then( function(result) { cfg_js = result; } , console.error),
  3749. GM.getValue("vid_volume", "0.5").then( function(result) { cfg_vol = result; } , console.error)
  3750. ]).then(
  3751. function() { console.debug("GM settings loaded"); loadCfg_callbacks.forEach(function(item) {item()}); },
  3752. function(error) { console.error("GM settings NOT loaded: " + error); loadCfg_callbacks.forEach(function(item) {item()}); }
  3753. );
  3754. }
  3755. console.debug("GM settings started loading")
  3756. loadCfg();
  3757. }