Gibberations by Kiffin Gish...
Cyber-Gish | Kiffin's blog
Gibberations RSS feed
917 entries
1478 comments
Archives by Category
:: Javascript ::
9 items
Wednesday / August 11th / 2004
Shake me...

Found at The JavaScript Source


~ Posted at 08:50 PM | Permalink | any comments?
[Top]
Monday / April 26th / 2004
Are you an expert...

So you thought that you knew everything there was to good old javascript did you? Well then, check out the slayeroffice web site first and then ask yourself again whether or not you are such a big shot afterall.

Personally, I found the Mouseover DOM Inspector the most impressive of all.


~ Posted at 09:10 PM | Permalink | 3 comments
[Top]
Friday / October 3rd / 2003
Break it up...

Don't you just hate it when you include some external piece of (javascript) code from another site, and it breaks up the layout of your web page?

This is the problem I've been having with Blogsob. The kind folks there provide a free service for members of the blogging community, enabling you to increase your blog's exposure via simple text-based ads.

All you have to do is insert the following code somewhere and hope everything works out okay:

<script src="https://www.blogsnob.idya.net/ad.php?id=n"
  type="text/javascript"></script>

I have placed this at the very bottom of my right-hand margin. This margin is set to a width of around 160 pixels and it is meant to stay that way.

The only problem with inserting this piece of code is that you do not know ahead of time how much text and/or images might be thrown into your site. Now I trust the service for what it is, and most of the time it seems to be working alright. However, sometimes I get really long words containing say 50 characters in a row. This breaks up my layout. In order to accommodate this exceptionally long word, the poor 160 pixel wide margin is expanded so that a much larger vertical bar appears. You see, HTML has no character wrapping, only word wrapping at the white-space borders. My main content area is covered up on the right side and shifted to the left. Bummer, man.

So what's a poor soul like myself going to do? Well, I have chosen to solve this using good old Javascript based on the DOM-interface. Here is what I do. First of all, I bracket the inserted code above like this:

<div id="blogsnob">
<script src="https://www.blogsnob.idya.net/ad.php?id=n"
  type="text/javascript"></script>
</div>

Note that I have wrapped the ill-behaved section of code with another div-tag and I have labeled it "blogsnob" accordingly.

Then just right after the spot where I have inserted the code above, I add the following function call:

<script language="javascript" type="text/javascript">
<!--
mxw("blogsnob");
//-->
</script>

Alright, so what does this magical function called mxw() really do? Well, it looks within the div-tag that I labeled as "blogsnob", recursively parses through the nodes and child-nodes, and grabs each TEXT-element. If it then finds any words which are longer than a pre-defined maximum length, say 20 characters (mxw_max = 20;), then it will truncate this bugger to this given length. Pretty neat, huh?

Just in case you were curious what this function looks like, and assuming that you not only have a good knowledge of Javascript, but also at least some limited experience with that thing called DOM, then here it is:

<script language="javascript" type="text/javascript">
<!--
// Maximum allowed length of text words.
var mxw_max = 20;
//
// mxw(id)
//
// Wrapper function which checks that certain DOM
// is supported before calling recursive mxw2(). 
//
function mxw(id)
{
  if; (!document.getElementById) return;
  var; n = document.getElementById(id);
  if; (!n || !n.nodeType) return;
  mxw2;(n);
}
//
// mxw2(id)
//
// Checks all text of given node and all its
// descendant nodes, truncating each word that
// is longer than allowed length mxw_max. This
// is an extra safety valve preventing unwanted
// overrun, e.g. of sidebars and/or margins.
function mxw2(n)
{
  if; (n.nodeType == 3 /*Node.TEXT_NODE*/)
  {
    var flag = 0;
      var words = n.data.split(" ");
    for (var i = 0; i < words.length; i++)
    {
      if (words[i].length > mxw_max)
      {
        flag++;
        words[i] = words[i].substr(0, mxw_max-2) + ". "; 
      }
    }
    if (flag > 0) n.data = words.join(" ");
  }
  var; children = n.childNodes;
  for; (var i = 0; i < children.length; i++) mxw2(children[i]); 
}
//-->
</script>

Hope you like it and find it useful for your own web pages somewhere. You're welcome.


~ Posted at 09:53 AM | Permalink | 5 comments
[Top]
Wednesday / September 3rd / 2003
Now you see me...

Here's some more javascript stuff which you too can use in order to achieve yet another truly amazing affect. Boggle the minds of your readers and make new friends. Just click on the following button to find out for yourself:


~ Posted at 10:44 AM | Permalink | 3 comments
[Top]
Friday / August 29th / 2003
Something silly with Javascript...

