Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some fix and request lazy load image support #71

Closed
DandyClubs opened this issue Sep 17, 2022 · 4 comments
Closed

some fix and request lazy load image support #71

DandyClubs opened this issue Sep 17, 2022 · 4 comments

Comments

@DandyClubs
Copy link

some fix

id: 'imagevenue,',

const fastpic = {
id: 'fastpic',
name: 'FastPic',
linkRegExp: /fastpic.(?:ru|org)/view/,
imageURLRegExp: /src="(?http[^"]+)" class="image img-fluid"/,
getURL: getURLFromPage,
}

const URL_PARTS_REGEXP = /i(\d+).+.(ru|org)/big(/\d+/\d+/).+/([^/]+)$/
to
const URL_PARTS_REGEXP = /i(\d+).+.(ru|org)/big(/\d+/\d+/).+/([^\/]+)$/

ImageTwist some link include jpeg.html link extension length 4 image extension length 3
this changed xxx.jpeg to xxxjpeg

const imagetwist = {
id: 'imagetwist',
name: 'ImageTwist',
linkRegExp: /imagetwist.com/,
viewMode: 'origin-download',

async getURL(link) {
const imageName = link.url.split('/').pop()?.replace('.html', '')
const extension = imageName?.split('.').pop() ?? ''
const imageUrl = link.thumbnailURL
.replace('/th/', '/i/')
.slice(0, -extension.length)

to

const imageName = link.split('/').pop()?.replace('.html', '')
const extension = imageName?.split('.').pop() ?? ''
const srcextension = src?.split('.').pop() ?? ''
//console.log(imageName, extension)
const imageUrl = src
.replace('/th/', '/i/')
.slice(0, -srcextension.length)

lazy load image.. src data:image.......

i check.. imagesWithLinks

thumbnailUrl: img.src ?? img.title

get img.src data:image....

how can change this script showInViewer to https://github.com/fengyuanchen/viewerjs

please a not only img gallery support

@nikolay-borzov
Copy link
Owner

  1. I will fix issues with URL extractors
  2. Could you provide mode details (examples, link HTML) regarding

lazy load image.. src data:image.......

  1. About

how can change this script showInViewer to https://github.com/fengyuanchen/viewerjs

Do you miss gallery feature? If so, I'm planning to add this.
I hesitate using existing solution for viewer feature - It could have its own issues.

@DandyClubs
Copy link
Author

i mod some code

function ImagesCollect(){
var imagesWithLinks = [...document.querySelectorAll('a > img, a > var, a > div')]
.map((img) => ({
link: img.parentElement,
thumbnailUrl: (img.src && img.src.includes('data:image') ? img.dataset.src : img.src) ?? img.title,
}))
.filter(({ link }) => ImagesHost.test(link.href))
return imagesWithLinks
}

@nikolay-borzov
Copy link
Owner

What is HTML that this code handles?

@DandyClubs
Copy link
Author

DandyClubs commented Feb 26, 2023

from this code

const imagesWithLinks = $$('a > img, a > var', container)
.map((img) => ({
link: img.parentElement,
thumbnailUrl: img.src ?? img.title,
}))
.filter(({ link }) => link.href)

some site lazy load image src is data:image........ or 1x1 transparent image

so i try... getAttribute lazy load image src

const lazyAttributes =[
"data-cover",
"data-ks-lazyload",
"data-lazyload",
"data-src",
"data-actualsrc",
"data-defer-src",
"data-imageurl",
"data-ks-lazyload-custom",
"data-lazy-load-src",
"data-lazy-src",
"data-lazyload-src",
"data-original",
"data-placeholder",
"data-thumb_url",
"data-url",
"data-lazy",
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Image Viewer
  
To do
Development

No branches or pull requests

2 participants