Expand my Community achievements bar.

SOLVED

wait the sidekick

Avatar

Level 4

Hi,

i need to wait the appearance of the sidekick popup for adding a div on the little black arrow on the top right.

I can plays with the lower icons (edit, preview,design) but not with the icon that i want.

If i run a javascript function like these:

$(window).load(function() { alert("id"+$( ".x-tool-toggle" ).attr('id')); });

The id is undefined. How can i resolve my problem?

1 Accepted Solution

Avatar

Correct answer by
Level 10

What do you mean by graphics will be different? Are you customizing the UI of sidekick?

As far as sidekick code is concern,

CQ.WCM.launchSidekick("<%= currentPage.getPath() %>",{ propsDialog: "<%= dlgPath == null ? "" : dlgPath %>", locked: <%= currentPage.isLocked() %>, adminUrl: "/siteadmin", previewReload: "true" }) 

If you are creating init.jsp in your project, then don't call init.jsp present in /libs When the project started why dont you override default init.jsp. which is always recommended. Wht you want to achieve has been suggested to you as recommended approach.

View solution in original post

9 Replies

Avatar

Correct answer by
Level 10

What do you mean by graphics will be different? Are you customizing the UI of sidekick?

As far as sidekick code is concern,

CQ.WCM.launchSidekick("<%= currentPage.getPath() %>",{ propsDialog: "<%= dlgPath == null ? "" : dlgPath %>", locked: <%= currentPage.isLocked() %>, adminUrl: "/siteadmin", previewReload: "true" }) 

If you are creating init.jsp in your project, then don't call init.jsp present in /libs When the project started why dont you override default init.jsp. which is always recommended. Wht you want to achieve has been suggested to you as recommended approach.

Avatar

Level 10

I guess, you can easily use this.

$(document).ready(function(){ alert("id"+$( ".x-tool-toggle" ).attr('id')); });

Not clearly sure what you are trying to achieve. Please share your use case / requirement clearly so that community can provide you good answer.

Thanks

Avatar

Level 10

can you elaborate on your use case ?

Avatar

Level 4

I need a visible div in edit mode and a hidden div in preview mode. (sidekick attached)

When the user clicks the lens of the preview is not forced the refresh of the page so i can't do it in a normal way. I can't force the refresh why i have the rule to not edit the foundation/libs components.

I can resolve my problem with a js function that is called when the user clicks the lens and another js function when the user clicks the button on the top right corner (little black arrow). The first function works fine but when the second function is called doesn't find the class "x-tool-toogle" (the class of the button on the top right corner). If i launch a function after the load of the page the element with class "x-tool-toggle" is undefined so i can't continue.

 

Thanks for the help

Avatar

Level 4

Thanks for the help.

I thought that the file was a system file loaded by cq5 and not an include row.

I have found the indicted row.

Case closed, thanks

Avatar

Level 4

Another solution is the file inside libs/wcm/core/components/init, if i add the refresh mode my problem is resolved.

I can't modify this file.

Is there a way to have a custom version of this file inside my project?

Avatar

Level 10

Yes, its recommended not to change anything in /libs.

You can create new init.jsp in your project setup location /apps/project/init.jsp and include in the template. Copy code from /libs init.jsp file to your file.

Check this for help : https://docs.adobe.com/docs/en/cq/5-6-1/howto/website.html

Avatar

Level 4

I can't simply copy the code from init.jsp to my project because the graphics of the sidekick will be different.

The shadow is in the wrong position and if i scroll the sidekick is duplicated.

Avatar

Level 10

I am not sure what "wait the sidekick" means - please clarify.