cancel
Showing results for 
Search instead for 
Did you mean: 

How can I inject my custom javascript after faceted-search page loading?

emmeci92
Champ on-the-rise
Champ on-the-rise

I need to import my javascript file or inline script after the faceted-search page loading.

I'm using a 5.2 community version.

1 ACCEPTED ANSWER

emmeci92
Champ on-the-rise
Champ on-the-rise

I have found another guy with the same problem and there is a solution: Aikau: How to call a repo webscript from an aikau widget 

It works for me.

View answer in original post

7 REPLIES 7

afaust
Legendary Innovator
Legendary Innovator

That is actually not the way to customize the faceted search page (or any Aikau page) at all. You do not inject a JavaScript file - you modify the page JSON model so that Share / Aikau construct the widgets according to your needs (this may include loading a custom JavaScript of yours for a custom widget). Look at this Parashift blog post for an example. Though this may not describe specifically what you want to customize, the basic concept is the same for most customizations.

emmeci92
Champ on-the-rise
Champ on-the-rise

If I follow the example by Parashift blog I have this error: Could not find compressed file: /parashift/action/QuickPrint.js

I attach the folder structure of my project, can you check it? screen folder structure — imgbb.com 

afaust
Legendary Innovator
Legendary Innovator

It looks like they left a small thing out - the definition of a custom Dojo package "parashift". That can also be part of the extension XML, i.e. I have this in one of my modules.

emmeci92
Champ on-the-rise
Champ on-the-rise

My extension.xml is placed in site-data/extensions/ folder.

I have moved parashift/action/QuickPrint.js under site-webscripts folder

By the last moving, log doesn't show me the previous error but in the actions of faceted-search page i show

  • Download
  • Show in the browser
  • Edit offline
  • Copy to...
  • Move to...
  • Remove documento
  • Start workflow
  • Permissions

There is not a quick print action.

afaust
Legendary Innovator
Legendary Innovator

The JS file was in the right place - you only needed to add a package for parashift and specify its location as "parashift" (the first-level folder below META-INF). Putting that file in site-webscripts will do nothing for you.

emmeci92
Champ on-the-rise
Champ on-the-rise

I have found another guy with the same problem and there is a solution: Aikau: How to call a repo webscript from an aikau widget 

It works for me.

afaust
Legendary Innovator
Legendary Innovator

Good to know that "how to call a Repository web script" was your original problem. If you had given that information initially as your use case we could have helped you sooner..