Handy Image

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

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