Giter Site home page Giter Site logo

Filter loading lag about nsfw-filter HOT 30 CLOSED

nsfw-filter avatar nsfw-filter commented on May 18, 2024
Filter loading lag

from nsfw-filter.

Comments (30)

yzevm avatar yzevm commented on May 18, 2024 1

we didn't , I just put everything in a single loop, its lazy loading behaviour, if you just mark as checked not loading content, user can see nsfw images in next scrolls
will check in 12hr

from nsfw-filter.

yzevm avatar yzevm commented on May 18, 2024 1

Yeah. I'll fix it today
sure
accepted

from nsfw-filter.

yzevm avatar yzevm commented on May 18, 2024 1

Difficult bug, lets fix it in the next releases, removed from v1.0.0

from nsfw-filter.

pottekkat avatar pottekkat commented on May 18, 2024 1

We are getting some coverage on social media. And this lag could be a turn off for some of the users. Although it may work on things like social media sites where NSFW images may occur not that frequently. But the users test them on Google Images and sites like that and although the extension works, the initial lag may be an issue. It could defy the purpose of the extension.

Link: https://www.appinn.com/nsfw-filter/
PS: This article was translated from Chinese?
Screenshot from 2020-08-05 17-24-52

from nsfw-filter.

yzevm avatar yzevm commented on May 18, 2024 1

Related solution:

Moved to v1.1.0 project

ps. chinese article? dude your marketing skill is awesome 👍

from nsfw-filter.

yzevm avatar yzevm commented on May 18, 2024 1

What will we change, document.readyState? before the EventListner?

Dunno yet, just possible solution

from nsfw-filter.

pottekkat avatar pottekkat commented on May 18, 2024

@YegorZaremba There seems to be a small lag from when the pages are loaded and the images are hidden. Can we fix this?
@yxlin118 is currently looking for a solution to this.
@YegorZaremba Please check in on this.

from nsfw-filter.

yzevm avatar yzevm commented on May 18, 2024

Hi, thanks for contributing, so yeah its issue that I tried to solve, thought that document.addEventListener("DOMContentLoaded", func); will fix it, cause we used(and still use) window load event, but same behaviour. Please share If you find sth related to solution. I hope I will fix it in next release

from nsfw-filter.

yxlin118 avatar yxlin118 commented on May 18, 2024

@YegorZaremba Hi Yegor thanks for following up! What do you mean by document.addEventListener("DOMContentLoaded", func); will fix it but stil lthe same behavior?

from nsfw-filter.

yzevm avatar yzevm commented on May 18, 2024

We subscribe on event to know when page is load, there are to events for our case
DOMContentLoaded – the browser fully loaded HTML, and the DOM tree is built, but external resources like pictures and stylesheets may be not yet loaded.
load – not only HTML is loaded, but also all the external resources: images, styles etc.

Not sure, looks like first task is load page, then work with extensions, maybe sth to force task into eventloop is helps, setImmediate or etc, needs time to figure out

from nsfw-filter.

yxlin118 avatar yxlin118 commented on May 18, 2024

I see. I can look into that. Do you have any useful documentation that you would recommend me to look into?

from nsfw-filter.

pottekkat avatar pottekkat commented on May 18, 2024

@all-contributors please add @yxlin118 for bug, ideas

from nsfw-filter.

allcontributors avatar allcontributors commented on May 18, 2024

@navendu-pottekkat

I've put up a pull request to add @yxlin118! 🎉

from nsfw-filter.

yzevm avatar yzevm commented on May 18, 2024

Not really, im newbie in extensions, I use https://developer.chrome.com/extensions/devguide and https://developer.mozilla.org/en-US/docs/Web/API/Window

from nsfw-filter.

yxlin118 avatar yxlin118 commented on May 18, 2024

Thanks! I will take a look.

from nsfw-filter.

yxlin118 avatar yxlin118 commented on May 18, 2024

I think currently what I am experiencing is that a lot of times it will only start the filtering process after I start to scroll. Not sure if that's a problem with other people too.

from nsfw-filter.

yzevm avatar yzevm commented on May 18, 2024

Yeah, its a another issue :D In cases of websites where JS dynamically render DOM elements, we just set timeout right now line in code

Probably related solution of it

from nsfw-filter.

yxlin118 avatar yxlin118 commented on May 18, 2024

And a lot of times when I scroll back up the filtered image would reappear and be filtered again. Probably also has to do elements being rendered dynamically?

from nsfw-filter.

yzevm avatar yzevm commented on May 18, 2024

Yeah you talk about lazy loading content and its another issue :D, which I'll fix soon #21

from nsfw-filter.

yxlin118 avatar yxlin118 commented on May 18, 2024

I think I might have a fix using MutationObserver, and it seems to also fix the issue where scrolling might would make contents visible again. Can I be added to the repo so I can push my branch to set up review and pull request? @navendu-pottekkat

from nsfw-filter.

pottekkat avatar pottekkat commented on May 18, 2024

@yxlin118 Please for this repo and create a pull request. I will review the code and add it

from nsfw-filter.

yxlin118 avatar yxlin118 commented on May 18, 2024

@navendu-pottekkat I don't have access for this repo for me to push a branch and create pull request

from nsfw-filter.

pottekkat avatar pottekkat commented on May 18, 2024

@yxlin118 You can create a pull request by forking this branch and making changes in your forked version and test it out to make sure everything works. Once you have committed to your forked version, you can create a pull request and we will review it and accept. You don't need access to the repo for making PRs.

Check the docs for more info: https://gist.github.com/Chaser324/ce0505fbed06b947d962

from nsfw-filter.

pottekkat avatar pottekkat commented on May 18, 2024

And a lot of times when I scroll back up the filtered image would reappear and be filtered again. Probably also has to do elements being rendered dynamically?

Earlier we handled this using a separate function which checks for valid images. If the images have already been replaced then sets a dataset in the image as shown in the code below:

function validImage(image) {
  /*
  Checks if the image is of a certain height and width and check if the image has already been replaced,
  preventing infinite loops.
  */
  const valid = image.src &&
    image.width > 64 && image.height > 64 &&
    !image.dataset.isReplaced;
  console.log('image %s valid', image.src, valid);
  return valid;
}

@YegorZaremba Why did we remove this?

from nsfw-filter.

pottekkat avatar pottekkat commented on May 18, 2024

@YegorZaremba Could you also check the PR?

from nsfw-filter.

pottekkat avatar pottekkat commented on May 18, 2024

@YegorZaremba But then we should not be having this issue right?

Also, I am having some problems with @yxlin118 's PR. I am experiencing some issues and some performance issues. Could you check and confirm?

I have invited you as a collaborator. Please check your mail and confirm,

from nsfw-filter.

pottekkat avatar pottekkat commented on May 18, 2024

@YegorZaremba That is a good idea. We should get more eyes on the project and we will fix the bug

from nsfw-filter.

pottekkat avatar pottekkat commented on May 18, 2024

We need to fix this ASAP.
https://www.reddit.com/r/webdev/comments/i13apj/block_nsfw_content_using_ai_opensource_web/fzuw3et?utm_source=share&utm_medium=web2x

from nsfw-filter.

pottekkat avatar pottekkat commented on May 18, 2024

ps. chinese article? dude your marketing skill is awesome

I really do not know how it got there. Maybe because of Product Hunt and the Javascript community

from nsfw-filter.

pottekkat avatar pottekkat commented on May 18, 2024

Related solution:

ps. chinese article? dude your marketing skill is awesome

What will we change, document.readyState? before the EventListner?

from nsfw-filter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.