How can I add JS(add custom JavaScript code) on OJS's article HTML?

Dear All,
How can I add JS(add custom JavaScript code) on OJS’s article HTML?
Just like the following webpage’s bookmarks(left) and float window(right).
http://callmenick.com/_development/single-page-smooth-scroll/
I had completed floatWin and popupWin, dealt with JS&CSS, could work with html webpage on local machine.
But how can I put the codes to work on OJS ?

Thanks~~

Hi @ych,

What version of OJS are you working with? Most likely you’ll need to modify a template or two, depending on where you want to add the new markup. Working with Smarty templates is just like working with HTML – with additional options – but you’ll have to make sure you escape certain characters that Smarty uses for its own purposes (e.g. { as {lparam} and } as {rparam}). See the Smarty documentation for specifics.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher, Many Thanks~~

I’ll try to do that after a while.
Following method, I do not know whether the correct !?
A short time before, I had made that, just added css&js code in html directly, then published on issue.
The float-Window had displayed, but the float function couldn’t work(moving up and down).
Whether, the js code must be put on OJS? If so, How to deal with that?

THANKS

The version of OJS is 2.4.8.0

Thanks~~

Hi @ych,

Can you describe what modifications you made? Ideally a link to a commit in github is the easiest to review.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi, How can I do that for OJS version 3?.

Hi @josuevalrob,

You can add arbitrary javascript in your article HTML already. Is that not working? What are you trying to accomplish?

Regards,
Alec Smecher
Public Knowledge Project Team

Hello. Tell me, you need to do to when you download website pop up window with language selection. The code is (there is JavaScript and HTML. Is worth OJS 3.1.2.0. Standard theme template from the kit. Tried different options, but the code does not work. I cannot understand in what files it is necessary to make changes. Please tell me what files are worth watching. I would appreciate that. Yours, Yuri.

Hi @Yuriy_Kadatski,

I’m afraid I’m not sure what you’d like to do – can you write it in other terms, or maybe include a mock-up or screenshot?

Regards,
Alec Smecher
Public Knowledge Project Team

Good @asmecher
I need to insert a Java script and a div with a pop-up window so that this window will appear immediately when the main page of the journal (index) is loaded. How is this done is done on sites where the age limit and ask about 18 years.
The code itself is also in simple php or html pages it works, but I do not understand where to integrate it in the journal so that it does not violate the existing structure of the journal system itself.
I tried to understand it with the help of the manual on the journal system, but it still didn’t work out, apparently I misunderstood something somewhere.
Could you tell me what could be the integration options for my code in this case?

Hi @Yuriy_Kadatski,

I would suggest looking at the Custom Header Plugin: https://github.com/asmecher/customHeader

You can either use it directly to add custom Javascript to your page, or if you want better control over how/where the code is injected, you can experiment with using that plugin as a template for your own custom plugin.

Regards,
Alec Smecher
Public Knowledge Project Team

@asmecher
Thanks for the tip, but …
After installing the plugin, I can’t find where and how to configure and / or use it.
Maybe you can tell me how it allows you to use your java scripts?

Hi @Yuriy_Kadatski,

See Use Case/Examples for Custom header plugin for OJS for examples.

Regards,
Alec Smecher
Public Knowledge Project Team

@asmecher
Thanks for helping!)