document.addEventListener(
'dblclick', function(event) {
alert("Double-click disabled!");
event.preventDefault();
event.stopPropagation();
},
true//capturing phase!!
);
Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts
Saturday, November 18, 2017
Javascript to disable double-clicking on a webpage
Use a capture phase event listener on the document:
Etichete:
capture,
dblclick,
double-click,
event,
Javascript,
webpage
Sunday, January 30, 2011
virtual flying birds
I have created a 2D simulation of a a flock of flying birds that are scared of mouse movement. Here is the link www.virtual-flying-birds.tk.
Etichete:
birds flight,
canvas element,
Javascript,
simulation
Sunday, December 5, 2010
Translate BIG webpages using Google Translate JS API
Today I have released yet another open source project : zgtranslate . It is a Javascript library that could be used to translate large webpages using Google Translate JS API.
Google provides a widget that can be placed in the html code of the webpage, but there are some nasty things about it:
Google provides a widget that can be placed in the html code of the webpage, but there are some nasty things about it:
- it requires flash (and I have flash removed)
- it translates just the current page, but not the next linked page (althow it should as it says in its help)
So I decided to make my own translator. Because Google Translate JS API can only process small texts we need to split the (large) webpage into smaller pieces that can be send to hungry Google for processing. I have implemented this split in my library.
Usage is very simple: just include the zGTranslate.js script in your webpage, and set startTranslate(id,language code) to be called when something is clicked (first example) or auto(second example) when the page was loaded.
You can download the examples and the library and see it in action.
Etichete:
API,
google,
Javascript,
open source,
translate
Subscribe to:
Posts (Atom)


