2014-05-07 18:27:51 +02:00
|
|
|
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
2014-05-07 20:08:29 +02:00
|
|
|
var templater = require("handlebars/runtime").default.template;module.exports = templater(function (Handlebars,depth0,helpers,partials,data) {
|
|
|
|
this.compilerInfo = [4,'>= 1.0.0'];
|
|
|
|
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
|
var buffer = "", stack1, helper, functionType="function", escapeExpression=this.escapeExpression;
|
2014-05-07 18:27:51 +02:00
|
|
|
|
2014-05-07 20:08:29 +02:00
|
|
|
|
2014-10-06 23:44:25 +02:00
|
|
|
buffer += "<div class=\"entry\" data-name=\"";
|
2014-05-07 20:08:29 +02:00
|
|
|
if (helper = helpers.name) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
|
|
else { helper = (depth0 && depth0.name); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
|
|
buffer += escapeExpression(stack1)
|
2014-10-06 23:44:25 +02:00
|
|
|
+ "\" data-version=\"";
|
2014-05-07 20:08:29 +02:00
|
|
|
if (helper = helpers.version) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
|
|
else { helper = (depth0 && depth0.version); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
|
|
buffer += escapeExpression(stack1)
|
2014-10-06 23:44:25 +02:00
|
|
|
+ "\">\n <div class=\"row\">\n <div class=\"col-md-8 col-sm-8\">\n <h4 class=\"title\">\n <a class='name icon-angle-right red' href='javascript:void(0)'>";
|
2014-05-07 21:56:48 +02:00
|
|
|
if (helper = helpers.name) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
|
|
else { helper = (depth0 && depth0.name); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
|
|
buffer += escapeExpression(stack1)
|
2014-10-06 23:44:25 +02:00
|
|
|
+ "</a>\n <small class='version'>v";
|
2014-05-07 21:56:48 +02:00
|
|
|
if (helper = helpers.version) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
|
|
else { helper = (depth0 && depth0.version); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
|
|
buffer += escapeExpression(stack1)
|
2014-10-06 23:44:25 +02:00
|
|
|
+ "</small>\n </h4>\n </div>\n <div class=\"col-md-4 col-sm-4\">\n <div class=\"author pull-right\">\n <small>By: "
|
2014-05-07 20:08:29 +02:00
|
|
|
+ escapeExpression(((stack1 = ((stack1 = (depth0 && depth0._npmUser)),stack1 == null || stack1 === false ? stack1 : stack1.name)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
|
2014-10-06 23:44:25 +02:00
|
|
|
+ "</small>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12\">\n <p class=\"description\">";
|
2014-05-07 20:08:29 +02:00
|
|
|
if (helper = helpers.description) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
|
|
else { helper = (depth0 && depth0.description); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
|
|
buffer += escapeExpression(stack1)
|
2014-10-06 23:44:25 +02:00
|
|
|
+ "</p>\n </div>\n </div>\n</div>\n";
|
2014-05-07 20:08:29 +02:00
|
|
|
return buffer;
|
|
|
|
});
|
2014-10-06 23:37:23 +02:00
|
|
|
},{"handlebars/runtime":11}],2:[function(require,module,exports){
|
2014-05-07 21:56:48 +02:00
|
|
|
var $ = require('unopinionate').selector,
|
2014-05-07 23:51:03 +02:00
|
|
|
onClick = require('onclick'),
|
|
|
|
transitionComplete = require('transition-complete');
|
2014-05-07 21:28:10 +02:00
|
|
|
|
2014-05-07 21:56:48 +02:00
|
|
|
$(function() {
|
|
|
|
onClick('.entry .name', function() {
|
|
|
|
var $this = $(this),
|
|
|
|
$entry = $this.closest('.entry');
|
|
|
|
|
2014-05-07 23:51:03 +02:00
|
|
|
//Close entry
|
2014-05-07 21:56:48 +02:00
|
|
|
if($entry.hasClass('open')) {
|
|
|
|
$entry
|
2014-10-06 23:44:25 +02:00
|
|
|
.height($entry.outerHeight())
|
2014-05-07 23:51:03 +02:00
|
|
|
.removeClass('open');
|
|
|
|
|
|
|
|
setTimeout(function() {
|
|
|
|
$entry.css('height', $entry.attr('data-height') + 'px');
|
|
|
|
}, 0);
|
|
|
|
|
2014-10-06 23:37:23 +02:00
|
|
|
transitionComplete(function() {
|
2014-05-07 23:51:03 +02:00
|
|
|
$entry.find('.readme').remove();
|
|
|
|
$entry.css('height', 'auto');
|
|
|
|
});
|
2014-05-07 21:56:48 +02:00
|
|
|
}
|
2014-05-07 23:51:03 +02:00
|
|
|
//Open entry
|
2014-05-07 21:56:48 +02:00
|
|
|
else {
|
2014-05-07 23:51:03 +02:00
|
|
|
//Close open entries
|
|
|
|
$('.entry.open').each(function() {
|
2014-05-08 18:13:39 +02:00
|
|
|
var $entry = $(this);
|
|
|
|
$entry
|
2014-10-06 23:37:23 +02:00
|
|
|
.height($entry.outerHeight())
|
|
|
|
.removeClass('open');
|
2014-05-08 18:13:39 +02:00
|
|
|
|
2014-10-06 23:37:23 +02:00
|
|
|
setTimeout(function() {
|
|
|
|
$entry.css('height', $entry.attr('data-height') + 'px');
|
|
|
|
}, 0);
|
2014-05-08 18:13:39 +02:00
|
|
|
|
2014-10-06 23:37:23 +02:00
|
|
|
transitionComplete(function() {
|
|
|
|
$entry.find('.readme').remove();
|
|
|
|
$entry.css('height', 'auto');
|
|
|
|
});
|
2014-05-07 23:51:03 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
//Add the open class
|
2014-05-07 21:56:48 +02:00
|
|
|
$entry.addClass('open');
|
|
|
|
|
2014-05-07 23:51:03 +02:00
|
|
|
//Explicitly set heights for transitions
|
2014-10-06 23:44:25 +02:00
|
|
|
var height = $entry.outerHeight();
|
2014-05-07 23:51:03 +02:00
|
|
|
$entry
|
|
|
|
.attr('data-height', height)
|
|
|
|
.css('height', height);
|
|
|
|
|
|
|
|
//Get the data
|
2014-05-07 21:56:48 +02:00
|
|
|
$.ajax({
|
2014-10-20 03:44:02 +02:00
|
|
|
url: '-/readme/'+$entry.attr('data-name')+'/'+$entry.attr('data-version'),
|
2014-05-07 21:56:48 +02:00
|
|
|
dataType: 'text',
|
|
|
|
success: function(html) {
|
2014-05-07 23:51:03 +02:00
|
|
|
var $readme = $("<div class='readme'>")
|
2014-05-07 21:56:48 +02:00
|
|
|
.html(html)
|
|
|
|
.appendTo($entry);
|
2014-05-07 23:51:03 +02:00
|
|
|
|
|
|
|
$entry.height(height + $readme.outerHeight());
|
|
|
|
|
|
|
|
transitionComplete(function() {
|
|
|
|
$entry.css('height', 'auto');
|
|
|
|
});
|
2014-05-07 21:56:48 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2014-05-08 22:41:59 +02:00
|
|
|
|
2014-10-06 23:37:23 +02:00
|
|
|
},{"onclick":12,"transition-complete":14,"unopinionate":15}],3:[function(require,module,exports){
|
2014-05-07 21:28:10 +02:00
|
|
|
require('./search');
|
|
|
|
require('./entry');
|
2014-10-06 23:37:23 +02:00
|
|
|
|
|
|
|
},{"./entry":2,"./search":4}],4:[function(require,module,exports){
|
2014-05-07 20:08:29 +02:00
|
|
|
var $ = require('unopinionate').selector,
|
2014-05-08 23:34:16 +02:00
|
|
|
template = require('../entry.hbs'),
|
|
|
|
onScroll = require('onscroll');
|
2014-05-07 20:08:29 +02:00
|
|
|
|
|
|
|
$(function() {
|
2014-05-08 21:47:24 +02:00
|
|
|
'use strict';
|
|
|
|
|
2014-10-06 23:44:25 +02:00
|
|
|
(function( window, document ) {
|
2014-05-07 20:08:29 +02:00
|
|
|
|
2014-10-06 23:44:25 +02:00
|
|
|
var $form = $('#search-form');
|
|
|
|
var $input = $form.find('input');
|
|
|
|
var $body = $('body');
|
|
|
|
var $clear = $form.find('.clear');
|
|
|
|
var $searchResults = $("#search-results");
|
|
|
|
var $pkgListing = $("#all-packages");
|
|
|
|
var $searchBtn = $('.js-search-btn');
|
|
|
|
var request;
|
|
|
|
var currentResults;
|
2014-05-07 20:08:29 +02:00
|
|
|
|
2014-10-06 23:44:25 +02:00
|
|
|
var toggle = function( validQuery ) {
|
|
|
|
$searchResults.toggleClass( 'show', validQuery );
|
|
|
|
$pkgListing.toggleClass( 'hide', validQuery );
|
2014-05-07 20:08:29 +02:00
|
|
|
|
|
|
|
|
2014-10-06 23:44:25 +02:00
|
|
|
$searchBtn.find('i').toggleClass( 'icon-cancel', validQuery );
|
|
|
|
$searchBtn.find('i').toggleClass( 'icon-search', !validQuery );
|
|
|
|
};
|
2014-05-07 23:51:03 +02:00
|
|
|
|
2014-10-06 23:44:25 +02:00
|
|
|
$form.bind('submit keyup', function(e) {
|
|
|
|
var q, qBool;
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
q = $input.val();
|
|
|
|
qBool = q !== '';
|
|
|
|
|
|
|
|
toggle( qBool );
|
|
|
|
|
|
|
|
if( !qBool ) {
|
|
|
|
if( request && typeof request.abort === 'function' ) {
|
|
|
|
request.abort();
|
|
|
|
}
|
|
|
|
|
|
|
|
currentResults = null;
|
|
|
|
$searchResults.html('');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( request && typeof request.abort === 'function' ) {
|
2014-05-07 20:08:29 +02:00
|
|
|
request.abort();
|
|
|
|
}
|
|
|
|
|
2014-10-06 23:44:25 +02:00
|
|
|
if( !currentResults ) {
|
2014-10-20 03:44:02 +02:00
|
|
|
$searchResults.html( "<img class='search-ajax' src='-/static/ajax.gif' alt='Spinner'/>" );
|
2014-05-08 21:47:24 +02:00
|
|
|
}
|
|
|
|
|
2014-10-20 03:44:02 +02:00
|
|
|
request = $.getJSON('-/search/' + q, function( results ) {
|
2014-05-08 21:47:24 +02:00
|
|
|
currentResults = results;
|
|
|
|
|
2014-10-06 23:44:25 +02:00
|
|
|
if( results.length > 0 ) {
|
2014-05-07 20:08:29 +02:00
|
|
|
var html = '';
|
|
|
|
|
2014-10-06 23:44:25 +02:00
|
|
|
$.each(results, function( i, entry ) {
|
|
|
|
html += template( entry );
|
2014-05-07 20:08:29 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
$searchResults.html(html);
|
2014-10-06 23:44:25 +02:00
|
|
|
} else {
|
2014-05-07 22:36:03 +02:00
|
|
|
$searchResults.html("<div class='no-results'><big>No Results</big></div>");
|
2014-05-07 20:08:29 +02:00
|
|
|
}
|
|
|
|
});
|
2014-10-06 23:44:25 +02:00
|
|
|
});
|
2014-05-07 20:26:44 +02:00
|
|
|
|
2014-10-06 23:44:25 +02:00
|
|
|
$( document ).on( 'click', '.icon-cancel', function( e ) {
|
|
|
|
e.preventDefault();
|
|
|
|
$input.val('');
|
|
|
|
$form.keyup();
|
|
|
|
});
|
2014-05-08 23:34:16 +02:00
|
|
|
|
2014-10-06 23:44:25 +02:00
|
|
|
})( window, window.document );
|
2014-05-07 20:08:29 +02:00
|
|
|
});
|
|
|
|
|
2014-10-06 23:37:23 +02:00
|
|
|
},{"../entry.hbs":1,"onscroll":13,"unopinionate":15}],5:[function(require,module,exports){
|
2014-05-07 20:08:29 +02:00
|
|
|
"use strict";
|
|
|
|
/*globals Handlebars: true */
|
|
|
|
var base = require("./handlebars/base");
|
|
|
|
|
|
|
|
// Each of these augment the Handlebars object. No need to setup here.
|
|
|
|
// (This is done to easily share code between commonjs and browse envs)
|
|
|
|
var SafeString = require("./handlebars/safe-string")["default"];
|
|
|
|
var Exception = require("./handlebars/exception")["default"];
|
|
|
|
var Utils = require("./handlebars/utils");
|
|
|
|
var runtime = require("./handlebars/runtime");
|
|
|
|
|
|
|
|
// For compatibility and usage outside of module systems, make the Handlebars object a namespace
|
|
|
|
var create = function() {
|
|
|
|
var hb = new base.HandlebarsEnvironment();
|
|
|
|
|
|
|
|
Utils.extend(hb, base);
|
|
|
|
hb.SafeString = SafeString;
|
|
|
|
hb.Exception = Exception;
|
|
|
|
hb.Utils = Utils;
|
|
|
|
|
|
|
|
hb.VM = runtime;
|
|
|
|
hb.template = function(spec) {
|
|
|
|
return runtime.template(spec, hb);
|
|
|
|
};
|
|
|
|
|
|
|
|
return hb;
|
|
|
|
};
|
|
|
|
|
|
|
|
var Handlebars = create();
|
|
|
|
Handlebars.create = create;
|
|
|
|
|
|
|
|
exports["default"] = Handlebars;
|
2014-10-06 23:37:23 +02:00
|
|
|
},{"./handlebars/base":6,"./handlebars/exception":7,"./handlebars/runtime":8,"./handlebars/safe-string":9,"./handlebars/utils":10}],6:[function(require,module,exports){
|
2014-05-07 20:08:29 +02:00
|
|
|
"use strict";
|
|
|
|
var Utils = require("./utils");
|
|
|
|
var Exception = require("./exception")["default"];
|
|
|
|
|
|
|
|
var VERSION = "1.3.0";
|
|
|
|
exports.VERSION = VERSION;var COMPILER_REVISION = 4;
|
|
|
|
exports.COMPILER_REVISION = COMPILER_REVISION;
|
|
|
|
var REVISION_CHANGES = {
|
|
|
|
1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
|
|
|
|
2: '== 1.0.0-rc.3',
|
|
|
|
3: '== 1.0.0-rc.4',
|
|
|
|
4: '>= 1.0.0'
|
|
|
|
};
|
|
|
|
exports.REVISION_CHANGES = REVISION_CHANGES;
|
|
|
|
var isArray = Utils.isArray,
|
|
|
|
isFunction = Utils.isFunction,
|
|
|
|
toString = Utils.toString,
|
|
|
|
objectType = '[object Object]';
|
|
|
|
|
|
|
|
function HandlebarsEnvironment(helpers, partials) {
|
|
|
|
this.helpers = helpers || {};
|
|
|
|
this.partials = partials || {};
|
|
|
|
|
|
|
|
registerDefaultHelpers(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = {
|
|
|
|
constructor: HandlebarsEnvironment,
|
|
|
|
|
|
|
|
logger: logger,
|
|
|
|
log: log,
|
|
|
|
|
|
|
|
registerHelper: function(name, fn, inverse) {
|
|
|
|
if (toString.call(name) === objectType) {
|
|
|
|
if (inverse || fn) { throw new Exception('Arg not supported with multiple helpers'); }
|
|
|
|
Utils.extend(this.helpers, name);
|
|
|
|
} else {
|
|
|
|
if (inverse) { fn.not = inverse; }
|
|
|
|
this.helpers[name] = fn;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
registerPartial: function(name, str) {
|
|
|
|
if (toString.call(name) === objectType) {
|
|
|
|
Utils.extend(this.partials, name);
|
|
|
|
} else {
|
|
|
|
this.partials[name] = str;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
function registerDefaultHelpers(instance) {
|
|
|
|
instance.registerHelper('helperMissing', function(arg) {
|
|
|
|
if(arguments.length === 2) {
|
|
|
|
return undefined;
|
|
|
|
} else {
|
|
|
|
throw new Exception("Missing helper: '" + arg + "'");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
instance.registerHelper('blockHelperMissing', function(context, options) {
|
|
|
|
var inverse = options.inverse || function() {}, fn = options.fn;
|
|
|
|
|
|
|
|
if (isFunction(context)) { context = context.call(this); }
|
|
|
|
|
|
|
|
if(context === true) {
|
|
|
|
return fn(this);
|
|
|
|
} else if(context === false || context == null) {
|
|
|
|
return inverse(this);
|
|
|
|
} else if (isArray(context)) {
|
|
|
|
if(context.length > 0) {
|
|
|
|
return instance.helpers.each(context, options);
|
|
|
|
} else {
|
|
|
|
return inverse(this);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return fn(context);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
instance.registerHelper('each', function(context, options) {
|
|
|
|
var fn = options.fn, inverse = options.inverse;
|
|
|
|
var i = 0, ret = "", data;
|
|
|
|
|
|
|
|
if (isFunction(context)) { context = context.call(this); }
|
|
|
|
|
|
|
|
if (options.data) {
|
|
|
|
data = createFrame(options.data);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(context && typeof context === 'object') {
|
|
|
|
if (isArray(context)) {
|
|
|
|
for(var j = context.length; i<j; i++) {
|
|
|
|
if (data) {
|
|
|
|
data.index = i;
|
|
|
|
data.first = (i === 0);
|
|
|
|
data.last = (i === (context.length-1));
|
|
|
|
}
|
|
|
|
ret = ret + fn(context[i], { data: data });
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for(var key in context) {
|
|
|
|
if(context.hasOwnProperty(key)) {
|
|
|
|
if(data) {
|
|
|
|
data.key = key;
|
|
|
|
data.index = i;
|
|
|
|
data.first = (i === 0);
|
|
|
|
}
|
|
|
|
ret = ret + fn(context[key], {data: data});
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(i === 0){
|
|
|
|
ret = inverse(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
});
|
|
|
|
|
|
|
|
instance.registerHelper('if', function(conditional, options) {
|
|
|
|
if (isFunction(conditional)) { conditional = conditional.call(this); }
|
|
|
|
|
|
|
|
// Default behavior is to render the positive path if the value is truthy and not empty.
|
|
|
|
// The `includeZero` option may be set to treat the condtional as purely not empty based on the
|
|
|
|
// behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
|
|
|
|
if ((!options.hash.includeZero && !conditional) || Utils.isEmpty(conditional)) {
|
|
|
|
return options.inverse(this);
|
|
|
|
} else {
|
|
|
|
return options.fn(this);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
instance.registerHelper('unless', function(conditional, options) {
|
|
|
|
return instance.helpers['if'].call(this, conditional, {fn: options.inverse, inverse: options.fn, hash: options.hash});
|
|
|
|
});
|
|
|
|
|
|
|
|
instance.registerHelper('with', function(context, options) {
|
|
|
|
if (isFunction(context)) { context = context.call(this); }
|
|
|
|
|
|
|
|
if (!Utils.isEmpty(context)) return options.fn(context);
|
|
|
|
});
|
|
|
|
|
|
|
|
instance.registerHelper('log', function(context, options) {
|
|
|
|
var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
|
|
|
|
instance.log(level, context);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
var logger = {
|
|
|
|
methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' },
|
|
|
|
|
|
|
|
// State enum
|
|
|
|
DEBUG: 0,
|
|
|
|
INFO: 1,
|
|
|
|
WARN: 2,
|
|
|
|
ERROR: 3,
|
|
|
|
level: 3,
|
|
|
|
|
|
|
|
// can be overridden in the host environment
|
|
|
|
log: function(level, obj) {
|
|
|
|
if (logger.level <= level) {
|
|
|
|
var method = logger.methodMap[level];
|
|
|
|
if (typeof console !== 'undefined' && console[method]) {
|
|
|
|
console[method].call(console, obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
exports.logger = logger;
|
|
|
|
function log(level, obj) { logger.log(level, obj); }
|
|
|
|
|
|
|
|
exports.log = log;var createFrame = function(object) {
|
|
|
|
var obj = {};
|
|
|
|
Utils.extend(obj, object);
|
|
|
|
return obj;
|
|
|
|
};
|
|
|
|
exports.createFrame = createFrame;
|
2014-10-06 23:37:23 +02:00
|
|
|
},{"./exception":7,"./utils":10}],7:[function(require,module,exports){
|
2014-05-07 20:08:29 +02:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
|
|
|
|
|
|
|
|
function Exception(message, node) {
|
|
|
|
var line;
|
|
|
|
if (node && node.firstLine) {
|
|
|
|
line = node.firstLine;
|
|
|
|
|
|
|
|
message += ' - ' + line + ':' + node.firstColumn;
|
|
|
|
}
|
|
|
|
|
|
|
|
var tmp = Error.prototype.constructor.call(this, message);
|
|
|
|
|
|
|
|
// Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
|
|
|
|
for (var idx = 0; idx < errorProps.length; idx++) {
|
|
|
|
this[errorProps[idx]] = tmp[errorProps[idx]];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (line) {
|
|
|
|
this.lineNumber = line;
|
|
|
|
this.column = node.firstColumn;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Exception.prototype = new Error();
|
|
|
|
|
|
|
|
exports["default"] = Exception;
|
2014-10-06 23:37:23 +02:00
|
|
|
},{}],8:[function(require,module,exports){
|
2014-05-07 20:08:29 +02:00
|
|
|
"use strict";
|
|
|
|
var Utils = require("./utils");
|
|
|
|
var Exception = require("./exception")["default"];
|
|
|
|
var COMPILER_REVISION = require("./base").COMPILER_REVISION;
|
|
|
|
var REVISION_CHANGES = require("./base").REVISION_CHANGES;
|
|
|
|
|
|
|
|
function checkRevision(compilerInfo) {
|
|
|
|
var compilerRevision = compilerInfo && compilerInfo[0] || 1,
|
|
|
|
currentRevision = COMPILER_REVISION;
|
|
|
|
|
|
|
|
if (compilerRevision !== currentRevision) {
|
|
|
|
if (compilerRevision < currentRevision) {
|
|
|
|
var runtimeVersions = REVISION_CHANGES[currentRevision],
|
|
|
|
compilerVersions = REVISION_CHANGES[compilerRevision];
|
|
|
|
throw new Exception("Template was precompiled with an older version of Handlebars than the current runtime. "+
|
|
|
|
"Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+").");
|
|
|
|
} else {
|
|
|
|
// Use the embedded version info since the runtime doesn't know about this revision yet
|
|
|
|
throw new Exception("Template was precompiled with a newer version of Handlebars than the current runtime. "+
|
|
|
|
"Please update your runtime to a newer version ("+compilerInfo[1]+").");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.checkRevision = checkRevision;// TODO: Remove this line and break up compilePartial
|
|
|
|
|
|
|
|
function template(templateSpec, env) {
|
|
|
|
if (!env) {
|
|
|
|
throw new Exception("No environment passed to template");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Note: Using env.VM references rather than local var references throughout this section to allow
|
|
|
|
// for external users to override these as psuedo-supported APIs.
|
|
|
|
var invokePartialWrapper = function(partial, name, context, helpers, partials, data) {
|
|
|
|
var result = env.VM.invokePartial.apply(this, arguments);
|
|
|
|
if (result != null) { return result; }
|
|
|
|
|
|
|
|
if (env.compile) {
|
|
|
|
var options = { helpers: helpers, partials: partials, data: data };
|
|
|
|
partials[name] = env.compile(partial, { data: data !== undefined }, env);
|
|
|
|
return partials[name](context, options);
|
|
|
|
} else {
|
|
|
|
throw new Exception("The partial " + name + " could not be compiled when running in runtime-only mode");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// Just add water
|
|
|
|
var container = {
|
|
|
|
escapeExpression: Utils.escapeExpression,
|
|
|
|
invokePartial: invokePartialWrapper,
|
|
|
|
programs: [],
|
|
|
|
program: function(i, fn, data) {
|
|
|
|
var programWrapper = this.programs[i];
|
|
|
|
if(data) {
|
|
|
|
programWrapper = program(i, fn, data);
|
|
|
|
} else if (!programWrapper) {
|
|
|
|
programWrapper = this.programs[i] = program(i, fn);
|
|
|
|
}
|
|
|
|
return programWrapper;
|
|
|
|
},
|
|
|
|
merge: function(param, common) {
|
|
|
|
var ret = param || common;
|
|
|
|
|
|
|
|
if (param && common && (param !== common)) {
|
|
|
|
ret = {};
|
|
|
|
Utils.extend(ret, common);
|
|
|
|
Utils.extend(ret, param);
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
},
|
|
|
|
programWithDepth: env.VM.programWithDepth,
|
|
|
|
noop: env.VM.noop,
|
|
|
|
compilerInfo: null
|
|
|
|
};
|
|
|
|
|
|
|
|
return function(context, options) {
|
|
|
|
options = options || {};
|
|
|
|
var namespace = options.partial ? options : env,
|
|
|
|
helpers,
|
|
|
|
partials;
|
|
|
|
|
|
|
|
if (!options.partial) {
|
|
|
|
helpers = options.helpers;
|
|
|
|
partials = options.partials;
|
|
|
|
}
|
|
|
|
var result = templateSpec.call(
|
|
|
|
container,
|
|
|
|
namespace, context,
|
|
|
|
helpers,
|
|
|
|
partials,
|
|
|
|
options.data);
|
|
|
|
|
|
|
|
if (!options.partial) {
|
|
|
|
env.VM.checkRevision(container.compilerInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.template = template;function programWithDepth(i, fn, data /*, $depth */) {
|
|
|
|
var args = Array.prototype.slice.call(arguments, 3);
|
|
|
|
|
|
|
|
var prog = function(context, options) {
|
|
|
|
options = options || {};
|
|
|
|
|
|
|
|
return fn.apply(this, [context, options.data || data].concat(args));
|
|
|
|
};
|
|
|
|
prog.program = i;
|
|
|
|
prog.depth = args.length;
|
|
|
|
return prog;
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.programWithDepth = programWithDepth;function program(i, fn, data) {
|
|
|
|
var prog = function(context, options) {
|
|
|
|
options = options || {};
|
|
|
|
|
|
|
|
return fn(context, options.data || data);
|
|
|
|
};
|
|
|
|
prog.program = i;
|
|
|
|
prog.depth = 0;
|
|
|
|
return prog;
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.program = program;function invokePartial(partial, name, context, helpers, partials, data) {
|
|
|
|
var options = { partial: true, helpers: helpers, partials: partials, data: data };
|
|
|
|
|
|
|
|
if(partial === undefined) {
|
|
|
|
throw new Exception("The partial " + name + " could not be found");
|
|
|
|
} else if(partial instanceof Function) {
|
|
|
|
return partial(context, options);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.invokePartial = invokePartial;function noop() { return ""; }
|
|
|
|
|
|
|
|
exports.noop = noop;
|
2014-10-06 23:37:23 +02:00
|
|
|
},{"./base":6,"./exception":7,"./utils":10}],9:[function(require,module,exports){
|
2014-05-07 20:08:29 +02:00
|
|
|
"use strict";
|
|
|
|
// Build out our basic SafeString type
|
|
|
|
function SafeString(string) {
|
|
|
|
this.string = string;
|
|
|
|
}
|
|
|
|
|
|
|
|
SafeString.prototype.toString = function() {
|
|
|
|
return "" + this.string;
|
|
|
|
};
|
|
|
|
|
|
|
|
exports["default"] = SafeString;
|
2014-10-06 23:37:23 +02:00
|
|
|
},{}],10:[function(require,module,exports){
|
2014-05-07 20:08:29 +02:00
|
|
|
"use strict";
|
|
|
|
/*jshint -W004 */
|
|
|
|
var SafeString = require("./safe-string")["default"];
|
|
|
|
|
|
|
|
var escape = {
|
|
|
|
"&": "&",
|
|
|
|
"<": "<",
|
|
|
|
">": ">",
|
|
|
|
'"': """,
|
|
|
|
"'": "'",
|
|
|
|
"`": "`"
|
|
|
|
};
|
|
|
|
|
|
|
|
var badChars = /[&<>"'`]/g;
|
|
|
|
var possible = /[&<>"'`]/;
|
|
|
|
|
|
|
|
function escapeChar(chr) {
|
|
|
|
return escape[chr] || "&";
|
|
|
|
}
|
|
|
|
|
|
|
|
function extend(obj, value) {
|
|
|
|
for(var key in value) {
|
|
|
|
if(Object.prototype.hasOwnProperty.call(value, key)) {
|
|
|
|
obj[key] = value[key];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.extend = extend;var toString = Object.prototype.toString;
|
|
|
|
exports.toString = toString;
|
|
|
|
// Sourced from lodash
|
|
|
|
// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
|
|
|
|
var isFunction = function(value) {
|
|
|
|
return typeof value === 'function';
|
|
|
|
};
|
|
|
|
// fallback for older versions of Chrome and Safari
|
|
|
|
if (isFunction(/x/)) {
|
|
|
|
isFunction = function(value) {
|
|
|
|
return typeof value === 'function' && toString.call(value) === '[object Function]';
|
|
|
|
};
|
|
|
|
}
|
|
|
|
var isFunction;
|
|
|
|
exports.isFunction = isFunction;
|
|
|
|
var isArray = Array.isArray || function(value) {
|
|
|
|
return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false;
|
|
|
|
};
|
|
|
|
exports.isArray = isArray;
|
|
|
|
|
|
|
|
function escapeExpression(string) {
|
|
|
|
// don't escape SafeStrings, since they're already safe
|
|
|
|
if (string instanceof SafeString) {
|
|
|
|
return string.toString();
|
|
|
|
} else if (!string && string !== 0) {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
// Force a string conversion as this will be done by the append regardless and
|
|
|
|
// the regex test will do this transparently behind the scenes, causing issues if
|
|
|
|
// an object's to string has escaped characters in it.
|
|
|
|
string = "" + string;
|
|
|
|
|
|
|
|
if(!possible.test(string)) { return string; }
|
|
|
|
return string.replace(badChars, escapeChar);
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.escapeExpression = escapeExpression;function isEmpty(value) {
|
|
|
|
if (!value && value !== 0) {
|
|
|
|
return true;
|
|
|
|
} else if (isArray(value) && value.length === 0) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.isEmpty = isEmpty;
|
2014-10-06 23:37:23 +02:00
|
|
|
},{"./safe-string":9}],11:[function(require,module,exports){
|
2014-05-07 20:08:29 +02:00
|
|
|
// Create a simple path alias to allow browserify to resolve
|
|
|
|
// the runtime on a supported path.
|
|
|
|
module.exports = require('./dist/cjs/handlebars.runtime');
|
|
|
|
|
2014-10-06 23:37:23 +02:00
|
|
|
},{"./dist/cjs/handlebars.runtime":5}],12:[function(require,module,exports){
|
2014-05-07 21:56:48 +02:00
|
|
|
var $ = require('unopinionate').selector;
|
|
|
|
|
|
|
|
var $document = $(document),
|
|
|
|
bindings = {};
|
|
|
|
|
|
|
|
var click = function(events) {
|
|
|
|
click.bind.apply(click, arguments);
|
|
|
|
return click;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*** Configuration Options ***/
|
|
|
|
click.distanceLimit = 10;
|
|
|
|
click.timeLimit = 140;
|
|
|
|
|
|
|
|
/*** Useful Properties ***/
|
|
|
|
click.isTouch = ('ontouchstart' in window) ||
|
|
|
|
window.DocumentTouch &&
|
|
|
|
document instanceof DocumentTouch;
|
|
|
|
|
|
|
|
/*** Cached Functions ***/
|
|
|
|
var onTouchstart = function(e) {
|
|
|
|
e.stopPropagation(); //Prevents multiple click events from happening
|
|
|
|
|
|
|
|
click._doAnywheres(e);
|
|
|
|
|
|
|
|
var $this = $(this),
|
|
|
|
startTime = new Date().getTime(),
|
|
|
|
startPos = click._getPos(e);
|
|
|
|
|
|
|
|
$this.one('touchend', function(e) {
|
|
|
|
e.preventDefault(); //Prevents click event from firing
|
|
|
|
|
|
|
|
var time = new Date().getTime() - startTime,
|
|
|
|
endPos = click._getPos(e),
|
|
|
|
distance = Math.sqrt(
|
|
|
|
Math.pow(endPos.x - startPos.x, 2) +
|
|
|
|
Math.pow(endPos.y - startPos.y, 2)
|
|
|
|
);
|
|
|
|
|
|
|
|
if(time < click.timeLimit && distance < click.distanceLimit) {
|
|
|
|
//Find the correct callback
|
|
|
|
$.each(bindings, function(selector, callback) {
|
|
|
|
if($this.is(selector)) {
|
|
|
|
callback.apply(e.target, [e]);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
/*** API ***/
|
|
|
|
click.bind = function(events) {
|
|
|
|
|
|
|
|
//Argument Surgery
|
|
|
|
if(!$.isPlainObject(events)) {
|
|
|
|
newEvents = {};
|
|
|
|
newEvents[arguments[0]] = arguments[1];
|
|
|
|
events = newEvents;
|
|
|
|
}
|
|
|
|
|
|
|
|
$.each(events, function(selector, callback) {
|
|
|
|
|
|
|
|
/*** Register Binding ***/
|
|
|
|
if(typeof bindings[selector] != 'undefined') {
|
|
|
|
click.unbind(selector); //Ensure no duplicates
|
|
|
|
}
|
|
|
|
|
|
|
|
bindings[selector] = callback;
|
|
|
|
|
|
|
|
/*** Touch Support ***/
|
|
|
|
if(click.isTouch) {
|
|
|
|
$document.delegate(selector, 'touchstart', onTouchstart);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** Mouse Support ***/
|
|
|
|
$document.delegate(selector, 'click', function(e) {
|
|
|
|
e.stopPropagation(); //Prevents multiple click events from happening
|
|
|
|
//click._doAnywheres(e); //Do anywheres first to be consistent with touch order
|
|
|
|
callback.apply(this, [e]);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
return this;
|
|
|
|
};
|
|
|
|
|
|
|
|
click.unbind = function(selector) {
|
|
|
|
$document
|
|
|
|
.undelegate(selector, 'touchstart')
|
|
|
|
.undelegate(selector, 'click');
|
|
|
|
|
|
|
|
delete bindings[selector];
|
|
|
|
|
|
|
|
return this;
|
|
|
|
};
|
|
|
|
|
|
|
|
click.unbindAll = function() {
|
|
|
|
$.each(bindings, function(selector, callback) {
|
|
|
|
$document
|
|
|
|
.undelegate(selector, 'touchstart')
|
|
|
|
.undelegate(selector, 'click');
|
|
|
|
});
|
|
|
|
|
|
|
|
bindings = {};
|
|
|
|
|
|
|
|
return this;
|
|
|
|
};
|
|
|
|
|
|
|
|
click.trigger = function(selector, e) {
|
|
|
|
e = e || $.Event('click');
|
|
|
|
|
|
|
|
if(typeof bindings[selector] != 'undefined') {
|
|
|
|
bindings[selector](e);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
console.error("No click events bound for selector '"+selector+"'.");
|
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
};
|
|
|
|
|
|
|
|
click.anywhere = function(callback) {
|
|
|
|
click._anywheres.push(callback);
|
|
|
|
return this;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*** Internal (but useful) Methods ***/
|
|
|
|
click._getPos = function(e) {
|
|
|
|
e = e.originalEvent;
|
|
|
|
|
|
|
|
if(e.pageX || e.pageY) {
|
|
|
|
return {
|
|
|
|
x: e.pageX,
|
|
|
|
y: e.pageY
|
|
|
|
};
|
|
|
|
}
|
|
|
|
else if(e.changedTouches) {
|
|
|
|
return {
|
|
|
|
x: e.changedTouches[0].clientX,
|
|
|
|
y: e.changedTouches[0].clientY
|
|
|
|
};
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return {
|
|
|
|
x: e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft,
|
|
|
|
y: e.clientY + document.body.scrollTop + document.documentElement.scrollTop
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
click._anywheres = [];
|
|
|
|
|
|
|
|
click._doAnywheres = function(e) {
|
|
|
|
var i = click._anywheres.length;
|
|
|
|
while(i--) {
|
|
|
|
click._anywheres[i](e);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
$(document).bind('mousedown', click._doAnywheres);
|
|
|
|
|
|
|
|
module.exports = click;
|
|
|
|
|
|
|
|
|
2014-10-06 23:37:23 +02:00
|
|
|
},{"unopinionate":15}],13:[function(require,module,exports){
|
2014-05-08 22:41:59 +02:00
|
|
|
var $ = require('unopinionate').selector;
|
|
|
|
|
|
|
|
var bodyScrollers = [];
|
|
|
|
|
|
|
|
$(function() {
|
|
|
|
var $html = $('html'),
|
|
|
|
$body = $('body');
|
|
|
|
|
|
|
|
$(window, document, 'body').bind('scroll touchmove', function() {
|
|
|
|
var top = $html[0].scrollTop || $body[0].scrollTop;
|
|
|
|
|
|
|
|
for(var i=0; i<bodyScrollers.length; i++) {
|
|
|
|
bodyScrollers[i](top);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
var onScroll = function(callback) {
|
|
|
|
bodyScrollers.push(callback);
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = onScroll;
|
2014-10-06 23:37:23 +02:00
|
|
|
},{"unopinionate":15}],14:[function(require,module,exports){
|
2014-05-07 23:51:03 +02:00
|
|
|
(function(root) {
|
|
|
|
var callbacks = [];
|
|
|
|
|
|
|
|
var transitionComplete = function(callback) {
|
|
|
|
if(callbacks.length === 0) {
|
|
|
|
setEvent();
|
|
|
|
}
|
|
|
|
|
|
|
|
callbacks.push(callback);
|
|
|
|
};
|
|
|
|
|
|
|
|
function setEvent() {
|
|
|
|
document.addEventListener(eventName(), function() {
|
|
|
|
var i = callbacks.length;
|
|
|
|
while(i--) {
|
|
|
|
callbacks[i]();
|
|
|
|
}
|
|
|
|
|
|
|
|
callbacks = [];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
var _eventName;
|
|
|
|
|
|
|
|
function eventName() {
|
|
|
|
if(!_eventName) {
|
|
|
|
// Sourced from: http://stackoverflow.com/questions/5023514/how-do-i-normalize-css3-transition-functions-across-browsers
|
|
|
|
var el = document.createElement('fakeelement');
|
|
|
|
transitions = {
|
|
|
|
transition: 'transitionend',
|
|
|
|
OTransition: 'oTransitionEnd',
|
|
|
|
MozTransition: 'transitionend',
|
|
|
|
WebkitTransition: 'webkitTransitionEnd'
|
|
|
|
};
|
|
|
|
|
|
|
|
for(var t in transitions) {
|
|
|
|
if(el.style[t] !== undefined) {
|
|
|
|
_eventName = transitions[t];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return _eventName;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** Export ***/
|
|
|
|
|
|
|
|
// AMD
|
|
|
|
if(typeof define === 'function' && define.amd) {
|
|
|
|
define([], function() {
|
|
|
|
return transitionComplete;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
// CommonJS
|
|
|
|
else if(typeof exports !== 'undefined') {
|
|
|
|
module.exports = transitionComplete;
|
|
|
|
}
|
|
|
|
// Browser Global
|
|
|
|
else {
|
|
|
|
root.transitionComplete = transitionComplete;
|
|
|
|
}
|
|
|
|
})(this);
|
|
|
|
|
2014-10-06 23:37:23 +02:00
|
|
|
},{}],15:[function(require,module,exports){
|
2014-05-07 20:08:29 +02:00
|
|
|
(function (global){
|
|
|
|
(function(root) {
|
|
|
|
var unopinionate = {
|
|
|
|
selector: root.jQuery || root.Zepto || root.ender || root.$,
|
|
|
|
template: root.Handlebars || root.Mustache
|
|
|
|
};
|
|
|
|
|
|
|
|
/*** Export ***/
|
|
|
|
|
|
|
|
//AMD
|
|
|
|
if(typeof define === 'function' && define.amd) {
|
|
|
|
define([], function() {
|
|
|
|
return unopinionate;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
//CommonJS
|
|
|
|
else if(typeof module.exports !== 'undefined') {
|
|
|
|
module.exports = unopinionate;
|
|
|
|
}
|
|
|
|
//Global
|
|
|
|
else {
|
|
|
|
root.unopinionate = unopinionate;
|
|
|
|
}
|
|
|
|
})(typeof window != 'undefined' ? window : global);
|
|
|
|
|
|
|
|
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
2014-10-06 23:37:23 +02:00
|
|
|
},{}]},{},[3]);
|