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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Free nodelet hack: Auto-Fold threads in RAT
by LanX (Saint) on Jan 31, 2015 at 19:09 UTC | |
by LanX (Saint) on Feb 01, 2015 at 23:48 UTC |
Back to
Perl Monks Discussion