Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Free Nodelet Hack: Toggle Between Two Nodelet Configurations

by jdporter (Chancellor)
on Dec 11, 2006 at 16:38 UTC ( [id://589079]=note: print w/replies, xml ) Need Help??


in reply to Free Nodelet Hack: Hide/Display Nodelet Bar On Demand
in thread Free Nodelet freed

There are lots of cool nodelets, and normally I like to have almost all of them turned on. Problem is, that makes each page take noticeably longer to load. So sometimes I wish I could have just a bare-bones set of nodelets active.

Fortunately, PerlMonks gives you two nodelet configurations, as you can see by going to your Nodelet Settings: there's your FrontPage nodelets, and your non-FrontPage nodelets. But using Nodelet Settings to toggle quickly between them is just not convenient!

So I came up with the following code to go in my Free Nodelet. (Note that if you use this you'll definitely want Free Nodelet to be enabled in both your FrontPage and non-FrontPage nodelet sets.)

<script language="javascript"><!-- // the value of _redir must be a node ID! if ( "`_redir`" != "`" + "_redir" + "`" ) { window.location.search= "?node_id=`_redir`"; } //--></script> [href://?node_id=25185;_redir=`id`;setfpeqnonfp=1|FP nodelets] | [href://?node_id=25185;_redir=`id`;clrfpeqnonfp=1|main nodelets]

Each link makes a submission to Nodelet Settings — to enable and disable Use my frontpage nodelets everywhere, respectively — and then "redirects" back to the node you were viewing when you clicked. Note that only the node ID of the current node is remembered; any other URI arguments are dropped.

This technique is based on ideas in subthread Re: Free Nodelet Hack: Add parent & root links to nodes in 'Nodes You Wrote' (or anywhere). tye++

Update (hopefully temporary):
The above technique does not work any longer, since apparently the two form fields (setfpeqnonfp, clrfpeqnonfp) are no longer settable via HTTP GET requests. Until that capability is restored, you can achieve the same with the equivalent POSTs, e.g.:

Nodelets: <form method="post" action="?" enctype="application/x-www-form-urlenco +ded"> <input type="hidden" name="node_id" value="25185"> <input type="hidden" name="_redir" value="`id`"> <input type="hidden" name="setfpeqnonfp" value="1"> <input type="submit" name="sexisgood" value="FP"> </form> <form method="post" action="?" enctype="application/x-www-form-urlenco +ded"> <input type="hidden" name="node_id" value="25185"> <input type="hidden" name="_redir" value="`id`"> <input type="hidden" name="clrfpeqnonfp" value="1"> <input type="submit" name="sexisgood" value="Main"> </form>

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://589079]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-03-19 03:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found