jaredcowing / wmsNewBooks

Small program to view list of new books by fund & date acquired using WorldShare Acquisitions API.
MIT License
2 stars 1 forks source link

Jquery issues #10

Closed gjerdery closed 3 years ago

gjerdery commented 4 years ago

I was having an issue images loading in Bookview in both Chrome and Firefox on Windows. The cover image wouldn't resize, and after further investigation, I found that newBooks.js wasn't executing, even though it appeared to have loaded.

After a lot of trial and error, I noticed that your site at https://library.woodbury.edu/newbooks worked fine, while mine didn't. The only difference I could find was your site includes a different version of jquery. The version in Github sets 3.4.1, while your local site uses 2.1.4.

I reset my NewBooksConfig to also point to 2.1.4, and that resolved the display issues I'd encountered. I wasn't sure if the plan of action should be to downgrade the version referenced in the repository files, or to dig in to newBooks.js and try to get it working with 3.4.1...

jaredcowing commented 4 years ago

Thanks for alerting me to the JQuery compatibility issue, I'm going to take a look and see if I can get it working with 3.4.1 (I'm glad to hear that 2.1.4 fixed the problem for now though).

jaredcowing commented 3 years ago

Hmm, I am testing with JQuery 3.4.1 and 3.5.1, and both are working for me. I am going to update the header views slightly though, just in case that helps.

gjerdery commented 3 years ago

If you’re able to make a 3.4.1 environment public-facing I’d be happy to test here to see if I can reproduce. Also I can install the same on my end to see if you can reproduce from my server.

jaredcowing commented 3 years ago

Hi Ryan, apologies for the delayed response (November is the month when things get a bit hectic here, but we're on the other side of it now). I've switched my installation to 3.4.1, I'd also be interested to see it on your server as well if the JQuery scripts still aren't working.

gjerdery commented 3 years ago

The difference I see between your site and the repository code is that you have a local copy of jquery-3.4.1.min.js, while the repo code points to a Google-hosted version. I can confirm that your site is displaying properly for me. I'll see if I can reproduce on my site.

gjerdery commented 3 years ago

I downloaded a local copy of 3.4.1 to another instance, and see the same issues on Windows: https://lis.luther.edu/wmstest/index.php/Bookview/viewFA/All/1Y. Your site doesn't have any issue for me on the same browser.

jaredcowing commented 3 years ago

How curious, in the link you provided to me the JQuery is working properly (I tried in Firefox, Chrome and Edge, this is on Windows). I'm not sure what might be causing the discrepancy but am very curious to know.

gjerdery commented 3 years ago

I realized that I didn't include one detail in the initial report - while other users were reporting more consistent errors, I could only see the issue if I refreshed the page. The first load always looked fine, but then about 2/3's of refreshes show the faulty layout. From my limited understanding of JQuery, I was assuming this was an issue with how the browser was processing javascript, but found it strange that your site worked perfectly in the same browser. Perhaps my server is passing some incorrect response headers??

jaredcowing commented 3 years ago

Hmm, I might do a little testing, I do recall that I had a similar issue with book covers taking a long time to resize when there were lots of books to load on screen (it was more of an issue before pagination cut down on the number of book covers that load at once). If it's related to that, it could be a matter of optimizing something in the JQuery. Perhaps that might help. If you can re-create the issue on your server, would you mind sending me a screenshot of what it looks like? That might help me figure out if it's similar to the issue I was seeing for awhile.

gjerdery commented 3 years ago

Here's a screen shot of my site using JQuery 3.4.1 (https://lis.luther.edu/wmstest/index.php/Bookview/viewFA/All/1Y) after refreshing the page once:

Screen Shot 2020-12-04 at 1 50 56 PM

jaredcowing commented 3 years ago

Thanks for the screenshot, this does look like what I had been encountering. I'm not able to reproduce when refreshing on your link, but I suspect the issue is that the JS code which resizes each cover image and hides the blue title text is either not executing at all, or executing too early (before the cover images are in place). I just tinkered a bit with relocating that code within newBooks.js to see if it helps (a bit of a shot in the dark until I can recreate/test the problem, but perhaps it might help). If you get a chance, does the updated newBooks.js script make any difference?

gjerdery commented 3 years ago

Hmm, strange that you can't reproduce it with my site (a reminder that it only does this on Windows browsers). Regarding an updated newBooks.js, I don't see any updated file in the repository.

gjerdery commented 3 years ago

Never mind... it is available now and says it was updated "22 hours" ago. Not sure why I couldn't see it this morning!

jaredcowing commented 3 years ago

That was my mistake, I forgot to push it to the repository yesterday (whoops!)

gjerdery commented 3 years ago

Yeah, that fixes it!

jaredcowing commented 3 years ago

Glad to hear it. :) The resizing script now waits until all page elements have been loaded, so that should allow the cover images to all be loaded by the time the script tries to resize them. Do let me know if the problem resurfaces.