nofollow Bookmarklet

June 14th, 2008

Here is a smallish bookmarklet that highlights all links that are marked with the nofollow attribute. Just drag and drop it to your bookmarks bar.

show nofollow

In its current version the bookmarklet is very very simple: it just highlights nofollow-links and reports back the total number. However it only works on frameless documents.

Here’s the code in a readable <code>-block:

javascript:(function(){
  for (var i = 0, a = document.getElementsByTagName('a'), b = a.length, c = b; i < b; i++) {
    a[i].rel.match(/nofollow/i) ? a[i].style.backgroundColor = '#ff0066' : c--;
  }
  alert(c);
})();

That’s the shortest I could get. Have fun :).

P.S. You can test-drive it right away on this page: the about-link in the footer is a nofollow-link.

P.P.S. It’s the browser that turns a double minus into a single long dash.

Candles in the Night

May 11th, 2008

candles in the night

candles in the night

candles in the night

candles in the night

candles in the night

candles in the night

Exposed

April 7th, 2008

I’ll be participating in this year’s naked day on 9th of April.

Yeah, I’m a nudist, baby. I’ll be running the whole day with my clothes off and I’ll be exposing myself all over the place. I’m so excited I’ll do the long 48-hours-day striptease.

Cheers.

about: X-UA-Compatible, Take 3

March 4th, 2008

I’m so happy about the great news today that I don’t know what to say … :) :)

Official anouncment and some people’s reactions.

I welcome this decision and applaud it. It really shows Microsoft’s efforts towards openness and interoperability. This news just might turn my personal image of Microsoft from evil to good.

Hey bartender, let me get a beer for Chris Wilson, Bill Gates and all the great guys and girls from the web development community that helped with this issue.

Unobtrusive Smilies :)

February 20th, 2008

I don’t know whether you may find use for this, it might be a complete overhaul, but anyway.

Smilies are small inline images that represent a mood like being sad :( or help enrich the context with some emotion like winking after a joke ;). Everybody uses them but no one actually puts down those img-tags: we rely on our smart CMS’s to the job. Smilies are accessible since screen readers use either the title or the alternative text attributes of the img-tag. The problem is that such inline images aren’t semantically correct: they should be part of the text as text and not as images.

I’ve put down a small (~2KB minified) mixture which filters all smilies and replaces them with images in an unobtrusive way.

Download uns v. 0.2

What is the basic?

Default behavior is to query the document for span-tags that have the class smiley. Each one option is customizable.

What’s the compatibility?

It’s known to work with Firefox 2, Firefox 3, IE5.5, IE6, IE7, Safari 3 and Opera 9 under Windows, Safari 3 under Mac OS X and Konqueror 3.5 under Kubuntu.

How to trigger it?

Use it just as any other unobtrusive JavaScript out there:

window.onload = function() {
  uns.parse();
};

Or gain performance by providing a node where smilies are to be found, like the main content div-block:

window.onload = function() {
  uns.parse({node: document.getElementById('content')});
};

You can also provide an onfinish callback:

window.onload = function() {
  uns.parse({
    node: document.getElementById('content'),
    onfinish: function() {
      alert('finished');
    }
  });
};

Or you can add additional smilies:

window.onload = function() {
  uns.smilies({
    ':cska:': 'images/cska.gif'
  });
  uns.parse();
};

You can also AJAX load new content into some poor div and run the parser afterwards:

xhr.onreadystatechange = function() {
  if (xhr.readyState == 4) {
    var comments = document.getElementById('comments');
    comments.innerHtml = xhr.responseText;
    uns.parse({node: comments});
  }
};

Where can it be seen?

I’ve put down a small demo.

Log

20.02.2008: 0.1 Initial release.
22.02.2008: 0.2 Added support for native getElementsByClassName and tested with Firefox 3, added support for IE5.5 and IE6.

Kitchen Sink Party

February 20th, 2008

kitchen sink party (0)

kitchen sink party (1)

kitchen sink party (2)

kitchen sink party (3)

kitchen sink party (4)

kitchen sink party (5)

kitchen sink party (6)

kitchen sink party (7)

about: X-UA-Compatible, Take 2

January 27th, 2008

In case you’ve missed it, you can warm up here, here and here.

I’ve realized today, that it’ll be a long time till “edge” is default setting.

Let’s just examine the problem from Microsoft’s corporate point of view. Don’t forget that IE has still the largest market share and back then when IE7 came out it was even larger. But IE7 is supposed to be a better browser than IE6, why did Microsoft lost users? Because IE7 “broke the web”. By being more standards aware. And users didn’t blame the poorly written web sites nor the authors of those sites but the software. Many downgraded to IE6, others switched to Firefox or Opera. Truth is Microsoft lost “something” by bringing out a new browser release. And they obviously did learned from their mistake. This is the reason for the switch and this is also the reason, why “edge” is not going to be the default setting any time soon.

This is sad because backwards compatibility slows down the progress. But it’s also nice because it ensures accessibility.

I like about the solution that it’s a simple one. The <meta>-tag should save us real work of crafting ie6.css or ie7.css or anything similar. But only if IE8’s adoption rate is high enough, which I doubt. However what I don’t like about the whole story is the mere fact that out there are a lot, and I mean a lot, of lazy web developers that rely on old design patterns like table-based layouts, inline styling and scripting and spacer.gif. Those developers will be adopting standards at even slower rates. Now … this could mean more contracts for real web developers but on the other hand: Why pay more and wait longer?

And this is the real issue here and what the discussion should be about: How is Microsoft planning to remove old rendering modes? On what rates, under which conditions? Dean actually already asked the very same question:

Tell us what your real concerns are and we will try to help.

Thinking about the whole story today I’ve realized how right Dean is and how wrong I was yesterday. My statement might have been true, but this just makes the switch more dangerous: Where is our Web going to be in 2 or 3 years? Still IE6? No, thank you Microsoft, you can keep it for yourself.

John Resig also makes some perfectly good and valid points about the <meta> but in terms of JavaScript. Eric Meyer suggests for javascripters to continue and to expand object detection or browser sniffing. Now have a look at this sample code and tell me what do you think of it:

jQuery(document).ready(function($) {
  switch ($.whichIEifIE($)) {
    case 6:   return my.uber.cool.site.ie6($); break;
    case 7:   return my.uber.cool.site.ie7($); break;
    case 8:   return my.uber.cool.site.ie8($); break;
    case 9:   my.uber.cool.site.edge.fixes($);
    default:  return my.uber.cool.site.w3c($); break;
  }
});

about: X-UE-Compatible, Take 1

January 25th, 2008

… People seem to forget that the internet is big — really big — and the number of pages written to match what the spec wants, rather than what IE displays, is rather small. Furthermore … people would blame IE and not the web developer.

Now although it’d be nice for the world to be perfect … the sad truth is that there’s a real world out there, with real people other than web developers, and Microsoft has to make IE work for them, even if this means opt-out backward compatibility.

Leszek Swirski

I just want to add that unfortunately there are a lot of web developers out there, that are unaware of specs, semantics and best practices. They are definitely not going to be drilled about IE8 “breaking the web”. So I’m for this version targeting. But I really wish “edge” would be default rendering if no <meta>-tag is found.
Update 26.01.2007: I’ll vote against if given the chance.