Javascript
Javascript image scaling
- Posted by Rob (#1) on March 30, 2007 14:11 CEST
If there's one feature I'd like for Javascript to be able to do is to scale images. And I don't mean dynamically adjusting width/height when displaying images, but actually changing the JPEG/PNG data into a smaller image for form uploads.
I've seen all too often that users of a CMS will upload an image straight from their digital camera or scanner and therefore submit a megabyte-sized file. It's easy to scale it on the server end (because most web sites won't display the image in full size), but wouldn't it be nice if it could be transformed on the client side first? It would save a lot bandwidth and upload time.
If anyone knows if this is possible, let me know.
- PermaLink: Javascript image scaling
- Tags: Javascript, images, scaling, CMS
- Post comment
MSIE Javascript workarounds for table manipulation
- Posted by Rob (#1) on March 28, 2007 16:16 CEST
Sorting tables on the fly can be fun in Javascript, especially when working with standard-compliant browsers. However when MSIE is thrown in the mix, the following workarounds are key to know:
If insertRow doesn't work properly or at all, just use insertBefore(newRow, targetRow). If you actually need to insert after, use targetRow.nextSibling if it is not null and otherwise simply use tbody.appendChild.
If newRow.innerHTML assignments are working, then just move the children of the original row to the new one instead. Like this:
var cells = oldRow.getElementsByTagName("td");
var i;
for ( i=0; i
var td = cells[i];
newRow.appendChild( td );
}
Note that the counter is not incremented: appendChild removes the element from the source so you'll always be operating on the zeroeth child.
These techniques make sure your table manipulations start working in both MSIE/6 and MSIE/7, while everything is still fine and dandy on KHTML (Konqueror/Safari), Firefox and Opera.
- PermaLink: MSIE Javascript workarounds for table manipulation (2 comments)
- Tags: Javascript, HTML, MSIE, tables, workarounds, innerHTML, insertRow
- Post comment
Still angry with MSIE
- Posted by Rob (#1) on March 19, 2007 17:08 CET
It's been a (short) while since I've filed a complaint about the dead parrot called Microsoft Internet Explorer, so here I go again:
It is extremely frustrating when a piece of craftmanship (in this case Javascript code) conforms to all known standards in the solar system and then MSIE says "nuh-uh, I have my own rules so your standards-compliant crap is not going to work". Trying to do some magic with insertRow on a TableElement? Tough luck: both MSIE/6 and MSIE/7 will fail.
Maybe I should start writing pages in plain text.
- PermaLink: Still angry with MSIE
- Tags: Javascript, Internet Explorer
- Post comment
Content with my content
- Posted by Rob (#1) on March 19, 2007 09:14 CET
Let's talk about my new site.
First of all: the user interface is improving rapidly and nearing completion, even though my todo-list is still the size of a decent novel. There are tons of useful Javascript/AJAX gimmicks I have mastered over the past weeks, all of them offering significant usability improvements for features such as the on-line calendar.
The basic design is also set in stone now. Obviously small details will still need to be taken care of, but those also depend on the specific content that will be displayed on the different parts of the site. Either way, expect a colourful improvement to the current offering. And the name has also been chosen: I decided to simply reuse the old Capsi(.com) name which I registered in 1996. Short and simple.
Last but not least: the database is growing at an unprecedented rate and I am increasingly content with the new content. There is still a lot of work to do though: my current site has approximately 4700 content pages compared to 1100 so far for the new one, but each of those new pages is more tuned to the target audience than what exists currently so I'm positive it will generate a broader audience on the long run.
- PermaLink: Content with my content
- Tags: Ajax, Javascript, Capsi, content
- Post comment
Konqueror xmlHttpRequest bug
- Posted by Rob (#1) on July 23, 2006 16:35 CEST
This really sucks: Konqueror eats characters from user input in xmlHttpRequest POST data, when the input contains UTF-8 characters. I filed a bug report and created a test-case, but as long as this isn't resolved I can't remove my workarounds in Kiki, which upon further investigation turns out to be rather limited.
- PermaLink: Konqueror xmlHttpRequest bug (2 comments)
- Tags: KDE, Javascript, Konqueror, UTF-8, HTTP
- Post comment
Still playing with AJAX
- Posted by Rob (#1) on July 13, 2006 18:33 CEST
If you wonder what's up with me: not a lot, currently. I'm still playing with Asynchronous JavaScript and XML and am slowly deploying some usability changes based on my progress. I'm currently working on a new login form. And don't worry, I won't remove the simple 1995-era POST forms just yet. Some people don't like JavaScript and that shouldn't prevent them from accessing the site.
The most important AJAX lessons I've learned so far: integrating tiny bits of JavaScript into XHTML pages and then handling their XmlHttpRequest mojo properly on the server end in PHP is easy as Paris Hiltonpie. However integrating the actual presentation is a bit more of a challenge. It seems almost impossible to resist the urge to redesign major elements of a web site when going from a stateful to (partially) stateless interface. So far most of the time I spend on AJAX ends up in tweaking public user texts and CSS style definitions.
Don't expect major changes to the site or profiles until I've figured out where I want to take my new-found abilities. I might decide to not bother changing anything at all, but I feel close to shutting down my social life for a few weeks in order to get a complete overhaul of this site out of the way.
- PermaLink: Still playing with AJAX
- Tags: CSS, Ajax, Javascript, web design, PHP, XmlHttpRequest
- Post comment
AJAX Instant Messenger
- Posted by Rob (#1) on July 9, 2006 02:14 CEST
I've added instant messaging to the Kiki user profiles on this web site! It's quite simple: a bit of Javascript sends your messages to the server and retrieves new ones for you, adding them to the page without requiring a refresh/reload of your browser. Tested in Konqueror and Mozilla Firefox.
The database keeps track of what messages you have seen, and you get notified of when a mate enters of leaves the chat. And, if someone chats you up, the site will give you a popup saying there's a new message. From there you can directly join the chat!
To start a conversation you currently have to manually find a mate who is on-line because their profile will have a chat link. But I'll be working on a nice status bar which will tell you which mates are on-line all the time! I shall also make the actual chat window a pop-up, so you won't be limited to a single chat a time (you can work around this by using tabs or multiple windows manually but that's not optimal).
- PermaLink: AJAX Instant Messenger (1 comment)
- Tags: Kiki, Ajax, user profiles, Javascript, instant messaging, chat
- Post comment