I have been working on a simple framework to put a website online for a friend. The premise are simple: No backend language available. No scripting. No database, here we go static site. Some idea of organization and structure, with separated pages. This means multiple page rendering, home/news/content1/about/contact. Common header […]
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
Sometimes you will need to replace an HTML <select> box by a custom one in order to apply special styles. Life might not allow you to use beautiful frameworks such as Jquery or Dojo, so you will have to manage without them, just with your own two hands… A first […]
Replace an HTML select box with onchange without jquery
One day I needed to get the function name from the function itself. Here is what I found. function functionName(fn) { var name=/\W*function\s+([\w\$]+)\(/.exec(fn); if(!name)return 'No name'; return name[1]; } via http://bytes.com/topic/javascript/answers/640929-obtain-function-name
get a function name from the function in Javascript
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
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
If you have the following message error in ErrorShell (among others ;) ) element.dispatchEvent is not a function while you are using (or trying) LightBox or one of his clones with Scriptaculous libraries, one solution of your problem could be to check that your Lightbox javascript file is not call […]