cancel
Showing results for 
Search instead for 
Did you mean: 

how to modify *.js file and make it work?

jinjiankang
Champ in-the-making
Champ in-the-making
Hi all,

I can find .js file, such as '/share/res/components/documentlibrary/documentlist_7a2cddfa85f47a8aabe35c5523cc4eec.js', from firefox, but only searched /webapps/share/components/documentlibrary/documentlist.js in server side.

Why?

I want to insert some debug info into documentlist.js, such as console.log("some info").

Thanks.
4 REPLIES 4

ddraper
World-Class Innovator
World-Class Innovator
All the source files have an MD5 checksum appended to them. This is done to avoid the problem of stale browser caches. Resources can be cached forever in the knowledge that if they are updated (eg by hot fix or upgrade) then a new version will be requested. So you can update documentlist.js and the MD5 checksum will be updated and a new file will be downloaded.

zladuric
Champ on-the-rise
Champ on-the-rise
Hi,

The way I found it to work is to:
1. Make changes to the file
2. Click on "Clear dependency caches" here: http://127.0.0.1:8080/share/page/index
3. It's fresh.

Before I learned about that bit, I had to restart alfresco each time, which was pretty lame and slow.

ddraper
World-Class Innovator
World-Class Innovator
The reason for this additional step is that Surf is caching dependencies more aggressively than before. There are many different possible locations that Surf is able to retrieve a resource from (more than in a standard web app) and it also minifies resources dynamically and this is cached to save repeatedly hunting for resources. The clear dependency caches button resets the cached information. Whilst this is adds an extra step when developing it is beneficial in production systems.

zladuric
Champ on-the-rise
Champ on-the-rise
Yeah, I agree. The process is better then before, I'd say. On 3.4c, I would symlink a file.js and file-min.js while developing, then when moving to production, minify the script, then you have to make a fix and back to beginning, which takes a while Smiley Happy

The button is cool, I keep a tab open and just hit refresh when I want to try out what I did Smiley Happy