Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Free nodelet hack: Auto-Fold threads in RAT for special browsers

by LanX (Canon)
on Feb 17, 2011 at 12:04 UTC ( #888694=monkdiscuss: print w/ replies, xml ) Need Help??

The following code expands Free Nodelet Hack: RAT collapse all in different aspects.

It checks if I'm surfing perlmonks with my (small screen) mobile (appName=="Obigo") and automatically collapses only root nodes of threads (nnt-depth-1).

A link in the "Free Nodelet" allows to toggle the folding.

This code is a blueprint for customizing appearance and UI in different browsers. The navigator object provides more attributes to distinguish browser and OS.

Suggestions welcomed! :)

<script language="javascript"><!-- var expandState="expanded"; function toggle_threads(){ expandState = (expandState=='expanded') ? 'collapsed' : 'expanded' ; var elements = document.getElementsByTagName('ul'); var elnum; for( elnum=0; elnum<elements.length; elnum++ ){ var el = elements[elnum]; if ( el.parentNode.className.match(/nnt-depth-1/) ) el.className = expandState; } } if ( document.title=="Recently Active Threads" ) { document.writeln('<a href="javascript:toggle_threads()">+/- Thread +s</a>'); if (navigator.appName=="Obigo") toggle_threads(); } //--></script>

Cheers Rolf

Comment on Free nodelet hack: Auto-Fold threads in RAT for special browsers
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: monkdiscuss [id://888694]
Approved by Old_Gray_Bear
Front-paged by ww
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2015-01-31 07:30 GMT
Find Nodes?
    Voting Booth?

    My top resolution in 2015 is:

    Results (257 votes), past polls