Undocumented jQuery constructor

September 17th, 2008

In jQuery it is possible to create nodes in a foreign document by calling jQuery('<div>sample html</div>', foreignElement.ownerDocument);. If somebody documented this I wouldn’t have lost the last hour or so.

This is why I like wiki style documentation.

Reblog this post [with Zemanta]

Levels of government

September 9th, 2008
Overview of Piran, Slovenia
Image via Wikipedia

Just now the chief of Slovenian Police (about 10.000 employees according to their website) said that he cannot be held responsible for a thing that a guy 20 levels below him did wrong while talking about Slovenian Interpol not responding to an Austrian Interpol request within a year.

Funny – while working at Parsek I worked on the Cisco Systems Slovenia website. If I recollect correctly our contact at Cisco Slovenia was only about 7 or 8 steps from the CEO of the company which has about 66.000 employees (according to Wikipedia).

Reblog this post [with Zemanta]

Dear Opera guys…

September 2nd, 2008
Large bookcase #1, 3rd shelfImage by vjl via Flickr

Can you please tell me how to add external stylesheets with JavaScript? I’m trying to add them by creating a link element with a rel=”stylesheet”, type=”text/css” and a valid href and then appending this to the head element but it doesn’t seem to work. I’m quite sure my css files are good since when stripped down they only contain body {background-color:#ff0000;}.

It’d be great if you could post a solution because I really don’t want to spend another hour thinking about this – I already spent four and I got nowhere.

Reblog this post [with Zemanta]

Lure me in with the music

August 29th, 2008

Window shopping at Eaton's department store.Image via Wikipedia While shopping today it struck me that you can also choose your clientele with the music you play in a shop. Or inadvertently repulse shoppers if an aggressive young shop assistant plays music that customers don’t like. This made me think that I’m not in the demographic of Jack & Jones Jones and that I’m welcome in the shop for wedding gifts. I’m getting old obviously.

Reblog this post [with Zemanta]

Reading JavaScript

August 28th, 2008

Douglas CrockfordImage by Edd Dumbill via Flickr I’ve just received two books about JavaScript that will keep me entertained over the weekend. The first one is from the father of JSON, JSLint and JSmin Douglas Crockford, whose series of lectures on JavaScript is really a great video introduction from beginner to intermediate and sometimes even pro level and is called Javascript: The Good Parts. I haven’t even tried to look at it because I’m scared I’ll start reading it and won’t get any sleep.

The other one is from the new kid on the block, the jQuery author and JavaScripter extraordinaire John Resig, called Pro Javascript Techniques. Reading the jQuery code is always one of the most fascinating parts of work, so I just had to order it.

I’ll try to post a review of both of them as soon as possible, but it might be later than I hope since I have a lot to do in these coming weeks.

Reblog this post [with Zemanta]

Discovering Greasemonkey again

August 15th, 2008

Meissner effect: levitation of a magnet above ...Image via Wikipedia I’ve been rediscovering the joy of Greasemonkey scripts lately. For those who don’t know, Greasemonkey is one of the best extensions for Firefox ever made (the other being Zemanta of course:) that allows you to run JavaScripts on specified pages. This doesn’t really mean much to the non-technical crowd, but to us geeks this means you can do almost whatever you want with the page. As I make more and more of these I decided to share them here.

For my Slovenian readers

  1. Finance unfixed is a script that will unfix the header of finance.si. This means the header will scroll and you’ll get more space to read the article.
  2. RTVSlo OI is a script that will remove the header from the OI page on rtvslo.si again leaving you with more real estate for reading.
  3. Delo is a script that will help your eyes when reading delo.si news site since it’s small default line-height might make them hurt.

Developers

  1. JSLint highlighter will help you read the JSLint results. If you write JavaScript and don’t know what JSLint is you should go check!

How to work it

Well first you have to have Greasemonkey installed. After that installing a user script should be as simple as a click of a link. When a script activates you’ll see a little green box that will say ‘Greased’ in the top right corner. Clicking it will toggle the script – either it’s on and active (green) or off and the page looks as it would in the first place (red). You can also toggle the script with alt+g.

Reblog this post [with Zemanta]