You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2013/10/22 01:24:23 UTC

[3/9] first commit

http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/f50cc931/attachments/sammy/plugins/sammy.mustache.js
----------------------------------------------------------------------
diff --git a/attachments/sammy/plugins/sammy.mustache.js b/attachments/sammy/plugins/sammy.mustache.js
new file mode 100644
index 0000000..169f0c7
--- /dev/null
+++ b/attachments/sammy/plugins/sammy.mustache.js
@@ -0,0 +1,444 @@
+(function($) {
+
+if (!window.Mustache) {
+
+  /*
+    mustache.js — Logic-less templates in JavaScript
+
+    See http://mustache.github.com/ for more info.
+  */
+
+  var Mustache = function() {
+    var Renderer = function() {};
+
+    Renderer.prototype = {
+      otag: "{{",
+      ctag: "}}",
+      pragmas: {},
+      buffer: [],
+      pragmas_implemented: {
+        "IMPLICIT-ITERATOR": true
+      },
+      context: {},
+
+      render: function(template, context, partials, in_recursion) {
+        // reset buffer & set context
+        if(!in_recursion) {
+          this.context = context;
+          this.buffer = []; // TODO: make this non-lazy
+        }
+
+        // fail fast
+        if(!this.includes("", template)) {
+          if(in_recursion) {
+            return template;
+          } else {
+            this.send(template);
+            return;
+          }
+        }
+
+        template = this.render_pragmas(template);
+        var html = this.render_section(template, context, partials);
+        if(in_recursion) {
+          return this.render_tags(html, context, partials, in_recursion);
+        }
+
+        this.render_tags(html, context, partials, in_recursion);
+      },
+
+      /*
+        Sends parsed lines
+      */
+      send: function(line) {
+        if(line != "") {
+          this.buffer.push(line);
+        }
+      },
+
+      /*
+        Looks for %PRAGMAS
+      */
+      render_pragmas: function(template) {
+        // no pragmas
+        if(!this.includes("%", template)) {
+          return template;
+        }
+
+        var that = this;
+        var regex = new RegExp(this.otag + "%([\\w-]+) ?([\\w]+=[\\w]+)?" +
+              this.ctag);
+        return template.replace(regex, function(match, pragma, options) {
+          if(!that.pragmas_implemented[pragma]) {
+            throw({message:
+              "This implementation of mustache doesn't understand the '" +
+              pragma + "' pragma"});
+          }
+          that.pragmas[pragma] = {};
+          if(options) {
+            var opts = options.split("=");
+            that.pragmas[pragma][opts[0]] = opts[1];
+          }
+          return "";
+          // ignore unknown pragmas silently
+        });
+      },
+
+      /*
+        Tries to find a partial in the curent scope and render it
+      */
+      render_partial: function(name, context, partials) {
+        name = this.trim(name);
+        if(!partials || partials[name] === undefined) {
+          throw({message: "unknown_partial '" + name + "'"});
+        }
+        if(typeof(context[name]) != "object") {
+          return this.render(partials[name], context, partials, true);
+        }
+        return this.render(partials[name], context[name], partials, true);
+      },
+
+      /*
+        Renders inverted (^) and normal (#) sections
+      */
+      render_section: function(template, context, partials) {
+        if(!this.includes("#", template) && !this.includes("^", template)) {
+          return template;
+        }
+
+        var that = this;
+        // CSW - Added "+?" so it finds the tighest bound, not the widest
+        var regex = new RegExp(this.otag + "(\\^|\\#)\\s*(.+)\\s*" + this.ctag +
+                "\n*([\\s\\S]+?)" + this.otag + "\\/\\s*\\2\\s*" + this.ctag +
+                "\\s*", "mg");
+
+        // for each {{#foo}}{{/foo}} section do...
+        return template.replace(regex, function(match, type, name, content) {
+          var value = that.find(name, context);
+          if(type == "^") { // inverted section
+            if(!value || that.is_array(value) && value.length === 0) {
+              // false or empty list, render it
+              return that.render(content, context, partials, true);
+            } else {
+              return "";
+            }
+          } else if(type == "#") { // normal section
+            if(that.is_array(value)) { // Enumerable, Let's loop!
+              return that.map(value, function(row) {
+                return that.render(content, that.create_context(row),
+                  partials, true);
+              }).join("");
+            } else if(that.is_object(value)) { // Object, Use it as subcontext!
+              return that.render(content, that.create_context(value),
+                partials, true);
+            } else if(typeof value === "function") {
+              // higher order section
+              return value.call(context, content, function(text) {
+                return that.render(text, context, partials, true);
+              });
+            } else if(value) { // boolean section
+              return that.render(content, context, partials, true);
+            } else {
+              return "";
+            }
+          }
+        });
+      },
+
+      /*
+        Replace {{foo}} and friends with values from our view
+      */
+      render_tags: function(template, context, partials, in_recursion) {
+        // tit for tat
+        var that = this;
+
+        var new_regex = function() {
+          return new RegExp(that.otag + "(=|!|>|\\{|%)?([^\\/#\\^]+?)\\1?" +
+            that.ctag + "+", "g");
+        };
+
+        var regex = new_regex();
+        var tag_replace_callback = function(match, operator, name) {
+          switch(operator) {
+          case "!": // ignore comments
+            return "";
+          case "=": // set new delimiters, rebuild the replace regexp
+            that.set_delimiters(name);
+            regex = new_regex();
+            return "";
+          case ">": // render partial
+            return that.render_partial(name, context, partials);
+          case "{": // the triple mustache is unescaped
+            return that.find(name, context);
+          default: // escape the value
+            return that.escape(that.find(name, context));
+          }
+        };
+        var lines = template.split("\n");
+        for(var i = 0; i < lines.length; i++) {
+          lines[i] = lines[i].replace(regex, tag_replace_callback, this);
+          if(!in_recursion) {
+            this.send(lines[i]);
+          }
+        }
+
+        if(in_recursion) {
+          return lines.join("\n");
+        }
+      },
+
+      set_delimiters: function(delimiters) {
+        var dels = delimiters.split(" ");
+        this.otag = this.escape_regex(dels[0]);
+        this.ctag = this.escape_regex(dels[1]);
+      },
+
+      escape_regex: function(text) {
+        // thank you Simon Willison
+        if(!arguments.callee.sRE) {
+          var specials = [
+            '/', '.', '*', '+', '?', '|',
+            '(', ')', '[', ']', '{', '}', '\\'
+          ];
+          arguments.callee.sRE = new RegExp(
+            '(\\' + specials.join('|\\') + ')', 'g'
+          );
+        }
+        return text.replace(arguments.callee.sRE, '\\$1');
+      },
+
+      /*
+        find `name` in current `context`. That is find me a value
+        from the view object
+      */
+      find: function(name, context) {
+        name = this.trim(name);
+
+        // Checks whether a value is thruthy or false or 0
+        function is_kinda_truthy(bool) {
+          return bool === false || bool === 0 || bool;
+        }
+
+        var value;
+        if(is_kinda_truthy(context[name])) {
+          value = context[name];
+        } else if(is_kinda_truthy(this.context[name])) {
+          value = this.context[name];
+        }
+
+        if(typeof value === "function") {
+          return value.apply(context);
+        }
+        if(value !== undefined) {
+          return value;
+        }
+        // silently ignore unkown variables
+        return "";
+      },
+
+      // Utility methods
+
+      /* includes tag */
+      includes: function(needle, haystack) {
+        return haystack.indexOf(this.otag + needle) != -1;
+      },
+
+      /*
+        Does away with nasty characters
+      */
+      escape: function(s) {
+        s = String(s === null ? "" : s);
+        return s.replace(/&(?!\w+;)|["<>\\]/g, function(s) {
+          switch(s) {
+          case "&": return "&amp;";
+          case "\\": return "\\\\";
+          case '"': return '\"';
+          case "<": return "&lt;";
+          case ">": return "&gt;";
+          default: return s;
+          }
+        });
+      },
+
+      // by @langalex, support for arrays of strings
+      create_context: function(_context) {
+        if(this.is_object(_context)) {
+          return _context;
+        } else {
+          var iterator = ".";
+          if(this.pragmas["IMPLICIT-ITERATOR"]) {
+            iterator = this.pragmas["IMPLICIT-ITERATOR"].iterator;
+          }
+          var ctx = {};
+          ctx[iterator] = _context;
+          return ctx;
+        }
+      },
+
+      is_object: function(a) {
+        return a && typeof a == "object";
+      },
+
+      is_array: function(a) {
+        return Object.prototype.toString.call(a) === '[object Array]';
+      },
+
+      /*
+        Gets rid of leading and trailing whitespace
+      */
+      trim: function(s) {
+        return s.replace(/^\s*|\s*$/g, "");
+      },
+
+      /*
+        Why, why, why? Because IE. Cry, cry cry.
+      */
+      map: function(array, fn) {
+        if (typeof array.map == "function") {
+          return array.map(fn);
+        } else {
+          var r = [];
+          var l = array.length;
+          for(var i = 0; i < l; i++) {
+            r.push(fn(array[i]));
+          }
+          return r;
+        }
+      }
+    };
+
+    return({
+      name: "mustache.js",
+      version: "0.3.1-dev",
+
+      /*
+        Turns a template and view into HTML
+      */
+      to_html: function(template, view, partials, send_fun) {
+        var renderer = new Renderer();
+        if(send_fun) {
+          renderer.send = send_fun;
+        }
+        renderer.render(template, view, partials);
+        if(!send_fun) {
+          return renderer.buffer.join("\n");
+        }
+      }
+    });
+  }();
+
+} // Ensure Mustache
+
+  Sammy = Sammy || {};
+
+  // <tt>Sammy.Mustache</tt> provides a quick way of using mustache style templates in your app.
+  // The plugin itself includes the awesome mustache.js lib created and maintained by Jan Lehnardt
+  // at http://github.com/janl/mustache.js
+  //
+  // Mustache is a clever templating system that relys on double brackets {{}} for interpolation.
+  // For full details on syntax check out the original Ruby implementation created by Chris Wanstrath at
+  // http://github.com/defunkt/mustache
+  //
+  // By default using Sammy.Mustache in your app adds the <tt>mustache()</tt> method to the EventContext
+  // prototype. However, just like <tt>Sammy.Template</tt> you can change the default name of the method
+  // by passing a second argument (e.g. you could use the ms() as the method alias so that all the template
+  // files could be in the form file.ms instead of file.mustache)
+  //
+  // ### Example #1
+  //
+  // The template (mytemplate.ms):
+  //
+  //       <h1>\{\{title\}\}<h1>
+  //
+  //       Hey, {{name}}! Welcome to Mustache!
+  //
+  // The app:
+  //
+  //       var $.app = $.sammy(function() {
+  //         // include the plugin and alias mustache() to ms()
+  //         this.use(Sammy.Mustache, 'ms');
+  //
+  //         this.get('#/hello/:name', function() {
+  //           // set local vars
+  //           this.title = 'Hello!'
+  //           this.name = this.params.name;
+  //           // render the template and pass it through mustache
+  //           this.partial('mytemplate.ms');
+  //         });
+  //
+  //       });
+  //
+  // If I go to #/hello/AQ in the browser, Sammy will render this to the <tt>body</tt>:
+  //
+  //       <h1>Hello!</h1>
+  //
+  //       Hey, AQ! Welcome to Mustache!
+  //
+  //
+  // ### Example #2 - Mustache partials
+  //
+  // The template (mytemplate.ms)
+  //
+  //       Hey, {{name}}! {{>hello_friend}}
+  //
+  //
+  // The partial (mypartial.ms)
+  //
+  //       Say hello to your friend {{friend}}!
+  //
+  // The app:
+  //
+  //       var $.app = $.sammy(function() {
+  //         // include the plugin and alias mustache() to ms()
+  //         this.use(Sammy.Mustache, 'ms');
+  //
+  //         this.get('#/hello/:name/to/:friend', function() {
+  //           var context = this;
+  //
+  //           // fetch mustache-partial first
+  //           $.get('mypartial.ms', function(response){
+  //             context.partials = response;
+  //
+  //             // set local vars
+  //             context.name = this.params.name;
+  //             context.hello_friend = {name: this.params.friend};
+  //
+  //             // render the template and pass it through mustache
+  //             context.partial('mytemplate.ms');
+  //           });
+  //         });
+  //
+  //       });
+  //
+  // If I go to #/hello/AQ/to/dP in the browser, Sammy will render this to the <tt>body</tt>:
+  //
+  //       Hey, AQ! Say hello to your friend dP!
+  //
+  // Note: You dont have to include the mustache.js file on top of the plugin as the plugin
+  // includes the full source.
+  //
+  Sammy.Mustache = function(app, method_alias) {
+
+    // *Helper* Uses Mustache.js to parse a template and interpolate and work with the passed data
+    //
+    // ### Arguments
+    //
+    // * `template` A String template. {{}} Tags are evaluated and interpolated by Mustache.js
+    // * `data` An Object containing the replacement values for the template.
+    //   data is extended with the <tt>EventContext</tt> allowing you to call its methods within the template.
+    // * `partials` An Object containing one or more partials (String templates
+    //   that are called from the main template).
+    //
+    var mustache = function(template, data, partials) {
+      data     = $.extend({}, this, data);
+      partials = $.extend({}, data.partials, partials);
+      return Mustache.to_html(template, data, partials);
+    };
+
+    // set the default method name/extension
+    if (!method_alias) method_alias = 'mustache';
+    app.helper(method_alias, mustache);
+
+  };
+
+})(jQuery);

