Collapsed Sitemap HELP!

website-publishing

#1

There have been several (old) discussions in the forum that ask for the feature for generating the sitemap tree’s collapsed by default. Unfortunately Axure (after 2-3 years of requests) has not added this feature.

I am well aware of the hack that Matt Howell created. It seems however that this hack does not work on V7. I’ve tried my hand at looking at the sitemap.js file and hacking it myself but have had no luck.

Anyone else had any success generating prototypes with all sitemap trees collapsed by default?? I know there are some VERY smart cookies out there who have found some awesome Axure hacks. Major brownie points for anyone who has figured this out :bow:


#2

While not exactly what you’re asking for, you can link directly to a page without the sitemap frame.

abcdef.axshare.com/#p=yourpage to abcdef.axshare.com/yourpage.html


#3

While helpful… not exactly what I need. Thank you though.


#4

Here’s something this hopefully is helpful. I took a look and saw that the “minus” button that collapses the sitemap just calls a ‘collapse()’ function.

In pages where you want to collapse the sitemap by default, put this in the OnPageLoad event:

Open link in current window: “javascript:void(window.parent.collapse())”

Unfortunately you will briefly see the sitemap before the page loads. Instead if you’re fine modifying your sitemap.js, try putting collapse() at the very end of the file as this script is run in the sitemap frame nor will it be dependent on your prototype loading.


#5

That is a neat hack, I will definitely have to remember that. However is simply minimizes the entire sitemap. Instead I’m looking to collapse the sitemap nodes.

Like this:


#6

Oh, I totally misunderstood what you were looking for. I thought you meant the whole sitemap.

This is probably the simplest thing I can think of:

$('.sitemapMinus').each(function(){this.click()})

Not very elegant but it works.


#7

Sorry I could’ve been clearer. Thanks for your help though. If you can think of anything else that might solve my problem, feel free to reach out.


#8

Edited my post above with a simple solution.


#9

:bow:

That worked! Kinda… it minimized all of my nodes, but it gave me the error "File Not Found
url : /16.54.19/$(%27.sitemapMinus%27).each(function()%7Bthis.click()%7D) "

Maybe I inserted it into the wrong spot? Thoughts?


#10

If you have it in an open link action be sure to prefix it with javascript:

javascript:void($('.sitemapMinus').each(function(){this.click()}))

#11

So close… I inserted “$(’.sitemapMinus’).each(function(){this.click()})” into the sitemap.js file under “$(’.sitemapPageLink’).click(node_click)” and it is correctly collapsing the nodes when I generated the HTML (my happy dance was pretty impressive) but when I published it to AxShare they were expanded.

I also tried to enter it in as a onpageload event with javascript:void but that didn’t work either.

Any more magic?


#12

For it to work on AxShare you might have to use this:

javascript:void(window.parent.$('.sitemapMinus').each(function(){this.click()}))

in an OnPageLoad event.

Unfortunately, since the page is loaded into an iframe on the sitemap page, this won’t run until that page is loaded meaning you’ll see the sitemap, then when the page loads it will collapse.


#13

:bow::bow::bow::bow::bow::bow::bow::bow::bow::bow::bow::bow::bow::bow::bow::bow::bow::bow::bow::bow::bow:

You are amazing my friend.

I need your address… I’m sending you brownies… or bacon… or my first born. You choose.


#14

aside to @nkrisc

I’d go with the bacon. I nearly have my own first born and I’ve learnt never to trust brownies. And - Bacon. Always bacon…


#15

Bacon brownies… Mmmmm


#16

This works great! Does anyone know how to modify this to collapse ALL subfolders and pages too?


#17

I took a look on the Version 8 sitemap and I see the problem you’re referencing. It will look like everything is collapsed, but if you open a top level folder/page the children will be expanded even though the icon indicates the collapsed state. I imagine you’d have to write the script to start bottommost child nodes and click your way up the tree to the top level nodes.

The sitemap is mostly nested unordered lists so it wouldn’t be a terribly difficult script to write, but it’s a little too tedious for me to bother with. Sorry :frowning:


#18

I’m confused. Where / how exactly do I add this code? Thanks!


#19

Hi easyishard,

It looks like Nathan is suggesting you put this in the “Hyperlink” field of an “Open Link” action under the OnPageLoad event.


#20

Done it. Turns out it is quite simple… traverse the list backwards.

This version should collapse all levels of folders in Version 8:



javascript:void(window.parent.jQuery.fn.reverse = [].reverse); void(window.parent.$('.sitemapMinus').reverse().each(function(){this.click()}));