• Welcome to the Chevereto User Community!

    Here, users from all over the world come together to learn, share, and collaborate on everything related to Chevereto. It's a place to exchange ideas, ask questions, and help improve the software.

    Please keep in mind:

    • This community is user-driven. Always be polite and respectful to others.
    • Support development by purchasing a Chevereto license, which also gives you priority support.
    • Go further by joining the Community Subscription for even faster response times and to help sustain this space
  • Chevereto Support CLST

    Support response

    Support checklist

    • Got a Something went wrong message? Read this guide and provide the actual error. Do not skip this.
    • Confirm that the server meets the System Requirements
    • Check for any available Hotfix - your issue could be already reported/fixed
    • Read documentation - It will be required to Debug and understand Errors for a faster support response

Popup plugin : how to pass variables using jQuery ?

ImagesGuru

Chevereto Member
Hello,

For a developpement I am working on, I can't pass properties using data-xxx using <script> . I am forced to use a JS include system that does not pass properties but only calls the JS script. It's something like that :

Code:
{% INCLUDEJS './js/pup.js' %}

So I try to pass the properties using a div element :
Code:
<div id="images-guru" class="hidden" data-url="https://images.guru/upload" data-vendor="default" data-sibling=".message-box"></div>

And I try to recover the properties using jQuery in the JS :
Code:
var data = $('#images-guru').data();
console.log(data);

The console of my browser indicates that the variables to the javascript, but I do not know how to exploit them after :

@Rodolfo can you bring me a solution?
A big thank-you.
Jack
 
@ImagesGuru I sent you a PM asking something, but it sems you didn't care to reply to it. Please check into it.

Also @Rodolfo does not work on custom things, so if you need help others on here who can help will reply instead of author of script.
 
I am not asking @Rodolfo to develop something custom for me but just to tell me on what lines of the js to focus on.

@JakeSully I have read your pm today. I will give you my ext in the next days. Is not that simple, I have a specific sql table to endle that.
 
By design, pup.js is inside a closure so you can't access to any of its members. You will need to create your own pup, which is not that hard as you have the source already: https://demo.chevereto.com/sdk/pup.dev.js

So you have to change this:
JavaScript:
(function() {})()

To (something like) this:
JavaScript:
var PUP = {actual code};
...
PUP.prepare();
 
Hello @Rodolfo,

Thanks for reply.
Actualy all the code is between {}.

Do I have to do :

Code:
var PUP = function();
PUP(the actual code);

or

Code:
var PUP = function();
PUP() {the actual code};

or something else ?
 
JavaScript:
var PUP = {the actual code};
...
PUP.prepare();
 
I have done this afternood, is that ok or function is not needed ?

Code:
var PUP = function () {the actual code};
PUP();

Thanks
 
I never gave you usable code, "something like this" doesn't mean copy/paste, it means "you are looking for a result like this" and I assumed that you knew about JS.

Here, this is the usable code: https://pastebin.com/KyBh4cFJ
 
Back
Top