DailyJS

DailyJS

The JavaScript blog.


Tagcalendars
Featured

jquery plugins forms calendars time widgets

jQuery Roundup: persistState, CLNDR.js

Posted on .

Note: You can send your plugins and articles in for review through our contact form or @dailyjs.

persistState

persistState (GitHub: togakangaroo / persistState, License: MIT) by George Mauer saves the state of UI widgets. It can be applied to a selector, so you can save the state of a specific set of widgets rather than all of them.

I like the idea of using this to save the state of form controls, particularly in a multi-stage form that's handled client-side. Values are saved to localStorage, and the API of persistState allows you to swap in your own serialisation handler.

Saving the state of form controls looks like this:

$.ow.persistState.elementPersistence['textarea,input:not(:checkbox),select'] = {
  saveState: function($el) {
    return { val: $el.val() };
  },

  restoreState: function($el, state) {
    if (!state) return;
    if ($el.val() !== state.val)
      $el.val(state.val).trigger('change');
  }
};

CLNDR.js

CLNDR.js (GitHub: kylestetz / CLNDR, License: MIT) by Kyle Stetz is a calendar plugin:

There are wonderful and feature-rich calendar modules out there and they all suffer the same problem: they give you markup (and often a good heap of JS) that you have to work with and style. This leads to a lot of hacking, pushing, pulling, and annoying why-can't-it-do-what-I-want scenarios.

CLNDR doesn't generate markup (well, it has some reasonable defaults, but that's an aside). Instead, CLNDR asks you to create a template and in return it supplies your template with a great set of objects that will get you up and running in a few lines.

CLNDR requires Moment.js, which is OK because I don't leave home without it!

Featured

calendars node modules unix

Nools, Procstreams, Kalendae

Posted on .

Nools

Nools (License: MIT, npm: nools) by Doug Martin is a rules engine. Rules are contained in "flows", and instances of flows are known as "sessions" -- these are used to add or retract facts from the engine:

var nools = require('nools')  
  , session
  , message;

function Message(message) {  
  this.message = message;
}

session = flow.getSession();  
message = new Message('hello');

// Add the fact to the engine
session.assert(message);

// Change it
message.message = 'Bye';  
session.modify(message);

// Remove it
session.retract(message);  

For examples of how to define flows, have a look at the Nools readme.

Procstreams

Procstreams (License: MIT, npm: procstreams) by Marco Rogers is an attempt to create a more idiomatic JavaScript shell scripting API:

var $p = require('procstreams');  
$p('cat lines.txt').pipe('wc -l')
  .data(function(stdout, stderr) {
      console.log(stdout); // prints number of lines in the file lines.txt
  });

$p('mkdir foo')
  .and('cp file.txt foo/')
  .and('rm file.txt')
    .on('exit', function() {
      console.log('done');
    });

As we've seen many times on DailyJS, chainable APIs offer an elegant solution to reducing unnecessary callbacks in asynchronous APIs, so this module is definitely appealing on that level.

Kalendae

Kalendae example screenshot

Kalendae (License: MIT) by Jarvis Badgley provides a date picker without any dependencies. There's a demo of Kalendae showing calendars instantiated with various options.

If jQuery is available, then a plugin will also be available through $(selector).kalendae(options).

The author has also provided a makefile that can build the project, minimise it, and run it through Google Closure.

Featured

jquery plugins ajax calendars

jQuery Plugin Roundup 14

Posted on .

Welcome to the jQuery Plugin Roundup, episode 14. Remember you can send
your plugins in for review through our contact form or
@dailyjs.

The average day can take me from Objective-C to Ruby, then to
server-side JavaScript and perhaps even into Photoshop for some design
work. Being a freelancer keeps my work incredibly varied. But... I've
actually been working with jQuery a lot lately!

Supersized 2.0

Supersized 2.0 by Sam Dunn resizes images to fit the browser window, and can show modern
transition and loading effects. It's packaged with some example files
that despite having .php extensions seem more like plain HTML. The
images Supersized ships with look cool, so it might be a nice quick
start if you need this kind of functionality on a project.

$.fn.supersized.options = {  
  startwidth: 640,  
  startheight: 480,
  vertical_center: 1,
  slideshow: 1,
  navigation: 1,
  transition: 1,
  pause_hover: 0,
  slide_counter: 1,
  slide_captions: 1,
  slide_interval: 3000  
};

Ajax Retry

I haven't tested
jquery-ajax-retry (MIT License) by execjosh, but I like the idea. It attempts to retransmit a
request when it fails. The requests are spaced out until a certain
number have been sent. It might work well for certain classes of mobile
web apps.

Internationalised Calendars

I thought e-calendar (MIT
License) was interesting, it displays a Chinese
calendar
. It reminded me
of my recent work adding I18n support to an app, which was nearly three
weeks of solid work.

jQuery Calendars Datepicker (GPL or MIT) by
Keith Wood supports a whole load of calendars. You can even select a
Mayan calendar, but it doesn't have an Easter Egg for selecting 2012.

Other calendar plugins sometimes support internationalization, and
hopefully browser manufacturers won't botch the HTML 5 date picker.

I'll have to write a calendar picker roundup at some point -- jQuery
alone has a huge selection available.