Using jQuery As A Named Module In RequireJS With the release of jQuery 1.7, there's been some amorphous buzz about the support between AMD (Asynchronous Module Definition) script loaders and the jQuery library. I say, "amorphous," because I simply don't understand what that support entails. While reading Wilson Page's post on loading AMD modules from a remote CDN (Content Delivery Network), however, I started to see that "named modules" seemed to be important. And, furthermore, I discovered, after some testing, that RequireJS supports using a named "jquery" module even prior the release of jQuery 1.7. In RequireJS, you can load JavaScript dependencies before a given block of code needs to be executed. These dependencies can be defined in the form of file paths to the dependent modules; or, they can be defined by aliases (ie. named modules) that represent short-cuts to module file paths. With jQuery 1.7, this named module works because jQuery actually calls define() internally to define itself as the "jquery" module:
dbushell/Pikaday HTML5 context menu - How to use it? Mozilla introduces HTML5 context menu in Firefox 8 (and is the only browser to implement this till date as per caniuse). So as a newbie to HTML5 I took a dive of HTML5 context menu and dissected this sample using Firefox 8, Firebug and Eclipse. HTML5 context menu makes you to add the custom menus natively to the already existing custom menus. Before HTML5 this is possible only with the help of JavaScript frameworks like Jquery. To know more about HTML5 context menu you need to know the following Contextmenu attribute: ‘Contextmenu’ is the new global attribute used in HTML5 supported by almost all HTML5 elements, which makes you to add your own context menus to any element. Example: Menu Element: Menu element allows you to define the type of menu. Menuitem Element: Menuitem Element is used to add menus. Feature Detection: Firefox is the only browser, that supports HTML5 context menu. Take a look at the sample code for the complete demo. Sample code: Further Reading: Digg 0DZone 0Reddit
nnnick/Chart.js Enhancing Web Apps with AmplifyJS There seems to be a new crop of special-purpose JavaScript libraries every week. Gone, it seems, are the days of using only one library per project. Today I’ll introduce you to a very cool component library, AmplifyJS, that offers just a few very specialized components. Devs, Meet AmplifyJS According to the website: AmplifyJS is a set of components designed to solve common web application problems. Sounds prestigious, but what’s actually in this library? AmplifyJS has three main pieces: An AJAX APIA PubSub Event SystemA Client-side Storage API Join me now for a tour of the incredible AmplifyJS library! We don’t really need to concern ourselves with styling and layout issues today so I’m going to use the Twitter Bootstrap library. Step 1: Setting it Up So, make yourself a project directory. jQuery: Amplify’s AJAX component uses jQuery’s AJAX feature underneath it’s API, at least by default. Then, start off our index.html file like this: All right, we’re ready to go! amplify.publish And TABLE?
Promise Pipelines in JavaScript - sitr.us Promises, also know as deferreds or futures, are a wonderful abstraction for manipulating asynchronous actions. Dojo has had Deferreds for some time. jQuery introduced its own Deferreds in version 1.5 based on the CommonJS Promises/A specification. I’m going to show you some recipes for working with jQuery Deferreds. The basics of jQuery Deferreds A Deferred is an object that represents some future outcome. In jQuery’s terms a promise is a read-only view of a deferred. Here is a simple example of creating and then resolving a promise: function fooPromise() { var deferred = $.Deferred(); setTimeout(function() { deferred.resolve("foo"); }, 1000); return deferred.promise();} Callbacks can be added to a deferred or a promise using the .then() method. fooPromise().then( function(value) { // prints "foo" after 1 second console.log(value); }, function() { console.log("something went wrong"); }); For more information see the jQuery Deferred documentation. Sequential operations Parallel operations
Jquery Notification Plugin. Introducing a new jQuery notification plugin, it helps better and enrich message notification system for your web application. This plugin contains four types of notification systems such as Success, Error, Warning and Information with rich user interface. Very easy to implement just follow the steps. Download Script Live Demo Developer The Basic Setup 1. 2. 3. showNotification(params); Example Usage Usage To know more Jquery Notification Plugin .. A JavaScript survival guide Are you a programmer who is considering learning JavaScript, but unsure whether it is worth the pain? Then this blog post is for you: I argue that it is worth it and give tips for surviving the language. Why learn JavaScript? The present The main reason for choosing JavaScript is the breadth of its ecosystem: the web platform, Node.js, JSON, NoSQL databases, Cordova/PhoneGap, automating PhotoShop and many other apps, etc. Compared to Java, I like the interactivity of JavaScript and the web platform. I also like the flexibility of the language. The future ECMAScript 6 [1], the upcoming version of JavaScript fixes many of JavaScript’s problems: not enough data structures, limited built-in support for inheritance, no built-in support for modules, shadowing this, functions playing too many roles, … Additionally, there is much innovation and experimentation around: Take your time to get to know JavaScript An important insight for learning JavaScript (paraphrasing Golo Roden): JavaScript’s power
AliceJS AliceJS - (A Lightweight Independent CSS Engine) is a micro JavaScript library focused on using hardware-accelerated capabilities (in particular CSS3 features) in modern browsers for generating high-quality, high-end visual effects. Created by Laurent Hasson (@ldhasson, lhasson at rim dot com), and co-developed with Jim Ing (@jim_ing, jing at rim dot com), and Matt Lantz (@mattylantz, malantz at rim dot com) Introduction While working on a simple game written in HTML5, I wanted to use a "flip3D" effect. So I decided to explore the ability to package such animations in a very lightweight library that would set up all the CSS and manage my base HTML for me, and keep my page clean of "effects logic". We are experimenting with many UI components, with tying in sensors, adding physics, and even organics. Alice 0.1, 0.2 Compatibility and Special Notes With version 0.5 we've introduced some changes to the core and cheshire while introducing the all new caterpillar effect. Demos View Demos Downloads
jstayton/jquery-marcopolo Coordinating multiple ajax requests with jquery.when | Joshua Flanagan While building a rich JavaScript application, you may get in a situation where you need to make multiple ajax requests, and it doesn’t make sense to work with the results until after all of them have returned. For example, suppose you wanted to collect the tweets from three different users, and display the entire set sorted alphabetically (yes, its contrived). To get the tweets for a user via jQuery, you write code like: $.get(" function(tweets){ // work with tweets }, "jsonp"); (For the purposes of this example, I’m going to assume there is no way to get the tweets for multiple users in a single call) To get the tweets for three users, you would need to make three separate $.get calls to the user_timeline endpoint. As of jQuery 1.5, the solution is much simpler. I have a helper method, getTweets, which returns the return value of a call to $.get. It it that last point that is interesting to me. Play with the example on jsFiddle