Javascript



Reverse a regex in javascript ? function reverse(s) { return s.split('').reverse().join(''); } function reverseSequence (s) { // chopper les expression conditionnelles // et construire un tableau pour les stocker var conditionals1 = s.match(/\[(.*?)\]/g); var conditionals2 = s.match(/(\[(.+)\])+\{(.*?)\}/g); var conditionals3 = s.match(/[A-Z\.]{1}\{(.*?)\}/g); var conditionals4 = s.match(/\^(.)/g); // on reverse la sequence […]

Attempt to reverse a regular expression


A little javascript class to handle geolocation in a web browser https://github.com/FabFab/GPS-in-your-browser How it works : GPS.get(); [...] var latitude = GPS.position.latitude; var longitude = GPS.position.longitude; or with a callback: GPS.get(updatePosition); function updatePosition() { var latitude = GPS.position.latitude; var longitude = GPS.position.longitude; [...] } More about Geolocation in web browsers: […]

GPS Geolocation in web browser class in Javascript





1
These past years JavaScript has been the language on the web. Through Ajax, we can do amazing dynamics things on a web page. From what I remember, when I started my first web page a while ago in 2002, Javascript was considered evil. Hard to program, poor documentation, and to […]

Why we love JavaScript



How to get an object real coordinates when there is a zoom or an scroll bar on the page ? var scrOfX = 0, scrOfY = 0; if (typeof(window.pageYOffset) == 'number' ) { //Netscape compliant scrOfY = window.pageYOffset; scrOfX = window.pageXOffset; } else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) { […]

Coordinates when there is an offset in the page


1
Désolé, j’ai pas résisté… :D Comment ça marche ? Il vous faut pas loin le framework Ajax Javascript Prototype… <script src="javascripts/prototype.js" type="text/javascript"></script> Et il vous faut ce bout de code : if ( window.addEventListener ) {        var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65";        window.addEventListener("keydown", function(e){                kkeys.push( e.keyCode );                if ( […]

Powered by Konami Code