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

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I like to have my Nodelet bar (column? table?) nice and wide, most of the time, partly because it makes the nodelets shorter, and thus I have to scroll less to read them. (I keep the most dynamic ones at the top.) The downside is that the main body of the node is squeezed. This not only makes it taller, but often causes ugly line wrapping, especially in embedded HTML tables. So, sometimes I really want to get my Nodelet column out of the way, and just view the main node body in its full glory. So I thought:

How can I hide (toggle off) the Nodelet bar as needed?

The following code does just that. Simply plunk it into your Free Nodelet Settings. It makes two checkboxes near the top right corner of your page, labeled 'Hide Main Body' and 'Hide Nodelets'. When one or the other part of the page is hidden, the remaining visible part expands to fill the entire width of the window.

// add toggles to hide/show nodelets and main_content { var tbl = document.getElementById('titlebar-bottom'); var cel = document.createElement('td'); tbl.rows[0].appendChild(cel); cel.width = "20%"; cel.align = "right"; // add toggle to hide/show main_content txt = document.createTextNode( 'Hide Main Body' ); cel.appendChild(txt); chk = document.createElement('input'); cel.appendChild(chk); chk.type = 'checkbox'; chk.name = 'hide_mainbody'; chk.id = 'hide_mainbody'; chk.onclick = function(){ var chk = document.getElementById('hide_mainbody'); var state = chk.checked ? 'none' : 'table-cell'; element_of_tag_and_class('td','main_content').style.display = +state; } // add toggle to hide/show nodelets var txt = document.createTextNode( 'Hide Nodelets' ); cel.appendChild(txt); var chk = document.createElement('input'); cel.appendChild(chk); chk.type = 'checkbox'; chk.name = 'hide_nodelets'; chk.id = 'hide_nodelets'; chk.onclick = function(){ var chk = document.getElementById('hide_nodelets'); var state = chk.checked ? 'none' : 'table-cell'; element_of_tag_and_class('td','nodelets').style.display = stat +e; } } // presumes only one. returns first found. function element_of_tag_and_class(tagname,classname) { var elems = document.getElementsByTagName(tagname); var i; for ( i = 0; i < elems.length; i++ ) { if ( elems[i].className == classname ) { return( elems[i] ); } } }
We're building the house of the future together.

In reply to Free Nodelet Hack: Hide/Display Nodelet Bar On Demand by jdporter
in thread Free Nodelet freed by tye

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (4)
    As of 2020-02-24 11:31 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      What numbers are you going to focus on primarily in 2020?










      Results (104 votes). Check out past polls.

      Notices?