Page 1 of 2

Javascript by post ?

Posted: Mon Jun 17, 2019 9:48 am
by Renaud
Hello,

I need to add one script on one post. Is there a simple way to do this?
It is to open a popup when a link is clicked. Example :

The script :

Code: Select all

<script id="form-script-tag-151665" src="/remote/page/1516654bd2dd4668a57870e334a160811f2211.js"</script>
And then in the html content of the post :

Code: Select all

<a href="#" class="systeme-show-popup-151665">Cliquez ici</a>
I suppose that the best is to code a plugin with 2 fields and 2 buttons
- one field for the javascript code
- one field for the list of the posts
- one button to apply
- one button to remove.
Is it hard to do? I can try, but need samples, do you have it?

Best regards.

Re: Javascript by post ?

Posted: Mon Jun 17, 2019 12:30 pm
by Jay
For only 1 page that won't be edited anymore I'd go with disabling any editor plugin and paste the js code at the bottom.

Re: Javascript by post ?

Posted: Mon Jun 17, 2019 3:27 pm
by Renaud
Jay wrote: Mon Jun 17, 2019 12:30 pm For only 1 page that won't be edited anymore I'd go with disabling any editor plugin and paste the js code at the bottom.
Thank you.

Re: Javascript by post ?

Posted: Mon Jun 17, 2019 5:22 pm
by Edi
Jay wrote: Mon Jun 17, 2019 12:30 pm [...] with disabling any editor plugin and paste the js code at the bottom.
You also can add the code with the editor enabled.

Or you can add the script editing the file index.txt in the directory of the page (in the directory /bl-content/pages/).

Re: Javascript by post ?

Posted: Mon Jun 17, 2019 5:49 pm
by Renaud
Edi wrote: Mon Jun 17, 2019 5:22 pm You also can add the code with the editor enabled.
Or you can add the script editing the file index.txt in the directory of the page (in the directory /bl-content/pages/).
I'm using TinyMCE. It remove all the scripts.
I already tried to paste it in the .txt file, but if I modify the post, TinyMCE remove it.

It's OK, now I'm using another page instead of a popup, so it works.

Thank you all.

Re: Javascript by post ?

Posted: Mon Jun 17, 2019 6:15 pm
by Edi
Renaud wrote: Mon Jun 17, 2019 5:49 pm I'm using TinyMCE. It remove all the scripts.
You have to add the code to the field "Source code" (button "<>" in the toolbar).
I already tried to paste it in the .txt file, but if I modify the post, TinyMCE remove it.
I cannot reproduce it, it works on my side.

Re: Javascript by post ?

Posted: Mon Jun 17, 2019 6:19 pm
by Renaud
Maybe it depends of the options/plugin of TinyMCE?

Re: Javascript by post ?

Posted: Mon Jun 17, 2019 6:20 pm
by Renaud
I will double check it.

Re: Javascript by post ?

Posted: Mon Jun 17, 2019 6:27 pm
by Renaud
Edi wrote: Mon Jun 17, 2019 6:15 pm I cannot reproduce it, it works on my side.
What are your options/plugins of TinyMCE ?

Re: Javascript by post ?

Posted: Mon Jun 17, 2019 10:25 pm
by Edi
The following plugins are activated: Code, Autolink, Image, Link, Pagebreak, Advlist, Lists, Textpattern and Table.