Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Wouldn't switching the body's css class also work and make it all more maintainable? :)

    --
    Ordinary morality is for ordinary people. -- Aleister Crowley
    • Yes, ofcourse it would.. It's one of those TIMTOWTDI thingies :)
      • It’s not TMTOWTDI… it’s a matter of, as Larry likes to say, baby talk. What you did is a way to do it, but really it’s not a very good way. Switching the body class is one thing you should really do; the other is unobtrusive scripting [wikipedia.org]. Another thing is that you want to hide these links from people who don’t have Javascript in the first place.

        Consider:

        <style type="text/css">
        body { /* ... */ }
        body.with-bg { /* ... */ }
        #toggle-bg b { font-weight: normal }
        body.with-bg #toggle-bg .plus  { display: none }
        body.with-bg #toggle-bg .minus { display: inline }
        body         #toggle-bg .minus { display: none }
        </style>

        <script type="text/javascript" language="javascript"
        src="http://jqueryjs.googlecode.com/files/jquery-1.2.3.mi n.js"></script>
        <script type="text/javascript">
        jQuery( function() {
            $('#toggle-bg')
                .append( '<a href="#"><b class="plus">[+]</b><b class="minus">[-]</b></a>' )
                .find( 'a' )
                .click( function() { $('body').toggleClass('with-bg'); return false } );
        } );
        </script>

        <body class="with-bg">
        <div id="toggle-bg"></div>
        </body>
        • Err, s/jQuery/\$/.

          • I can still remember those ugly times of NN4, where we still had to assume people who don't have JS on, might also have CSS off. The days really got better in this regard.

            --
            Ordinary morality is for ordinary people. -- Aleister Crowley