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

cancel
Showing results for 
Search instead for 
Did you mean: 
emmeci92
Active Member

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

Jump to solution

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 Solution

Accepted Solutions
emmeci92
Active Member

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

Jump to solution

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 solution in original post

7 Replies
afaust
Master

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

Jump to solution

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
Active Member

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

Jump to solution

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
Master

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

Jump to solution

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
Active Member

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

Jump to solution

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
Master

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

Jump to solution

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
Active Member

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

Jump to solution

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
Master

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

Jump to solution

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..