Dax

No Default!

March 20th, 2007 · 8 Comments

no-default.gifDownload No Default! v1

If you have a lot of clients who blog or parents who blog and they just can’t seem to remember to put their posts into categories, slap this plugin down.

No Default! pops up a little javascript box if they didn’t choose a category and it won’t let them submit or save until they do.

Now you just have to answer the question of “Why didn’t my post save when I wrote it, saved it, and a little error box which I didn’t read popped up before I walked away?”

The tricky bits in this plugin are the methods you need to call to stop Javascript from submitting a form after submit.

In IE, you have to use attachEvent(’onsubmit’, checkCategory) to catch the submission, but in Firefox it’s addEventListener(’submit’, checkCategory, false)

Also in Firefox, returning false from your onsubmit function doesn’t work because it’s not supposed to. Call e.stopPropagation() and e.preventDefault() to halt the form submission.

Why would I say all that? Because Google was very little help while I was trying to figure it out in the first place.

Tags: Wordpress Plugins

8 responses so far ↓

  • 1 Phantombookman // Mar 23, 2007 at 12:20 pm

    Dax,
    seeing as how you’re the HT Access Kid any opinions on stopping hotlinkers, they’re pissing me off, I’ve read all the crap on the net (mostly pages from 1998) just hoped for a $500 an hour opinion for nothing !

    There seems to be pros and cons for it, just wondered whether you would bother and if so any chance of a masterclass on how ;) It could be good link bait…… well it could be !

    Best
    Rod
    PS: Link a Dink is still doing a great job thanks

  • 2 hammer // Mar 23, 2007 at 12:41 pm

    stopping hotlinkers? I use a little htaccess thing

    RewriteCond %{HTTP_HOST} biggnuts\.com [NC]
    RewriteCond %{REQUEST_FILENAME} .*jpg$|.*gif$|.*png$ [NC]
    RewriteCond %{REQUEST_FILENAME} !hotlink.gif$ [NC]
    RewriteCond %{REQUEST_FILENAME} !wncover.jpg$ [NC]
    RewriteCond %{REQUEST_FILENAME} !vective [NC]
    RewriteCond %{REQUEST_FILENAME} !aton [NC]
    RewriteCond %{REQUEST_FILENAME} !wayward [NC]
    RewriteCond %{REQUEST_FILENAME} !moustache [NC]
    RewriteCond %{REQUEST_FILENAME} !banner [NC]
    RewriteCond %{REQUEST_FILENAME} !adsense [NC]
    RewriteCond %{REQUEST_FILENAME} !bunhump [NC]
    RewriteCond %{REQUEST_FILENAME} !dicktastics [NC]
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !biggnuts\.com [NC]
    RewriteCond %{HTTP_REFERER} !google\. [NC]
    RewriteCond %{HTTP_REFERER} !yahoo\. [NC]
    RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
    RewriteRule (.*) http://www.biggnuts.com/wp-content/hotlink.gif [R=301,L]

    Actually. On some sites I’ve used an image that tells people to go to the site to find the picture. That’s pretty much it. Unfortunately, tracking-wise I have no way of knowing if that actually works.

  • 3 Phantombookman // Mar 24, 2007 at 7:49 am

    Hi Dax
    thanks for that, I shall have a go if you do it.
    I would fancy using your script, if that’s OK,
    Presumably I just need to change biggnuts for mysite, but not sure about the rest.
    I have all my images in one folder, imaginatively called images, are you blocking yours individually ?
    Regards
    Rod

  • 4 wminside // Mar 29, 2007 at 1:32 pm

    Dax, I don’t understand this part of your htaccess

    RewriteCond %{REQUEST_FILENAME} !vective [NC]
    RewriteCond %{REQUEST_FILENAME} !aton [NC]
    RewriteCond %{REQUEST_FILENAME} !wayward [NC]
    RewriteCond %{REQUEST_FILENAME} !moustache [NC]
    RewriteCond %{REQUEST_FILENAME} !banner [NC]
    RewriteCond %{REQUEST_FILENAME} !adsense [NC]
    RewriteCond %{REQUEST_FILENAME} !bunhump [NC]
    RewriteCond %{REQUEST_FILENAME} !dicktastics [NC]

    Actually I have never seen something like that, could you explain what’s that for pleaseee?

  • 5 hammer // Mar 29, 2007 at 2:03 pm

    Oh yea…that htaccess that I posted was to stop hotlinkers.

    That part you’ve posted will allow hotlinking for those files.

    So I have a bunch of banners with “vective” in them somewhere. That first line means all requests for anything with “vective” in the filename will be served regardless of where it’s getting displayed.

  • 6 Phantombookman // Mar 31, 2007 at 2:09 am

    Hey Dax
    pinched some of your code and now have this as my htaccess file, appears to work nicely, just wondered whether you thought it looks OK.
    Don’t want to lose Google images or wreck anything else etc

    Thanks mate and last time I do this
    Cheers Rod

    PS: When’s the next Edgar N Vective due ?

    RewriteEngine On
    RewriteCond %{HTTP_HOST} mysite\.com [NC]
    RewriteCond %{REQUEST_FILENAME} .*jpg$|.*gif$|.*png$ [NC]
    RewriteCond %{HTTP_REFERER} !mysite\.com [NC]
    RewriteCond %{HTTP_REFERER} !google\. [NC]
    RewriteCond %{HTTP_REFERER} !yahoo\. [NC]
    RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
    RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://www.mysite.com/ [R,NC]

  • 7 stacey lane // Apr 9, 2007 at 2:45 pm

    This little stick figure has mysteriously popped up on my brothers desktop, you wanna explain that to me?

  • 8 Mike // Nov 9, 2007 at 8:15 pm

    No default sounds like it is going to work great for me. I have a couple of new people posting on my blog and now i wont have to worry about them forgetting to select the category.

Leave a Comment