Alright, so I get kind of bored once in awhile, so what? Everyone has those periods when all you feel like doing is doing nothing at all. Nothing at all like a good old bout with some amazing Javascript, that is.

Here is something I created this morning, something quite silly but still entertaining nonetheless. And to think that I did it all with some simple Javascript. Try it out please.

Speed:   Sleep:     

Kind of reminds me of that program called Life, remember it? A simulation of living objects based on the population, available food and number of neighbors and other predators. I guess I could enhance this simple creation to include some kind of intelligence, but that will have to wait until another day (sorry).

If worse comes to worse, I can always find a job somewhere as a Javascript programmer. Want to hire me?

Hope this made your day. It did mine.


~ Posted at 11:52 AM | Permalink | 5 comments
[Top]
Wednesday / November 20th / 2002
Spam-bots beware...

Alright, so I finally have gotten so overly fed up with those droves of spam emails the flood my in-box everyday that it is time to do something about them. After having read the article Spam-Proofing Your Website, I have taken some of their suggestions at heart and have begun to cloak all email addresses displayed on my homepage and blog. You see, there are millions of so-called spam harvesters crawling all over the Internet, consuming page after page and extracting all the discovered emails. To be used for junk email, those jerks. I am curious if I will now be getting less junk email (about 60 per day and growing).

<script language="javascript" type="text/javascript">
<!--
// Try and spoof those nasty spambots!
  document.write('<a href="' + 'ma' + 'ilto:k');
  document.write('iffin' + '&#064;' + 'cyber-gi');
  document.write('sh.com' + '">' + 'kiffin (at) ');
  document.write('cyber-gish' + '</a>');
//-->
</script>

And this is what all that mumbo-jumbo code (hopefully) looks like after it has been parsed by your internet browser and presented in readable form: [ ]

Now be honest. If you were a spam-bot, would you be able to figure out what this is? I've heard that they are getting pretty smart lately, even able to scan Javascript code and understanding it, but I doubt very much if this can ever be understood.

Here is an email encoder site which you might find useful, or you can also try out this anti-spam obfuscator.


~ Posted at 02:24 PM | Permalink | 2 comments
[Top]
Thursday / October 3rd / 2002
Ordered books...

Since my birthday is coming up soon, I decided to order two more books from Amazon in the hopes that my shipment will arrive in time for the big event. They've got less than nine days, but so far I have never had to wait more than a week. Now I will tell you which two books I ordered if you promise not to make fun of me. The titles are:

  • The Java Programming Language by Ken Arnold et al.
  • Effective Java by Josh Bloch.
I figured that I have pretty much learned enough about HTML, Javascript, XML, CSS, Perl and CGI that it is time to take the next jump into the most obvious domain about which I need (would like) to be more knowledgeable. I have heard so much about the wonderful world of Java and at the same time know so very little about it. Time to expand my knowledge another slight click. Is this a sign of getting senile, crazy, too old for this stuff or am I simply a born techie guru type at heart? Take your pick. Any way, the books will add a pleasant counterweight to whatever it is I am planning to do in the not so near future.


~ Posted at 12:55 PM | Permalink | 2 comments
[Top]
Saturday / February 23rd / 2002
Infinite knowledge...

Right now I am reading a bunch of books simultaneously in my never-ending attempt to acquire infinite knowledge. Nine books all in a row, to be more precise. Depending on my mood at a given instant, I will jump from the one book to the other. Sometimes smack dab in the middle of a chapter, I will close the book I am currently reading and open up another book. Some reading sessions consist of switching books five or six times an hour. I suffer from an insecure feeling that perhaps I am not increasing my knowledge as productively as I should. That what I am reading at the moment is not valuable enough in the sense that I am suffering an acute shortage by not improving my life sufficiently and quickly enough! This can be very frustrating. The innocent pleasures of reading suffer in that regard which is ironic to say the least. There is this endless source of interesting information out there, and there is absolutely no way I can absorb it all in the limited span of my lifetime. By nature I have an addictive tendency, a proclivity which bends me in fixations. Especially when it is in any way remotely related to the esoteric acquisition of knowledge. So why bother in the first place? Infinite knowledge is preferable, of course. Unfortunately one cannot attain this by reading, even if one could have enough time to read every single book in every possible language that has ever been written in the history of civilization. In order to give my readers a hint of how far along this reading adventure I have come, here is a list of books that currently lie on the reading table next to my bedside. The order is from bottom to top, or since I am by nature symetrical and neat, from the widest (usually the thickest, but now always) in decreasing order:

  • Programming Perl, Third Edition by Larry Wall et al.
  • Javascript, The Definitive Guide by David Flanagan.
  • The 7 Habits of Highly Effective People by Stephen R. Covey.
  • Essential CSS & DHTML for Web Professionals by Dan Livingston.
  • Web Design in a Nutshell by Jennifer Niederst.
  • Cascading Style Sheets 2.0 Programmer's Reference by Eric A. Meyer.
  • A Beautiful Mind by Sylvia Nasar.
  • The Power of Now by Eckhart Tolle.
  • Caesar by Colleen McCullough.
