So, more than once I’ve had to grab a list from a Word document or a PDF and put it into some HTML friendly code. My fingers would start to hurt from copying and pasting <li> tags and <p> tags into documents so I could properly style them. I searched for a while, and couldn’t find a tool like this… so I made one.

Simply copy the list you have to the box on the left, click a button, and the tags are added for you. Nice and simple. It works for LI tags and P tags. I’ll add features if I get enough requests.

http://www.whathuhstudios.com/addli.html

Let me know what you think! Tested in IE8, FF3.6, Chrome 4, and Safari 4.

Tags: , , ,

Some Jquery tricks

development April 22nd, 2009

I have been using Jquery for a few months now, and have completely fallen in love with it. I’ve probably looked at hundreds of different pages, blogs, posts, plugins, and tricks over the time I’ve spent learning it. Here are a few of my favorite things to use it for.

Putting text labels in a password field

Password inputs mask the text in them, so having “Enter Password” inside the field won’t do much good. We can’t change the type of input on the fly, but we can make it disappear, and have another appear… Here’s how I’ve done this:

1.	$(".passflip").click(function() {
2.	  if ($(this).attr("type") == "text") {
3.	    $(this).hide();
4.	    $("#"+$(this).attr("id").slice(1)).show().focus();
5.	  }
6.	});
7.	$(".passflip").show();
8.	$(":password").hide();

And the HTML code:

1.   <input id="Tuser_pass" class="input passflip" style="display: none;"
        name="Tpwd" size="20" type="text" value="Enter Password" />
2.   <input id="user_pass" class="input" name="pwd" size="20"
        type="password" />

What we’re looking at here may seem messy at first, especially line 4 of the javascript code. Its not that bad. It takes the id of the passflip element that we clicked, removes the first character (giving us user_pass in this case), and shows and sets focus to that element. To the user, that text input will have “transformed” to a password input seamlessly.

The text input has an initial display of “none”. Also, in lines 7 and 8, we then hide all the password inputs (which are set to visible on page load), and show all the passflip inputs. This ensures that for those without javascript enabled, they will still be able to use the form as intented. The only difference, is that they won’t see the “Enter Password” information in the input, it will just be blank.

Friendly one time “clear this” function

1.	$(".clearThis").click(function() {
2.	   if ($(this).val() == $(this).attr("title")) $(this).val("");
3.	});
4.	$("#username").val($("#username").attr("title"));

and the html

1.   <input type="text" name="user_email" id="user_email"
       class="input clearThis"  size="20" tabindex="20"
       title="ENTER EMAIL" />

The value of this little gem may not be apparent at first, but it’s a perfect companion to the above mentioned function, and fails very gracefully on non-javascript enabled machines as well.

Instead of setting the value of the text box to display “ENTER EMAIL”, we simply set the title. What happens then, if javascript is enabled, is that the value will be set, displaying instructions to the user. the clearThis click function then checks to see if the two match, and if so, its likely the first time that input was clicked, and it clears the box for user input. If javascript is not enabled, the clearThis click function obviously cannot work, but the text input won’t have anything in it to clear anyway, so we have a double win.

This is all I have for now. I’ll post more sometime next week. Love live JQuery!

Tags: , , , ,

Simply put: Flash will not replace well-designed web sites based on html/css. To elaborate:

Saw this gentleman’s article on Technorati, and the title caught my attention.

Adobe recently announced that Flash and related files are going to be open source. This means that pretty much anyone can write and develop a program to author flash files. So what? This changes nothing.

My honest opinion is that the argument of Flash taking over the standard web page is moot. There are practical, well executed uses of flash, and there are practical, well executed uses of any of the other technologies mentioned. However, it seems that there are at least as many poor uses of each.

Flash has it’s place: Interactive, colorful, design-rich web applications, games, demontrations, advertisements, web intros, and so on. The key is that flash files use up bandwidth and computing power, and if used when not needed, can actually harm the user experience and usability. Flash files are also not indexed in search engines, which means that in order to have the page relevant on the web, the designer/developer must include additional content indicating what is contained in the flash movie/video. If the entire site is in flash… then no search results.

AJAX has simliar problems, and should be used when appropriate. The large-content AJAX staple “iframe” won’t be indexed, and users without javascript enabled (many office computers, terminals especially) cannot use the AJAX content at all. This means that developers must write code twice: Once for the general population, and again for those that can’t use the technology. Either that, or they stand to lose 1 out of 10 potential users of their software.

I hate flash. I hate how easy it is to make a really ugly navigation menu in flash. I hate how easy it is for anyone who … Let me interrupt myself here. I hate that because I have a web page open in the background that has a flash movie running, my browser just shut down, and I lost two sentences that I wrote because of it. I hate that 90% of flash applications could have been done better, faster, and cleaner using web standards, and without alienating those with slow computers, or those who can’t install flash at their office.

But just remember: I love a great looking flash-based website. Just a random search on google found me this site: http://www.singularitydesign.com/ . Very well done. The flash file is only 202K, which is much smaller than even the Yahoo! homepage. The content is clean, and flash is used to show off how flashy this particular web design company can make your site look.

Simply put: Flash will not replace well-designed web sites based on html/css.

Tags: , , ,

What the hell is a <canvas>? How do I use it? Why do I want to use it? What is so great about it?

I have had no idea, so I decided to find out.

With my recent kick on finding out everything I possibly can about html5, this is one part of it that has been implemented in a few of the more popular browsers, and actually has some use. By definition:

The tag defines graphic, such as graphs or other images. The tag is new in HTML 5

That seemed 100% pointless to me, until I learned more. The idea of this element, is to provide a container for graphics, and to use a script to actually print the graphics to the screen. What that means is… dynamic graphics in your webpage without the need for Flash, Java, or Silverlight (shudder) . This is my dream come true. Here is a great example of a real life example: http://canvaspaint.org/, and here is a page with a few basic “how to’s” to understand the <canvas> element better: http://labs.mininova.org/canvas/

Supported Browsers:

  • Mozilla Firefox 1.5+
  • Opera 9.5+
  • Safari 3.x
  • IE8beta1

Edit: Damn RSS feeds and wordpress titles… If I put <canvas> in the title, the browser sees it as a tag. If I put &lt;canvas&gt; in the title, then the rss feed sees it as a tag. C’mon people… this tag arrived in 2004…

Tags: , , , , ,

HTML5

development, html5 April 24th, 2008

New blog site up, http://www.htmlfive.net. The purpose of this site is to provide a central resource for any and all updates or articles that pop up on the web about the new HTML5 specifications.

Currently, HTML5 is in working draft mode, with no real implementations besides proof of concept. Opera 9.5 has Web Forms 2.0 working to spec, which is a side-step of HTML5. There are custom builds and JavaScript workarounds that will cause certain elements of HTML5 to become active. HTML5 is not expected to reach the stage of W3C recommendation for some time now (10 years +), but that doesn’t mean we can’t start using it sooner. I will post more here as more becomes available on the site.

Tags: , ,