http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/f50cc931/attachments/sammy/plugins/sammy.nested_params.js
----------------------------------------------------------------------
diff --git a/attachments/sammy/plugins/sammy.nested_params.js b/attachments/sammy/plugins/sammy.nested_params.js
new file mode 100644
index 0000000..645f8c9
--- /dev/null
+++ b/attachments/sammy/plugins/sammy.nested_params.js
@@ -0,0 +1,118 @@
+(function($) {
+
+  Sammy = Sammy || {};
+
+  function parseValue(value) {
+    value = unescape(value);
+    if (value === "true") {
+      return true;
+    } else if (value === "false") {
+      return false;
+    } else {
+      return value;
+    }
+  };
+
+  function parseNestedParam(params, field_name, field_value) {
+    var match, name, rest;
+
+    if (field_name.match(/^[^\[]+$/)) {
+      // basic value
+      params[field_name] = parseValue(field_value);
+    } else if (match = field_name.match(/^([^\[]+)\[\](.*)$/)) {
+      // array
+      name = match[1];
+      rest = match[2];
+
+      if(params[name] && !$.isArray(params[name])) { throw('400 Bad Request'); }
+
+      if (rest) {
+        // array is not at the end of the parameter string
+        match = rest.match(/^\[([^\]]+)\](.*)$/);
+        if(!match) { throw('400 Bad Request'); }
+
+        if (params[name]) {
+          if(params[name][params[name].length - 1][match[1]]) {
+            params[name].push(parseNestedParam({}, match[1] + match[2], field_value));
+          } else {
+            $.extend(true, params[name][params[name].length - 1], parseNestedParam({}, match[1] + match[2], field_value));
+          }
+        } else {
+          params[name] = [parseNestedParam({}, match[1] + match[2], field_value)];
+        }
+      } else {
+        // array is at the end of the parameter string
+        if (params[name]) {
+          params[name].push(parseValue(field_value));
+        } else {
+          params[name] = [parseValue(field_value)];
+        }
+      }
+    } else if (match = field_name.match(/^([^\[]+)\[([^\[]+)\](.*)$/)) {
+      // hash
+      name = match[1];
+      rest = match[2] + match[3];
+
+      if (params[name] && $.isArray(params[name])) { throw('400 Bad Request'); }
+
+      if (params[name]) {
+        $.extend(true, params[name], parseNestedParam(params[name], rest, field_value));
+      } else {
+        params[name] = parseNestedParam({}, rest, field_value);
+      }
+    }
+    return params;
+  };
+
+  // <tt>Sammy.NestedParams</tt> overrides the default form parsing behavior to provide
+  // extended functionality for parsing Rack/Rails style form name/value pairs into JS
+  // Objects. In fact it passes the same suite of tests as Rack's nested query parsing.
+  // The code and tests were ported to JavaScript/Sammy by http://github.com/endor
+  //
+  // This allows you to translate a form with properly named inputs into a JSON object.
+  //
+  // ### Example
+  //
+  // Given an HTML form like so:
+  //
+  //     <form action="#/parse_me" method="post">
+  //       <input type="text" name="obj[first]" />
+  //       <input type="text" name="obj[second]" />
+  //       <input type="text" name="obj[hash][first]" />
+  //       <input type="text" name="obj[hash][second]" />
+  //     </form>
+  //
+  // And a Sammy app like:
+  //
+  //     var app = $.sammy(function(app) {
+  //       this.use(Sammy.NestedParams);
+  //
+  //       this.post('#/parse_me', function(context) {
+  //         $.log(this.params);
+  //       });
+  //     });
+  //
+  // If you filled out the form with some values and submitted it, you would see something
+  // like this in your log:
+  //
+  //     {
+  //       'obj': {
+  //         'first': 'value',
+  //         'second': 'value',
+  //         'hash': {
+  //           'first': 'value',
+  //           'second': 'value'
+  //         }
+  //       }
+  //     }
+  //
+  // It supports creating arrays with [] and other niceities. Check out the tests for
+  // full specs.
+  //
+  Sammy.NestedParams = function(app) {
+
+    app._parseParamPair = parseNestedParam;
+
+  };
+
+})(jQuery);

http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/f50cc931/attachments/sammy/plugins/sammy.path_location_proxy.js
----------------------------------------------------------------------
diff --git a/attachments/sammy/plugins/sammy.path_location_proxy.js b/attachments/sammy/plugins/sammy.path_location_proxy.js
new file mode 100644
index 0000000..13f9014
--- /dev/null
+++ b/attachments/sammy/plugins/sammy.path_location_proxy.js
@@ -0,0 +1,29 @@
+(function($) {
+
+  Sammy = Sammy || {};
+
+  // `Sammy.PathLocationProxy` is a simple Location Proxy that just
+  // gets and sets window.location. This allows you to use
+  // Sammy to route on the full URL path instead of just the hash. It
+  // will take a full refresh to get the app to change state.
+  //
+  // To read more about location proxies, check out the
+  // documentation for `Sammy.HashLocationProxy`
+  Sammy.PathLocationProxy = function(app) {
+    this.app = app;
+  };
+
+  Sammy.PathLocationProxy.prototype = {
+    bind: function() {},
+    unbind: function() {},
+
+    getLocation: function() {
+      return [window.location.pathname, window.location.search].join('');
+    },
+
+    setLocation: function(new_location) {
+      return window.location = new_location;
+    }
+  };
+
+})(jQuery);

http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/f50cc931/attachments/sammy/plugins/sammy.pure.js
----------------------------------------------------------------------
diff --git a/attachments/sammy/plugins/sammy.pure.js b/attachments/sammy/plugins/sammy.pure.js
new file mode 100644
index 0000000..16fe3df
--- /dev/null
+++ b/attachments/sammy/plugins/sammy.pure.js
@@ -0,0 +1,756 @@
+(function($) {
+
+/*!
+  PURE Unobtrusive Rendering Engine for HTML
+
+  Licensed under the MIT licenses.
+  More information at: http://www.opensource.org
+
+  Copyright (c) 2010 Michael Cvilic - BeeBole.com
+
+  Thanks to Rog Peppe for the functional JS jump
+  revision: 2.47
+*/
+
+var $p, pure = $p = function(){
+  var sel = arguments[0],
+    ctxt = false;
+
+  if(typeof sel === 'string'){
+    ctxt = arguments[1] || false;
+  }
+  return $p.core(sel, ctxt);
+};
+
+$p.core = function(sel, ctxt, plugins){
+  //get an instance of the plugins
+  var plugins = getPlugins(),
+    templates = [];
+
+  //search for the template node(s)
+  switch(typeof sel){
+    case 'string':
+      templates = plugins.find(ctxt || document, sel);
+      if(templates.length === 0) {
+        error('The template "' + sel + '" was not found');
+      }
+    break;
+    case 'undefined':
+      error('The template root is undefined, check your selector');
+    break;
+    default:
+      templates = [sel];
+  }
+
+  for(var i = 0, ii = templates.length; i < ii; i++){
+    plugins[i] = templates[i];
+  }
+  plugins.length = ii;
+
+  // set the signature string that will be replaced at render time
+  var Sig = '_s' + Math.floor( Math.random() * 1000000 ) + '_',
+    // another signature to prepend to attributes and avoid checks: style, height, on[events]...
+    attPfx = '_a' + Math.floor( Math.random() * 1000000 ) + '_',
+    // rx to parse selectors, e.g. "+tr.foo[class]"
+    selRx = /^(\+)?([^\@\+]+)?\@?([^\+]+)?(\+)?$/,
+    // set automatically attributes for some tags
+    autoAttr = {
+      IMG:'src',
+      INPUT:'value'
+    },
+    // check if the argument is an array - thanks salty-horse (Ori Avtalion)
+    isArray = Array.isArray ?
+      function(o) {
+        return Array.isArray(o);
+      } :
+      function(o) {
+        return Object.prototype.toString.call(o) === "[object Array]";
+      };
+
+  return plugins;
+
+
+  /* * * * * * * * * * * * * * * * * * * * * * * * * *
+    core functions
+   * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+  // error utility
+  function error(e){
+    if(typeof console !== 'undefined'){
+      console.log(e);
+    }else{ alert(e); }
+    throw('pure error: ' + e);
+  }
+
+  //return a new instance of plugins
+  function getPlugins(){
+    var plugins = $p.plugins,
+      f = function(){};
+    f.prototype = plugins;
+
+    // do not overwrite functions if external definition
+    f.prototype.compile    = plugins.compile || compile;
+    f.prototype.render     = plugins.render || render;
+    f.prototype.autoRender = plugins.autoRender || autoRender;
+    f.prototype.find       = plugins.find || find;
+
+    // give the compiler and the error handling to the plugin context
+    f.prototype._compiler  = compiler;
+    f.prototype._error     = error;
+
+    return new f();
+  }
+
+  // returns the outer HTML of a node
+  function outerHTML(node){
+    // if IE take the internal method otherwise build one
+    return node.outerHTML || (
+      function(n){
+            var div = document.createElement('div'), h;
+            div.appendChild( n.cloneNode(true) );
+        h = div.innerHTML;
+        div = null;
+        return h;
+      })(node);
+  }
+
+  // returns the string generator function
+  function wrapquote(qfn, f){
+    return function(ctxt){
+      return qfn('' + f.call(ctxt.context, ctxt));
+    };
+  }
+
+  // default find using querySelector when available on the browser
+  function find(n, sel){
+    if(typeof n === 'string'){
+      sel = n;
+      n = false;
+    }
+    if(typeof document.querySelectorAll !== 'undefined'){
+      return (n||document).querySelectorAll( sel );
+    }else{
+      error('You can test PURE standalone with: iPhone, FF3.5+, Safari4+ and IE8+\n\nTo run PURE on your browser, you need a JS library/framework with a CSS selector engine');
+    }
+  }
+
+  // create a function that concatenates constant string
+  // sections (given in parts) and the results of called
+  // functions to fill in the gaps between parts (fns).
+  // fns[n] fills in the gap between parts[n-1] and parts[n];
+  // fns[0] is unused.
+  // this is the inner template evaluation loop.
+  function concatenator(parts, fns){
+    return function(ctxt){
+      var strs = [ parts[ 0 ] ],
+        n = parts.length,
+        fnVal, pVal, attLine, pos;
+
+      for(var i = 1; i < n; i++){
+        fnVal = fns[i]( ctxt );
+        pVal = parts[i];
+
+        // if the value is empty and attribute, remove it
+        if(fnVal === ''){
+          attLine = strs[ strs.length - 1 ];
+          if( ( pos = attLine.search( /[\w]+=\"?$/ ) ) > -1){
+            strs[ strs.length - 1 ] = attLine.substring( 0, pos );
+            pVal = pVal.substr( 1 );
+          }
+        }
+
+        strs[ strs.length ] = fnVal;
+        strs[ strs.length ] = pVal;
+      }
+      return strs.join('');
+    };
+  }
+
+  // parse and check the loop directive
+  function parseloopspec(p){
+    var m = p.match( /^(\w+)\s*<-\s*(\S+)?$/ );
+    if(m === null){
+      error('bad loop spec: "' + p + '"');
+    }
+    if(m[1] === 'item'){
+      error('"item<-..." is a reserved word for the current running iteration.\n\nPlease choose another name for your loop.');
+    }
+    if( !m[2] || (m[2] && (/context/i).test(m[2]))){ //undefined or space(IE)
+      m[2] = function(ctxt){return ctxt.context;};
+    }
+    return {name: m[1], sel: m[2]};
+  }
+
+  // parse a data selector and return a function that
+  // can traverse the data accordingly, given a context.
+  function dataselectfn(sel){
+    if(typeof(sel) === 'function'){
+      return sel;
+    }
+    //check for a valid js variable name with hyphen(for properties only), $, _ and :
+    var m = sel.match(/^[a-zA-Z\$_\@][\w\$:-]*(\.[\w\$:-]*[^\.])*$/);
+    if(m === null){
+      var found = false, s = sel, parts = [], pfns = [], i = 0, retStr;
+      // check if literal
+      if(/\'|\"/.test( s.charAt(0) )){
+        if(/\'|\"/.test( s.charAt(s.length-1) )){
+          retStr = s.substring(1, s.length-1);
+          return function(){ return retStr; };
+        }
+      }else{
+        // check if literal + #{var}
+        while((m = s.match(/#\{([^{}]+)\}/)) !== null){
+          found = true;
+          parts[i++] = s.slice(0, m.index);
+          pfns[i] = dataselectfn(m[1]);
+          s = s.slice(m.index + m[0].length, s.length);
+        }
+      }
+      if(!found){
+        error('bad data selector syntax: ' + sel);
+      }
+      parts[i] = s;
+      return concatenator(parts, pfns);
+    }
+    m = sel.split('.');
+    return function(ctxt){
+      var data = ctxt.context;
+      if(!data){
+        return '';
+      }
+      var  v = ctxt[m[0]],
+        i = 0;
+      if(v && v.item){
+        data = v.item;
+        i += 1;
+      }
+      var n = m.length;
+      for(; i < n; i++){
+        if(!data){break;}
+        data = data[m[i]];
+      }
+      return (!data && data !== 0) ? '':data;
+    };
+  }
+
+  // wrap in an object the target node/attr and their properties
+  function gettarget(dom, sel, isloop){
+    var osel, prepend, selector, attr, append, target = [];
+    if( typeof sel === 'string' ){
+      osel = sel;
+      var m = sel.match(selRx);
+      if( !m ){
+        error( 'bad selector syntax: ' + sel );
+      }
+
+      prepend = m[1];
+      selector = m[2];
+      attr = m[3];
+      append = m[4];
+
+      if(selector === '.' || ( !selector && attr ) ){
+        target[0] = dom;
+      }else{
+        target = plugins.find(dom, selector);
+      }
+      if(!target || target.length === 0){
+        return error('The node "' + sel + '" was not found in the template');
+      }
+    }else{
+      // autoRender node
+      prepend = sel.prepend;
+      attr = sel.attr;
+      append = sel.append;
+      target = [dom];
+    }
+
+    if( prepend || append ){
+      if( prepend && append ){
+        error('append/prepend cannot take place at the same time');
+      }else if( isloop ){
+        error('no append/prepend/replace modifiers allowed for loop target');
+      }else if( append && isloop ){
+        error('cannot append with loop (sel: ' + osel + ')');
+      }
+    }
+    var setstr, getstr, quotefn, isStyle, isClass, attName, setfn;
+    if(attr){
+      isStyle = (/^style$/i).test(attr);
+      isClass = (/^class$/i).test(attr);
+      attName = isClass ? 'className' : attr;
+      setstr = function(node, s) {
+        node.setAttribute(attPfx + attr, s);
+        if (attName in node && !isStyle) {
+          node[attName] = '';
+        }
+        if (node.nodeType === 1) {
+          node.removeAttribute(attr);
+          isClass && node.removeAttribute(attName);
+        }
+      };
+      if (isStyle || isClass) {//IE no quotes special care
+        if(isStyle){
+          getstr = function(n){ return n.style.cssText; };
+        }else{
+          getstr = function(n){ return n.className;  };
+        }
+        quotefn = function(s){ return s.replace(/\"/g, '&quot;'); };
+      }else {
+        getstr = function(n){ return n.getAttribute(attr); };
+        quotefn = function(s){ return s.replace(/\"/g, '&quot;').replace(/\s/g, '&nbsp;'); };
+      }
+      if(prepend){
+        setfn = function(node, s){ setstr( node, s + getstr( node )); };
+      }else if(append){
+        setfn = function(node, s){ setstr( node, getstr( node ) + s); };
+      }else{
+        setfn = function(node, s){ setstr( node, s ); };
+      }
+    }else{
+      if (isloop) {
+        setfn = function(node, s) {
+          var pn = node.parentNode;
+          if (pn) {
+            //replace node with s
+            pn.insertBefore(document.createTextNode(s), node.nextSibling);
+            pn.removeChild(node);
+          }
+        };
+      } else {
+        if (prepend) {
+          setfn = function(node, s) { node.insertBefore(document.createTextNode(s), node.firstChild);  };
+        } else if (append) {
+          setfn = function(node, s) { node.appendChild(document.createTextNode(s));};
+        } else {
+          setfn = function(node, s) {
+            while (node.firstChild) { node.removeChild(node.firstChild); }
+            node.appendChild(document.createTextNode(s));
+          };
+        }
+      }
+      quotefn = function(s) { return s; };
+    }
+    return { attr: attr, nodes: target, set: setfn, sel: osel, quotefn: quotefn };
+  }
+
+  function setsig(target, n){
+    var sig = Sig + n + ':';
+    for(var i = 0; i < target.nodes.length; i++){
+      // could check for overlapping targets here.
+      target.set( target.nodes[i], sig );
+    }
+  }
+
+  // read de loop data, and pass it to the inner rendering function
+  function loopfn(name, dselect, inner, sorter, filter){
+    return function(ctxt){
+      var a = dselect(ctxt),
+        old = ctxt[name],
+        temp = { items : a },
+        filtered = 0,
+        length,
+        strs = [],
+        buildArg = function(idx, temp, ftr, len){
+          ctxt.pos = temp.pos = idx;
+          ctxt.item = temp.item = a[ idx ];
+          ctxt.items = a;
+          //if array, set a length property - filtered items
+          typeof len !== 'undefined' &&  (ctxt.length = len);
+          //if filter directive
+          if(typeof ftr === 'function' && ftr(ctxt) === false){
+            filtered++;
+            return;
+          }
+          strs.push( inner.call(temp, ctxt ) );
+        };
+      ctxt[name] = temp;
+      if( isArray(a) ){
+        length = a.length || 0;
+        // if sort directive
+        if(typeof sorter === 'function'){
+          a.sort(sorter);
+        }
+        //loop on array
+        for(var i = 0, ii = length; i < ii; i++){
+          buildArg(i, temp, filter, length - filtered);
+        }
+      }else{
+        if(a && typeof sorter !== 'undefined'){
+          error('sort is only available on arrays, not objects');
+        }
+        //loop on collections
+        for(var prop in a){
+          a.hasOwnProperty( prop ) && buildArg(prop, temp, filter);
+        }
+      }
+
+      typeof old !== 'undefined' ? ctxt[name] = old : delete ctxt[name];
+      return strs.join('');
+    };
+  }
+  // generate the template for a loop node
+  function loopgen(dom, sel, loop, fns){
+    var already = false, ls, sorter, filter, prop;
+    for(prop in loop){
+      if(loop.hasOwnProperty(prop)){
+        if(prop === 'sort'){
+          sorter = loop.sort;
+          continue;
+        }else if(prop === 'filter'){
+          filter = loop.filter;
+          continue;
+        }
+        if(already){
+          error('cannot have more than one loop on a target');
+        }
+        ls = prop;
+        already = true;
+      }
+    }
+    if(!ls){
+      error('Error in the selector: ' + sel + '\nA directive action must be a string, a function or a loop(<-)');
+    }
+    var dsel = loop[ls];
+    // if it's a simple data selector then we default to contents, not replacement.
+    if(typeof(dsel) === 'string' || typeof(dsel) === 'function'){
+      loop = {};
+      loop[ls] = {root: dsel};
+      return loopgen(dom, sel, loop, fns);
+    }
+    var spec = parseloopspec(ls),
+      itersel = dataselectfn(spec.sel),
+      target = gettarget(dom, sel, true),
+      nodes = target.nodes;
+
+    for(i = 0; i < nodes.length; i++){
+      var node = nodes[i],
+        inner = compiler(node, dsel);
+      fns[fns.length] = wrapquote(target.quotefn, loopfn(spec.name, itersel, inner, sorter, filter));
+      target.nodes = [node];    // N.B. side effect on target.
+      setsig(target, fns.length - 1);
+    }
+  }
+
+  function getAutoNodes(n, data){
+    var ns = n.getElementsByTagName('*'),
+      an = [],
+      openLoops = {a:[],l:{}},
+      cspec,
+      isNodeValue,
+      i, ii, j, jj, ni, cs, cj;
+    //for each node found in the template
+    for(i = -1, ii = ns.length; i < ii; i++){
+      ni = i > -1 ?ns[i]:n;
+      if(ni.nodeType === 1 && ni.className !== ''){
+        //when a className is found
+        cs = ni.className.split(' ');
+        // for each className
+        for(j = 0, jj=cs.length;j<jj;j++){
+          cj = cs[j];
+          // check if it is related to a context property
+          cspec = checkClass(cj, ni.tagName);
+          // if so, store the node, plus the type of data
+          if(cspec !== false){
+            isNodeValue = (/nodevalue/i).test(cspec.attr);
+            if(cspec.sel.indexOf('@') > -1 || isNodeValue){
+              ni.className = ni.className.replace('@'+cspec.attr, '');
+              if(isNodeValue){
+                cspec.attr = false;
+              }
+            }
+            an.push({n:ni, cspec:cspec});
+          }
+        }
+      }
+    }
+    return an;
+
+    function checkClass(c, tagName){
+      // read the class
+      var ca = c.match(selRx),
+        attr = ca[3] || autoAttr[tagName],
+        cspec = {prepend:!!ca[1], prop:ca[2], attr:attr, append:!!ca[4], sel:c},
+        i, ii, loopi, loopil, val;
+      // check in existing open loops
+      for(i = openLoops.a.length-1; i >= 0; i--){
+        loopi = openLoops.a[i];
+        loopil = loopi.l[0];
+        val = loopil && loopil[cspec.prop];
+        if(typeof val !== 'undefined'){
+          cspec.prop = loopi.p + '.' + cspec.prop;
+          if(openLoops.l[cspec.prop] === true){
+            val = val[0];
+          }
+          break;
+        }
+      }
+      // not found check first level of data
+      if(typeof val === 'undefined'){
+        val = isArray(data) ? data[0][cspec.prop] : data[cspec.prop];
+        // nothing found return
+        if(typeof val === 'undefined'){
+          return false;
+        }
+      }
+      // set the spec for autoNode
+      if(isArray(val)){
+        openLoops.a.push( {l:val, p:cspec.prop} );
+        openLoops.l[cspec.prop] = true;
+        cspec.t = 'loop';
+      }else{
+        cspec.t = 'str';
+      }
+      return cspec;
+    }
+  }
+
+  // returns a function that, given a context argument,
+  // will render the template defined by dom and directive.
+  function compiler(dom, directive, data, ans){
+    var fns = [];
+    // autoRendering nodes parsing -> auto-nodes
+    ans = ans || data && getAutoNodes(dom, data);
+    if(data){
+      var j, jj, cspec, n, target, nodes, itersel, node, inner;
+      // for each auto-nodes
+      while(ans.length > 0){
+        cspec = ans[0].cspec;
+        n = ans[0].n;
+        ans.splice(0, 1);
+        if(cspec.t === 'str'){
+          // if the target is a value
+          target = gettarget(n, cspec, false);
+          setsig(target, fns.length);
+          fns[fns.length] = wrapquote(target.quotefn, dataselectfn(cspec.prop));
+        }else{
+          // if the target is a loop
+          itersel = dataselectfn(cspec.sel);
+          target = gettarget(n, cspec, true);
+          nodes = target.nodes;
+          for(j = 0, jj = nodes.length; j < jj; j++){
+            node = nodes[j];
+            inner = compiler(node, false, data, ans);
+            fns[fns.length] = wrapquote(target.quotefn, loopfn(cspec.sel, itersel, inner));
+            target.nodes = [node];
+            setsig(target, fns.length - 1);
+          }
+        }
+      }
+    }
+    // read directives
+    var target, dsel;
+    for(var sel in directive){
+      if(directive.hasOwnProperty(sel)){
+        dsel = directive[sel];
+        if(typeof(dsel) === 'function' || typeof(dsel) === 'string'){
+          // set the value for the node/attr
+          target = gettarget(dom, sel, false);
+          setsig(target, fns.length);
+          fns[fns.length] = wrapquote(target.quotefn, dataselectfn(dsel));
+        }else{
+          // loop on node
+          loopgen(dom, sel, dsel, fns);
+        }
+      }
+    }
+        // convert node to a string
+        var h = outerHTML(dom), pfns = [];
+    // IE adds an unremovable "selected, value" attribute
+    // hard replace while waiting for a better solution
+        h = h.replace(/<([^>]+)\s(value\=""|selected)\s?([^>]*)>/ig, "<$1 $3>");
+
+        // remove attribute prefix
+        h = h.split(attPfx).join('');
+
+    // slice the html string at "Sig"
+    var parts = h.split( Sig ), p;
+    // for each slice add the return string of
+    for(var i = 1; i < parts.length; i++){
+      p = parts[i];
+      // part is of the form "fn-number:..." as placed there by setsig.
+      pfns[i] = fns[ parseInt(p, 10) ];
+      parts[i] = p.substring( p.indexOf(':') + 1 );
+    }
+    return concatenator(parts, pfns);
+  }
+  // compile the template with directive
+  // if a context is passed, the autoRendering is triggered automatically
+  // return a function waiting the data as argument
+  function compile(directive, ctxt, template){
+    var rfn = compiler( ( template || this[0] ).cloneNode(true), directive, ctxt);
+    return function(context){
+      return rfn({context:context});
+    };
+  }
+  //compile with the directive as argument
+  // run the template function on the context argument
+  // return an HTML string
+  // should replace the template and return this
+  function render(ctxt, directive){
+    var fn = typeof directive === 'function' ? directive : plugins.compile( directive, false, this[0] );
+    for(var i = 0, ii = this.length; i < ii; i++){
+      this[i] = replaceWith( this[i], fn( ctxt, false ));
+    }
+    context = null;
+    return this;
+  }
+
+  // compile the template with autoRender
+  // run the template function on the context argument
+  // return an HTML string
+  function autoRender(ctxt, directive){
+    var fn = plugins.compile( directive, ctxt, this[0] );
+    for(var i = 0, ii = this.length; i < ii; i++){
+      this[i] = replaceWith( this[i], fn( ctxt, false));
+    }
+    context = null;
+    return this;
+  }
+
+  function replaceWith(elm, html) {
+    var ne,
+      ep = elm.parentNode,
+      depth = 0;
+    switch (elm.tagName) {
+      case 'TBODY': case 'THEAD': case 'TFOOT':
+        html = '<TABLE>' + html + '</TABLE>';
+        depth = 1;
+      break;
+      case 'TR':
+        html = '<TABLE><TBODY>' + html + '</TBODY></TABLE>';
+        depth = 2;
+      break;
+      case 'TD': case 'TH':
+        html = '<TABLE><TBODY><TR>' + html + '</TR></TBODY></TABLE>';
+        depth = 3;
+      break;
+    }
+    tmp = document.createElement('SPAN');
+    tmp.style.display = 'none';
+    document.body.appendChild(tmp);
+    tmp.innerHTML = html;
+    ne = tmp.firstChild;
+    while (depth--) {
+      ne = ne.firstChild;
+    }
+    ep.insertBefore(ne, elm);
+    ep.removeChild(elm);
+    document.body.removeChild(tmp);
+    elm = ne;
+
+    ne = ep = null;
+    return elm;
+  }
+};
+
+$p.plugins = {};
+
+$p.libs = {
+  dojo:function(){
+    if(typeof document.querySelector === 'undefined'){
+      $p.plugins.find = function(n, sel){
+        return dojo.query(sel, n);
+      };
+    }
+  },
+  domassistant:function(){
+    if(typeof document.querySelector === 'undefined'){
+      $p.plugins.find = function(n, sel){
+        return $(n).cssSelect(sel);
+      };
+    }
+    DOMAssistant.attach({
+      publicMethods : [ 'compile', 'render', 'autoRender'],
+      compile:function(directive, ctxt){ return $p(this).compile(directive, ctxt); },
+      render:function(ctxt, directive){ return $( $p(this).render(ctxt, directive) )[0]; },
+      autoRender:function(ctxt, directive){ return $( $p(this).autoRender(ctxt, directive) )[0]; }
+    });
+  },
+  jquery:function(){
+    if(typeof document.querySelector === 'undefined'){
+      $p.plugins.find = function(n, sel){
+        return jQuery(n).find(sel);
+      };
+    }
+    jQuery.fn.extend({
+      compile:function(directive, ctxt){ return $p(this[0]).compile(directive, ctxt); },
+      render:function(ctxt, directive){ return jQuery( $p( this[0] ).render( ctxt, directive ) ); },
+      autoRender:function(ctxt, directive){ return jQuery( $p( this[0] ).autoRender( ctxt, directive ) ); }
+    });
+  },
+  mootools:function(){
+    if(typeof document.querySelector === 'undefined'){
+      $p.plugins.find = function(n, sel){
+        return $(n).getElements(sel);
+      };
+    }
+    Element.implement({
+      compile:function(directive, ctxt){ return $p(this).compile(directive, ctxt); },
+      render:function(ctxt, directive){ return $p(this).render(ctxt, directive); },
+      autoRender:function(ctxt, directive){ return $p(this).autoRender(ctxt, directive); }
+    });
+  },
+  prototype:function(){
+    if(typeof document.querySelector === 'undefined'){
+      $p.plugins.find = function(n, sel){
+        n = n === document ? n.body : n;
+        return typeof n === 'string' ? $$(n) : $(n).select(sel);
+      };
+    }
+    Element.addMethods({
+      compile:function(element, directive, ctxt){ return $p(element).compile(directive, ctxt); },
+      render:function(element, ctxt, directive){ return $p(element).render(ctxt, directive); },
+      autoRender:function(element, ctxt, directive){ return $p(element).autoRender(ctxt, directive); }
+    });
+  },
+  sizzle:function(){
+    if(typeof document.querySelector === 'undefined'){
+      $p.plugins.find = function(n, sel){
+        return Sizzle(sel, n);
+      };
+    }
+  },
+  sly:function(){
+    if(typeof document.querySelector === 'undefined'){
+      $p.plugins.find = function(n, sel){
+        return Sly(sel, n);
+      };
+    }
+  }
+};
+
+// get lib specifics if available
+(function(){
+  var libkey =
+    typeof dojo         !== 'undefined' && 'dojo' ||
+    typeof DOMAssistant !== 'undefined' && 'domassistant' ||
+    typeof jQuery       !== 'undefined' && 'jquery' ||
+    typeof MooTools     !== 'undefined' && 'mootools' ||
+    typeof Prototype    !== 'undefined' && 'prototype' ||
+    typeof Sizzle       !== 'undefined' && 'sizzle' ||
+    typeof Sly          !== 'undefined' && 'sly';
+
+  libkey && $p.libs[libkey]();
+})();
+
+
+  Sammy = Sammy || {};
+
+  // `Sammy.Pure` is a simple wrapper around the pure.js templating engine for
+  // use in Sammy apps.
+  //
+  // See http://beebole.com/pure/ for detailed documentation.
+  Sammy.Pure = function(app, method_alias) {
+
+    var pure = function(template, data, directives) {
+      return $(template).autoRender(data, directives);
+    };
+
+    // set the default method name/extension
+    if (!method_alias) method_alias = 'pure';
+    app.helper(method_alias, pure);
+
+  };
+
+})(jQuery);

http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/f50cc931/attachments/sammy/plugins/sammy.storage.js
----------------------------------------------------------------------
diff --git a/attachments/sammy/plugins/sammy.storage.js b/attachments/sammy/plugins/sammy.storage.js
new file mode 100644
index 0000000..d97ab93
--- /dev/null
+++ b/attachments/sammy/plugins/sammy.storage.js
@@ -0,0 +1,577 @@
+(function($) {
+
+  Sammy = Sammy || {};
+
+  // Sammy.Store is an abstract adapter class that wraps the multitude of in
+  // browser data storage into a single common set of methods for storing and
+  // retreiving data. The JSON library is used (through the inclusion of the
+  // Sammy.JSON) plugin, to automatically convert objects back and forth from
+  // stored strings.
+  //
+  // Sammy.Store can be used directly, but within a Sammy.Application it is much
+  // easier to use the `Sammy.Storage` plugin and its helper methods.
+  //
+  // Sammy.Store also supports the KVO pattern, by firing DOM/jQuery Events when
+  // a key is set.
+  //
+  // ### Example
+  //
+  //      // create a new store named 'mystore', tied to the #main element, using HTML5 localStorage
+  //      // Note: localStorage only works on browsers that support it
+  //      var store = new Sammy.Store({name: 'mystore', element: '#element', type: 'local'});
+  //      store.set('foo', 'bar');
+  //      store.get('foo'); //=> 'bar'
+  //      store.set('json', {obj: 'this is an obj'});
+  //      store.get('json'); //=> {obj: 'this is an obj'}
+  //      store.keys(); //=> ['foo','json']
+  //      store.clear('foo');
+  //      store.keys(); //=> ['json']
+  //      store.clearAll();
+  //      store.keys(); //=> []
+  //
+  // ### Arguments
+  //
+  // The constructor takes a single argument which is a Object containing these possible options.
+  //
+  // * `name` The name/namespace of this store. Stores are unique by name/type. (default 'store')
+  // * `element` A selector for the element that the store is bound to. (default 'body')
+  // * `type` The type of storage/proxy to use (default 'memory')
+  //
+  // Extra options are passed to the storage constructor.
+  // Sammy.Store supports the following methods of storage:
+  //
+  // * `memory` Basic object storage
+  // * `data` jQuery.data DOM Storage
+  // * `cookie` Access to document.cookie. Limited to 2K
+  // * `local` HTML5 DOM localStorage, browswer support is currently limited.
+  // * `session` HTML5 DOM sessionStorage, browswer support is currently limited.
+  //
+  Sammy.Store = function(options) {
+    var store = this;
+    this.options  = options || {};
+    this.name     = this.options.name || 'store';
+    this.element  = this.options.element || 'body';
+    this.$element = $(this.element);
+    if ($.isArray(this.options.type)) {
+      $.each(this.options.type, function(i, type) {
+        if (Sammy.Store.isAvailable(type)) {
+          store.type = type;
+          return false;
+        }
+      });
+    } else {
+      this.type = this.options.type || 'memory';
+    }
+    this.meta_key = this.options.meta_key || '__keys__';
+    this.storage  = new Sammy.Store[Sammy.Store.stores[this.type]](this.name, this.element, this.options);
+  };
+
+  Sammy.Store.stores = {
+    'memory': 'Memory',
+    'data': 'Data',
+    'local': 'LocalStorage',
+    'session': 'SessionStorage',
+    'cookie': 'Cookie'
+  };
+
+  $.extend(Sammy.Store.prototype, {
+    // Checks for the availability of the current storage type in the current browser/config.
+    isAvailable: function() {
+      if ($.isFunction(this.storage.isAvailable)) {
+        return this.storage.isAvailable();
+      } else {
+        true;
+      }
+    },
+    // Checks for the existance of `key` in the current store. Returns a boolean.
+    exists: function(key) {
+      return this.storage.exists(key);
+    },
+    // Sets the value of `key` with `value`. If `value` is an
+    // object, it is turned to and stored as a string with `JSON.stringify`.
+    // It also tries to conform to the KVO pattern triggering jQuery events on the
+    // element that the store is bound to.
+    //
+    // ### Example
+    //
+    //      var store = new Sammy.Store({name: 'kvo'});
+    //      $('body').bind('set-kvo-foo', function(e, data) {
+    //        Sammy.log(data.key + ' changed to ' + data.value);
+    //      });
+    //      store.set('foo', 'bar'); // logged: foo changed to bar
+    //
+    set: function(key, value) {
+      var string_value = (typeof value == 'string') ? value : JSON.stringify(value);
+      key = key.toString();
+      this.storage.set(key, string_value);
+      if (key != this.meta_key) {
+        this._addKey(key);
+        this.$element.trigger('set-' + this.name, {key: key, value: value});
+        this.$element.trigger('set-' + this.name + '-' + key, {key: key, value: value});
+      };
+      // always return the original value
+      return value;
+    },
+    // Returns the set value at `key`, parsing with `JSON.parse` and
+    // turning into an object if possible
+    get: function(key) {
+      var value = this.storage.get(key);
+      if (typeof value == 'undefined' || value == null || value == '') {
+        return value;
+      }
+      try {
+        return JSON.parse(value);
+      } catch(e) {
+        return value;
+      }
+    },
+    // Removes the value at `key` from the current store
+    clear: function(key) {
+      this._removeKey(key);
+      return this.storage.clear(key);
+    },
+    // Clears all the values for the current store.
+    clearAll: function() {
+      var self = this;
+      this.each(function(key, value) {
+        self.clear(key);
+      });
+    },
+    // Returns the all the keys set for the current store as an array.
+    // Internally Sammy.Store keeps this array in a 'meta_key' for easy access.
+    keys: function() {
+      return this.get(this.meta_key) || [];
+    },
+    // Iterates over each key value pair passing them to the `callback` function
+    //
+    // ### Example
+    //
+    //      store.each(function(key, value) {
+    //        Sammy.log('key', key, 'value', value);
+    //      });
+    //
+    each: function(callback) {
+      var i = 0,
+          keys = this.keys(),
+          returned;
+
+      for (i; i < keys.length; i++) {
+        returned = callback(keys[i], this.get(keys[i]));
+        if (returned === false) { return false; }
+      };
+    },
+    // Filters the store by a filter function that takes a key value.
+    // Returns an array of arrays where the first element of each array
+    // is the key and the second is the value of that key.
+    //
+    // ### Example
+    //
+    //      var store = new Sammy.Store;
+    //      store.set('one', 'two');
+    //      store.set('two', 'three');
+    //      store.set('1', 'two');
+    //      var returned = store.filter(function(key, value) {
+    //        // only return
+    //        return value === 'two';
+    //      });
+    //      // returned => [['one', 'two'], ['1', 'two']];
+    //
+    filter: function(callback) {
+      var found = [];
+      this.each(function(key, value) {
+        if (callback(key, value)) {
+          found.push([key, value]);
+        }
+        return true;
+      });
+      return found;
+    },
+    // Works exactly like filter except only returns the first matching key
+    // value pair instead of all of them
+    first: function(callback) {
+      var found = false;
+      this.each(function(key, value) {
+        if (callback(key, value)) {
+          found = [key, value];
+          return false;
+        }
+      });
+      return found;
+    },
+    // Returns the value at `key` if set, otherwise, runs the callback
+    // and sets the value to the value returned in the callback.
+    //
+    // ### Example
+    //
+    //    var store = new Sammy.Store;
+    //    store.exists('foo'); //=> false
+    //    store.fetch('foo', function() {
+    //      return 'bar!';
+    //    }); //=> 'bar!'
+    //    store.get('foo') //=> 'bar!'
+    //    store.fetch('foo', function() {
+    //      return 'baz!';
+    //    }); //=> 'bar!
+    //
+    fetch: function(key, callback) {
+      if (!this.exists(key)) {
+        return this.set(key, callback.apply(this));
+      } else {
+        return this.get(key);
+      }
+    },
+    // loads the response of a request to `path` into `key`.
+    //
+    // ### Example
+    //
+    // In /mytemplate.tpl:
+    //
+    //    My Template
+    //
+    // In app.js:
+    //
+    //    var store = new Sammy.Store;
+    //    store.load('mytemplate', '/mytemplate.tpl', function() {
+    //      s.get('mytemplate') //=> My Template
+    //    });
+    //
+    load: function(key, path, callback) {
+      var s = this;
+      $.get(path, function(response) {
+        s.set(key, response);
+        if (callback) { callback.apply(this, [response]); }
+      });
+    },
+
+    _addKey: function(key) {
+      var keys = this.keys();
+      if ($.inArray(key, keys) == -1) { keys.push(key); }
+      this.set(this.meta_key, keys);
+    },
+    _removeKey: function(key) {
+      var keys = this.keys();
+      var index = $.inArray(key, keys);
+      if (index != -1) { keys.splice(index, 1); }
+      this.set(this.meta_key, keys);
+    }
+  });
+
+  // Tests if the type of storage is available/works in the current browser/config.
+  // Especially useful for testing the availability of the awesome, but not widely
+  // supported HTML5 DOM storage
+  Sammy.Store.isAvailable = function(type) {
+    try {
+      return Sammy.Store[Sammy.Store.stores[type]].prototype.isAvailable();
+    } catch(e) {
+      return false;
+    }
+  };
+
+  // Memory ('memory') is the basic/default store. It stores data in a global
+  // JS object. Data is lost on refresh.
+  Sammy.Store.Memory = function(name, element) {
+    this.name  = name;
+    this.element = element;
+    this.namespace = [this.element, this.name].join('.');
+    Sammy.Store.Memory.store = Sammy.Store.Memory.store || {};
+    Sammy.Store.Memory.store[this.namespace] = Sammy.Store.Memory.store[this.namespace] || {};
+    this.store = Sammy.Store.Memory.store[this.namespace];
+  };
+  $.extend(Sammy.Store.Memory.prototype, {
+    isAvailable: function() { return true; },
+    exists: function(key) {
+      return (typeof this.store[key] != "undefined");
+    },
+    set: function(key, value) {
+      return this.store[key] = value;
+    },
+    get: function(key) {
+      return this.store[key];
+    },
+    clear: function(key) {
+      delete this.store[key];
+    }
+  });
+
+  // Data ('data') stores objects using the jQuery.data() methods. This has the advantadge
+  // of scoping the data to the specific element. Like the 'memory' store its data
+  // will only last for the length of the current request (data is lost on refresh/etc).
+  Sammy.Store.Data = function(name, element) {
+    this.name = name;
+    this.element = element;
+    this.$element = $(element);
+  };
+  $.extend(Sammy.Store.Data.prototype, {
+    isAvailable: function() { return true; },
+    exists: function(key) {
+      return (typeof this.$element.data(this._key(key)) != "undefined");
+    },
+    set: function(key, value) {
+      return this.$element.data(this._key(key), value);
+    },
+    get: function(key) {
+      return this.$element.data(this._key(key));
+    },
+    clear: function(key) {
+      this.$element.removeData(this._key(key));
+    },
+    _key: function(key) {
+      return ['store', this.name, key].join('.');
+    }
+  });
+
+  // LocalStorage ('local') makes use of HTML5 DOM Storage, and the window.localStorage
+  // object. The great advantage of this method is that data will persist beyond
+  // the current request. It can be considered a pretty awesome replacement for
+  // cookies accessed via JS. The great disadvantage, though, is its only available
+  // on the latest and greatest browsers.
+  //
+  // For more info on DOM Storage:
+  // [https://developer.mozilla.org/en/DOM/Storage]
+  // [http://www.w3.org/TR/2009/WD-webstorage-20091222/]
+  //
+  Sammy.Store.LocalStorage = function(name, element) {
+    this.name = name;
+    this.element = element;
+  };
+  $.extend(Sammy.Store.LocalStorage.prototype, {
+    isAvailable: function() {
+      return ('localStorage' in window) && (window.location.protocol != 'file:');
+    },
+    exists: function(key) {
+      return (this.get(key) != null);
+    },
+    set: function(key, value) {
+      return window.localStorage.setItem(this._key(key), value);
+    },
+    get: function(key) {
+      return window.localStorage.getItem(this._key(key));
+    },
+    clear: function(key) {
+      window.localStorage.removeItem(this._key(key));;
+    },
+    _key: function(key) {
+      return ['store', this.element, this.name, key].join('.');
+    }
+  });
+
+  // .SessionStorage ('session') is similar to LocalStorage (part of the same API)
+  // and shares similar browser support/availability. The difference is that
+  // SessionStorage is only persistant through the current 'session' which is defined
+  // as the length that the current window is open. This means that data will survive
+  // refreshes but not close/open or multiple windows/tabs. For more info, check out
+  // the `LocalStorage` documentation and links.
+  Sammy.Store.SessionStorage = function(name, element) {
+    this.name = name;
+    this.element = element;
+  };
+  $.extend(Sammy.Store.SessionStorage.prototype, {
+    isAvailable: function() {
+      return ('sessionStorage' in window) &&
+      (window.location.protocol != 'file:') &&
+      ($.isFunction(window.sessionStorage.setItem));
+    },
+    exists: function(key) {
+      return (this.get(key) != null);
+    },
+    set: function(key, value) {
+      return window.sessionStorage.setItem(this._key(key), value);
+    },
+    get: function(key) {
+      var value = window.sessionStorage.getItem(this._key(key));
+      if (value && typeof value.value != "undefined") { value = value.value }
+      return value;
+    },
+    clear: function(key) {
+      window.sessionStorage.removeItem(this._key(key));;
+    },
+    _key: function(key) {
+      return ['store', this.element, this.name, key].join('.');
+    }
+  });
+
+  // .Cookie ('cookie') storage uses browser cookies to store data. JavaScript
+  // has access to a single document.cookie variable, which is limited to 2Kb in
+  // size. Cookies are also considered 'unsecure' as the data can be read easily
+  // by other sites/JS. Cookies do have the advantage, though, of being widely
+  // supported and persistent through refresh and close/open. Where available,
+  // HTML5 DOM Storage like LocalStorage and SessionStorage should be used.
+  //
+  // .Cookie can also take additional options:
+  //
+  // * `expires_in` Number of seconds to keep the cookie alive (default 2 weeks).
+  // * `path` The path to activate the current cookie for (default '/').
+  //
+  // For more information about document.cookie, check out the pre-eminint article
+  // by ppk: [http://www.quirksmode.org/js/cookies.html]
+  //
+  Sammy.Store.Cookie = function(name, element, options) {
+    this.name = name;
+    this.element = element;
+    this.options = options || {};
+    this.path = this.options.path || '/';
+    // set the expires in seconds or default 14 days
+    this.expires_in = this.options.expires_in || (14 * 24 * 60 * 60);
+  };
+  $.extend(Sammy.Store.Cookie.prototype, {
+    isAvailable: function() {
+      return ('cookie' in document) && (window.location.protocol != 'file:');
+    },
+    exists: function(key) {
+      return (this.get(key) != null);
+    },
+    set: function(key, value) {
+      return this._setCookie(key, value);
+    },
+    get: function(key) {
+      return this._getCookie(key);
+    },
+    clear: function(key) {
+      this._setCookie(key, "", -1);
+    },
+    _key: function(key) {
+      return ['store', this.element, this.name, key].join('.');
+    },
+    _getCookie: function(key) {
+      var escaped = this._key(key).replace(/(\.|\*|\(|\)|\[|\])/g, '\\$1');
+      var match = document.cookie.match("(^|;\\s)" + escaped + "=([^;]*)(;|$)")
+      return (match ? match[2] : null);
+    },
+    _setCookie: function(key, value, expires) {
+      if (!expires) { expires = (this.expires_in * 1000) }
+      var date = new Date();
+      date.setTime(date.getTime() + expires);
+      var set_cookie = [
+        this._key(key), "=", value,
+        "; expires=", date.toGMTString(),
+        "; path=", this.path
+      ].join('');
+      document.cookie = set_cookie;
+    }
+  });
+
+  // Sammy.Storage is a plugin that provides shortcuts for creating and using
+  // Sammy.Store objects. Once included it provides the `store()` app level
+  // and helper methods. Depends on Sammy.JSON (or json2.js).
+  Sammy.Storage = function(app) {
+    this.use(Sammy.JSON);
+
+    this.stores = this.stores || {};
+
+    // `store()` creates and looks up existing `Sammy.Store` objects
+    // for the current application. The first time used for a given `'name'`
+    // initializes a `Sammy.Store` and also creates a helper under the store's
+    // name.
+    //
+    // ### Example
+    //
+    //      var app = $.sammy(function() {
+    //        this.use(Sammy.Storage);
+    //
+    //        // initializes the store on app creation.
+    //        this.store('mystore', {type: 'cookie'});
+    //
+    //        this.get('#/', function() {
+    //          // returns the Sammy.Store object
+    //          this.store('mystore');
+    //          // sets 'foo' to 'bar' using the shortcut/helper
+    //          // equivilent to this.store('mystore').set('foo', 'bar');
+    //          this.mystore('foo', 'bar');
+    //          // returns 'bar'
+    //          // equivilent to this.store('mystore').get('foo');
+    //          this.mystore('foo');
+    //          // returns 'baz!'
+    //          // equivilent to:
+    //          // this.store('mystore').fetch('foo!', function() {
+    //          //   return 'baz!';
+    //          // })
+    //          this.mystore('foo!', function() {
+    //            return 'baz!';
+    //          });
+    //
+    //          this.clearMystore();
+    //          // equivilent to:
+    //          // this.store('mystore').clearAll()
+    //        });
+    //
+    //      });
+    //
+    // ### Arguments
+    //
+    // * `name` The name of the store and helper. the name must be unique per application.
+    // * `options` A JS object of options that can be passed to the Store constuctor on initialization.
+    //
+    this.store = function(name, options) {
+      // if the store has not been initialized
+      if (typeof this.stores[name] == 'undefined') {
+        // create initialize the store
+        var clear_method_name = "clear" + name.substr(0,1).toUpperCase() + name.substr(1);
+        this.stores[name] = new Sammy.Store($.extend({
+          name: name,
+          element: this.element_selector
+        }, options || {}));
+        // app.name()
+        this[name] = function(key, value) {
+          if (typeof value == 'undefined') {
+            return this.stores[name].get(key);
+          } else if ($.isFunction(value)) {
+            return this.stores[name].fetch(key, value);
+          } else {
+            return this.stores[name].set(key, value)
+          }
+        };
+        // app.clearName();
+        this[clear_method_name] = function() {
+          return this.stores[name].clearAll();
+        }
+        // context.name()
+        this.helper(name, function() {
+          return this.app[name].apply(this.app, arguments);
+        });
+        // context.clearName();
+        this.helper(clear_method_name, function() {
+          return this.app[clear_method_name]();
+        });
+      }
+      return this.stores[name];
+    };
+
+    this.helpers({
+      store: function() {
+        return this.app.store.apply(this.app, arguments);
+      }
+    });
+  };
+
+  // Sammy.Session is an additional plugin for creating a common 'session' store
+  // for the given app. It is a very simple wrapper around `Sammy.Storage`
+  // that provides a simple fallback mechanism for trying to provide the best
+  // possible storage type for the session. This means, `LocalStorage`
+  // if available, otherwise `Cookie`, otherwise `Memory`.
+  // It provides the `session()` helper through `Sammy.Storage#store()`.
+  //
+  // See the `Sammy.Storage` plugin for full documentation.
+  //
+  Sammy.Session = function(app, options) {
+    this.use(Sammy.Storage);
+    // check for local storage, then cookie storage, then just use memory
+    this.store('session', $.extend({type: ['local', 'cookie', 'memory']}, options));
+  };
+
+  // Sammy.Cache provides helpers for caching data within the lifecycle of a
+  // Sammy app. The plugin provides two main methods on `Sammy.Application`,
+  // `cache` and `clearCache`. Each app has its own cache store so that
+  // you dont have to worry about collisions. As of 0.5 the original Sammy.Cache module
+  // has been deprecated in favor of this one based on Sammy.Storage. The exposed
+  // API is almost identical, but Sammy.Storage provides additional backends including
+  // HTML5 Storage. `Sammy.Cache` will try to use these backends when available
+  // (in this order) `LocalStorage`, `SessionStorage`, and `Memory`
+  Sammy.Cache = function(app, options) {
+    this.use(Sammy.Storage);
+    // set cache_partials to true
+    this.cache_partials = true;
+    // check for local storage, then session storage, then just use memory
+    this.store('cache', $.extend({type: ['local', 'session', 'memory']}, options));
+  };
+
+})(jQuery);

http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/f50cc931/attachments/sammy/plugins/sammy.template.js
----------------------------------------------------------------------
diff --git a/attachments/sammy/plugins/sammy.template.js b/attachments/sammy/plugins/sammy.template.js
new file mode 100644
index 0000000..f24c23e
--- /dev/null
+++ b/attachments/sammy/plugins/sammy.template.js
@@ -0,0 +1,117 @@
+(function($) {
+
+  // Simple JavaScript Templating
+  // John Resig - http://ejohn.org/ - MIT Licensed
+  // adapted from: http://ejohn.org/blog/javascript-micro-templating/
+  // originally $.srender by Greg Borenstein http://ideasfordozens.com in Feb 2009
+  // modified for Sammy by Aaron Quint for caching templates by name
+  var srender_cache = {};
+  var srender = function(name, template, data) {
+    // target is an optional element; if provided, the result will be inserted into it
+    // otherwise the result will simply be returned to the caller
+    if (srender_cache[name]) {
+      fn = srender_cache[name];
+    } else {
+      if (typeof template == 'undefined') {
+        // was a cache check, return false
+        return false;
+      }
+      // Generate a reusable function that will serve as a template
+      // generator (and which will be cached).
+      fn = srender_cache[name] = new Function("obj",
+      "var p=[],print=function(){p.push.apply(p,arguments);};" +
+
+      // Introduce the data as local variables using with(){}
+      "with(obj){p.push(\"" +
+
+      // Convert the template into pure JavaScript
+      template
+        .replace(/[\r\t\n]/g, " ")
+        .replace(/\"/g, '\\"')
+        .split("<%").join("\t")
+        .replace(/((^|%>)[^\t]*)/g, "$1\r")
+        .replace(/\t=(.*?)%>/g, "\",$1,\"")
+        .split("\t").join("\");")
+        .split("%>").join("p.push(\"")
+        .split("\r").join("")
+        + "\");}return p.join('');");
+    }
+
+    if (typeof data != 'undefined') {
+      return fn(data);
+    } else {
+      return fn;
+    }
+  };
+
+  Sammy = Sammy || {};
+
+  // <tt>Sammy.Template</tt> is a simple plugin that provides a way to create
+  // and render client side templates. The rendering code is based on John Resig's
+  // quick templates and Greg Borenstien's srender plugin.
+  // This is also a great template/boilerplate for Sammy plugins.
+  //
+  // Templates use <% %> tags to denote embedded javascript.
+  //
+  // ### Examples
+  //
+  // Here is an example template (user.template):
+  //
+  //      <div class="user">
+  //        <div class="user-name"><%= user.name %></div>
+  //        <% if (user.photo_url) { %>
+  //          <div class="photo"><img src="<%= user.photo_url %>" /></div>
+  //        <% } %>
+  //      </div>
+  //
+  // Given that is a publicly accesible file, you would render it like:
+  //
+  //       $.sammy(function() {
+  //         // include the plugin
+  //         this.use(Sammy.Template);
+  //
+  //         this.get('#/', function() {
+  //           // the template is rendered in the current context.
+  //           this.user = {name: 'Aaron Quint'};
+  //           // partial calls template() because of the file extension
+  //           this.partial('user.template');
+  //         })
+  //       });
+  //
+  // You can also pass a second argument to use() that will alias the template
+  // method and therefore allow you to use a different extension for template files
+  // in <tt>partial()</tt>
+  //
+  //      // alias to 'tpl'
+  //      this.use(Sammy.Template, 'tpl');
+  //
+  //      // now .tpl files will be run through srender
+  //      this.get('#/', function() {
+  //        this.partial('myfile.tpl');
+  //      });
+  //
+  Sammy.Template = function(app, method_alias) {
+
+    // *Helper:* Uses simple templating to parse ERB like templates.
+    //
+    // ### Arguments
+    //
+    // * `template` A String template. '<% %>' tags are evaluated as Javascript and replaced with the elements in data.
+    // * `data` An Object containing the replacement values for the template.
+    //   data is extended with the <tt>EventContext</tt> allowing you to call its methods within the template.
+    // * `name` An optional String name to cache the template.
+    //
+    var template = function(template, data, name) {
+      // use name for caching
+      if (typeof name == 'undefined') name = template;
+      return srender(name, template, $.extend({}, this, data));
+    };
+
+    // set the default method name/extension
+    if (!method_alias) method_alias = 'template';
+    // create the helper at the method alias
+    app.helper(method_alias, template);
+
+  };
+
+})(jQuery);

http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/f50cc931/attachments/sammy/plugins/sammy.title.js
----------------------------------------------------------------------
diff --git a/attachments/sammy/plugins/sammy.title.js b/attachments/sammy/plugins/sammy.title.js
new file mode 100644
index 0000000..9874a1e
--- /dev/null
+++ b/attachments/sammy/plugins/sammy.title.js
@@ -0,0 +1,59 @@
+(function($) {
+
+  Sammy = Sammy || {};
+
+  // Sammy.Title is a very simple plugin to easily set the document's title.
+  // It supplies a helper for setting the title (`title()`) within routes,
+  // and an app level method for setting the global title (`setTitle()`)
+  Sammy.Title = function() {
+
+    // setTitle allows setting a global title or a function that modifies the
+    // title for each route/page.
+    //
+    // ### Example
+    //
+    //    // setting a title prefix
+    //    $.sammy(function() {
+    //
+    //      this.setTitle('My App -');
+    //
+    //      this.get('#/', function() {
+    //        this.title('Home'); // document's title == "My App - Home"
+    //      });
+    //    });
+    //
+    //    // setting a title with a function
+    //    $.sammy(function() {
+    //
+    //      this.setTitle(function(title) {
+    //        return [title, " /// My App"].join('');
+    //      });
+    //
+    //      this.get('#/', function() {
+    //        this.title('Home'); // document's title == "Home /// My App";
+    //      });
+    //    });
+    //
+    this.setTitle = function(title) {
+      if (!$.isFunction(title)) {
+        this.title_function = function(additional_title) {
+          return [title, additional_title].join(' ');
+        }
+      } else {
+        this.title_function = title;
+      }
+    };
+
+    // *Helper* title() sets the document title, passing it through the function
+    // defined by setTitle() if set.
+    this.helper('title', function() {
+      var new_title = $.makeArray(arguments).join(' ');
+      if (this.app.title_function) {
+        new_title = this.app.title_function(new_title);
+      }
+      document.title = new_title;
+    });
+
+  };
+
+})(jQuery);