As you can see from the list I am pretty much obsessed with Web-related stuff at the moment. However, I try my best to balance this with other non-Web stuff. Reading one book at a time would probably be much more efficient, but I am too impatient. For the sake of simplicity, let's just say that I am about half-way along the pursuit of infinite knowledge.


~ Posted at 12:08 PM | Permalink | 6 comments
[Top]
Friday / February 8th / 2002
Activate your web pages...

When I arrived home I was so very excited to receive my latest order from amazon.co.uk that my heart started beating wildly. I ripped open the box and let out a gleeful shout. The reason:

Javascript, The Definitive Guide by David Flanagan.

Yes, yes, yes. As if there is still even more to learn. Haven't I learned enough? This weekend I plan to saw through the exciting thickness and learn as much as I can about javascript this wonderful programming language for the web.

At heart I guess I remain quite an Internet geek.


~ Posted at 04:33 PM | Permalink | any comments?
[Top]
Navigation
In order to go back to the main blog just click on the button below.
Most visited
Here are the top twenty visited entries in this blog: (10560) Crackedty-crack
(5175) Maslow's hierarchy of needs
(4206) Growing a beard can be hazardous to your health
(3861) Maslov's pyramid
(3761) Fish tycoon
(3213) Top referers
(2327) Don't sneeze
(1862) Squeaky clean windows
(1577) Phineas Gage
(1471) Get me on your pda
(1310) Mangled mess
(1223) How people find me
(1130) Top phrases
(1113) Designing with web standards
(1100) Kirk hits seventy-three
(1045) Queen's birthday
(1042) Trains collide
(1033) Beetle effect
(986) Obfuscated code
(969) Googled to death

Top Googles
Here are the top 20 Google searches bringing folks to my blog:
(616) maslov
(588) how to clean windows
(538) maslov pyramid
(497) growing a beard
(418) fish tycoon crack
(369) fish tycoon registration code
(326) maslow's pyramid
(303) maslov hierarchy of needs
(291) phineas gage
(289) how to grow a beard
(278) javascript sleep
(275) maslov hierarchy
(232) maslov's pyramid
(197) link:btrx-_qryr4j...
(191) fish tycoon
(175) maslow pyramid
(140) maslov's hierarchy of needs
(127) maslows hierachy of needs
(120) clean windows
(100) boys in bikinis
Guestbook
Prove you were here and tell me what you really think. You can either sign my guestbook or just have a look.

Top referers
Here are the top 20 web sites bringing folks to my blog:
(45) Weblog Review
(29) andrewsaluk.com
(27) Ageless
(22) dogpile.com
(11) nutrition-sports-...
(7) msxml.excite.com
(7) texas-holdem.andr...
(5) Grow-a-brain
(4) home.bellsouth.net
(3) adelphia.net
(3) metacrawler.com
(2) lightning-picture...
(2) attdslservice.att...
(2) upspiral.com
(2) Splog
(2) swishzone.com
(2) 165.89.58.50
(2) att.net
(2) dpxmldsl.verizon.net
(2) results.dashbar.com

Bloggers forum
Please visit my new discussion forum. It is dedicated to all bloggers worldwide and called Bloggers Galore. Come and make yourself known, and contribute to the collective blogging consciousness.
PDA notes
Check out the mobile version of this blog.
Check out the mobile version of this blog.
Last 100 posts
Articles about blogs

Video
Wondering what this guy is trying to prove? Play the video and find out:
This is a short video which you might find entertaining...
media player ( hi | lo )
real player ( hi | lo )
Contact
There are a number of ways you can get a hold of me, just pick one:

Email:
MSN: Email: kiffin_gish@hotmail.com
ICQ: 101918614
AIM: My AIM username is 'CyberGish' CyberGish

[ I use Trillian Pro ]
Blogs I reviewed
For awhile now as official weblog pseudo-analyst on the weblog review, I have written a number of reviews about the following sites:

big picnic | untamed | my november | neurosis | runnerblog | this is what orgasms look like | hustlebox | becoming | journal life | mark's weblog | macaroni | syaffolee | alt164 | cheese | people's republic of seabrook | isabella's teddy's travels | random rationale | after horizon | 168 | fuh-q dot com | twisted soul | drifting castles | one moment | neal curley dot com | reality rendered | most definitely

My weblog was also once reviewed so you might want to have a look at
kiffin's blog.

You might also want to check out the blog control site.