[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] document.observe is not a function Error in EPrints3.4.4


I think someone also reported a similar issue on this mailing list 
recently.? If you add the prototypejs ingredient to your 
EPRINTS_PATH/flavours/pub_lib/inc file, as well as reloading the web 
server, if you initially loaded your EPrints repository in the same web 
browser without adding prototypejs to your inc file, the JavaScript 
(/javascript/auto-3.4.4.js) will be cached client-side. In most browser 
you can clear this client-side cache with a hard refresh using the key 
combination Ctrl+Shift+R. (You could also test loading your EPrints 
repository again in private/incognito mode or in a different web browser).

If this does not work? It is worth loading in your web browser the 
auto-generated JavaScript file itself, which can be found by viewing the 
source for the page and finding it in the page's <head>.- Check the 
JavaScript code displayed for the string "20_prototype.js".? If this is 
not present, also try a hard refresh (Ctrl+Shift+R)? of the JavaScript 
'page' and search for the string "20_prototype.js" again.? If you still 
cannot find it your may have some other issue preventing the JavaScript 
from being updated.

3.4.4 introduced a timestamp to the Javascript 
(/javascript/auto-3.4.4.js) and CSS (/style/auto-3.4.4.css) 
auto-generated file links, which are the amalgamation of various 
JavaScript or CSS files across the EPrints codebase's javascript/auto/ 
or style/auto/ directories.? E.g.


However, the code that determines whether the link for auto-generated 
JavaScript file needs to update its timestamp, so web browsers will drop 
their client cache automatically, does not take into account that new 
JavaScript files might be added by virtue of including a new 
ingredient.? The timestamp is set based on the latest time any included 
JavaScript file was modified.? A newly added ingredient, may not have 
any JavaScript files that have been modified since the current timestamp 
being used.? Therefore, the client cache will not be cleared despite the 
auto-generated JavaScript file having? changed to include extra 
JavaScript files. I have added a GitHub issue to investigate and fix this:



David Newman

On 06/01/2023 5:49 am, MATILUKO, Opeyemi Emmanuel via Eprints-tech wrote:
> *CAUTION:* This e-mail originated outside the University of Southampton.
>     Hi
>     I recently upgraded EPrints to version 3.4.4 and the statistics
>     stopped working. On inspection, I see 2 error popping up and the
>     errors are;
>     1. Uncaught ReferenceError: Class is not defined in
>     auto-3.4.4.js:283:18
>     The line contains var EPJS_Menus = Class.create({...
>     2. Uncaught TypeError: document.observe is not a function
>     This error is from the line
>     document.observe("dom:loaded",function(){
>     ? ? ? ? new EPJS_Stats_Table ({ 'context': {
>     ? ? ? ? ? ? 'range':'_ALL_',
>     ? ? ? ? ? ? 'datatype':'downloads'
>     ? ? ? ? ? ? },
>     ? ? ? ? ? ? 'options': {
>     ? ? ? ? ? ? 'container_id': 'top-authors', 'top': 'authors',
>     'view': 'Table', 'limit': '10', 'title': 'Top Authors'
>     ? ? ? ? ? ? }
>     ? ? ? ? });
>     ? ? });
>     I have added ingredients/prototypejs as a dependency
>     What can be the issue? and what is the possible solution?
>     Thanks
> *** Options:http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive:https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C281ced764b61451f0b9f08daefc2b4d0%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C638085916778089324%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=h2%2BdOpG53TtEHB5t58mGva494jGc58%2FJh0wCsS55NrI%3D&reserved=0
> *** EPrints community wiki:https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C281ced764b61451f0b9f08daefc2b4d0%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C638085916778089324%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=gt%2FwtuHEnu35qm3Nb1k3SYRvVLHOgLyhHw2zKP%2FZNr8%3D&reserved=0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20230106/a7ab8078/attachment.html