Results 1 to 5 of 5

Thread: [DHTML] EarthQuake II

  1. #1
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default [DHTML] EarthQuake II

    1) CODE TITLE: EarthQuake II

    2) AUTHOR NAME/NOTES: Dynamic Drive - updated by jscheuer1

    3) DESCRIPTION: I'm almost ashamed of this one, as it was always annoying. But every so often we get a geologist who wants it, or someone else who thinks it's cute. So I propose that it either be removed from the library or updated (the old script doesn't work in Opera or Chrome, and is quite outdated). This version shakes the page, not the browser, and has some new options (highlighted):

    Code:
      var quakechance = '100%'; //set likelihood an earthquake will occur (100% means always)
      var runonload = true;     //should earthequake run onload?
      var usemessage = true;    //should "An earthquake of magnitude . . . " message be used?
      var richteroverride = 0;  //set to 0 for random richter setting each time (valid values 0 to 10)
    It exposes only one global variable and may be called by other scripts if desired.

    4) URL TO CODE: http://home.comcast.net/~jscheuer1/s...rthquake_2.htm
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    That looks nice. I've never liked the earth quake script though, it was just annoying.
    Although I do see how your script can act as a protection from bots. You could set it to a high number, so high that humans can't read it, and you can have an input field. And say if you fill in this box with the random number next to it - you're a bot.
    Jeremy | jfein.net

  3. #3
    Join Date
    Dec 2008
    Location
    Nigeria
    Posts
    95
    Thanks
    3
    Thanked 8 Times in 8 Posts

    Default

    That is a great idea @Nile, but on the contrary it can also be used with ajax, if you post an ajax request and the results have been fetched, u can just quake the browser to alert the user....

  4. #4
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    Does the magnitude actually say how strong the quake was or is it just a random number?

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Both actually, unless you set the richteroverride, in which case it isn't random. The 'richterscale' is set to escalate a little less intensely than the real Richter Scale, the script's is set:

    Code:
    richterscale = [1, 3, 6, 9, 12, 15, 18, 21, 24, 27],
    The magnitude is the index of the scale + 1. In some browsers it is harder to differentiate visually between the various magnitudes than it is in others though.

    All of this (as regards the scale and magnitude) was already worked out in the original script.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •