How to run a function after entire page is loaded in AEM - aem

I added an jquery plugin to AEM
When I run the code on console it works
but not when I add the same lines to the js file.
What would be the issue ?

You can insert any of Jquery functions/Events to your AEM page. Helpx article:- https://helpx.adobe.com/experience-manager/using/custom-carousel-components.html //Creating Custom Carousel components for Adobe Experience Manager Here you can lear to integrate with 3rd party javaScript or JQuery.
Like:-
$(window).load(function() {
// executes when complete page is fully loaded, including all frames, objects and images
alert("window is loaded");
});
OR
$(document).on("pageload",function(){
alert("pageload event fired!");
});
Reference article of Adobe AEM Community: http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.html/forum__6l3s-i_would_liketocrea.html
I hope this would help you.
Thanks and Regards
Kautuk Sahni

Related

Add Masonry view in Algoliya in Magento 2

I am trying to implement Masonry into my website catalog. Although I found that Masonry view is already in Algolia. I found this jsFiddle but I could not understand how do I implement this on my website. Where to add this java Script code.
if any one knows this, would be appreciated.
[1]: https://jsfiddle.net/vw53u259 js fiddle code

How to add new button in tiny_mce from magento 2 module?

I have already made a wordpress plugin for tiny_mce editor via add_filter() function.
I included the js file of tiny_mce plugin. It works properly.
Now when same thing I am willing to develop for magento 2. I have create basic hello_world module with this tutorial:
http://inchoo.net/magento-2/how-to-create-a-basic-module-in-magento-2/
Now from this module how I add my custom button in tiny_mce editor.
Advance thanks for reply.....
I've wrote a blog post about how to add a TinyMCE pluing to the Magento WYSIWYG Editor.
I've also created a demo module which should give you a direction how to do it for yourself.

Segment resolving in AEM / CQ5 using initializeTeaserLoader adding multiple divs inside campaign target

The below code is part of teaser.jsp (/libs/cq/personalization/components/teaser/teaser.jsp)
<script type="text/javascript">$CQ(function() {
initializeTeaserLoader(<%=allTeasers%>, "<%=strategy%>", "<%=targetDivId%>", "<%=(WCMMode.fromRequest(request) == WCMMode.EDIT)%>", "<%=trackingURLStr%>", "<%=resource.getPath()%>");
});</script>
Similar code we used in our customized teaser jsp.
The aboveinitializeTeaserLoader method is adding multiple divs inside the target div at the first time when offerpage is resolved.
Ideally it should have only one resolved div. Is there any solution for it?
Note: On page refresh functionality is working fine. But our application is single page application may be this issue is coming.
Its seems to be an existing issue with OOTB teaser component.Apparently same thing happened in our project, we were using Angular Js on top of AEM (6.1).
We we went to ADOBE with a ticket and got one patch for the same problem (and few more, not relevant to this question).
Most probably if you go ahead and use 6.2, this problem should not persist.
Good LUCK (y)

Multiple layers of zones on a page google tv jquery ui lib

I'm using google tv jquery ui library to build app. I want to build multi page in one html file. I follow example : http://gtv-resources.googlecode.com/svn/trunk/templates/html-01/index.html, but it using 2 html files to switch between app. Please show me example code to manage multi page in one html file, thanks
If you'd like to do multi page web using single html, you could use layers. You should look at examples BuildPhotoPages or BuildVideoPages here:
https://developers.google.com/tv/web/lib/jquery/
Thanks.

How to safely add page content via CMS?

If I were to build a custom CMS that allowed someone to log in and build a page using a WYSIWYG would it be possible to make it secure and allow JavaScript code in the content? There are times where someone wants to add a video embed code or a widget that grabs an RSS feed, these embed codes and widgets are in JavaScript. So how do I allow them to add that to their page through a CMS? My main concern is XSS/vulnerabilities.
You could store tags with references to widgets in your rich text content, like <video>id</video>, and render the javascript only in frontend... or you could choose to use any of the modern CMS's out there with plugins for video and widgets that already solved the problem for you.