EPrints Technical Mailing List Archive

Message: #09147


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

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


Hi,

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.

/_javascript_/auto-3.4.4.js?1664898850

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:

https://github.com/eprints/eprints3.4/issues/274

Regards

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: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/