I was doing a bit of CSS tweaking on the site this evening, and my mind started wandering. For some reason, I started thinking about how all the best old DOS games had a “boss mode” that you could activate, usually by pressing the “b” key, that would instantly pause the game and throw up a spreadsheet screen or something similar for when your boss walked up while you were playing at work.
So, since I was already in tweaking mode, I whipped up a short JavaScript function that hides the title banner, the sidebar, and all images when you hold control and double-click anywhere in the page. Now you can get your daily wonkofix without making it terribly obvious to The Man that you’re not doing work. Utterly useless, but it was fun to write.
Comments
tell me how
tell me how to do it
Some degree of usefullness!
Printing an articel look better without the menu and stuph... could end up missing the pic's contained in any given article tho' :-)
Re: tell me how
You see, this is the sort of guy that makes open source developers give up on user support. He feels a sense of entitlement to the software he has put forth no effort to produce, he's too stupid to read the fucking manual (or in this case, the post), and he's an inarticulate moron with no social skills.
Re: Some degree of usefullness!
You'll also get a slightly slimmed down style if you visit the site on a handheld device that supports media descriptors.
Re: Some degree of usefullness!
Weee :-P
forgot bout' that... :-D
Sorry ;-)
Re: tell me how
wow, someone woke up on the wrong side of the bed. take a step back and go have a beer or something, you seem a little frustreated. maybe you lack in the skills down there if you know what i mean. i simply wanted to know how he did it. i had no plans to use it as i have no side, i was simply curious. perhaps you can shut the fuck up you ignorant cock sucking faggot?
Re: tell me how
Aw, what happened to the thoughtful, mature r4wb we all know and love?
Re: tell me how
Sometimes I can't help admiring your angelic patience, Wonko. I must confess that I would probably have re-routed all requests from this user to goatse by now.
Re: tell me how
sry i lost my cool with that MOTHER FUCKEr... wont happen again
Re: tell me how
Are you saying you'd redirect a poor innocent reader to goatse.cx? How utterly crass and immature of you! Shame!
Re: tell me how
<script language="javascript" type="text/javascript">
function bossMode()
{
var images = document.getElementsByTagName("img");
var logo = document.getElementById("logo").style;
var sidebar = document.getElementById("sidebar").style;
var mainbar = document.getElementById("mainbar").style;
if (sidebar.display == 'none')
{
logo.display = '';
sidebar.display = '';
mainbar.left = '190px';
mainbar.marginTop = '55px';
for (i=0; i < images.length; i++)
images.item(i).style.display = '';
}
else
{
logo.display = 'none';
sidebar.display = 'none';
mainbar.left = '5px';
mainbar.marginTop = '0px';
for (i=0; i < images.length; i++)
images.item(i).style.display = 'none';
}
}
</script>
And then:
<body ondblclick="bossMode();">
Re: tell me how
Hehehe...
Re: tell me how
If only the <pre> tag had worked...
Re: tell me how
and Mithrandir FUCK YOU !! for being an asshole.
Re: tell me how
Calm down, r4wb. There are limits to people's patience. Even Wonko's. Furthermore, if you wish to righteously criticize someone for being impolite, it doesn't help to be even more impolite. You would benefit from learning the art of simply ignoring insults instead of escalating them. The latter approach will get you nothing but a peptic ulcer.
Re: tell me how
peptic ulcer?
Re: tell me how
Peptic ulcer, Pathol.
An erosion of the mucous membrane of the lower esophagus, stomach, or duodenum, caused in part by the corrosive action of the gastric juice.
Re: tell me how
Oaw, my duodenum!
Re: tell me how
Alright, then. Here.
Hmm.
Perhaps you could use a keystroke instead? I know the specs support accelerator keys, but I don't know if browsers implement them well. That, and I think you would then have to use an on-focus handler, since the accelerators don't raise their own events, IIRC.
Maybe just ctrl-dblclick?
Re: Hmm.
I've modified the function to listen for control-double-click instead of just double-click, and it only pays attention to the left mouse button now as well. I attempted to use preventDefault() to keep the browser from highlighting text, activating links, etc. when the event fires, but either I misunderstood the spec or Mozilla's DOM implementation is broken, because it didn't have any effect. Oh well.
Re: Hmm.
I also notice now that it triggers even on white space. Before when I double clicked on whitespace it just sat there (like under the left menu system).
Re: Hmm.
Yeah. In order to capture the event object for the double click event (which I need in order to detect whether control is pressed and which mouse button was clicked), I had to set the event listener on
document.ondblclickinstead of in theondblclickattribute of the<body>element.ok
and hows the forum coming.
Re: tell me how
This guy reminds me of the slashdot troll. Where did that friendly troll go??
Re: tell me how
Hey, yeah! That guy was fun. And where's that other guy? The kid that looked about twelve years old but probably made more money than I did. What was his name again?
Re: tell me how
wonko where is he image gallery... i cant wait to use it. how far done is it
Re: tell me how
Lucida won't be released publicly until there's a stable version of PHP with a working glob() function.
Re: tell me how
omg man come on just release a beta u cant do this to me
Re: tell me how
and you never answered my forum question
Neat, now how about...
...fixing the text selection. When I try to select any article text, it for some reason selects huge blocks of text that my cursor is nowhere near.
Re: Neat, now how about...
Just use Mozilla instead of IE. :o)
Re: Neat, now how about...
Hey now, I think my IT dept. would disapprove of my installing lots of new software the third day on the job. I have the same problem, and I think I have to use IE here.
Re: Neat, now how about...
The problem stems from the fact that wonko.com uses CSS to position the sidebar block and the main block, which is what the W3C recommends these days (in the old days, I would've used a two-column table, but that sort of thing is condemned now). Mozilla, Opera, and other browsers deal with this properly, but IE gets confused about where the text really is, so it tries to select everything from the beginning instead of limiting your selection to a single block like it should.
If anyone can come up with a good, standards-compliant solution for this in CSS, I'll be very, very grateful. Until then, sorry. :/
Re: Neat, now how about...
Maybe you could put in a request? Point them to this list of unpatched IE security holes and say that you're worried about the potential damaging effects IE could have on the network.
Re: tell me how
I love it when a conversation about coding turns into a diagram of the human intestines. Interesting.
Re: Neat, now how about...
Like I know enough about network security to claim the network's insecure.
Re: Neat, now how about...
wonko ill paypal u $20 right now if u answer my forum question
Tables vs. position: absolute
Really, I find tables to be incredibly useful. Short of display: inline-block (which Mozilla does not yet support), I know of no other reasonable way to do any sort of columnar layout.
Also, absolute positioning doesn't seem to provide for a way to place things at the bottom of a document. The 'bottom' style element is relative to the bottom of the viewport, or some user-specified height, but not the bottom of the tallest positioned element. I think we need a position: footer, so that we can have a box guarenteed to be below everything else.
If I'm wrong, please, enlighten me.
Re: Tables vs. position: absolute
Nowadays, as the standards are becoming increasingly solidifed, the W3C has made a very strong effort to separate content from presentation. As such, the font tag has been deprecated, cats and dogs have been relegated to their own separate beds, and there's been a massive attempt to shoehorn tables back into their proper role as a markup tool rather than a layout tool. The good thing about this is that it makes websites more accessible and allows designs to degrade gracefully for handheld devices, screen-readers, printers, and other things that could care less about presentation and would rather just have the raw content. The bad thing is that it's a lot harder to duplicate the layout possibilities of tables with pure CSS. It's mostly doable, but it takes some work. And of course, there's always that one non-compliant browser that's a huge pain in the ass about it.
The CSS footer problem is something I've battled with myself (and you'll notice I generally tend to shove the footer in at the bottom of the main content box in most of my designs), however a quick Google search turns up an elegant solution that actually appears to be backwards-compatible with older browsers.
Re: Tables vs. position: absolute
I suppose you could do:
header
/header
content
left
/left
middle
/middle
right
/right
/content
footer
/footer
But you'd end up using display: table-cell for left, middle and right, and then we're back to tables. Once we have a working display: inline-block, I'll be happy. Until then, I think I'll stick to tables.
Re: Tables vs. position: absolute
display: table-cellordisplay: inline-block? Column positioning is easy enough without those. Look at wonko.com's CSS for an example of simple absolute positioning with a fixed column. There are also plenty of other excellent examples online of multi-column CSS layouts, with both fixed and relative widths, with floats or without.While I agree that floats should be avoided if possible, I don't agree that floats are as bad as using tables for layout. The W3C itself even recommends using floats (they use the technique they describe on their own website).
Re: tell me how
Wonko would NEVER do that! Just ask Sssnake...
Why Tables are Bad
FWIW... :)
Wow
I'm surprised you even remember those "old DOS games". Of course I played "Dam Buster" in glorious ASCII graphics on our old Commodore PET, and remeber buying the original Zork and MS Flight Simulator I and Ultima I and.. Maybe I remeber you playing around with them a bit back then too...
Re: Wow
Luckily, Mom had saved copies of some of them, so I still managed to spend countless hours playing the Zork games, lots of the old Sierra stuff, and plenty of shareware. I also got UncaTim to help me write (read: write for me) a 2D lightcycles-style game in QBasic which I tweaked endlessly and released as shareware (it's still listed here as "curves13.zip"!), and I spent years writing little text adventures with increasingly complex language parsers. Eventually I managed to trick someone (I can't remember who, now) into buying me a silly 3D engine complete with map creation tools and a small library of textures and sprites, and I spent another year or two building goofy Doom knockoffs.
Then the INTARWEB happened and I got sidetracked.