Trapping URL from button click in a Blog object

All WYSIWYG Web Builder support issues that are not covered in the forums below.
Forum rules
IMPORTANT NOTE!!

DO YOU HAVE A QUESTION OR PROBLEM AND WANT QUICK HELP?
THEN PLEASE SHARE A "DEMO" PROJECT.



PLEASE READ THE FORUM RULES BEFORE YOU POST:
http://www.wysiwygwebbuilder.com/forum/viewtopic.php?f=12&t=1901

MUST READ:
http://www.wysiwygwebbuilder.com/getting_started.html
WYSIWYG Web Builder FAQ
Post Reply
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Trapping URL from button click in a Blog object

Post by alex4orly »

I am going to a major remake of this website, as an example - please see this page : http://www.nmaa-rc.org.au/videoclips.html

On the right hand side column (Layout grid) is a Blog object with many options.
Clicking any of them, brings up a page in the left hand side column, inside an iFrame

How can I trap, the blog entry "Button" click and get its intended link / url - in Javascript

I have many other pages, in this website and other sites with this setup, and I am forced to re-buld it

Looking forward to some help

Thanks
User avatar
Pablo
 
Posts: 22489
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Trapping URL from button click in a Blog object

Post by Pablo »

User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Trapping URL from button click in a Blog object

Post by alex4orly »

Yes, this helps.

I figured the 1st half already, I was missing the 2nd part which the above link answered

document.getElementById("Blog2").addEventListener("click", function(){
alert(Blog2);
});

"Blog2" is the elemnt ID of the entire blog object.
It seems that in QWB, the object itself doesn't have the "Enets" menubar, it is dissabled - why? So, I inserted it into the Page HTML.

Or is it the wrong way about it? In the Object itself, where can I insert this?

In my case, this object is sitting on it's own html page, that page is then embeded inside the main page.
Will the setup "Find" the iFrame, which is in the main parent page?

Thanks
User avatar
Pablo
 
Posts: 22489
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Trapping URL from button click in a Blog object

Post by Pablo »

Unfortunately, I cannot help you with coding related questions.
For me, it may also take a lot of time to figure out how to implement this.
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Trapping URL from button click in a Blog object

Post by alex4orly »

OK, I followed the link and created a new page : http://www.nmaa-rc.org.au/page9.html
It has in it a single example, the Blog object is part of the page, NOT embeded like I had it originally

The following is the function:

<script>
document.addEventListener(`click`, e => {
const origin = e.target.closest("a");

if (origin)
{
var clicked = origin.href;
window.frames[0].location = clicked;
}
});
</script>

When you click on the button "Click to view" , it goes at first to show the clip in the iFrame on the left, then it opens a new browser page and moves to it. If you hit the back button in the browser - you can see that in the original page, the video is in the iFrame ready to be played.

Any suggestion, why does it do that? It has to do something with this? e.target.closest("a"); What is this command?

Thank yoy
User avatar
BaconFries
 
 
Posts: 5648
Joined: Thu Aug 16, 2007 7:32 pm

Re: Trapping URL from button click in a Blog object

Post by BaconFries »

Hi Alex just a suggestion that's all wouldn''t it be simpler to use the YouTube playlist method? See the following examples:
Demo Codepen
https://codepen.io/derwinsadiwa/pen/obbjdx
And
https://woosterwebdesign.com/responsive ... -playlist/

Just a suggestion but I realise you do like playing about with script to do what you require.
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Trapping URL from button click in a Blog object

Post by alex4orly »

Long time no hear... Hope all is well at your end.

My use of this method is NOT restricted to YT clips, see this as an example : http://www.nmaa-rc.org.au/howto.html
Or this : http://www.nmaa-rc.org.au/rclinks.html

So, as you can see, my "Play-list" is generic way, not only for YT, hence - I must find a solution for all other cases.
Thanks for the links, I may have use for it in some cases.

In the meantime- my problem is resolved - I just added into the parent page and Event trigger
Onclick->Show->InlineFrame1 , this forces the action to take place where it needs to be
This little extra with the above code sample.

Thanks again
User avatar
BaconFries
 
 
Posts: 5648
Joined: Thu Aug 16, 2007 7:32 pm

Re: Trapping URL from button click in a Blog object

Post by BaconFries »

Hi Alex Doing ok here, I was under lockdown and shielding, this meant staying at home from the 23rd of March and only came to a end from the 1st of August. I hope all is well with you down under. Good to hear you have it working now. Right of to get a bite to eat and possibly a wee dram 🥃 or 2.
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Trapping URL from button click in a Blog object

Post by alex4orly »

Hello again,

Easy on the beer... Take care of yourself

My exercise of moving to Linux, turned out a real nightmare, to say the least. Yesterday, while at it, I had no computer at all, trying to use the entire storage device to install Linux, it wiped the Windows partition and I had nothing...

At the moment, I am able to access this forum but NOT the QNE forum

Cheers
Alex
Post Reply