Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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?
Username:
Password:

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
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2014-09-17 02:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (56 votes), past polls