Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Just the contents m'am

by jZed (Prior)
on Oct 15, 2004 at 03:20 UTC ( #399388=monkdiscuss: print w/replies, xml ) Need Help??

Here's a javascript hack for the most excellent Free Nodelet Freed which allows you to toggle between two views of any perlmonks page. One view is the normal view, the one you see now except that it has a "Toggle Page View" link near the top. The other view hides the Pair banner, the search bar, and the nodelets panel and extends the contents to the full width of the screen. Clicking on "Toggle Page View" (surprise) toggles between the two views. In browser windows of 800x600 or less, it more than doubles the amount of content per screen. The banners and nodelets are never more than a click away - toggling happens immediately, there is no page reloading.

To install it, just turn on the Free Nodelet in Nodelet Settings, copy the code below, then go to your User Settings, paste the code in the Free Nodelet box at the bottom of the settings, and submit. Currently the default page display is content-view, if you'd prefer to default to full-view, comment out the toggle_nodelets() call on the last line of code.

update just a reminder - browsing with javascript enabled (as this hack requires) isn't always safe; also changed the script type (thanks elusion)

<script type="text/javascript"> var nodelet_state = 'block'; var lb = "\x5B"; var rb = "\x5D" function add_toggle_link() { var tbl = document.getElementById('titlebar-bottom'); var row = document.createElement('tr'); var cel = document.createElement('td'); var lnk = document.createElement('a'); var txt = document.createTextNode( 'Toggle Page View' ); lnk.href = "javascript:toggle_nodelets()"; lnk.appendChild(txt); cel.appendChild(lnk); row.appendChild(cel); tbl.appendChild(row); } function toggle_nodelets(){ nodelet_state = (nodelet_state!='none') ? 'none' : 'block'; var elements = document.getElementsByTagName('table'); var elnum; var content_width=(nodelet_state=='none') ? '100%' : '80%'; document.getElementById('monkbar').style.display=nodelet_state; var tds = document.getElementsByTagName('td'); for(tnum=0;tnum<tds.length;tnum++){ var td = eval("tds"+lb+"tnum"+rb); if( td.className=='main_content' ) { = content_width; break; } } for(elnum=0;elnum<elements.length;elnum++){ var el = eval("elements"+lb+"elnum"+rb); if( el.className=='nodelet_container' ) { = nodelet_state; break; } } } add_toggle_link(); toggle_nodelets(); </script>

Replies are listed 'Best First'.
Re: Just the contents m'am
by elusion (Curate) on Oct 15, 2004 at 03:48 UTC
    You'll probably want to change the first line to <script type="javascript">. Having the type set to "text/css" must work for whatever browser you use, but it doesn't work with Safari.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: monkdiscuss [id://399388]
Approved by kvale
[oiskuu]: glibc getlogin just does ttyname() and falls back on getutline(); it's not security related at all. (reminds me of sendmail and remote finger services of the naive early spam era)
[Corion]: But yes, "who started this process" is interesting information :)
[tye]: no, I really believe that "login user" was added as a fundamental bit of info about each process in order to enhance the usefulness of auditing
[Corion]: Ah - if that information is saved in a file, then you could theoretically spam that file and confuse getlogin(). So, don't use it for authentication :)
[tye]: that is what getlogin() certainly *used* to do. I don't believe that is what it certainly should do.
[davido]: /var/run/utmp is 664 i think.
[tye]: Note that my "man getlogin" says that it uses stdin when it should use /dev/tty (calling a glibc bug). But that does not appear to be the case when I test it. But maybe Perl's getlogin() is not using glibc's getlogin().
[oiskuu]: well, run a strace and see what the getlogin does for you.... As I said. SELinux probably has those security labels. But not regular linux.
[tye]: for example, read https://unix. questions/146138/ loginuid-should-be -allowed-to-change -or-not-mutable-or -not
[tye]: I'm not using SELinux and it certainly appears to disagree with you. shrug

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2017-06-23 19:44 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (554 votes). Check out past polls.