Javascript by post ?

User avatar
Renaud
Sr. Bludit
Posts: 48
Joined: Tue Feb 19, 2019 9:08 pm

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.
User avatar
Jay
Master Bludit
Posts: 133
Joined: Mon Feb 11, 2019 8:41 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.
User avatar
Renaud
Sr. Bludit
Posts: 48
Joined: Tue Feb 19, 2019 9:08 pm

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.
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

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/).
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
Renaud
Sr. Bludit
Posts: 48
Joined: Tue Feb 19, 2019 9:08 pm

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.
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

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.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
Renaud
Sr. Bludit
Posts: 48
Joined: Tue Feb 19, 2019 9:08 pm

Maybe it depends of the options/plugin of TinyMCE?
User avatar
Renaud
Sr. Bludit
Posts: 48
Joined: Tue Feb 19, 2019 9:08 pm

I will double check it.
User avatar
Renaud
Sr. Bludit
Posts: 48
Joined: Tue Feb 19, 2019 9:08 pm

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 ?
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

The following plugins are activated: Code, Autolink, Image, Link, Pagebreak, Advlist, Lists, Textpattern and Table.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
Post Reply