Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

2008-01-02

Panorama navigation II

There was a bug in my "draggable navigation type". Instead of navigating the panorama -- Internet Explorer sometimes tried to drag&drop the image. After half an hour of searching the internet and javascript programming I think now it should be OK.

Now the question is - What should be the default navigation type?

Mouseover navigation
Just move the mouse pointer over the panorama:



...or...

Draggable navigation
Click on the panorama and move the mouse:



PS. Tried it with Internet explorer 6, Firefox 2.0 and Opera 9.2. I hope it works in IE7 ;)

2007-12-25

Panorama download progress

One thing difficult to do with javascript panorama is the download progress counter. For example, when you try java panoramas - on the bottom of the panorama there is a progress bar saying that 1%, 2%, 3%, ... 10% ... 20% ... 50% ... 99% ... of the image is downloaded.

With javascript that's impossible to do. But, after thinking (hard) about it, i decided to replace the loading.gif image (loading.gif) with the "compressed" thumbnail of the panorama. Now you can see how big is the part already downloaded in your local browser's memory:
loading panorama loading panorama
But, there is one drawback; now the map will be displayed only after the panorama is downloaded and displayed.

I tried it with Firefox, Opera, and IE6. Try it here.

2007-12-21

Why I hate IE

I simply can't understand why is it that this don't work...
var Utils = new Object();
Utils.byId = function( id ) {
if( document.all ) {
return document.all[ id ];
}
return document.getElementById( id );
}
It is just a utility function which returns me an element by its id attribute. Nothing special. But then... There is a line saying:
panorama = Utils.byId( "panorama" );
It works. Well, it worked in Firefox and Opera. But in IE, there was an error saying something like: object doesn't have that property... I can't remember now (I'm on my Ubuntu linux PC now). It took me half an hour of experiments before I found the error. The error was the word var. The line:
var panorama = Utils.byId( "panorama" );
don't work without the "var".

When I was studying Javascript, in the manual it was said that if I use var for declaring variables -- they were local variables. Without var they are global variables. Since panorama in my javascript is a global variable, I decided to delete the "var". But IE didn't like it.

Why?

2007-12-13

Virus?

Since I don't speak German I asked google translator help me to understand what this sentence means:
Achtung: nicht anklicken, hier lauert ein Virus und der heißt
This is from a forum post with a link to panoye.com. OK, I understand "achtung", and "virus", but google translator translated me the full sentence:
Caution: Not click, a virus lurks here in the states
Hhhmmm... It seems that somebody is claiming that there is a virus on my site. Am I right? If so -- you have my word that there are no viruses here. The problem is that panoramas need javascript to work, but some versions of Internet explorer will not let javascript run unless the user confirms. But even then -- Javascript can't read or write files on your computer.

If you don't believe me, here is a quote from a 'Security' section in the Wikipedia Javascript article:
Browser authors contain this risk using two restrictions. First, scripts run in a sandbox in which they can only perform Web-related actions, not general-purpose programming tasks like creating files. Second, scripts are constrained by the same origin policy: scripts from one Web site do not have access to information such as usernames, passwords, or cookies sent to another site.
Update: I was wrong!