A simple library for handling keyboard shortcuts in Javascript // single keys Mousetrap.bind(‘4’, function() { highlight(2); }); Mousetrap.bind(‘x’, function() { highlight(3); }, ‘keyup’); // combinations Mousetrap.bind(‘command+shift+k’, function(e) { highlight([6, 7, 8, 9]); return false; }); Mousetrap.bind([‘command+k’, ‘ctrl+k’], function(e) { highlight([11, 12, 13, 14]); return false; }); // gmail style sequences Mousetrap.bind(‘g i’, function() { highlight(17); …
Tag Archives: javascript
JavaScript APIs you’ve never heard of (and some you have)
Google Chrome Packaged Apps
Packaged apps deliver an experience as capable as a native app, but as safe as a web page. Just like web apps, packaged apps are written in HTML5, JavaScript, and CSS. But packaged apps look and behave like native apps, and they have native-like capabilities that are much more powerful than those available to web …
JavaScript: Break all the Rulez
This talk will demonstrate that, whether its double-equals coercion, iteration without hasOwnProperty, augmenting native prototypes or even fraternizing with the evil eval and with, there is a time and place for virtually every feature of JavaScript and taking the time to study and understand their potential will enrich the programming experience, just as a broader …
JS adolescence
For me there was a time that can only be described as adolescence in the field of programming and more specifically JavaScript. This period was characterised by a certain laziness and hubris. I thought I was right. I thought others were wrong. I could see no path but the very strict one that I had …
headtrackr
CasperJS: a navigation scripting & testing utility for PhantomJS
CasperJS is an open source navigation scripting & testing utility written in Javascript and based on PhantomJS — the scriptable headless WebKit engine. It eases the process of defining a full navigation scenario and provides useful high-level functions, methods & syntactic sugar for doing common tasks Written on top of the previously mentioned PhantomJS var …
Continue reading “CasperJS: a navigation scripting & testing utility for PhantomJS”
PhantomJS: Headless WebKit with JavaScript API
PhantomJS is a headless WebKit with JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG. var page = require(‘webpage’).create(); console.log(‘The default user agent is ‘ + page.settings.userAgent); page.settings.userAgent = ‘SpecialAgent’; page.open(‘http://www.httpuseragent.org’, function (status) { if (status !== ‘success’) { console.log(‘Unable to access network’); } …
Continue reading “PhantomJS: Headless WebKit with JavaScript API”