Handy Image

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

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