summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2016-09-02 13:24:55 -0400
committerJules Laplace <jules@okfoc.us>2016-09-02 13:24:55 -0400
commit8def9579f2a78e80652d1e5e6f1eda510ae9a5dd (patch)
treec56d664f04d55f0d75c6d4f5e2d6fc567054498d
parent4ed81fa59119cee66b0413c5662639ec81fea4dc (diff)
parent5052d51aa4c55eabc736b3c76a783db2f5208289 (diff)
merge changes from twohustlers
-rw-r--r--.gitignore3
-rw-r--r--Gruntfile.js71
-rw-r--r--Readme.md36
-rw-r--r--app/index.js233
-rw-r--r--app/node_modules/okadminview/index.js391
-rw-r--r--app/node_modules/okadminview/package.json5
-rw-r--r--app/node_modules/okdb/index.js213
-rw-r--r--app/node_modules/okdb/package.json3
-rw-r--r--app/node_modules/okquery/index.js73
-rw-r--r--app/node_modules/okquery/package.json1
-rw-r--r--app/node_modules/okresource/index.js204
-rw-r--r--app/node_modules/okresource/package.json1
-rw-r--r--app/node_modules/okschema/index.js178
-rw-r--r--app/node_modules/okschema/package.json2
-rw-r--r--app/node_modules/okserver/index.js30
-rw-r--r--app/node_modules/okservices/index.js41
-rwxr-xr-xapp/node_modules/okservices/install.sh1
-rw-r--r--app/node_modules/okservices/oks3/index.js145
-rw-r--r--app/node_modules/okservices/oks3/package.json16
-rw-r--r--app/node_modules/okservices/oks3/upload.js79
-rw-r--r--app/node_modules/okservices/oktwitter/Readme.md6
-rw-r--r--app/node_modules/okservices/oktwitter/index.js48
-rw-r--r--app/node_modules/okservices/oktwitter/package.json13
-rw-r--r--app/node_modules/okservices/okwebhook/index.js83
-rw-r--r--app/node_modules/okservices/okwebhook/package.json11
-rw-r--r--app/node_modules/okservices/package.json8
-rw-r--r--app/node_modules/oktemplate/index.js74
-rw-r--r--app/node_modules/oktemplate/package.json1
-rw-r--r--app/node_modules/okview/index.js148
-rw-r--r--examples/db.json255
-rw-r--r--examples/index.js69
-rw-r--r--examples/lib/okdumpfm/index.js39
-rw-r--r--examples/lib/okdumpfm/package.json14
-rw-r--r--examples/lib/okexample/index.js49
-rw-r--r--examples/lib/okexample/package.json11
-rwxr-xr-xinstall.sh6
-rw-r--r--package.json18
-rw-r--r--site/DEPLOY21
-rw-r--r--site/TODO2
-rw-r--r--site/db.json1379
-rw-r--r--site/index.js96
-rw-r--r--site/public/assets/app.min.js8
-rw-r--r--site/public/assets/images/2H_LOGOMARK.svg58
-rw-r--r--site/public/assets/images/next.pngbin563 -> 1063 bytes
-rw-r--r--site/public/assets/images/prev.pngbin0 -> 1069 bytes
-rw-r--r--site/public/assets/javascripts/_env.js555
-rw-r--r--site/public/assets/javascripts/app.js20
-rw-r--r--site/public/assets/javascripts/mx/extensions/mx.unclampedOrbitCameraMobile.js225
-rw-r--r--site/public/assets/javascripts/vendor/fastclick.js790
-rw-r--r--site/public/assets/javascripts/vendor/flickity.pkgd.js215
-rw-r--r--site/public/assets/javascripts/vendor/loader.js23
-rw-r--r--site/public/assets/javascripts/vendor/polyfill.js32
-rw-r--r--site/public/assets/javascripts/vendor/util.js21
-rw-r--r--site/public/assets/style.css470
-rw-r--r--site/templates/about.liquid13
-rw-r--r--site/templates/all.liquid26
-rw-r--r--site/templates/index.liquid134
-rw-r--r--site/templates/page.liquid16
-rw-r--r--site/templates/project.liquid26
-rw-r--r--themes/okadmin/public/css/main.css238
-rw-r--r--themes/okadmin/public/js/app.js346
-rw-r--r--themes/okadmin/public/js/parser.js49
-rw-r--r--themes/okadmin/public/js/upload.js225
-rw-r--r--themes/okadmin/templates/404.liquid54
-rw-r--r--themes/okadmin/templates/5xx.liquid54
-rw-r--r--themes/okadmin/templates/index.liquid82
-rw-r--r--themes/okadmin/templates/partials/errors.liquid10
-rw-r--r--themes/okadmin/templates/partials/flash.liquid20
-rw-r--r--themes/okadmin/templates/partials/head.liquid6
-rw-r--r--themes/okadmin/templates/partials/inputs.liquid346
-rw-r--r--themes/okadmin/templates/partials/tail.liquid13
-rw-r--r--themes/okadmin/templates/resource.liquid18
-rw-r--r--themes/okadmin/templates/resource_new.liquid6
73 files changed, 6947 insertions, 1229 deletions
diff --git a/.gitignore b/.gitignore
index 0f331a0..e2282ba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,4 +5,7 @@
*.swp
.DS_Store
.env
+.tmp
+npm-debug.log
+site/public/decks/
diff --git a/Gruntfile.js b/Gruntfile.js
index 73fb8f7..bb6f1eb 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -3,43 +3,31 @@ module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
- dentist: {
- options: {
- include_js: "assets/javascripts/app.min.js",
- include_css: "assets/stylesheets/css.css"
- },
- build: {
- src: 'index.html',
- dest_js: 'tmp/null',
- dest_css: 'tmp/null',
- dest_html: 'dist/index.html'
- }
- },
concat: {
index: {
options: {
separator: "\n;\n"
},
src: [
- "assets/javascripts/vendor/loader.js",
- "assets/javascripts/vendor/froogaloop.js",
- "assets/javascripts/vendor/flickity.pkgd.js",
- "assets/javascripts/vendor/wheel.js",
- "assets/javascripts/vendor/polyfill.js",
- "assets/javascripts/vendor/util.js",
-
- "assets/javascripts/mx/mx.skew.js",
- "assets/javascripts/mx/extensions/mx.scene.js",
- "assets/javascripts/mx/extensions/mx.unclampedOrbitCamera.js",
- "assets/javascripts/mx/primitives/mx.image.js",
- "assets/javascripts/environments/app.js",
- "assets/javascripts/environments/path.js",
+ "site/public/assets/javascripts/mx/mx.skew.js",
+ "site/public/assets/javascripts/mx/extensions/mx.scene.js",
+ "site/public/assets/javascripts/mx/extensions/mx.unclampedOrbitCamera.js",
+ "site/public/assets/javascripts/mx/extensions/mx.unclampedOrbitCameraMobile.js",
+ "site/public/assets/javascripts/mx/primitives/mx.image.js",
- "assets/javascripts/_env.js",
+ "site/public/assets/javascripts/vendor/jquery.min.js",
+ "site/public/assets/javascripts/vendor/froogaloop.js",
+ "site/public/assets/javascripts/vendor/fastclick.js",
+ "site/public/assets/javascripts/vendor/flickity.pkgd.js",
+ "site/public/assets/javascripts/vendor/loader.js",
+ "site/public/assets/javascripts/vendor/wheel.js",
+ "site/public/assets/javascripts/vendor/polyfill.js",
+ "site/public/assets/javascripts/vendor/util.js",
- "assets/javascripts/app.js",
+ "site/public/assets/javascripts/_env.js",
+ "site/public/assets/javascripts/app.js",
],
- dest: 'dist/app.concat.js',
+ dest: 'site/public/assets/app.concat.js',
},
},
@@ -48,35 +36,16 @@ module.exports = function(grunt) {
banner: '/* okfoc.us 2o15 */\n'
},
index: {
- src: 'dist/app.concat.js',
- dest: 'dist/assets/javascripts/app.min.js'
+ src: 'site/public/assets/app.concat.js',
+ dest: 'site/public/assets/app.min.js'
}
},
clean: {
release: [
- "dist/app.concat.js",
- "dist/app.init.js",
+ "site/public/assets/app.concat.js",
"tmp/"
],
- },
-
- copy: {
- build: {
- files: [
- {
- nonull: true,
- expand: true,
- src: [
- 'assets/stylesheets/css.css',
- 'favicon.ico',
- 'icon.jpg',
- 'icon2.jpg',
- ],
- dest: "dist/"
- },
- ]
- },
}
});
@@ -88,5 +57,5 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-dentist');
// Default task(s).
- grunt.registerTask('default', ['dentist', 'concat', 'uglify', 'copy', 'clean']);
+ grunt.registerTask('default', ['concat', 'uglify', 'clean']);
};
diff --git a/Readme.md b/Readme.md
index 3b2d832..771a1f2 100644
--- a/Readme.md
+++ b/Readme.md
@@ -3,23 +3,31 @@
> "Pretty good"
> - Steve Jobs
-## To configure:
+## To run the demo:
-* Customize schemas and routes in site/index.js as needed
-* Create a file `site/.env` with the following environment variables set:
+* npm install
+* cd examples
+* node index
+
+Server will be running on http://lvh.me:1337/
+
+Admin area available on http://lvh.me:1337/admin/
+
+## Config
+
+To access the admin area, you need to set a username and password.
+To do that create a file called `.env` in the project directory with
+the following contents:
```
-S3_KEY=...
-S3_SECRET=...
-S3_BUCKET=...
-OK_USER=...
-OK_PASS=...
+OK_USER=username
+OK_PASS=password
```
-## To install and run:
-
-* Run `./install.sh`
-* `cd site`
-* `node index`
+S3 needs to be configured in the same way:
+```
+S3_KEY=s3key
+S3_SECRET=s3secret
+S3_BUCKET=bucketname
+```
-Server will be running on http://lvh.me:1337/
diff --git a/app/index.js b/app/index.js
index b312eb1..c0d2ff3 100644
--- a/app/index.js
+++ b/app/index.js
@@ -13,7 +13,9 @@ var OKResource = require('okresource')
var OKTemplate = require('oktemplate');
var OKServer = require('okserver');
var OKSchema = require('okschema');
-var OKImageService = require('okservices').OKImageService;
+var OKS3Service = require('okservices/oks3');
+var OKTwitterService = require('okservices/oktwitter')
+var OKWebhookService = require('okservices/okwebhook')
require('dotenv').load();
@@ -27,72 +29,103 @@ function OKCMS(options) {
var app = express();
app.enable('strict routing');
+ app.disable('x-powered-by');
+
+ var schemaConfig = options.schemas || {};
+ var resourceConfig = options.resources || [];
+ var viewConfig = options.views || {
+ '/': { template: 'index' }
+ };
+ var serviceConfig = options.services || {};
+ var adminConfig = options.admin || {}
var root = this._root = options.root || 'public';
- var adminConfig = options.admin || {};
+ var templateRoot = options.templateRoot || 'templates';
+
+ var adminPath = this._adminPath = adminConfig.path || '/admin';
var adminRoot = this._adminRoot = adminConfig.root ||
path.join(__dirname, '../themes/okadmin/public');
- var adminPath = this._adminPath = adminConfig.path || '/_admin'
- var templateRoot = options.templateRoot || 'templates';
- var adminTemplateRoot = options.templateRoot ||
+ var adminTemplateRoot = adminConfig.templateRoot ||
path.join(__dirname, '../themes/okadmin/templates');
- // Set metadata defaults
- // TODO Abstract this out somewhere else
- var meta = {
- type: 'meta',
- get: function() {
- return Q.promise(function(resolve, reject) {
- db.getMeta().then(function(metadata) {
- resolve(assign({}, {
- static: ''
- }, metadata));
- }).fail(reject);
- });
- }
- };
+ var debug = !!options.debug;
+ var production = !!options.production;
- var adminMeta ={
- type: 'meta',
- get: function() {
- return Q.promise(function(resolve, reject) {
- db.getMeta().then(function(metadata) {
- resolve(assign({}, {
- static: withoutTrailingSlash(adminPath)
- }, metadata));
- }).fail(reject);
- });
- }
+ var metaUser = options.meta || {};
+ var metaDefault = {
+ project: 'OKCMS',
+ production: production,
+ debug: debug
};
- var schemaConfig = options.schemas || {};
- var resourceConfig = options.resources || [];
- var viewConfig = options.views || {
- '/': { template: 'index' }
- };
- var serviceConfig = options.services || {};
+ var meta = assign({
+ static: ''
+ }, metaDefault, metaUser);
- var templateProvider = this._templateProvider =
- new OKTemplate({root: templateRoot});
- var adminTemplateProvider = this._adminTemplateProvider =
- new OKTemplate({root: adminTemplateRoot});
+ var adminMeta = assign({
+ static: withoutTrailingSlash(adminPath),
+ services: options.services,
+ }, metaDefault, metaUser);
+
+ var templateProvider = this._templateProvider = new OKTemplate({
+ root: templateRoot,
+ debug: debug
+ });
+ var adminTemplateProvider = this._adminTemplateProvider = new OKTemplate({
+ root: adminTemplateRoot,
+ debug: debug
+ });
- var db = new OKDB(options.db || 'fs');
var schemas = this._schemas = this._createSchemas(schemaConfig);
+ var db = new OKDB({
+ db: options.db || 'fs',
+ schemas: schemas
+ });
var resourceCache = this._resourceCache =
this._createResources(resourceConfig, db, schemas);
-
+ this._resolveForeignKeys(resourceCache)
+ var errorHandler = createErrorHandlerProducer(
+ templateProvider, adminTemplateProvider, debug);
// Create view instances from config
var views = this._views =
- this._createViews(viewConfig, db, meta, resourceCache, templateProvider);
+ this._createViews(viewConfig, db, meta, resourceCache, templateProvider,
+ errorHandler);
var adminViews = this._adminViews =
- this._createAdminViews(adminPath, app, express, resourceConfig,
- resourceCache, adminTemplateProvider, adminMeta);
+ this._createAdminViews(adminConfig, adminPath, app, express, resourceConfig,
+ resourceCache, adminTemplateProvider, adminMeta,
+ errorHandler);
// Create services
- var imageService = OKImageService({
- express: express,
- s3: serviceConfig.s3,
+ var services = {}
+ Object.keys(serviceConfig).forEach(function(key){
+ var config = serviceConfig[key]
+ switch (key) {
+ case 's3':
+ services.s3 = OKS3Service({
+ express: express,
+ s3: config,
+ });
+ break
+ case 'twitter':
+ services.twitter = OKTwitterService({
+ express: express,
+ credentials: config,
+ });
+ break
+ case 'webhook':
+ services.webhook = OKWebhookService({
+ express: express,
+ config: config,
+ });
+ break
+ default:
+ services[key] = config.lib({
+ db: resourceCache,
+ express: express,
+ config: config,
+ });
+ break
+ }
});
var server = this._server = new OKServer({
@@ -104,9 +137,8 @@ function OKCMS(options) {
root: root,
adminRoot: adminRoot,
adminPath: adminPath,
- services: {
- image: imageService
- }
+ services: services,
+ errorHandler: errorHandler
});
}
@@ -119,6 +151,11 @@ OKCMS.prototype._createSchemas = function(schemaConfig) {
schemaConfig = schemaConfig || {};
return Object.keys(schemaConfig).reduce(function(cache, key) {
var spec = schemaConfig[key];
+ // All resources have an autoincrementing index so we can order them suckas
+ // TODO Screw the __ prefix, just consider 'index' a reserved word
+ spec.__index = {type: 'meta', autoincrement: true};
+ // All resources have a dateCreated field
+ spec.dateCreated = {type: 'meta'};
cache[key] = OKSchema(spec);
return cache;
}, {});
@@ -130,8 +167,8 @@ OKCMS.prototype._createResources = function(resourceConfig, db, schemaCache) {
var type = config.type;
var schema = schemaCache[type];
if (!schema)
- throw new Error('Resource config references nonexistent schema');
- var resource = OKResource({
+ throw new Error('Resource config references nonexistent schema ' + type);
+ var resource = new OKResource({
type: type,
db: db,
schema: schema
@@ -146,8 +183,23 @@ OKCMS.prototype._createResources = function(resourceConfig, db, schemaCache) {
return ResourceCache(resources);
};
+OKCMS.prototype._resolveForeignKeys = function(resourceCache) {
+ resourceCache.forEach(function(resource) {
+ Object.keys(resource.foreignKeys).forEach(function(field) {
+ var foreignKeyType = resource.foreignKeys[field]
+ var keyedResource = resourceCache.get(foreignKeyType)
+ if (!keyedResource) {
+ throw new Error(format(
+ "Foreign key field '%s' in '%s' resource references unknown" +
+ "resource of type '%s'", field, resource.type, foreignKeyType))
+ }
+ resource._linkForeignKey(field, resourceCache.get(foreignKeyType))
+ })
+ })
+}
+
OKCMS.prototype._createViews = function(viewConfig, db,
- meta, resourceCache, templateProvider) {
+ meta, resourceCache, templateProvider, errorHandler) {
viewConfig = viewConfig || {};
var self = this;
var createQueries = this._createQueries.bind(this);
@@ -158,15 +210,15 @@ OKCMS.prototype._createViews = function(viewConfig, db,
if (!template) {
throw new Error(format('No template named "%s" found', templateName));
}
- var queryConfig = config.data || [];
- var queries = createQueries(queryConfig, resourceCache);
+ var queries = createQueries(config.data, resourceCache);
// Don't forget to add that trailing slash if the user forgot
cache[withTrailingSlash(route)] = OKView({
mount: 'get', // User defined views are read only
route: route,
template: template,
queries: queries,
- meta: meta
+ meta: meta,
+ errorHandler: errorHandler
});
return cache;
}, {});
@@ -187,8 +239,8 @@ OKCMS.prototype._createViews = function(viewConfig, db,
}
};
-OKCMS.prototype._createAdminViews = function(path, app, express,
- resourceConfig, resourceCache, templateProvider, meta) {
+OKCMS.prototype._createAdminViews = function(adminConfig, path, app, express,
+ resourceConfig, resourceCache, templateProvider, meta, errorHandler) {
var views = {};
var withTrail = withTrailingSlash(path);
var withoutTrail = withoutTrailingSlash(path);
@@ -212,13 +264,16 @@ OKCMS.prototype._createAdminViews = function(path, app, express,
resourceConfig: resourceConfig,
resourceCache: resourceCache,
templateProvider: templateProvider,
- meta: meta
+ meta: meta,
+ errorHandler: errorHandler,
+ dashboardConfig: adminConfig.dashboard || {}
});
return views;
};
OKCMS.prototype._createQueries = function(queryConfig, resourceCache) {
- queryConfig = queryConfig || {};
+ if (!queryConfig)
+ return [];
if (!queryConfig.length)
queryConfig = [queryConfig];
return queryConfig.map(function(config) {
@@ -230,7 +285,11 @@ OKCMS.prototype._createQueries = function(queryConfig, resourceCache) {
var query = config.query || '*';
return new OKQuery({
resource: resource,
- query: query
+ query: query,
+ as: config.as,
+ sortBy: config.sortBy,
+ descending: config.descending,
+ groupBy: config.groupBy
});
});
};
@@ -248,7 +307,7 @@ function ResourceCache(resources) {
throw new Error('Undefined resource given to ResourceCache');
if (resource.bound) {
cache[resource.type] = resource.parent;
- cache[resource.type + ':' + resource.id] = resource;
+ cache[resource.type + ':' + resource.getID()] = resource;
} else {
cache[resource.type] = resource;
}
@@ -264,6 +323,54 @@ ResourceCache.prototype.get = function(type, id) {
}
};
+ResourceCache.prototype.forEach = function(cb) {
+ cb = cb || function() {}
+ Object.keys(this._cache).forEach(function(key) {
+ cb(this._cache[key])
+ }.bind(this))
+}
+
+/**
+ * Higher order function implementing customizable error handling
+ */
+function createErrorHandlerProducer(templateProvider, adminTemplateProvider, debugMode) {
+
+ var template404 = templateProvider.getTemplate('404') ||
+ adminTemplateProvider.getTemplate('404');
+ var template5xx = templateProvider.getTemplate('5xx') ||
+ adminTemplateProvider.getTemplate('5xx');
+
+ if (!template404 || !template5xx)
+ throw new Error('No error templates provided by admin theme or user')
+
+ return debugMode ? createDebugHandler : createErrorHandler;
+
+ function createErrorHandler(req, res, status) {
+ return function handleError(err) {
+ switch (status) {
+ case 404:
+ template404.render().then(function(rendered) {
+ res.status(status);
+ res.send(rendered);
+ });
+ break;
+ default:
+ template5xx.render().then(function(rendered) {
+ res.status(status);
+ res.send(rendered);
+ });
+ }
+
+ };
+ }
+
+ function createDebugHandler(req, res, status) {
+ return function handleError(err) {
+ res.send(err.stack);
+ };
+ }
+}
+
module.exports = {
createApp: function(options) {
diff --git a/app/node_modules/okadminview/index.js b/app/node_modules/okadminview/index.js
index 987fe51..3a9056f 100644
--- a/app/node_modules/okadminview/index.js
+++ b/app/node_modules/okadminview/index.js
@@ -1,10 +1,25 @@
-var assign = require('object-assign')
+var assign = require('object-assign');
+var cloneDeep = require('lodash.clonedeep');
var bodyParser = require('body-parser');
var methodOverride = require('method-override');
+var session = require('express-session');
+var flash = require('connect-flash');
+var passport = require('passport');
+var DigestStrategy = require('passport-http').DigestStrategy;
var Q = require('q');
var pluralize = require('pluralize');
var OKQuery = require('okquery');
+// Configure auth
+passport.use(new DigestStrategy({qop: 'auth'},
+ function authenticate(username, done) {
+ if (!process.env.OK_USER || !process.env.OK_PASS) {
+ return done(new Error('No user or pass configured on server'));
+ } else {
+ return done(null, process.env.OK_USER, process.env.OK_PASS);
+ }
+}));
+
/**
* OKAdminView!
*/
@@ -21,13 +36,20 @@ function OKAdminView(options) {
if (!options.templateProvider)
throw new Error('No templateProvider provided to OKAdminView');
if (!options.meta)
- throw new Error('No meta query provided to OKAdminView');
+ throw new Error('No metadata provided to OKAdminView');
+ if (!options.errorHandler)
+ throw new Error('No error handler provided to OKAdminView');
+
+ var dashboardConfig = options.dashboardConfig || {}
+ var dashboardResourceConfig = dashboardConfig.resources || {}
var app = options.app;
var express = options.express;
var meta = options.meta;
var resourceCache = this._resourceCache = options.resourceCache;
- var resourceConfig = this._resourceConfig = options.resourceConfig;
+ var resourceConfig = this._resourceConfig = cloneDeep(options.resourceConfig);
var provider = options.templateProvider;
+ var error = this._error = options.errorHandler;
+
// Load templates
var templates = this._templates =
['index', 'resource', 'resource_new'].reduce(function(cache, name) {
@@ -37,6 +59,7 @@ function OKAdminView(options) {
cache[name] = template;
return cache;
}, {});
+
// OKAdmin middleware is a router, so mounts on 'use'
Object.defineProperty(this, 'mount', {
value: 'use',
@@ -51,16 +74,32 @@ function OKAdminView(options) {
var config = resourceConfig[key];
var type = config.type;
var staticData = config.static || {};
+ // Get parent level resource
var resource = resourceCache.get(config.type);
if (!resource)
throw new Error('Something weird is going on');
- var id = staticData[resource.idField];
+ var id = resource.getID(staticData);
+ // Check to see if there's a more specific instance
resource = resourceCache.get(type, id) || resource;
+ var dashConf = dashboardResourceConfig[type] || {}
+ var groupBy = dashConf.groupBy
+ var sortBy = dashConf.sortBy
+ var descending = dashConf.descending
if (resource.bound) {
- // Resource instances implement the query API
- return OKQuery({resource: resource});;
+ return OKQuery({
+ resource: resource,
+ groupBy: groupBy,
+ sortBy: sortBy,
+ descending: descending
+ })
} else {
- return OKQuery({resource: resource, query: config.query})
+ return OKQuery({
+ resource: resource,
+ query: config.query,
+ groupBy: groupBy,
+ sortBy: sortBy,
+ descending: descending
+ })
}
});
@@ -71,6 +110,14 @@ function OKAdminView(options) {
strict: app.get('strict routing')
});
+ // Enable basic sessions for flash messages
+ router.use(session({
+ secret: 'okadmin',
+ resave: false,
+ saveUninitialized: false
+ }));
+ // Enable flash messaging
+ router.use(flash());
// Parse form data
router.use(bodyParser.urlencoded({extended: true}));
// HTML forms only support POST and GET methods
@@ -85,27 +132,34 @@ function OKAdminView(options) {
}
}));
+ // This should really be mounted on the router, but can't be due to
+ // https://github.com/jaredhanson/passport-http/pull/16
+ app.use('/admin/', passport.initialize());
+ app.all('/admin/(:path*)?', passport.authenticate('digest', {
+ session: false
+ }));
+
router.get('/', function readIndex(req, res, next) {
- fetchIndexTemplateData(meta, indexQueries).then(function(data) {
- view.renderIndex(req, res, data);
- }).fail(errorHandler(req, res));
+ fetchIndexTemplateData(meta, indexQueries, dashboardConfig).then(function(data) {
+ view.renderIndex(req, res, assign(data, {
+ success: req.flash('success'),
+ errors: req.flash('errors')
+ }));
+ }).fail(error(req, res, 500));
});
- router.get('/:type/new/', function createResourceView(req, res, next) {
+ router.get('/:type/__new__/', function createResourceView(req, res, next) {
var type = req.params.type || '';
var resource = resourceCache.get(type);
if (!resource) {
- errorHandler(req, res)(new Error('No such resource ' + type));
+ error(req, res, 404)(new Error('No such resource ' + type));
} else {
- meta.get().then(function(metadata) {
- view.renderResourceNew(req, res, {
- meta: metadata,
- resource: {
- type: resource.type,
- spec: resource.spec
- }
- });
- }).fail(errorHandler(req, res));
+ fetchNewTemplateData(meta, resource, transformData).then(function(data) {
+ view.renderResourceNew(req, res, assign(data, {
+ success: req.flash('success'),
+ errors: req.flash('errors'),
+ }))
+ }).fail(error(req, res, 500))
}
});
@@ -113,22 +167,28 @@ function OKAdminView(options) {
var type = req.params.type || '';
var id = req.params.id || '';
var resource = resourceCache.get(type, id);
- if (!resource) {
- errorHandler(req, res)(new Error('No such resource'));
- } else {
- var query = OKQuery({
- resource: resource,
- query: id
- });
- fetchResourceTemplateData(meta, query, getResourceTemplateData).then(function(data) {
- if (!data) {
- resourceMissingHandler(req, res)()
- } else {
- view.renderResource(req, res, data);
- }
- }).fail(errorHandler(req, res));
- }
-
+ var query = OKQuery({
+ resource: resource,
+ query: id
+ });
+ fetchResourceTemplateData(meta, query, transformData)
+ .then(function(data) {
+ if (!data) {
+ resourceMissingHandler(req, res)()
+ } else {
+ view.renderResource(req, res, assign(data, {
+ JSON: JSON,
+ success: req.flash('success'),
+ errors: req.flash('errors')
+ }));
+ }
+ }).fail(function(err) {
+ if (err.message === 'No resource data') {
+ error(req, res, 404)(new Error('No such resource'));
+ } else {
+ error(req, res, 500)(err);
+ }
+ });
});
router.post('/:type/', function createResource(req, res, next) {
@@ -136,19 +196,47 @@ function OKAdminView(options) {
var resource = resourceCache.get(type);
var data = req.body;
if (!resource) {
- errorHandler(req, res)(new Error('No such resource ' + type));
+ error(req, res, 400)(new Error('No such resource ' + type));
} else {
- meta.get().then(function(metadata) {
- try {
- resource.assertValid(data);
- resource.create(data).then(function(created) {
- res.redirect(303, data[resource.idField]);
- }).fail(errorHandler(req, res));
- } catch (errors) {
- var templateData = getResourceTemplateData(metadata, resource, data);
- view.renderResource(req, res, assign(templateData, {errors: errors}));
- }
- }).fail(errorHandler(req, res));;
+ try {
+ resource.assertValid(data);
+ resource.create(data).then(function(created) {
+ req.flash('success', {action: 'create'});
+ res.redirect(303, resource.getID(data));
+ }).fail(error(req, res, 500));
+ } catch (errors) {
+ var spec = resource.spec
+ var templateData = transformData(meta, spec, resource, data);
+ view.renderResource(req, res, assign(templateData, {errors: errors}));
+ }
+ }
+ });
+
+ router.put('/:type/__batch__/', function putBatch(req, res, next) {
+ var type = req.params.type;
+ var body = req.body || {};
+ var resourcesJSON = body[type];
+ var resource = resourceCache.get(type);
+ if (!resourcesJSON || !resourcesJSON.length) {
+ error(req, res, 400)(new Error('Bad request'));
+ } else if (!resource) {
+ error(req, res, 404)(new Error('No such resource'));
+ } else {
+ try {
+ var ids = [];
+ var resourcesParsed = resourcesJSON.map(function(resourceJSON) {
+ var data = JSON.parse(resourceJSON);
+ ids.push(resource.getID(data));
+ return data;
+ });
+ } catch (e) {
+ error(req, res, 500)(new Error('Resource batch contains invalid JSON'));
+ return;
+ }
+ resource.updateBatch(ids, resourcesParsed).then(function(results) {
+ req.flash('success', {action: 'batch_update'});
+ res.redirect(303, '../..');
+ }).fail(error(req, res, 500));
}
});
@@ -158,20 +246,33 @@ function OKAdminView(options) {
var data = req.body;
var resource = resourceCache.get(type, id);
if (!resource) {
- errorHandler(req, res)(new Error('No such resource ' + type));
+ error(req, res, 400)(new Error('No such resource ' + type));
} else {
- // TODO Prob should make metadata synchronous...
- meta.get().then(function(metadata) {
- try {
- resource.assertValid(data);
- resource.update(id, data).then(function(updated) {
- res.redirect(303, '../' + updated[resource.idField]);
- }).fail(errorHandler(req, res));
- } catch (errors) {
- var templateData = getResourceTemplateData(metadata, resource, data);
- view.renderResource(req, res, assign(templateData, {errors: errors}));
- }
- }).fail(errorHandler(req, res));
+ try {
+ resource.assertValid(data);
+ resource.update(id, data).then(function(updated) {
+ req.flash('success', {action: 'update'});
+ res.redirect(303, '../' + resource.getID(updated));
+ }).fail(error(req, res, 500));
+ } catch (errors) {
+ var spec = resource.spec
+ var templateData = transformData(meta, spec, resource, data);
+ view.renderResource(req, res, assign(templateData, {errors: errors}));
+ }
+ }
+ });
+
+ router.delete('/:type/:id/', function deleteResource(req, res, next) {
+ var type = req.params.type;
+ var id = req.params.id;
+ var resource = resourceCache.get(type, id);
+ if (!resource) {
+ error(req, res, 500)(new Error('No such resource ' + type));
+ } else {
+ resource.destroy(id).then(function() {
+ req.flash('success', {action: 'delete'});
+ res.redirect(303, '../..');
+ }).fail(error(req, res, 500));
}
});
@@ -180,21 +281,27 @@ function OKAdminView(options) {
}
/**
- * Get template data for a single resource
+ * Yields formatted template data for a single resource
*/
-function getResourceTemplateData(meta, resource, data) {
+function transformData(meta, spec, resource, data) {
meta = meta || {};
resource = resource || {};
data = data || {};
- var spec = Object.keys(resource.spec).reduce(function(cache, prop) {
+ var spec = Object.keys(spec).reduce(function(cache, prop) {
var value = data[prop];
- cache[prop].value = value;
+ var propSpec = cache[prop];
+ // Decorate spec with actual resource values
+ propSpec.value = value;
+ // Some fields should not be shown to the user
+ if (propSpec.type === 'meta' || propSpec.static) {
+ propSpec.hidden = true;
+ }
return cache;
- }, resource.spec);
+ }, spec);
return {
meta: meta,
resource: {
- id: data[resource.idField],
+ id: resource.getID(data),
type: resource.type,
spec: spec
}
@@ -209,102 +316,128 @@ OKAdminView.prototype.renderIndex = function(req, res, data) {
data = data || {};
this._templates['index'].render(data).then(function(rendered) {
res.send(rendered);
- }).fail(errorHandler(req, res));
+ }).fail(this._error(req, res, 500));
};
OKAdminView.prototype.renderResource = function(req, res, data) {
data = data || {};
this._templates['resource'].render(data).then(function(rendered) {
res.send(rendered);
- }).fail(errorHandler(req, res));
+ }).fail(this._error(req, res, 500));
};
OKAdminView.prototype.renderResourceNew = function(req, res, data) {
data = data || {meta: {}, resource: {}};
this._templates['resource_new'].render(data).then(function(rendered) {
res.send(rendered);
- }).fail(errorHandler(req, res));
+ }).fail(this._error(req, res, 500));
};
/**
* Annotate template data with schema info
*/
-function fetchIndexTemplateData(meta, queries) {
- return Q.Promise(function(resolve, reject) {
- Q.all([meta.get()].concat(queries.map(function(query) {
+function fetchIndexTemplateData(meta, queries, dashboardConfig) {
+ var resourceConfig = dashboardConfig.resources || {}
+
+ return Q.promise(function(resolve, reject) {
+ Q.all(queries.map(function(query) {
return query.get();
- }))).then(function(results) {
- var meta = results.shift();
- var resources = results.reduce(function(cache, result, i) {
- if (!result)
- return cache;
+ })).then(function(results) {
+ var templateData = results.reduce(function(acc, result, i) {
+ result = result.length ? result : [result]
var resource = queries[i].resource;
- // We want the raw object spec
- var spec = resource.spec;
- var key = pluralize(resource.type);
- if (!cache[key]) {
- cache[key] = {
+ var key = pluralize(resource.type)
+ if (acc[key]) {
+ acc[key].data = acc[key].data.concat(result)
+ } else {
+ // We want the raw object spec
+ var spec = resource.spec;
+ var dashConf = resourceConfig[resource.type] || {}
+ var groupBy = dashConf.groupBy
+ var descending = dashConf.descending
+ acc[key] = {
type: resource.type,
spec: spec,
- data: []
- };
- }
-
- if (result.length) {
- result.forEach(addToCache)
- } else {
- addToCache(result);
- }
-
- function addToCache(data) {
- // Report id to template under standard name
- data.id = data[resource.idField];
- cache[key].data.push(data);
+ data: result,
+ groupBy: groupBy,
+ descending: descending,
+ }
}
-
- return cache;
- }, {});
-
+ return acc
+ }, {})
resolve({
meta: meta,
- resources: resources
- });
- }).fail(reject);
+ resources: templateData
+ })
+ }).fail(reject)
});
}
+function fetchNewTemplateData(meta, resource, transformFn) {
+ return Q.promise(function(resolve, reject) {
+ if (!resource.hasForeignKey) {
+ done({spec: resource.spec, resource: resource})
+ } else {
+ fetchForeignKeyOptions(resource).then(done).fail(reject)
+ }
+
+ function done(results) {
+ resolve(transformFn(meta, results.spec, results.resource, {}))
+ }
+ })
+}
+
/**
* Annotate template data with schema info
*/
-function fetchResourceTemplateData(meta, query, fn) {
- fn = fn || function(m, r, d) { return {meta: m, resource: d}; };
- return Q.Promise(function(resolve, reject) {
- meta.get().then(function(metadata) {
- query.get().then(function(data) {
- var resource = query.resource;
- resolve(fn(metadata, resource, data));
- }).fail(reject);
+function fetchResourceTemplateData(meta, query, transformFn) {
+ return Q.promise(function(resolve, reject) {
+ query.get().then(function(data) {
+ if (!data)
+ return reject(new Error('No resource data'))
+
+ var resource = query.resource
+
+ if (resource.hasForeignKey) {
+ fetchForeignKeyOptions(resource).then(done).fail(reject)
+ } else {
+ done({spec: resource.spec, resource: resource})
+ }
+
+ function done(results) {
+ resolve(transformFn(meta, results.spec, results.resource, data))
+ }
}).fail(reject)
- });
+ })
}
-/**
- * TODO Real error handling
- */
-function errorHandler(req, res) {
- return function(err) {
- res.send(err.stack);
- };
-}
+function fetchForeignKeyOptions(resource) {
+ var promises = Object.keys(resource.foreignKeys)
+ .map(fetchOptionsForKey)
+ var spec = resource.spec
-/**
- * TODO Real 404 handling
- */
-function resourceMissingHandler(req, res) {
- return function() {
- res.status(404);
- res.send('404');
+ return Q.all(promises).then(done)
+
+ function done() {
+ return Q.promise(function(resolve, reject) {
+ resolve({spec: spec, resource: resource})
+ })
+ }
+
+ function fetchOptionsForKey(field) {
+ var relatedResourceType = resource.foreignKeys[field]
+ return resource.related(relatedResourceType).then(fillOptions)
+
+ function fillOptions(results) {
+ return Q.promise(function(resolve, reject) {
+ spec[field].options = results.map(function(result) {
+ return result.id
+ })
+ resolve()
+ })
+ }
}
}
+
module.exports = OKAdminView;
diff --git a/app/node_modules/okadminview/package.json b/app/node_modules/okadminview/package.json
index 4832db1..bdaefc5 100644
--- a/app/node_modules/okadminview/package.json
+++ b/app/node_modules/okadminview/package.json
@@ -10,8 +10,13 @@
"license": "None",
"dependencies": {
"body-parser": "^1.12.2",
+ "connect-flash": "^0.1.1",
+ "express-session": "^1.11.1",
+ "lodash.clonedeep": "^3.0.0",
"method-override": "^2.3.2",
"object-assign": "^2.0.0",
+ "passport": "^0.2.1",
+ "passport-http": "^0.2.2",
"pluralize": "^1.1.2",
"q": "^1.2.0"
}
diff --git a/app/node_modules/okdb/index.js b/app/node_modules/okdb/index.js
index 79ce1eb..ad8d9a7 100644
--- a/app/node_modules/okdb/index.js
+++ b/app/node_modules/okdb/index.js
@@ -1,6 +1,10 @@
-var Q = require('q');
+var assign = require('object-assign')
+var cloneDeep = require('lodash.clonedeep');
+var isobject = require('lodash.isobject');
var format = require('util').format;
var low = require('lowdb');
+var Q = require('q');
+
low.mixin(low.mixin(require('underscore-db')));
/**
@@ -10,14 +14,14 @@ low.mixin(low.mixin(require('underscore-db')));
function OKDB(options) {
if (!(this instanceof OKDB)) return new OKDB(options);
options = options || {};
- var type;
+ var db;
if (typeof options === 'string')
- type = options;
+ db = options;
else
- type = options.type;
- if (!type)
- throw new Error('No DB type provided');
- switch (type) {
+ db = options.db;
+ if (!db)
+ throw new Error('No DB db provided to OKDB');
+ switch (db) {
case 'fs':
return FSDB(options);
default:
@@ -27,81 +31,186 @@ function OKDB(options) {
/**
* DB implementation backed by a JSON file.
- * TODO Incomplete
*/
function FSDB(options) {
if (!(this instanceof FSDB)) return new FSDB(options);
options = options || {};
+ if (!options.schemas)
+ throw new Error('No schemas provided to FSDB')
+ this._schemas = options.schemas;
var name = options.name || 'db';
var filename = name + '.json';
this._db = low(filename);
}
-FSDB.prototype._resolve = function(data, error) {
- return Q.Promise(function resolvePromise(resolve, reject) {
- if (error) {
- reject(error);
- } else {
- resolve(data);
- }
- });
+FSDB.prototype.get = function(collection, id) {
+ var schema = this._schemas[collection];
+ if (!schema)
+ return resolve(null, new Error('No such collection type'));
+
+ var query = getQuery(schema, id);
+ if (!query)
+ return resolve(null, new Error('Bad query'));
+
+ var result = this._db(collection).find(query);
+ return resolve(result ? cloneDeep(result) : result);
};
-FSDB.prototype.get = function(collection, query) {
- if (!query) {
- return this._resolve(null, new Error('No query given'));
+/**
+ * Add a new document to the DB
+ */
+FSDB.prototype.insert = function(collection, data) {
+ var schema = this._schemas[collection];
+ var wrapped = this._db(collection);
+ if (!schema)
+ return resolve(null, new Error('No such collection type'));
+ // Get detached, clone deep, data sleep, beep beep
+ data = cloneDeep(data);
+ // Auto-increment fields
+ data = autoincrement(wrapped, schema, data);
+ // Record date created
+ // TODO Should this meta prop logic be moved out of the DB?
+ data.dateCreated = new Date().toUTCString();
+ var result = wrapped.chain().push(data).last().value();
+
+ if (result) {
+ return resolve(cloneDeep(result));
} else {
- var data = this._db(collection).find(query);
- return this._resolve(data);
+ return resolve(null, new Error('Problem inserting document'));
}
};
-FSDB.prototype.put = function(collection, query, data) {
- data = data || {};
- if (!query) {
- return this._resolve(null, new Error('No query given'));
- } else if (this._db(collection).find(query)) {
- var updated = this._db(collection)
- .chain()
- .find(query)
- .assign(data)
- .value();
- return this._resolve(updated);
+/**
+ * Update an existing document in the DB
+ */
+FSDB.prototype.update = function(collection, id, data) {
+ var schema = this._schemas[collection];
+ if (!schema)
+ return resolve(null, new Error('No such collection type'));
+
+ var query = getQuery(schema, id);
+ var wrapped = this._db(collection);
+ var chain = wrapped.chain().find(query);
+
+ if (!chain.value()) {
+ return resolve(null, new Error('Cannot update nonexistent entry'));
+ }
+
+ var result = chain.assign(cloneDeep(data)).value();
+ if (result) {
+ return resolve(cloneDeep(result));
} else {
- return this._resolve(null, new Error('Cannot update nonexistent entry'));
+ return resolve(null, new Error('Problem updating document'));
}
};
-FSDB.prototype.create = function(collection, data) {
- var created = this._db(collection)
- .chain()
- .push(data)
- .last()
- .value();
- return this._resolve(created);
-};
+/**
+ * TODO Should be atomic ¯\_(ツ)_/¯
+ */
+FSDB.prototype.updateBatch = function(collection, ids, datas) {
+ var schema = this._schemas[collection];
+ if (!schema)
+ return resolve(null, new Error('No such collection type'));
+ if (!ids || !ids.length || !datas || !datas.length ||
+ ids.length !== datas.length) {
+ return resolve(null, new Error('Bad input'));
+ }
-FSDB.prototype.remove = function(collection, id, data) {
- throw new Error('Not implemented!');
+ var doc = this._db(collection);
+ var results = ids.map(function(id, i) {
+ return doc.chain().find(getQuery(schema, id)).assign(datas[i]).value();
+ });
+
+ return resolve(results);
};
-FSDB.prototype.find = function(collection, query) {
- if (!collection || !query) {
- return this._resolve(null, new Error('Bad input'));
+FSDB.prototype.remove = function(collection, id) {
+ var schema = this._schemas[collection];
+ if (!schema)
+ return resolve(null, new Error('No such collection type'));
+
+ var query = getQuery(schema, id);
+ var result = this._db(collection).removeWhere(query);
+
+ if (result) {
+ // Don't need to clone this ref, since it's removed anyway
+ return resolve(result);
} else {
- var data = this._db(collection).find(query);
- return this._resolve(data);
+ return resolve(null, new Error('Cannot remove nonexistent entry'));
}
};
+FSDB.prototype.sortBy = function(collection, prop, descend) {
+ var schema = this._schemas[collection];
+ if (!schema)
+ return resolve(null, new Error('No such collection type'));
+ if (!prop)
+ return resolve(null, new Error('Bad input'));
+
+ var result = this._db(collection).sortByOrder([prop], [!descend]);
+ return resolve(result);
+};
+
+FSDB.prototype.find = function(collection, query) {
+ var schema = this._schemas[collection];
+ if (!schema)
+ return resolve(null, new Error('No such collection type'));
+ if (!query)
+ return resolve(null, new Error('Bad input'));
+
+ var result = this._db(collection).find(query);
+
+ return resolve(cloneDeep(result));
+};
+
+FSDB.prototype.all = function(collection) {
+ var schema = this._schemas[collection];
+ if (!schema)
+ return resolve(null, new Error('No such collection type'));
+
+ var data = this._db(collection).value();
+ return resolve(cloneDeep(data || []));
+};
+
FSDB.prototype.getMeta = function() {
var data = this._db('meta').first();
- return this._resolve(data || {});
+ return resolve(data || {});
};
-FSDB.prototype.getAll = function(collection) {
- var data = this._db(collection).toArray();
- return this._resolve(data || []);
+/**
+ * Function implementing DB auto increment support
+ * Naive implementation, assumes DB is relatively small.
+ */
+function autoincrement(wrapper, schema, data) {
+ return schema.autoIncrementFields.reduce(function(data, field) {
+ var last = wrapper.chain().sortByOrder([field], [true]).last().value();
+ var index = last ? last[field] : -1;
+ var incremented = {};
+ incremented[field] = (parseInt(index) + 1);
+ return assign(data, incremented);
+ }, data);
+}
+
+function getQuery(schema, id) {
+ if (schema && id) {
+ var query = {};
+ query[schema.idField] = id;
+ return query;
+ }
+}
+
+/**
+ * Helper function to create promises for DB data
+ */
+function resolve(data, error) {
+ return Q.promise(function resolvePromise(resolve, reject) {
+ if (error) {
+ reject(error);
+ } else {
+ resolve(data);
+ }
+ });
};
+
module.exports = OKDB;
diff --git a/app/node_modules/okdb/package.json b/app/node_modules/okdb/package.json
index 659422e..5184cb6 100644
--- a/app/node_modules/okdb/package.json
+++ b/app/node_modules/okdb/package.json
@@ -9,7 +9,10 @@
"author": "OKFocus",
"license": "None",
"dependencies": {
+ "lodash.clonedeep": "^3.0.0",
+ "lodash.isobject": "^3.0.1",
"lowdb": "^0.7.2",
+ "object-assign": "^2.0.0",
"q": "^1.2.0",
"underscore-db": "^0.8.1"
}
diff --git a/app/node_modules/okquery/index.js b/app/node_modules/okquery/index.js
index 33a49c4..d4cb905 100644
--- a/app/node_modules/okquery/index.js
+++ b/app/node_modules/okquery/index.js
@@ -1,3 +1,4 @@
+var cloneDeep = require('lodash.clonedeep');
var assign = require('object-assign');
var isobject = require('lodash.isobject');
var Q = require('q');
@@ -16,6 +17,14 @@ function OKQuery(options) {
var resource = options.resource;
var type = resource.type;
var query = options.query || '*';
+ // Ensure immutability
+ if (isobject(query))
+ query = cloneDeep(query);
+
+ // Queries are ordered by index by default
+ var sortField = options.sortBy || '__index';
+ // TODO Make descending by default
+ var descending = options.descending || false;
Object.defineProperty(this, 'resource', {
value: resource,
@@ -29,8 +38,23 @@ function OKQuery(options) {
enumerable: true
});
+ Object.defineProperty(this, 'as', {
+ value: options.as,
+ writable: false,
+ enumerable: true
+ });
+
+ Object.defineProperty(this, 'groupBy', {
+ value: options.groupBy,
+ writable: false,
+ enumerable: true
+ })
+
this.get = createQuery(resource, query, {
- default: options.default
+ default: options.default,
+ sortField: sortField,
+ descending : descending,
+ groupBy: options.groupBy
});
}
@@ -43,18 +67,24 @@ function createQuery(resource, query, options) {
} else if (isDynamic(query)) {
query = queryDynamic(resource);
} else if (isSet(query)) {
- query = queryAll(resource);
+ query = queryAll(resource, options.sortField, options.descending);
} else {
query = querySingle(resource, query);
}
if (options.default) {
query = withDefault(query, options.default);
}
+ if (options.groupBy) {
+ query = withGrouping(query, options.groupBy)
+ }
return query;
}
function queryComplex(resource, query) {
var dynamicProp;
+ // Query is an object specifying key value pairs against which
+ // to match DB entries. Iterate through and check if any of the values
+ // is unbound e.g. :id
var notDynamic = Object.keys(query).every(function(prop) {
var matcher = query[prop];
if (isDynamic(matcher)) {
@@ -67,15 +97,15 @@ function queryComplex(resource, query) {
if (notDynamic) {
return function() {
- console.log('get it!', query)
return resource.find(query);
}
} else {
return function(id) {
+ // Bind the dynamic property to its value
+ // and add the pair to the query
var dynamicQuery = {};
dynamicQuery[dynamicProp] = id;
var query = assign({}, query, dynamicQuery);
- console.log('get it!', query)
return resource.find(query);
}
}
@@ -87,9 +117,9 @@ function queryDynamic(resource) {
};
}
-function queryAll(resource) {
+function queryAll(resource, sortField, descending) {
return function() {
- return resource.all();
+ return resource.sortBy(sortField, descending);
};
}
@@ -105,6 +135,37 @@ function queryBound(resource) {
};
}
+/**
+ * Transform the query such that the results are grouped by the
+ * given field
+ */
+function withGrouping(queryFn, groupField) {
+ return function() {
+ return Q.Promise(function(resolve, reject) {
+ queryFn().then(function(data) {
+ data = data || []
+ if (typeof data.length === 'undefined') {
+ data = [data]
+ }
+ var result = {}
+ result[groupField] = data.reduce(reduceToGroups, {})
+ resolve(result)
+ }, reject)
+ })
+ }
+
+ function reduceToGroups(acc, data) {
+ var groupName = data[groupField]
+ if (groupName) {
+ if (!acc[groupName]) {
+ acc[groupName] = []
+ }
+ acc[groupName].push(data)
+ }
+ return acc
+ }
+}
+
function withDefault(queryFn, resultDefault) {
return function() {
return Q.Promise(function(resolve, reject) {
diff --git a/app/node_modules/okquery/package.json b/app/node_modules/okquery/package.json
index 606d45b..5ba9dd5 100644
--- a/app/node_modules/okquery/package.json
+++ b/app/node_modules/okquery/package.json
@@ -9,6 +9,7 @@
"author": "OKFocus",
"license": "None",
"dependencies": {
+ "lodash.clonedeep": "^3.0.0",
"lodash.isobject": "^3.0.1",
"object-assign": "^2.0.0",
"q": "^1.2.0"
diff --git a/app/node_modules/okresource/index.js b/app/node_modules/okresource/index.js
index 94d8cfb..c1f2509 100644
--- a/app/node_modules/okresource/index.js
+++ b/app/node_modules/okresource/index.js
@@ -1,4 +1,6 @@
+var format = require('util').format
var assign = require('object-assign');
+var cloneDeep = require('lodash.clonedeep');
var Q = require('q');
/**
@@ -18,27 +20,44 @@ function OKResource(options) {
throw new Error('No DB provided to OKResource');
var schema = options.schema;
- // Iterate through spec to find field which will act as the
- // resource id in da db.
- var idField = Object.keys(schema.spec).reduce(function(idField, prop) {
- var spec = schema.spec[prop];
- if (spec.id)
- idField = prop;
- return idField;
- // If schema has a prop called 'id', default to that one
- }, schema.spec.id && 'id');
- if (!idField)
- throw new Error('Bad schema: no ID field');
+ var spec = schema.spec;
var type = options.type;
+ var hasForeignKey = false
this._db = options.db;
this._schema = schema;
+ var foreignKeys = Object.keys(spec).reduce(function(acc, field) {
+ var fieldSpec = spec[field]
+ if (fieldSpec.type === 'foreign-key') {
+ hasForeignKey = true
+ acc[field] = fieldSpec.key
+ }
+ return acc
+ }, {})
+
+ // Will store references to other resources referenced via foreign keys
+ this._foreignKeyedResources = {}
+
// Define properties which are part of the API
+
+ // Should be treated as read-only
+ Object.defineProperty(this, 'foreignKeys', {
+ get: function() {
+ return foreignKeys
+ }
+ })
+
+ Object.defineProperty(this, 'hasForeignKey', {
+ get: function() {
+ return hasForeignKey
+ }
+ })
Object.defineProperty(this, 'spec', {
- value: schema.spec,
- writable: false,
+ get: function() {
+ return schema.spec;
+ },
enumerable: true
});
@@ -48,12 +67,6 @@ function OKResource(options) {
enumerable: true
});
- Object.defineProperty(this, 'idField', {
- value: idField,
- writable: false,
- enumerable: true
- });
-
// Whether this resource represents a specific data point
// or a whole class of data
Object.defineProperty(this, 'bound', {
@@ -63,6 +76,30 @@ function OKResource(options) {
});
}
+OKResource.prototype._linkForeignKey = function(field, resource) {
+ this._foreignKeyedResources[field] = resource
+}
+
+/**
+ * Fetch all related resources for the given field
+ */
+OKResource.prototype.related = function(field) {
+ var resource = this._foreignKeyedResources[field]
+ return Q.promise(function(resolve, reject) {
+ if (!resource) {
+ return error(reject, new Error(format(
+ "No related resource for field '%s'", field)))
+ }
+ resource.all().then(resolve).fail(reject)
+ })
+
+ function error(reject, err) {
+ setTimeout(function() {
+ reject(err)
+ }, 0)
+ }
+}
+
/**
* Throws an error if data does not conform to schema
*/
@@ -71,31 +108,34 @@ OKResource.prototype.assertValid = function(data) {
};
OKResource.prototype.all = function() {
- return this._db.getAll(this.type);
+ return this._db.all(this.type);
};
-OKResource.prototype.create = function(data) {
+OKResource.prototype.getID = function(data) {
data = data || {};
+ return data[this._schema.idField];
+};
+
+OKResource.prototype.create = function(data) {
var type = this.type;
var db = this._db;
- var id = data[this.idField];
return Q.promise(function(resolve, reject) {
- if (!id) {
- reject(new Error('Data does not contain ID property'));
+ if (!data) {
+ reject(new Error('No data provided'));
} else {
- db.create(type, data).then(resolve).fail(reject);
+ db.insert(type, data).then(resolve).fail(reject);
}
});
};
-OKResource.prototype.destroy = function(data) {
- data = data || {};
- var id = data[this.idField];
+OKResource.prototype.destroy = function(id) {
+ var db = this._db;
+ var type = this.type;
return Q.promise(function(resolve, reject) {
if (!id) {
- reject(new Error('Data does not contain ID property'));
+ reject(new Error('No ID provided'));
} else {
- this._db.remove(this.type, data.id, data).then(resolve).fail(reject);
+ db.remove(type, id).then(resolve).fail(reject);
}
});
};
@@ -106,7 +146,7 @@ OKResource.prototype.find = function(query) {
var type = this.type;
return Q.promise(function(resolve, reject) {
if (!query) {
- throw new Error('No query given');
+ throw new Error('No query provided');
} else {
db.find(type, query).then(resolve).fail(reject);
}
@@ -116,53 +156,65 @@ OKResource.prototype.find = function(query) {
OKResource.prototype.get = function(id) {
var db = this._db;
var type = this.type;
- var idField = this.idField;
return Q.promise(function(resolve, reject) {
if (!id) {
- throw new Error('No ID given');
+ throw new Error('No ID provided');
} else {
- // We have the id, but we still need
- // to resolve which field is the id field
- // to match
- var query = {};
- query[idField] = id;
- db.get(type, query).then(resolve).fail(reject);
+ db.get(type, id).then(resolve).fail(reject);
}
});
};
OKResource.prototype.update = function(id, data) {
- data = data || {};
var db = this._db;
var type = this.type;
- var idField = this.idField;
return Q.promise(function(resolve, reject) {
if (!id) {
reject(new Error('No resource ID provided'));
+ } else if (!data) {
+ reject(new Error('No data provided'));
} else {
- var query = {};
- query[idField] = id;
- db.put(type, query, data).then(resolve).fail(reject);;
+ db.update(type, id, data).then(resolve).fail(reject);;
}
});
};
+OKResource.prototype.updateBatch = function(ids, datas) {
+ var self = this;
+ var db = this._db;
+ var type = this.type;
+ return Q.promise(function(resolve, reject) {
+ if (!ids || !ids.length || !datas || !datas.length ||
+ ids.length !== datas.length) {
+ reject(new Error('Bad input'));
+ } else {
+ db.updateBatch(type, ids, datas).then(resolve).fail(reject);
+ }
+ });
+}
+
+
+/**
+ * Get all documents in collection sorted by property,
+ * optionally in descending order
+ */
+OKResource.prototype.sortBy = function(prop, descend) {
+ return this._db.sortBy(this.type, prop, descend);
+};
+
OKResource.prototype.updateOrCreate = function(id, data) {
data = data || {};
var type = this.type;
var db = this._db;
- var idField = this.idField;
- var query = {};
- query[idField] = id;
return Q.promise(function(resolve, reject) {
if (!id) {
- reject(new Error('No resource ID provided'));
+ reject(new Error('No ID provided'));
} else {
- db.get(type, query).then(function(persisted) {
+ db.get(type, id).then(function(persisted) {
if (persisted) {
- db.put(type, query, data).then(resolve).fail(reject);
+ db.update(type, id, data).then(resolve).fail(reject);
} else {
- db.create(type, data).then(resolve).fail(reject);
+ db.insert(type, data).then(resolve).fail(reject);
}
}).fail(reject);
}
@@ -179,6 +231,9 @@ OKResource.prototype.instance = function(options) {
});
};
+/**
+ * TODO This class is such bullshit. Refactor out
+ */
function OKResourceInstance(resource, options) {
if (!(this instanceof OKResourceInstance)) return new OKResourceInstance(options);
// Only support static data instances for now
@@ -190,12 +245,16 @@ function OKResourceInstance(resource, options) {
// conceptually at all times since they are derived from app
// configuration, but may not actually be present
// in the database and need custom logic to handle this.
- var staticData = assign({}, options.static);
- var id = staticData[resource.idField];
+ var staticData = cloneDeep(options.static);
+ var id = resource.getID(staticData);
if (!id)
throw new Error(
'Cannot create static OKResourceInstance without an ID field');
+ this.getID = function() {
+ return id;
+ };
+
/**
* Ensure that static data is provided on get
*/
@@ -204,9 +263,9 @@ function OKResourceInstance(resource, options) {
resource.get(id).then(function(data) {
// Note the assign call. Don't expose private references!
if (data) {
- resolve(assign({}, data, staticData));
+ resolve(assign(data, cloneDeep(staticData)));
} else {
- resolve(assign({}, staticData));
+ resolve(cloneDeep(staticData));
}
}).fail(reject);
});
@@ -274,6 +333,18 @@ function OKResourceInstance(resource, options) {
resource.assertValid(data);
};
+ Object.defineProperty(this, 'foreignKeys', {
+ get: function() {
+ return []
+ }
+ })
+
+ Object.defineProperty(this, 'hasForeignKey', {
+ get: function() {
+ return false
+ }
+ })
+
Object.defineProperty(this, 'parent', {
value: resource,
writable: false,
@@ -281,14 +352,9 @@ function OKResourceInstance(resource, options) {
});
Object.defineProperty(this, 'spec', {
- value: resource.spec,
- writable: false,
- enumerable: true
- });
-
- Object.defineProperty(this, 'id', {
- value: id,
- writable: false,
+ get: function() {
+ return resource.spec
+ },
enumerable: true
});
@@ -298,23 +364,11 @@ function OKResourceInstance(resource, options) {
enumerable: true
});
- Object.defineProperty(this, 'idField', {
- value: resource.idField,
- writable: false,
- enumerable: true
- });
-
Object.defineProperty(this, 'bound', {
value: true,
writable: false,
enumerable: true
});
-
- Object.defineProperty(this, 'class', {
- value: resource,
- writable: false,
- enumerable: true
- });
}
module.exports = OKResource;
diff --git a/app/node_modules/okresource/package.json b/app/node_modules/okresource/package.json
index 7f19c9b..7b1dfbb 100644
--- a/app/node_modules/okresource/package.json
+++ b/app/node_modules/okresource/package.json
@@ -9,6 +9,7 @@
"author": "OKFocus",
"license": "None",
"dependencies": {
+ "lodash.clonedeep": "^3.0.0",
"object-assign": "^2.0.0",
"q": "^1.2.0"
}
diff --git a/app/node_modules/okschema/index.js b/app/node_modules/okschema/index.js
index 8871a99..0048fc5 100644
--- a/app/node_modules/okschema/index.js
+++ b/app/node_modules/okschema/index.js
@@ -1,4 +1,4 @@
-var assign = require('object-assign');
+var cloneDeep = require('lodash.clonedeep');
var mschema = require('mschema');
var v = require('validator');
@@ -41,36 +41,99 @@ var types = {
}
},
'captioned-image-list': {
+ isArray: true,
parent: [{
uri: { type: 'string' }, // TODO Implement URI type
caption: { type: 'string' }
}],
- assertValid: function(spec, value) {
- var message;
- var actual;
- if (!value || !value.length) {
- throw [{
- message: 'Not an array',
- expected: JSON.stringify(this.parent),
- actual: value
- }];
- }
- }
+ assertValid: function(spec, value) {}
+ },
+ 'gallery': {
+ isArray: true,
+ parent: [{
+ uri: { type: 'string' }, // TODO Implement URI type
+ caption: { type: 'string' }
+ }],
+ assertValid: function(spec, value) {}
+ },
+ // Special type for resource meta information
+ 'meta': {
+ parent: 'string',
+ assertValid: function(spec, value) {}
+ },
+ 'link-list': {
+ isArray: true,
+ parent: [{
+ uri: { type: 'string' },
+ text: { type: 'string' }
+ }],
+ assertValid: function(spec, value) {}
+ },
+ 'date': {
+ parent: 'string',
+ assertValid: function(spec, value) {}
+ },
+ 'flag': {
+ parent: 'boolean',
+ assertValid: function(spec, value) {}
+ },
+ 'foreign-key': {
+ parent: 'enum',
+ assertValid: function(spec, value) {}
+ },
+ 'media-list': {
+ isArray: true,
+ parent: [],
+ assertValid: function(spec, value) {}
+ },
+ 'media': {
+ isArray: true,
+ parent: [],
+ assertValid: function(spec, value) {}
+ },
+ 'double-captioned-image-list': {
+ isArray: true,
+ parent: [],
+ assertValid: function(spec, value) {}
+ },
+ 'triple-captioned-image-list': {
+ isArray: true,
+ parent: [],
+ assertValid: function(spec, value) {}
+ },
+}
+
+/*
+function checkArrayLength (spec, value) {
+ var message;
+ var actual;
+ if (!value || !value.length) {
+ throw [{
+ message: 'Not an array',
+ expected: JSON.stringify(this.parent),
+ actual: value
+ }];
}
}
+*/
+
/**
* OKSchema!
* Meant as a thin wrapper around some existing schema validation
* module, mostly to allow for the extension of types.
+ *
+ * NOTE: Currently just assumes spec is valid. If you give a bad spec
+ * strange things may or may not happen
*/
function OKSchema(spec) {
if (!(this instanceof OKSchema)) return new OKSchema(spec);
if (!spec)
throw new Error('No spec provided to OKSchema');
- spec = assign({}, spec);
+ spec = cloneDeep(spec);
+ var specKeys = Object.keys(spec);
// Cache the mschema version of our spec
- this._mschemaSpec = Object.keys(spec).reduce(function(cache, prop) {
+ this._mschemaSpec = specKeys.reduce(function(cache, prop) {
// If custom type, return its parent spec
var type = spec[prop].type;
if (types[type]) {
@@ -82,25 +145,104 @@ function OKSchema(spec) {
return cache;
}, {});
+ // Find ID field
+ var idField;
+ specKeys.every(function(prop) {
+ if (prop === 'id' || spec[prop].id) {
+ idField = prop;
+ return false;
+ } else {
+ return true;
+ }
+ });
+
+ // Register autoincrement fields
+ // NOTE Does not work for nested fields
+ var autoIncrementFields = specKeys.reduce(function(arr, prop) {
+ var specProp = spec[prop];
+ if (specProp.autoincrement) {
+ arr.push(prop);
+ }
+ return arr;
+ }, []);
+
Object.defineProperty(this, 'spec', {
- value: spec,
- writable: false
+ get: function() {
+ return cloneDeep(spec);
+ },
+ enumerable: true
+ });
+
+ Object.defineProperty(this, 'idField', {
+ value: idField,
+ writable: true,
+ enumerable: true
});
+
+ Object.defineProperty(this, 'autoIncrementFields',{
+ get: function() {
+ return cloneDeep(autoIncrementFields);
+ },
+ enumerable: true
+ });
+}
+
+OKSchema.prototype.fixMissingLists = function(data) {
+ var spec = this.spec;
+
+ // The qs body-parser module does not have a way to represent
+ // empty lists. If you delete all elements from a list,
+ // check against the spec so we know to replace with an empty list.
+ Object.keys(spec).forEach(function(prop){
+ var type = spec[prop].type;
+ if (types[type] && types[type].isArray && ! data[prop]) {
+ data[prop] = []
+ }
+ })
+}
+
+OKSchema.prototype.fixIndexField = function(data) {
+ // Likewise numbers always come in as strings. The field used to sort
+ // records, __index, is of type "meta", so the parseFloat in
+ // assertValid (below) never fires and we end up with sorting issues.
+ if (data.__index && typeof data.__index == "string") {
+ var __index = parseInt(data.__index)
+ if (! isNaN(__index)) {
+ data.__index = __index
+ }
+ }
}
OKSchema.prototype.assertValid = function(data) {
data = data || {};
var spec = this.spec;
+
// Run through custom validators, they'll throw if invalid
Object.keys(data).forEach(function(prop) {
var type = spec[prop].type;
- if (types[type]) {
+
+ // Check if it's a number/boolean and try to cast it
+ // otherwise pass and let mschema handle
+ if (type === 'number') {
+ try {
+ data[prop] = parseFloat(data[prop]);
+ } catch (err) {}
+ } else if (type === 'flag') {
+ data[prop] = data[prop] == "true" ? true : false
+ } else if (types[type]) {
types[type].assertValid(spec[prop], data[prop]);
}
});
var result = mschema.validate(data, this.toMschema());
- if (!result.valid)
+ if (!result.valid) {
throw result.errors;
+ }
+
+ // Fix various issues with our data, having to do
+ // with use of the "qs" body-parser module.
+ // TODO: just send JSON?
+ this.fixMissingLists(data)
+ this.fixIndexField(data)
};
/**
diff --git a/app/node_modules/okschema/package.json b/app/node_modules/okschema/package.json
index 21214fa..21a7c67 100644
--- a/app/node_modules/okschema/package.json
+++ b/app/node_modules/okschema/package.json
@@ -9,8 +9,8 @@
"author": "OKFocus",
"license": "None",
"dependencies": {
+ "lodash.clonedeep": "^3.0.0",
"mschema": "^0.5.5",
- "object-assign": "^2.0.0",
"validator": "^3.37.0"
}
}
diff --git a/app/node_modules/okserver/index.js b/app/node_modules/okserver/index.js
index 1645eaa..a89676f 100644
--- a/app/node_modules/okserver/index.js
+++ b/app/node_modules/okserver/index.js
@@ -16,6 +16,8 @@ function OKServer(options) {
throw new Error('No admin root directory provided to OKServer');
if (!options.adminPath)
throw new Error('No admin path provided to OKServer');
+ if (!options.errorHandler)
+ throw new Error('No error handler provided to OKServer');
var root = options.root;
var adminRoot = options.adminRoot;
var adminPath = options.adminPath;
@@ -25,6 +27,7 @@ function OKServer(options) {
var router = express.Router({
strict: app.get('strict routing')
});
+ var error = options.errorHandler;
var services = options.services || {};
Object.keys(views)
// Sort such that more general routes are matched last
@@ -49,11 +52,8 @@ function OKServer(options) {
* other middleware.
*/
- // Intercept favicon requests and 404 for now
- app.use('/favicon.ico', function(req, res) {
- res.status(404)
- return res.send('');
- });
+ // Disable x-powered-by express header
+ app.disable('x-powered-by')
// Serve user static files
app.use(express.static(root));
// Serve admin interface static files
@@ -61,22 +61,16 @@ function OKServer(options) {
// Application router
app.use(router);
// Add services
- if (services.image) {
- app.use('/_services/image', services.image.middleware());
- }
+ Object.keys(services).forEach(function(key){
+ app.use('/_services/' + key, services[key].middleware());
+ })
// Make sure this lady is last. Checks whether the desired
// route has a trailing-slash counterpart and redirects there
app.use(slash());
-
- /**
- * Create a handler which redirect all requests to
- * the same route with a trailing slash appended
- */
- function redirect(routeNoSlash) {
- return function(req, res) {
- res.redirect(301, routeNoSlash + '/');
- }
- }
+ // Otherwise it's a 404
+ app.use(function(req, res) {
+ error(req, res, 404)(new Error('No matching route'));
+ });
}
OKServer.prototype.listen = function listen(port) {
diff --git a/app/node_modules/okservices/index.js b/app/node_modules/okservices/index.js
deleted file mode 100644
index 46f7ffd..0000000
--- a/app/node_modules/okservices/index.js
+++ /dev/null
@@ -1,41 +0,0 @@
-var skipper = require('skipper');
-
-function OKImageService(options) {
- if (!(this instanceof OKImageService)) return new OKImageService(options);
- options = options || {};
- if (!options.express)
- throw new Error('Express not provided to OKImageService');
- if (!options.s3)
- throw new Error('S3 configuration not provided to OKImageService');
- var express = options.express;
-
- var router = express.Router();
-
- router.use(skipper());
-
- router.post('/', function(req, res) {
- // req should have a method `file` on it which is
- // provided by skipper. Use that to do AWS stuff
- req.file('image').upload({
- adapter: require('skipper-s3'),
- key: options.s3.key,
- secret: options.s3.secret,
- bucket: options.s3.bucket,
- headers: {
- 'x-amz-acl': 'public-read'
- }
- }, function (err, uploadedFiles) {
- res.json(uploadedFiles);
- });
- });
-
- this._middleware = router;
-}
-
-OKImageService.prototype.middleware = function() {
- return this._middleware;
-};
-
-module.exports = {
- OKImageService: OKImageService
-};
diff --git a/app/node_modules/okservices/install.sh b/app/node_modules/okservices/install.sh
new file mode 100755
index 0000000..5ffd898
--- /dev/null
+++ b/app/node_modules/okservices/install.sh
@@ -0,0 +1 @@
+for i in ok* ; do cd $i ; npm install; cd .. ; done ; cd ../..
diff --git a/app/node_modules/okservices/oks3/index.js b/app/node_modules/okservices/oks3/index.js
new file mode 100644
index 0000000..cc40b71
--- /dev/null
+++ b/app/node_modules/okservices/oks3/index.js
@@ -0,0 +1,145 @@
+var upload = require("./upload")
+var multer = require('multer')
+
+// Hack to prevent this god-forsaken module from crashing our shit
+var d = require('domain').create()
+d.on('error', function (err) {
+ console.log(err)
+ console.error('Stupid error in S3 upload. Upload probably prematurely canceled')
+})
+
+function OKS3(options) {
+ if (!(this instanceof OKS3)) return new OKS3(options);
+ options = options || {};
+ if (!options.express)
+ throw new Error('Express not provided to OKS3');
+ if (!options.s3)
+ throw new Error('S3 configuration not provided to OKS3');
+
+ if (!options.s3.image) options.s3.image = {}
+ if (!options.s3.audio) options.s3.audio = {}
+ if (!options.s3.video) options.s3.video = {}
+
+ // Make sure maxbytes property is there - it can be a number,
+ // or zero/undefined (for no maximum upload size)
+ if (options.s3.maxbytes) {
+ if (! ('maxbytes' in options.s3.image))
+ options.s3.image.maxbytes = options.s3.maxbytes
+ if (! ('maxbytes' in options.s3.video))
+ options.s3.video.maxbytes = options.s3.maxbytes
+ if (! ('maxbytes' in options.s3.audio))
+ options.s3.audio.maxbytes = options.s3.maxbytes
+ }
+ if (typeof options.s3.image.allowed !== "boolean")
+ options.s3.image.allowed = true
+ if (typeof options.s3.video.allowed !== "boolean")
+ options.s3.video.allowed = false
+ if (typeof options.s3.audio.allowed !== "boolean")
+ options.s3.audio.allowed = false
+
+ upload.init({
+ key: options.s3.key,
+ secret: options.s3.secret,
+ bucket: options.s3.bucket,
+ })
+
+ var express = options.express;
+
+ var router = express.Router();
+
+ var mult = multer()
+
+ router.post('/image', mult.single('image'), function(req, res) {
+ d.run(function () {
+
+ if (! options.s3.image.allowed) {
+ return res.status(500).json({ error: "Image uploading not permitted" })
+ }
+
+ upload.put({
+ file: req.file,
+ preserveFilename: options.s3.image.preserveFilename,
+ dirname: options.s3.dirname,
+ types: {
+ 'image/gif': 'gif',
+ 'image/jpeg': 'jpg',
+ 'image/jpg': 'jpg',
+ 'image/png': 'png',
+ },
+ unacceptable: function(err){
+ res.json({ error: err })
+ },
+ success: function(url){
+ res.json({ url: url })
+ }
+ })
+
+ });
+ });
+
+ router.post('/audio', mult.single('audio'), function(req, res) {
+ d.run(function () {
+
+ if (! options.s3.image.allowed) {
+ return res.status(500).json({ error: "Audio uploading not permitted" })
+ }
+
+ upload.put({
+ file: req.file,
+ preserveFilename: options.s3.audio.preserveFilename,
+ dirname: options.s3.dirname,
+ types: {
+ 'audio/mp3': 'mp3',
+ 'audio/mpeg': 'mp3',
+ 'audio/wav': 'wav',
+ 'audio/flac': 'flac',
+ },
+ unacceptable: function(err){
+ res.json({ error: err })
+ },
+ success: function(url){
+ res.json({ url: url })
+ }
+ })
+
+ });
+ });
+
+ router.post('/video', mult.single('video'), function(req, res) {
+ d.run(function () {
+
+ if (! options.s3.image.allowed) {
+ return res.status(500).json({ error: "Video uploading not permitted" })
+ }
+
+ upload.put({
+ file: req.file,
+ preserveFilename: options.s3.video.preserveFilename,
+ dirname: options.s3.dirname,
+ types: {
+ 'video/mp4': 'mp4',
+ 'video/webm': 'webm',
+ },
+ unacceptable: function(err){
+ res.json({ error: err })
+ },
+ success: function(url){
+ res.json({ url: url })
+ }
+ })
+
+ });
+ });
+
+ function preserveFilename (stream, cb){
+ cb(null, stream.filename)
+ }
+
+ this._middleware = router;
+}
+
+OKS3.prototype.middleware = function() {
+ return this._middleware;
+};
+
+module.exports = OKS3
diff --git a/app/node_modules/okservices/oks3/package.json b/app/node_modules/okservices/oks3/package.json
new file mode 100644
index 0000000..61da414
--- /dev/null
+++ b/app/node_modules/okservices/oks3/package.json
@@ -0,0 +1,16 @@
+{
+ "name": "oks3",
+ "version": "1.0.0",
+ "description": "s3 wassup",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "author": "OKFocus",
+ "license": "None",
+ "dependencies": {
+ "knox": "^0.9.2",
+ "multer": "^1.1.0",
+ "node-uuid": "^1.4.7"
+ }
+}
diff --git a/app/node_modules/okservices/oks3/upload.js b/app/node_modules/okservices/oks3/upload.js
new file mode 100644
index 0000000..517d5f7
--- /dev/null
+++ b/app/node_modules/okservices/oks3/upload.js
@@ -0,0 +1,79 @@
+
+var knox = require('knox')
+var uuid = require('node-uuid')
+
+var s3
+
+var acceptableuploadTypes = {
+ 'image/gif': 'gif',
+ 'image/jpeg': 'jpg',
+ 'image/jpg': 'jpg',
+ 'image/png': 'png',
+}
+
+module.exports = {}
+
+module.exports.init = function (opt){
+ s3 = knox.createClient({
+ key: opt.key,
+ secret: opt.secret,
+ bucket: opt.bucket,
+ })
+}
+
+module.exports.put = function (opt) {
+ var filename
+ var err
+ var now = new Date()
+
+ var file = opt.file
+
+ var types = opt.types || acceptableuploadTypes
+ var extension = types[file.mimetype]
+
+ if (opt.preserveFilename) {
+ filename = file.originalname
+ }
+ else {
+ filename = uuid.v1() + "." + extension;
+ }
+
+ var remote_path = "/" + opt.dirname + "/" + filename
+
+ if (! extension) {
+ err = "Unacceptable filetype."
+ }
+ else if (opt.maxSize && file.size > opt.maxSize) {
+ err = "File too large. Uploads can be a maximum of " + opt.maxSize + " bytes."
+ }
+
+ if (err) {
+ console.error(">>>", err)
+ opt.unacceptable && opt.unacceptable(err)
+ return
+ }
+
+ opt.acceptable && opt.acceptable(err)
+
+ // console.log("upload >", remote_path)
+ s3.putBuffer(file.buffer, remote_path, {
+ 'Content-Length': file.size,
+ 'Content-Type': file.mimetype,
+ 'x-amz-acl': 'public-read'
+ }, function(err, s3res) {
+ if (err || s3res.statusCode !== 200) {
+ console.error(err);
+ if (s3res && s3res.resume) {
+ s3res.resume()
+ }
+ return;
+ }
+
+ var file_url = s3res.url || s3res.req.url
+
+ opt.success && opt.success(file_url)
+ }).on('error', function(err, s3res){
+ console.error(err)
+ s3res && s3res.resume && s3res.resume()
+ })
+}
diff --git a/app/node_modules/okservices/oktwitter/Readme.md b/app/node_modules/okservices/oktwitter/Readme.md
new file mode 100644
index 0000000..def73db
--- /dev/null
+++ b/app/node_modules/okservices/oktwitter/Readme.md
@@ -0,0 +1,6 @@
+# oktwitter
+
+## Service to allow auth with Twitter API
+
+Requests to this service proxy to the twitter API, adding proper auth
+credentials along the way
diff --git a/app/node_modules/okservices/oktwitter/index.js b/app/node_modules/okservices/oktwitter/index.js
new file mode 100644
index 0000000..ec4945d
--- /dev/null
+++ b/app/node_modules/okservices/oktwitter/index.js
@@ -0,0 +1,48 @@
+var Twit = require('twit')
+
+/**
+ * Proxy to Twitter API adding auth creds
+ * TODO Technically can be abused by anyone right now.
+ * Should add some sort of same origin policy.
+ */
+function OKTwitter (options) {
+ if (!(this instanceof OKTwitter)) return new OKTwitter(options)
+ options = options || {}
+ if (!options.express)
+ throw new Error('Express not provided to OKTwitter');
+ if (!options.credentials)
+ throw new Error('Twitter credentials not provided to OKTwitter');
+
+ var express = options.express
+ var router = express.Router()
+ var creds = options.credentials
+ var twitter = new Twit({
+ consumer_key: creds.consumerKey,
+ consumer_secret: creds.consumerSecret,
+ access_token: creds.accessToken,
+ access_token_secret: creds.accessTokenSecret,
+ })
+
+ router.get('*', function (req, res) {
+ twitter.get(req.path.slice(1), req.query, function (err, data) {
+ if (err) {
+ res.status(err.statusCode)
+ res.send(err.twitterReply)
+ } else {
+ res.json(data)
+ }
+ })
+ })
+
+ router.post('*', function (req, res) {
+ throw new Error('Twitter POST requests not implemented')
+ })
+
+ this._router = router
+}
+
+OKTwitter.prototype.middleware = function () {
+ return this._router
+}
+
+module.exports = OKTwitter
diff --git a/app/node_modules/okservices/oktwitter/package.json b/app/node_modules/okservices/oktwitter/package.json
new file mode 100644
index 0000000..ddee2f9
--- /dev/null
+++ b/app/node_modules/okservices/oktwitter/package.json
@@ -0,0 +1,13 @@
+{
+ "name": "oktwitter",
+ "version": "1.0.0",
+ "description": "Allows auth to Twitter API",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "author": "OKFocus",
+ "dependencies": {
+ "twit": "^2.1.1"
+ }
+}
diff --git a/app/node_modules/okservices/okwebhook/index.js b/app/node_modules/okservices/okwebhook/index.js
new file mode 100644
index 0000000..d04e662
--- /dev/null
+++ b/app/node_modules/okservices/okwebhook/index.js
@@ -0,0 +1,83 @@
+
+/**
+ * Service which will listen for a Github webhook, fired on push.
+ * This service can be used to rebuild / restart the app automatically
+ * when new code is pushed.
+ */
+
+var crypto = require('crypto')
+var exec = require('child_process').exec
+var path = require('path')
+
+function OKWebhook (options) {
+ if (!(this instanceof OKWebhook)) return new OKWebhook(options)
+ options = options || {}
+ if (!options.express)
+ throw new Error('Express not provided to OKWebhook');
+ if (!options.config)
+ throw new Error('Configuration not provided to OKWebhook');
+ if (options.config.active && !options.config.secret)
+ throw new Error('Github secret not provided to OKWebhook');
+ if (options.config.active && !options.config.command)
+ throw new Error('Build command not provided to OKWebhook');
+
+ var express = options.express
+ var router = express.Router()
+ var config = options.config
+
+ var secret = config.secret
+ var command = config.command
+
+ router.get('/', function (req, res) {
+ res.send('GET not supported')
+ })
+
+ router.post('/', getBody, function (req, res) {
+ if (!config.active)
+ return
+ console.log("OKWebhook received push")
+ var event = req.headers['x-github-event']
+ if (event !== "push") {
+ return res.sendStatus(500)
+ }
+ var sig = req.headers['x-hub-signature'].split('=')[1]
+ var text = req.rawBody
+ var hash = crypto.createHmac('sha1', secret).update(text).digest('hex')
+ if (hash !== sig) {
+ return res.sendStatus(500)
+ }
+ res.sendStatus(200)
+ var cwd = path.dirname(command)
+ exec(command, { cwd: cwd }, function(err, stdout, stderr){
+ // may not fire if process was restarted..
+ console.log(process.env)
+ console.log(stdout)
+ })
+ })
+
+ function getBody (req, res, next) {
+ req.rawBody = ''
+ // req.setEncoding('utf8')
+
+ req.on('data', function(chunk) {
+ req.rawBody += chunk
+ })
+
+ req.on('end', function() {
+ try {
+ req.body = JSON.parse(req.rawBody)
+ } catch (e) {
+ return res.sendStatus(500)
+ }
+ next()
+ })
+ }
+
+ this._router = router
+}
+
+OKWebhook.prototype.middleware = function () {
+ return this._router
+}
+
+module.exports = OKWebhook
diff --git a/app/node_modules/okservices/okwebhook/package.json b/app/node_modules/okservices/okwebhook/package.json
new file mode 100644
index 0000000..0436f01
--- /dev/null
+++ b/app/node_modules/okservices/okwebhook/package.json
@@ -0,0 +1,11 @@
+{
+ "name": "okwebhook",
+ "version": "1.0.0",
+ "description": "webhook to receive pushes from github",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "author": "okfocus <frontdesk@okfoc.us>",
+ "license": "LNT"
+}
diff --git a/app/node_modules/okservices/package.json b/app/node_modules/okservices/package.json
index f27247b..6231499 100644
--- a/app/node_modules/okservices/package.json
+++ b/app/node_modules/okservices/package.json
@@ -4,12 +4,8 @@
"description": "providing very good services",
"main": "index.js",
"scripts": {
+ "postinstall": "./install.sh",
"test": "echo \"Error: no test specified\" && exit 1"
},
- "author": "OKFocus",
- "license": "None",
- "dependencies": {
- "skipper": "^0.5.5",
- "skipper-s3": "^0.5.5"
- }
+ "author": "OKFocus"
}
diff --git a/app/node_modules/oktemplate/index.js b/app/node_modules/oktemplate/index.js
index a37f78e..ae9d1b1 100644
--- a/app/node_modules/oktemplate/index.js
+++ b/app/node_modules/oktemplate/index.js
@@ -4,6 +4,7 @@ var path = require('path');
var glob = require('glob');
var stringify = require('json-to-html');
var Liquid = require('liquid-node');
+var chokidar = require('chokidar');
/**
* Define any custom liquid filters here.
@@ -14,13 +15,24 @@ var filters = {
* Return a string formatted version of a JSON object.
* Useful for quick debugging of template data.
*/
- stringify: function(obj) {
+ prettify: function(obj) {
try {
return '<pre>' + stringify(obj) + '</pre>';
} catch (e) {
+ return 'Error prettifying';
+ }
+ },
+
+ /**
+ * Serialize Javascript objects into a JSON string
+ */
+ stringify: function(obj) {
+ try {
+ return JSON.stringify(obj);
+ } catch (e) {
return 'Error stringifying';
}
- }
+ },
};
@@ -29,19 +41,56 @@ var filters = {
*/
function OKTemplateRepo(options) {
options = options || {};
+ var self = this;
var root = this._root = options.root || 'templates';
- var ext = 'liquid';
+ // TODO Support more templates?
+ var ext = this._ext = 'liquid';
var cache = this._cache = {};
var engine = this._engine = new Liquid.Engine;
+ var debug = options.debug;
+ var globString = this._globString = root + '/*.' + ext
engine.registerFilters(filters);
engine.fileSystem = new Liquid.LocalFileSystem(root, ext);
+
this._populateCache(engine, cache, ext);
+
+ if (debug) {
+ var watcher = chokidar.watch(globString);
+ watcher.on('change', reloadTemplate);
+ watcher.on('add', reloadTemplate);
+ }
+
+ function reloadTemplate(path) {
+ self._loadTemplate(path);
+ }
}
OKTemplateRepo.prototype.getTemplate = function getTemplate(name) {
return this._cache[name];
}
+OKTemplateRepo.prototype._loadTemplate = function loadTemplate(filePath) {
+ var engine = this._engine
+ var name = path.basename(filePath, '.' + this._ext);
+ var templateString = fs.readFileSync(filePath, {encoding: 'UTF8'});
+ if (!this._cache[name])
+ this._cache[name] = {};
+
+ var template = this._cache[name]
+ template.name = name;
+ template.templateString = templateString;
+ template.render = render
+
+ function render(data) {
+ return Q.promise(function(resolve, reject) {
+ // TODO Not sure if this caches parsed templates behind the scenes?
+ engine.parseAndRender(templateString, data)
+ .then(resolve)
+ .catch(reject);
+ });
+ }
+}
+
/**
* Go through our template dir and read the template files
* into memory as strings.
@@ -49,22 +98,9 @@ OKTemplateRepo.prototype.getTemplate = function getTemplate(name) {
*/
OKTemplateRepo.prototype._populateCache = function _populateCache(engine, cache, ext) {
var self = this;
- var files = glob.sync(this._root + '/*.' + ext);
- files.forEach(function eachFile(file) {
- var name = path.basename(file, '.' + ext);
- var templateString = fs.readFileSync(file, {encoding: 'UTF8'});
- cache[name] = {
- name: name,
- templateString: templateString,
- render: function(data) {
- return Q.promise(function(resolve, reject) {
- // TODO Not sure if this caches parsed templates behind the scenes?
- engine.parseAndRender(templateString, data)
- .then(resolve)
- .catch(reject);
- });
- }
- }
+ var files = glob.sync(this._globString);
+ files.forEach(function eachFile(path) {
+ self._loadTemplate(path);
});
}
diff --git a/app/node_modules/oktemplate/package.json b/app/node_modules/oktemplate/package.json
index 70e94e3..61d90e8 100644
--- a/app/node_modules/oktemplate/package.json
+++ b/app/node_modules/oktemplate/package.json
@@ -10,6 +10,7 @@
"license": "None",
"dependencies": {
"bluebird": "^2.9.21",
+ "chokidar": "^1.0.3",
"glob": "^5.0.3",
"json-to-html": "^0.1.2",
"liquid-node": "^2.5.0",
diff --git a/app/node_modules/okview/index.js b/app/node_modules/okview/index.js
index 6eebe6e..5f99d59 100644
--- a/app/node_modules/okview/index.js
+++ b/app/node_modules/okview/index.js
@@ -21,11 +21,14 @@ function OKView(options) {
if (!options.template)
throw new Error('No template provided to OKView.');
if (!options.meta)
- throw new Error('No meta resource provided to OKView');
+ throw new Error('No metadata provided to OKView');
if (!options.route)
throw new Error('No route provided to OKView');
+ if (!options.errorHandler)
+ throw new Error('No error handler provided to OKView');
var route = options.route;
var mount = options.mount || 'get';
+ var error = this._error = options.errorHandler;
this._template = options.template;
var meta = this._meta = options.meta;
var queries = this._queries = options.queries || [];
@@ -47,16 +50,9 @@ function OKView(options) {
enumerable: true
});
- this._middleware = createMiddleware(this);
- this._fetchTemplateData = unbound ? fetchUnbound : fetchBound;
-
- function fetchUnbound(id) {
- return fetchTemplateData(meta, queries, id)
- }
-
- function fetchBound() {
- return fetchTemplateData(meta, queries);
- }
+ this._middleware = unbound
+ ? unboundMiddleware(this, meta, queries, error)
+ : boundMiddleware(this, meta, queries, error);
}
OKView.prototype.middleware = function() {
@@ -66,39 +62,20 @@ OKView.prototype.middleware = function() {
OKView.prototype.render = function(req, res, data) {
this._template.render(data).then(function(html) {
res.send(html);
- }).fail(errorHandler(req, res, data));
-};
-
-OKView.prototype.fetchTemplateData = function() {
- return this._fetchTemplateData.apply(this, arguments);
+ }).fail(this._error(req, res, 500));
};
/**
- * Unbound views need different middleware to resolve requests
- */
-function createMiddleware(view) {
- if (view.unbound) {
- return unboundMiddleware(view);
- } else {
- return boundMiddleware(view);
- }
-}
-
-// Note that these middleware do not call next
-// and should thus always be added at the end of the
-// middleware chain.
-
-/**
* Creates middleware for a view which does not
* yet have a resource id associated with it
*/
-function unboundMiddleware(view) {
+function unboundMiddleware(view, meta, queries, error) {
var paramName = getParamName(view.route);
return function(req, res, next) {
var id = req.params[paramName];
- view.fetchTemplateData(id).then(function(data) {
+ fetchTemplateData(meta, queries, id).then(function(data) {
view.render(req, res, data);
- }).fail(errorHandler(req, res, next));
+ }).fail(failHandler(req, res, error));
};
}
@@ -106,20 +83,22 @@ function unboundMiddleware(view) {
* Creates middleware for a view which already
* has a resource id associated with it
*/
-function boundMiddleware(view) {
+function boundMiddleware(view, meta, queries, error) {
return function(req, res, next) {
- view.fetchTemplateData().then(function(data) {
+ fetchTemplateData(meta, queries).then(function(data) {
view.render(req, res, data);
- }).fail(errorHandler(req, res, next));
+ }).fail(failHandler(req, res, error));
};
}
-/**
- * TODO BS error handling for now
- */
-function errorHandler(req, res, next) {
- return function(err) {
- res.send(err.stack);
+function failHandler(req, res, error) {
+ return function (err) {
+ // TODO Use custom exception type
+ if (err.message === 'No resource found') {
+ error(req, res, 404)(err);
+ } else {
+ error(req, res, 500)(err);
+ }
}
}
@@ -138,49 +117,56 @@ function getParamName(route) {
* and returns a promise for an object merging all queried
* data, pluralizing keys where necessary.
*
- * Lil bit convoluted, sorry.
+ * Pretty convoluted, sorry.
*/
function fetchTemplateData(meta, queries, id) {
+ // If there's only one query, we assume it is for a single
+ // resource and will resolve errors if no data is found
+ var single = queries && queries.length === 1;
return Q.promise(function(resolve, reject) {
- return Q.all(
- [meta.get()].concat(queries.map(function(query) {
- return query.get(id);
- })))
- .then(function(results) {
- var metadata = results.shift();
- var normalized = results.reduce(function(cache, result, i) {
- // Could be just some rogue request
- if (!result) {
- return cache;
- }
- var resource = queries[i].resource;
- var type = queries[i].type;
- var manyResult = isarray(result);
- // Inform template of ID in generic field
- if (manyResult) {
- result = result.map(function(data) {
- return assign({}, data, {id: data[resource.idField]})
- });
- } else {
- result = assign({}, result, {id: result[resource.idField]});
- }
- // If we have a lot of results for a certain type,
- // we pluralize the key and yield an array of results
- if (cache[type] || manyResult) {
- var plural = pluralize(type);
- delete cache[type];
- cache[plural] = [];
- if (manyResult) {
- cache[plural] = cache[plural].concat(result);
+ return Q.all(queries.map(function(query) {
+ return query.get(id);
+ })).then(function(results) {
+ if (single && !results[0]) {
+ reject(new Error('No resource found'));
+ } else {
+ var normalized = results.reduce(function(cache, result, i) {
+ // Could be just some rogue request
+ if (!result) {
+ return cache;
+ }
+ var query = queries[i]
+ var resource = query.resource;
+ var type = query.as || query.type;
+ var manyResult = isarray(result);
+ var groupBy = query.groupBy
+ // If we have a lot of results for a certain type,
+ // we pluralize the key and yield an array of results
+ if (cache[type] || manyResult || groupBy) {
+ var plural = pluralize(type);
+ delete cache[type];
+ cache[plural] = [];
+ // Pluralize grouped field
+ if (query.groupBy) {
+ result = Object.keys(result).reduce(function(acc, key) {
+ acc[pluralize(key)] = result[key]
+ return acc
+ }, {})
+ }
+ if (manyResult) {
+ cache[plural] = cache[plural].concat(result);
+ } else if (groupBy) {
+ cache[plural] = result
+ } else {
+ cache[plural].push(result);
+ }
} else {
- cache[plural].push(result);
+ cache[type] = result;
}
- } else {
- cache[type] = result;
- }
- return cache;
- }, {meta: metadata});
- resolve(normalized);
+ return cache;
+ }, {meta: meta});
+ resolve(normalized);
+ }
}).fail(reject);
});
}
diff --git a/examples/db.json b/examples/db.json
index 148391a..b6ab96b 100644
--- a/examples/db.json
+++ b/examples/db.json
@@ -3,8 +3,8 @@
"bread": [
{
"type": "pretzel",
- "description": "really a very tasty bread! yup yes",
- "color": "green",
+ "description": "really a very tasty bread!",
+ "color": "red",
"id": "pretzel",
"title": "Pretzel Chips",
"images": [
@@ -13,6 +13,10 @@
"caption": "cool"
},
{
+ "uri": "https://ltho.s3.amazonaws.com/013781df-a926-409b-ab2a-b7b2becf99fa.png",
+ "caption": ""
+ },
+ {
"uri": "https://ltho.s3.amazonaws.com/5f4c3351-9434-446a-883b-aa4bffce8da3.png",
"caption": "errrr"
}
@@ -21,9 +25,13 @@
"url": "",
"type": "",
"token": "",
+ "width": "",
+ "height": "",
"title": "",
"thumb": ""
- }
+ },
+ "__index": "0",
+ "dateCreated": ""
},
{
"type": "bagel",
@@ -31,38 +39,263 @@
"id": "bagel",
"title": "nice",
"color": "blue",
- "images": [],
+ "images": [
+ {
+ "uri": "https://ltho.s3.amazonaws.com/229bcbc6-fb3c-428f-8c34-0c6bb69e70fd.gif",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/a7663bfc-501c-4354-b6ed-6ea305a8fb39.gif",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/7d380c24-7803-491a-94df-e812cbe667bb.gif",
+ "caption": ""
+ }
+ ],
"video": {
"url": "https://vimeo.com/112498725",
"type": "vimeo",
"token": "112498725",
+ "width": "",
+ "height": "",
"title": "FW14-2H-VIDEO-V4 2",
"thumb": "http://i.vimeocdn.com/video/497493142_640.jpg"
- }
+ },
+ "__index": "1",
+ "dateCreated": ""
},
{
"type": "pumpernickel",
- "description": "grandma's recipe",
+ "description": "yup",
"id": "pumpernickel",
- "title": "Pumpernickel",
+ "title": "ok",
"images": [
{
"uri": "cool",
"caption": "cool"
}
- ]
+ ],
+ "color": "red",
+ "video": {
+ "url": "",
+ "type": "",
+ "token": "",
+ "title": "",
+ "thumb": ""
+ },
+ "__index": 2
+ },
+ {
+ "type": "cracker",
+ "title": "",
+ "description": "once upon a time this noble creature etc",
+ "color": "red",
+ "video": {
+ "url": "",
+ "type": "",
+ "token": "",
+ "title": "",
+ "thumb": ""
+ },
+ "__index": 4,
+ "id": "cracker"
+ },
+ {
+ "type": "croissant",
+ "title": "",
+ "description": "wow just wow",
+ "color": "red",
+ "video": {
+ "url": "",
+ "type": "",
+ "token": "",
+ "title": "",
+ "thumb": ""
+ },
+ "__index": 3,
+ "id": "croissant"
}
],
"page": [
{
"title": "About Us",
"body": "Just a small bakery",
- "id": "about"
+ "id": "about",
+ "__index": "1",
+ "links": [],
+ "dateCreated": ""
},
{
- "title": "contact",
+ "title": "ok...",
"body": "2406 Old Rd, San Juan Bautista",
- "id": "contact"
+ "id": "contact",
+ "__index": "0",
+ "links": [
+ {
+ "text": "US Bread Board",
+ "uri": "http://bread.com/"
+ },
+ {
+ "text": "National Council on Grain",
+ "uri": "http://grain.org/"
+ },
+ {
+ "text": "USDA",
+ "uri": "http://usda.gov/"
+ }
+ ],
+ "dateCreated": ""
+ }
+ ],
+ "test": [
+ {
+ "id": "red",
+ "title": "Red",
+ "media": [
+ {
+ "uri": "https://ltho.s3.amazonaws.com/okcms-example/a91c4210-080c-11e6-8a7d-f30231d4ec26.png",
+ "width": "800",
+ "height": "800",
+ "caption": "",
+ "type": "image"
+ },
+ {
+ "uri": "http://asdf.us/",
+ "caption": "ASDF",
+ "type": "link"
+ }
+ ],
+ "__index": 0,
+ "dateCreated": "Mon, 28 Mar 2016 23:02:45 GMT",
+ "flagged": false
+ },
+ {
+ "id": "blue",
+ "title": "Blue",
+ "__index": 2,
+ "dateCreated": "Tue, 05 Apr 2016 15:17:54 GMT",
+ "media": [
+ {
+ "uri": "https://ltho.s3.amazonaws.com/okcms-example/f2775199-d700-4b1f-951f-88fda599014e.png",
+ "caption": "",
+ "type": "image"
+ }
+ ]
+ },
+ {
+ "id": "green",
+ "title": "Green",
+ "__index": 1,
+ "dateCreated": "Tue, 05 Apr 2016 15:17:57 GMT",
+ "media": [
+ {
+ "uri": "http://asdf.us/z/",
+ "caption": "",
+ "type": "link"
+ },
+ {
+ "uri": "http://asdf.us/",
+ "caption": "",
+ "type": "link"
+ },
+ {
+ "type": "video",
+ "token": "https://ltho.s3.amazonaws.com/ee12b137-1c8a-400a-87e3-89cbee7b4da6.mp4",
+ "uri": "",
+ "width": "400",
+ "height": "400",
+ "title": "ee12b137-1c8a-400a-87e3-89cbee7b4da6.mp4",
+ "thumb": "http://okfocus.s3.amazonaws.com/misc/okcms/video.png",
+ "autoplay": "true",
+ "loop": "false"
+ },
+ {
+ "type": "youtube",
+ "token": "y_35kXCQxN4",
+ "uri": "",
+ "width": "640",
+ "height": "360",
+ "title": "dëf lëöpär¨d¨¨¨¨<>~!@~#!:I!@",
+ "thumb": "http://i.ytimg.com/vi/y_35kXCQxN4/hqdefault.jpg",
+ "autoplay": "false",
+ "loop": "true"
+ },
+ {
+ "type": "audio",
+ "token": "http://asdf.us/clouds35.mp3",
+ "uri": "",
+ "duration": "225.645792",
+ "title": "clouds35.mp3",
+ "thumb": "http://okfocus.s3.amazonaws.com/misc/okcms/video.png"
+ }
+ ],
+ "flagged": true
+ }
+ ],
+ "flour": [
+ {
+ "id": "test",
+ "title": "TEST",
+ "image": {
+ "uri": "https://ltho.s3.amazonaws.com/okcms-example/7be163d0-080b-11e6-8a7d-f30231d4ec26.png",
+ "caption": "",
+ "width": "800",
+ "height": "800"
+ },
+ "__index": 0,
+ "dateCreated": "Thu, 21 Apr 2016 21:52:44 GMT"
+ }
+ ],
+ "card": [
+ {
+ "id": "1",
+ "title": "1",
+ "stack": "demo",
+ "__index": 5,
+ "dateCreated": "Fri, 02 Sep 2016 16:40:43 GMT"
+ },
+ {
+ "id": "2",
+ "title": "2",
+ "stack": "demo",
+ "__index": 4,
+ "dateCreated": "Fri, 02 Sep 2016 16:40:57 GMT"
+ },
+ {
+ "id": "3",
+ "title": "3",
+ "stack": "demo",
+ "__index": 3,
+ "dateCreated": "Fri, 02 Sep 2016 16:41:00 GMT"
+ },
+ {
+ "id": "4",
+ "title": "4",
+ "stack": "demo-2",
+ "__index": 1,
+ "dateCreated": "Fri, 02 Sep 2016 16:41:17 GMT"
+ },
+ {
+ "id": "5",
+ "title": "5",
+ "stack": "demo-2",
+ "__index": 2,
+ "dateCreated": "Fri, 02 Sep 2016 16:41:21 GMT"
+ }
+ ],
+ "stack": [
+ {
+ "id": "demo",
+ "title": "Demo",
+ "__index": 0,
+ "dateCreated": "Fri, 02 Sep 2016 16:20:27 GMT"
+ },
+ {
+ "id": "demo-2",
+ "title": "Demo #2",
+ "__index": 1,
+ "dateCreated": "Fri, 02 Sep 2016 16:41:10 GMT"
}
]
} \ No newline at end of file
diff --git a/examples/index.js b/examples/index.js
index 0b9bf02..f1fabfa 100644
--- a/examples/index.js
+++ b/examples/index.js
@@ -1,14 +1,32 @@
var okcms = require('..');
+var isProduction = process.env.OK_PRODUCTION === 'true'
+var port = process.env.PORT || 1337;
+
var app = okcms.createApp({
root: 'public',
+ debug: !isProduction,
+ production: isProduction,
+
+ admin: {
+ dashboard: {
+ resources: {
+ card: {
+ groupBy: 'stack',
+ descending: true
+ }
+ }
+ },
+ },
+
schemas: {
page: {
id: {type: 'string'},
title: {type: 'string'},
- body: {type: 'text'}
+ body: {type: 'text'},
+ links: {type: 'link-list'},
},
bread: {
type: {type: 'string', id: true},
@@ -16,7 +34,27 @@ var app = okcms.createApp({
description: {type: 'text'},
color: {type: 'enum', options: ["red","blue","green"]},
video: {type: 'video'},
- images: {type: 'captioned-image-list'}
+ images: {type: 'gallery'}
+ },
+ test: {
+ id: {type: 'string', hidden: true},
+ title: {type: 'string'},
+ flagged: {type: 'flag'},
+ media: {type: 'media'},
+ },
+ flour: {
+ id: {type: 'string', hidden: true},
+ title: {type: 'string'},
+ image: {type: 'image'},
+ },
+ card: {
+ id: {type: 'string', hidden: true},
+ title: {type: 'string'},
+ stack: {type: 'foreign-key', key: 'stack'},
+ },
+ stack: {
+ id: {type: 'string', hidden: true},
+ title: {type: 'string'},
}
},
@@ -24,6 +62,10 @@ var app = okcms.createApp({
{ type: 'page', static: {id: 'about'}},
{ type: 'page', static: {id: 'contact'}},
{ type: 'bread' },
+ { type: 'test' },
+ { type: 'flour' },
+ { type: 'card' },
+ { type: 'stack' },
],
services: {
@@ -31,6 +73,25 @@ var app = okcms.createApp({
key: process.env.S3_KEY,
secret: process.env.S3_SECRET,
bucket: process.env.S3_BUCKET,
+ dirname: "okcms-example",
+ image: { allowed: true, preserveFilename: false, maxbytes: 2*1024*1024 },
+ video: { allowed: true, preserveFilename: true, maxbytes: 200*1024*1024 },
+ audio: { allowed: true, preserveFilename: true, maxbytes: 100*1024*1024 },
+ },
+
+ webhook: {
+ active: false,
+ secret: 'test',
+ command: '/path/to/build.sh',
+ },
+
+ example: {
+ lib: require("./lib/okexample"),
+ stuff: "things",
+ },
+
+ dumpfm: {
+ lib: require("./lib/okdumpfm"),
}
},
@@ -52,6 +113,6 @@ var app = okcms.createApp({
}
}
-}).listen(process.env.PORT || 1337);
+}).listen(port)
-console.log('Server listening at port ' + (process.env.PORT || 1337) + '...');
+console.log('Server listening at port %d...', port);
diff --git a/examples/lib/okdumpfm/index.js b/examples/lib/okdumpfm/index.js
new file mode 100644
index 0000000..4dc5461
--- /dev/null
+++ b/examples/lib/okdumpfm/index.js
@@ -0,0 +1,39 @@
+var request = require('request')
+
+/**
+ * Example service which queries the Dump search.
+ */
+function OKDumpfm (options) {
+ if (!(this instanceof OKDumpfm)) return new OKDumpfm(options)
+ options = options || {}
+ if (!options.express)
+ throw new Error('Express not provided to OKDumpfm');
+
+ var express = options.express
+ var router = express.Router()
+
+ router.get('*', function (req, res) {
+ var query = req.query.q
+ request('http://dump.fm/cmd/search/' + query, function (err, response, body) {
+ if (err || response.statusCode !== 200) {
+ res.status(response.statusCode)
+ res.send(err)
+ } else {
+ res.set('Content-Type', 'application/json; charset=utf-8')
+ res.send(body)
+ }
+ })
+ })
+
+ router.post('*', function (req, res) {
+ throw new Error('OKDumpfm POST requests not implemented')
+ })
+
+ this._router = router
+}
+
+OKDumpfm.prototype.middleware = function () {
+ return this._router
+}
+
+module.exports = OKDumpfm
diff --git a/examples/lib/okdumpfm/package.json b/examples/lib/okdumpfm/package.json
new file mode 100644
index 0000000..17bcba2
--- /dev/null
+++ b/examples/lib/okdumpfm/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "okdumpfm",
+ "version": "1.0.0",
+ "description": "service to query the dump search API",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "author": "okfocus <frontdesk@okfoc.us>",
+ "license": "LNT",
+ "dependencies": {
+ "request": "^2.71.0"
+ }
+}
diff --git a/examples/lib/okexample/index.js b/examples/lib/okexample/index.js
new file mode 100644
index 0000000..04c5984
--- /dev/null
+++ b/examples/lib/okexample/index.js
@@ -0,0 +1,49 @@
+
+/**
+ * Example service to show how these things should be set up.
+ *
+ * Services should be added to index.js in the proper area,
+ * with any configuration parameters that you want passed in:
+ *
+ * services: {
+ * example: {
+ * lib: require("./lib/okexample"),
+ * stuff: "things",
+ * }
+ * },
+ *
+ * The service will be mounted on /_services/example
+ *
+ * This binds to route '*' but you can specify e.g. "/thing",
+ * and it will be mounted on /_services/example/thing
+ */
+
+function OKExample (options) {
+ if (!(this instanceof OKExample)) return new OKExample(options)
+ options = options || {}
+ if (!options.express)
+ throw new Error('Express not provided to OKExample');
+ if (!options.config)
+ throw new Error('Configuration not provided to OKExample');
+
+ var express = options.express
+ var router = express.Router()
+ var config = options.config
+ var db = options.db
+
+ router.get('*', function (req, res) {
+ res.send(config.stuff)
+ })
+
+ router.post('*', function (req, res) {
+ throw new Error('OKExample POST requests not implemented')
+ })
+
+ this._router = router
+}
+
+OKExample.prototype.middleware = function () {
+ return this._router
+}
+
+module.exports = OKExample
diff --git a/examples/lib/okexample/package.json b/examples/lib/okexample/package.json
new file mode 100644
index 0000000..2b2a47c
--- /dev/null
+++ b/examples/lib/okexample/package.json
@@ -0,0 +1,11 @@
+{
+ "name": "okexample",
+ "version": "1.0.0",
+ "description": "example service",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "author": "okfocus <frontdesk@okfoc.us>",
+ "license": "LNT"
+}
diff --git a/install.sh b/install.sh
index e0a43c4..41e51dc 100755
--- a/install.sh
+++ b/install.sh
@@ -1,5 +1 @@
-cd app/node_modules ; for i in * ; do cd $i ; npm install; cd .. ; done ; cd ../..
-npm install
-cd examples
-node index
-
+cd app/node_modules ; for i in ok* ; do cd $i ; npm install; cd .. ; done ; cd ../..
diff --git a/package.json b/package.json
index 1358023..bc2bba6 100644
--- a/package.json
+++ b/package.json
@@ -1,24 +1,28 @@
{
"name": "okcms",
- "version": "1.0.0",
- "description": "great",
+ "version": "0.1.36",
+ "description": "The dopest CMS on the planet.",
"main": "app/index.js",
"scripts": {
+ "postinstall": "./install.sh",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "OKFocus",
- "license": "None",
+ "license": "LNT",
"dependencies": {
"dotenv": "^1.1.0",
"express": "^4.12.3",
+ "object-assign": "^2.0.0",
+ "q": "^1.2.0",
+ "request": "^2.71.0"
+ },
+ "devDependencies": {
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-concat": "^0.5.1",
- "grunt-contrib-copy": "^0.8.0",
- "grunt-contrib-uglify": "^0.9.1",
"grunt-dentist": "^0.3.4",
- "object-assign": "^2.0.0",
- "q": "^1.2.0"
+ "grunt-contrib-copy": "^0.8.0",
+ "grunt-contrib-uglify": "^0.9.1"
}
}
diff --git a/site/DEPLOY b/site/DEPLOY
new file mode 100644
index 0000000..cedf761
--- /dev/null
+++ b/site/DEPLOY
@@ -0,0 +1,21 @@
+To deploy
+===
+
+`npm bin`/pm2 start index.js
+
+---
+
+The `npm bin` bit resolves the path to the locally installed `pm2`
+command. Could also use a global install.
+
+`npm bin`/pm2 logs
+
+to see logs and
+
+`npm bin`/pm2 list
+
+to see running processes and
+
+`npm bin`/pm2 show [id]
+
+for more process info
diff --git a/site/TODO b/site/TODO
new file mode 100644
index 0000000..c519946
--- /dev/null
+++ b/site/TODO
@@ -0,0 +1,2 @@
+This really should be in its own repo
+At very least, it should have its own package.json
diff --git a/site/db.json b/site/db.json
index 14f8724..39765bd 100644
--- a/site/db.json
+++ b/site/db.json
@@ -1,49 +1,1378 @@
{
"meta": [],
- "retail": [
+ "experiential": [
{
- "id": "diesel-ss15",
- "title": "DIESEL JOGG JEANS SS15 DENIM CAMPAIGN",
- "shortname": "DIESEL SS15",
- "description": "Sed posuere consectetur est at lobortis. Donec id elit non mi porta gravida at eget metus. Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. Donec sed odio dui. \r\n\r\nVestibulum id ligula porta felis euismod semper. Vestibulum id ligula porta felis euismod semper. Vestibulum id ligula porta felis euismod semper. Aenean lacinia bibendum nulla sed consectetur. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. \r\n\r\nCurabitur blandit tempus porttitor. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec ullamcorper nulla non metus auctor fringilla. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur blandit tempus porttitor. Maecenas sed diam eget risus varius blandit sit amet non magna.",
- "video": {
- "url": "http://vimeo.com/112498725",
- "type": "vimeo",
- "token": "112498725",
- "title": "CURABITUR BLANDIT TEMPUS PORTTITOR.",
- "thumb": "http://i.vimeocdn.com/video/497493142_640.jpg"
+ "id": "nicola-s-new-york",
+ "title": "NICOLA’S NEW YORK",
+ "menu": "NICOLA’S NEW YORK",
+ "description": "THE FIRST OMNI-CHANNEL RETAIL EXPERIENCE DRIVEN BY SOCIAL MEDIA. THE SHOP AND ITS PRODUCTS EVOLVED DAILY TO PROVIDE A HIGHLY CURATED ENVIRONMENT, WHERE ALL OF THE STORE PROGRAMMING WAS PROMOTED THROUGH SOCIAL MEDIA PLATFORMS.\r\n\r\nMADE WITH BOFFO + MARK FOSTER GAGE ARCHITECTS",
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F999cc7cf-225e-4003-aef0-e7d7f75720d9.jpg",
+ "caption": ""
},
- "images": [
+ "__index": 5,
+ "media": [
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F035e6b07-4f42-4f84-af57-d42aee71a90d.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F0cfe6dfd-c1d8-4262-83fe-6b3fa64fb40b.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F2c079de9-fb7b-4e53-8dba-350d85ff42cb.jpg",
+ "caption": ""
+ },
{
- "uri": "http://twohustlers.com/bigimages/ss15_1.jpg",
- "caption": "CURABITUR BLANDIT TEMPUS PORTTITOR 2"
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fa3e1bb68-7efc-44b4-a702-d0e3ed54f49d.jpg",
+ "caption": ""
},
{
- "uri": "http://twohustlers.com/bigimages/ss15_2.jpg",
- "caption": "CURABITUR BLANDIT TEMPUS PORTTITOR 3"
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fd19168eb-e98f-4a66-b884-f3c7a600d1f5.jpg",
+ "caption": ""
},
{
- "uri": "http://twohustlers.com/bigimages/ss15_3.jpg",
- "caption": "CURABITUR BLANDIT TEMPUS PORTTITOR 4"
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fda8a695d-c7d3-42f9-8cff-260f63d3d9b6.jpg",
+ "caption": ""
+ }
+ ],
+ "dateCreated": ""
+ },
+ {
+ "id": "nicola-s-lane-crawford",
+ "title": "NICOLA'S LANE CRAWFORD",
+ "menu": "NICOLA'S LANE CRAWFORD",
+ "description": "MADE WITH NICOLA FORMICHETTI + MARK FOSTER GAGE ARCHITECTS + LANE CRAWFORD BEIJING & HONG KONG",
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F5990399b-8d25-4b46-8e00-6417ecfa4ad6.jpg",
+ "caption": ""
+ },
+ "__index": 6,
+ "media": [
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F3e2d6814-1fe4-4121-8b86-4aa4983bd319.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F5adf3c85-3e46-47b7-9289-262f5cbe12fa.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fffcb0abb-4a28-4671-93b5-a2e0df091759.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F4274366d-ba91-4b28-9fa6-2ffb91cf5504.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F60c1c7d7-4e39-44e5-8421-06c5eb410590.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fb1dccbd3-cdf3-4d08-845f-a29736145c32.jpg",
+ "caption": ""
+ }
+ ],
+ "dateCreated": ""
+ },
+ {
+ "id": "nicola-s-holiday-pop-up",
+ "title": "NICOLA'S HOLIDAY POP-UP",
+ "menu": "NICOLA'S HOLIDAY POP-UP",
+ "description": "",
+ "media": [
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F1dc7e122-a12b-47c8-a65d-80fc67b54239.jpg",
+ "caption": ""
+ },
+ {
+ "type": "vimeo",
+ "token": "99641686",
+ "title": "Nicopanda Holiday Pop-Up Shop ",
+ "thumb": "http://i.vimeocdn.com/video/480884207_640.jpg"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F0fa87125-e5b2-4020-8646-1155aba96250.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F58c0a52b-86dd-48d0-9c44-294f98623f22.jpg",
+ "caption": ""
+ }
+ ],
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F478a842b-49ff-4a8c-b192-adeadb2410bf.jpg",
+ "caption": ""
+ },
+ "__index": 7,
+ "dateCreated": ""
+ },
+ {
+ "id": "gaga-s-workshop-barneys-new-york",
+ "title": "GAGA'S WORKSHOP + BARNEYS NEW YORK",
+ "menu": "BARNEYS NEW YORK",
+ "description": "CREATED THE FIRST EVER LIVE-STREAMED TWITTER FEED INSIDE OF A RETAIL WINDOW DISPLAY, ALLOWING USERS TO ENGAGE WITH LADY GAGA AND THE TWITTER AUDIENCE AND WATCH THE CONVERSATION GROW DIRECTLY FROM THE WINDOW DISPLAY. \r\n\r\nMADE WITH BARNEYS NEW YORK + LADY GAGA + TIM RICHARDSON + THE MILL",
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F263c4280-b4d7-4aa5-91c7-c64558834560.jpg",
+ "caption": ""
+ },
+ "__index": 1,
+ "media": [
+ {
+ "type": "vimeo",
+ "token": "37225537",
+ "title": "BARNEY'S, GAGA CONSTELLATION VIDEO",
+ "thumb": "http://i.vimeocdn.com/video/255633328_640.jpg"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Ffd59938e-fcf5-4760-935f-862cce53ab4d.jpeg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F2a910cb9-66b5-4e19-84d0-77e177ecefdf.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fed4ffb2e-c373-4be1-9118-23ad46306e7f.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F5382fb79-f276-46f1-91aa-d729acecccd6.jpeg",
+ "caption": ""
+ }
+ ],
+ "dateCreated": ""
+ },
+ {
+ "id": "-dieselreboot",
+ "title": "#DIESELREBOOT",
+ "menu": "DIESEL F/W 2013 OUTDOOR EXECUTIONS",
+ "description": "THE BRAND TRANSCENDED URL INTO IRL CONTINUING TO CELEBRATE THE TUMBLR COMMUNITY THROUGH ENGAGING OUTDOOR INSTALLATIONS, FROM WRAPPING A DEPARTMENT STORE TO WRITING AN OPEN LETTER IN THE NEW YORK TIMES. \r\n\r\nMADE WITH DIESEL + NEW YORK TIMES + GALERIES LAFAYETTE",
+ "media": [
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F8e71691e-eacf-4ebe-ae82-f3cdcca4de1e.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F9f71595b-a59c-497a-9fb3-87cdd44edf6b.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fc77b7911-8d30-4c9a-8223-73b60f8a0011.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fa19097df-0414-49f5-94ab-7967f3189ece.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F94dc19ac-1d82-4b88-9e62-8718b3677453.jpg",
+ "caption": ""
+ }
+ ],
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F69fac98e-30ae-48b9-a312-bc8803138a71.jpg",
+ "caption": ""
+ },
+ "__index": 2,
+ "dateCreated": ""
+ },
+ {
+ "id": "diesel-venice-twitter",
+ "title": "DIESEL VENICE + TWITTER",
+ "menu": "DIESEL VENICE",
+ "description": "COLLABORATED WITH TWITTER TO CREATE A BESPOKE DIGITAL FASHION SHOW EXPERIENCE UTILIZING NEW TECHNOLOGY THAT ALLOWED THE GLOBAL, DIGITAL AUDIENCE TO ENGAGE WITH AND BE PART OF THE SHOW ONLINE.\r\n\r\nMADE WITH DIESEL + NICK KNIGHT + SHOWSTUDIO + TWITTER",
+ "media": [
+ {
+ "type": "vimeo",
+ "token": "127544090",
+ "title": "Diesel Venice Short",
+ "thumb": "http://i.vimeocdn.com/video/518352040_640.jpg"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fb8e1f7c8-103b-4d0e-af70-816d6775db1a.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fa20ffa70-ab53-42a7-b509-50e595b0914c.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fd15601ae-a20e-458e-91ad-a04c94127e68.jpg",
+ "caption": ""
+ }
+ ],
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fff7fe24f-85a9-4004-b5e7-677538b7c62d.jpg",
+ "caption": ""
+ },
+ "__index": 4,
+ "dateCreated": ""
+ },
+ {
+ "id": "pepsi-challenge-2015-ignite-the-light",
+ "title": "PEPSI CHALLENGE 2015: IGNITE THE LIGHT",
+ "menu": "PEPSI CHALLENGE 2015",
+ "description": "MADE WITH PEPSI + NICOLA FORMICHETTI + LITER OF LIGHT ",
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F5784676b-a3c8-4103-8245-708a666f3317.jpg",
+ "caption": ""
+ },
+ "__index": 8,
+ "media": [
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F29d6ced3-53cf-4d19-9a31-e9f30fdb10f8.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F6049da98-becb-4373-b8b6-2a25974318f3.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fe5818553-2462-4092-af25-3e7a98be4f01.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fbec143fb-575e-47d4-9faa-60faae7a09dc.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fb9cfb27f-02a9-4a7c-b0ba-9c0786f12aba.jpg",
+ "caption": ""
}
]
+ },
+ {
+ "id": "diesel-guerilla-fly-posting-campaign-",
+ "title": "DIESEL GUERILLA FLY-POSTING CAMPAIGN ",
+ "menu": "DIESEL GUERILLA CAMPAIGN ",
+ "description": "THE WORLD’S FIRST USER GENERATED FASHION CAMPAIGN, SPOTLIGHTING TALENT AND CREATIVE DIRECTLY FROM THE TUMBLR COMMUNITY. THE #DIESELREBOOT CAMPAIGN RECEIVED MULTIPLE AWARDS FROM HERMES TO CLIO’S AND DIESEL WAS THE MOST ENGAGED BRAND ON TUMBLR IN 2013.\r\n\r\nMADE WITH DIESEL + LAURENCE PASSERA",
+ "media": [
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F09a284fc-715e-46a1-a603-17455c5493a5.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fcc66483a-db27-4455-b5de-fa0e07aba89d.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fa347a19c-64a4-4f46-ad15-3d313c2ee4ac.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F17c53862-2517-4af3-9a7d-7b1f47837bd1.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fa9bbe663-5eb5-474e-b5a5-6fec26ddcd5b.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F4ccb25b5-71ba-4a26-877b-6d48d6c6557d.jpg",
+ "caption": ""
+ }
+ ],
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F42732767-2c29-452c-b6bf-7e5554bbfbb7.jpg",
+ "caption": ""
+ },
+ "__index": 3,
+ "dateCreated": ""
+ },
+ {
+ "id": "tumblr-nyfw-environment-",
+ "title": "TUMBLR NYFW ENVIRONMENT ",
+ "menu": "TUMBLR",
+ "description": "MADE WITH TUMBLR + PRINT ALL OVER ME ",
+ "media": [
+ {
+ "type": "vimeo",
+ "token": "140123956",
+ "title": "TUMBLRNYFW",
+ "thumb": "https://i.vimeocdn.com/video/536323950_640.jpg"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F8d527b36-b36b-4f4b-a226-7719582bfbf7.JPG",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Ff2a3daa5-db3f-488f-8e3d-f45c38b1f019.JPG",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F671796ca-4e5d-4ea8-a6fa-98d45ee47036.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F83b2163f-2328-4f11-8e8b-23db62bf0402.JPG",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fced348fe-9ae8-41ba-b0b6-c8c00bf33bec.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Ff97bf10c-c94a-4dc3-a0c2-95529023e793.jpg",
+ "caption": ""
+ }
+ ],
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fce345385-9277-400c-ab48-8e0eca895eef.jpg",
+ "caption": ""
+ },
+ "__index": "0",
+ "dateCreated": "Tue, 22 Sep 2015 22:39:00 GMT"
+ }
+ ],
+ "content": [
+ {
+ "id": "brothers-of-arcadia",
+ "title": "BROTHERS OF ARCADIA",
+ "menu": "MUGLER MENSWEAR S/S 2012",
+ "description": "PARTNERED WITH AOL, SOUNDCLOUD, FACEBOOK AND MSN TO EXCLUSIVELY RELEASE ORIGINAL CONTENT, AS WELL AS MUSIC REMIXED BY LADY GAGA. IN TOTAL THE PROGRAMS GARNERED OVER 276 MILLION IMPRESSIONS ACROSS ALL PLATFORMS\r\n\r\nMADE WITH MUGLER + BRANISLAV JANKIC + XTUBE",
+ "media": [
+ {
+ "type": "vimeo",
+ "token": "126925547",
+ "title": "muglerv20X 45sec credits hiRes",
+ "thumb": "http://i.vimeocdn.com/video/517535794_640.jpg"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F70eeefcb-db1a-4407-94ba-5ef7b49ff1fc.jpg",
+ "caption": ""
+ }
+ ],
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F23ef609d-d3a3-41cb-b128-b2718e7aa9b8.jpg",
+ "caption": ""
+ },
+ "__index": "7",
+ "dateCreated": ""
+ },
+ {
+ "id": "mugler-womenswear-spring-summer-2012",
+ "title": "MUGLER WOMENSWEAR SPRING/SUMMER 2012",
+ "menu": "MUGLER WOMENSWEAR S/S 2012",
+ "description": "PARTNERED WITH AOL, SOUNDCLOUD, FACEBOOK AND MSN TO EXCLUSIVELY RELEASE ORIGINAL CONTENT, AS WELL AS MUSIC REMIXED BY LADY GAGA. IN TOTAL THE PROGRAMS GARNERED OVER 276 MILLION IMPRESSIONS ACROSS ALL PLATFORMS. \r\n\r\nMADE WITH MUGLER + LADY GAGA + INEZ & VINOODH + SOUNDCLOUD ",
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Faa8a1207-00ec-4a45-8412-63bf90605569.jpg",
+ "caption": ""
+ },
+ "__index": "8",
+ "media": [
+ {
+ "type": "vimeo",
+ "token": "50693159",
+ "title": "MUGLER, SS12 GAGA FILM PREMIERE",
+ "thumb": "http://i.vimeocdn.com/video/349239691_640.jpg"
+ }
+ ],
+ "dateCreated": ""
+ },
+ {
+ "id": "gilt-lady-gaga",
+ "title": "GILT + LADY GAGA",
+ "menu": "GILT",
+ "description": "MADE WITH GILT + NICOLA FORMICHETTI + LADY GAGA",
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fcf534cf7-65b3-4172-8ef7-2c9b7c206b34.jpg",
+ "caption": ""
+ },
+ "__index": 5,
+ "media": [
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Ff8e4227e-c8db-410b-9702-44d135bf64b7.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fcdbf303e-317a-4ef2-b1b6-d04aecaaba00.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F5d5c81e5-5822-4c1e-8cee-0f26c0d8f5c0.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F50ac66d5-b58a-4518-8b39-7d2a0dd0cf18.jpg",
+ "caption": ""
+ }
+ ]
+ },
+ {
+ "id": "diesel-spring-summer-2014-digital-remixes",
+ "title": "DIESEL SPRING/SUMMER 2014 DIGITAL REMIXES",
+ "menu": "DIESEL S/S 2014 ",
+ "description": "THE WORLD’S FIRST USER GENERATED FASHION CAMPAIGN, SPOTLIGHTING TALENT AND CREATIVE DIRECTLY FROM THE TUMBLR COMMUNITY. THE #DIESELREBOOT CAMPAIGN RECEIVED MULTIPLE AWARDS FROM HERMES TO CLIO’S AND DIESEL WAS THE MOST ENGAGED BRAND ON TUMBLR IN 2013.\r\n\r\nMADE WITH DIESEL + INEZ & VINOODH + TUMBLR",
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F01a77a24-4f24-481f-9cb2-75597756064b.jpg",
+ "caption": ""
+ },
+ "__index": "1",
+ "media": [
+ {
+ "type": "vimeo",
+ "token": "125848084",
+ "title": "10-050J-h264",
+ "thumb": "http://i.vimeocdn.com/video/516091392_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125850134",
+ "title": "VLM13073 Diesel 01-073H FULL RES Looped 1-h264",
+ "thumb": "http://i.vimeocdn.com/video/516093825_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125848075",
+ "title": "03-082H- 1-h264",
+ "thumb": "http://i.vimeocdn.com/video/516091173_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125849039",
+ "title": "15-062N 1-h264",
+ "thumb": "http://i.vimeocdn.com/video/516092364_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125848077",
+ "title": "03-111J-h264",
+ "thumb": "http://i.vimeocdn.com/video/516091157_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125849036",
+ "title": "14-063G 2 1-h264",
+ "thumb": "http://i.vimeocdn.com/video/516092274_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125848083",
+ "title": "09-039L-h264",
+ "thumb": "http://i.vimeocdn.com/video/516091553_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125848079",
+ "title": "04-055K-h264",
+ "thumb": "http://i.vimeocdn.com/video/516091515_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125849034",
+ "title": "11-054L 1-h264",
+ "thumb": "http://i.vimeocdn.com/video/516092561_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125849041",
+ "title": "DEISEL BOYS V04 LOOPED h264",
+ "thumb": "http://i.vimeocdn.com/video/516092686_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125849043",
+ "title": "Diesel Couple Ocean 4 - Longer intro-h264",
+ "thumb": "http://i.vimeocdn.com/video/516092520_640.jpg"
+ }
+ ],
+ "dateCreated": ""
+ },
+ {
+ "id": "diesel-spring-summer-2015-digital-remixes",
+ "title": "DIESEL SPRING/SUMMER 2015 DIGITAL REMIXES",
+ "menu": "DIESEL S/S 2015 ",
+ "description": "MADE WITH DIESEL + NICK KNIGHT",
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fb8751da1-1aad-4af9-acc6-4e519785616a.jpg",
+ "caption": ""
+ },
+ "__index": 0,
+ "media": [
+ {
+ "type": "vimeo",
+ "token": "125850826",
+ "title": "Remix 01 1920x1080",
+ "thumb": "http://i.vimeocdn.com/video/516094768_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125850829",
+ "title": "Remix 02 1920x1080",
+ "thumb": "http://i.vimeocdn.com/video/516095315_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125850834",
+ "title": "Remix 04 1920x1080",
+ "thumb": "http://i.vimeocdn.com/video/516094811_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125850831",
+ "title": "Remix 03 1920x1080",
+ "thumb": "http://i.vimeocdn.com/video/516094815_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125850836",
+ "title": "Remix 05 1920x1080",
+ "thumb": "http://i.vimeocdn.com/video/516095318_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125851403",
+ "title": "Remix 06 1920x1080",
+ "thumb": "http://i.vimeocdn.com/video/516095596_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125851404",
+ "title": "Remix 08 1920x1080",
+ "thumb": "http://i.vimeocdn.com/video/516095603_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125851405",
+ "title": "Remix 07 1920x1080",
+ "thumb": "http://i.vimeocdn.com/video/516095613_640.jpg"
+ }
+ ]
+ },
+ {
+ "id": "pepsi-challenge-2015",
+ "title": "PEPSI CHALLENGE 2015",
+ "menu": "PEPSI CHALLENGE 2015",
+ "description": "MADE WITH PEPSI + NICOLA FORMICHETTI + LITER OF LIGHT ",
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fa79fe5ee-afa8-4051-9639-3a82081cfe63.jpg",
+ "caption": ""
+ },
+ "__index": 10,
+ "media": [
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F0c0edf0f-cfe6-480c-9322-c719be7ab622.jpg",
+ "caption": ""
+ },
+ {
+ "type": "vimeo",
+ "token": "125852415",
+ "title": "Nicola Pepsi Edit 07 3",
+ "thumb": "http://i.vimeocdn.com/video/516097245_640.jpg"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fe33cbda5-8a63-41ca-a79e-87d425c6579a.jpg",
+ "caption": ""
+ }
+ ],
+ "dateCreated": ""
+ },
+ {
+ "id": "eve-online",
+ "title": "EVE ONLINE",
+ "menu": "EVE ONLINE",
+ "description": "MADE WITH ZOMBIE BOY + NICOLA FORMICHETTI + CCP GAMES\r\n",
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F8e3e2c78-f9e6-487c-b99b-b378f7680e91.jpg",
+ "caption": ""
+ },
+ "__index": "4",
+ "media": [
+ {
+ "type": "vimeo",
+ "token": "37225431",
+ "title": "EVE ONLINE, CCP GAMES",
+ "thumb": "http://i.vimeocdn.com/video/255632036_640.jpg"
+ }
+ ],
+ "dateCreated": ""
+ },
+ {
+ "id": "mac-viva-glam-lady-gaga",
+ "title": "MAC VIVA GLAM + LADY GAGA",
+ "menu": "MAC VIVA GLAM",
+ "description": "MADE WITH MAC + RUTH HOGBEN + NICOLA FORMICHETTI + LADY GAGA",
+ "media": [
+ {
+ "type": "vimeo",
+ "token": "126940796",
+ "title": "VIVAGLAM GAGA EDIT 4 NOFANS FINAL UNCOMPRESSED",
+ "thumb": "http://i.vimeocdn.com/video/517551770_640.jpg"
+ }
+ ],
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F086afb19-5530-431c-8702-79ebfd12426f.jpg",
+ "caption": ""
+ },
+ "__index": "6",
+ "dateCreated": ""
+ },
+ {
+ "id": "nicopanda-social-media-",
+ "title": "NICOPANDA SOCIAL MEDIA ",
+ "menu": "NICOPANDA",
+ "description": "",
+ "media": [
+ {
+ "type": "vimeo",
+ "token": "127536774",
+ "title": "NicopandaLanding 4.30.15",
+ "thumb": "http://i.vimeocdn.com/video/518342528_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125852910",
+ "title": "TRIPPING 2",
+ "thumb": "http://i.vimeocdn.com/video/516097701_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125852908",
+ "title": "Nicopanda i4.mov 2",
+ "thumb": "http://i.vimeocdn.com/video/516097692_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125852907",
+ "title": "CRAZY ROOM 3",
+ "thumb": "http://i.vimeocdn.com/video/516097693_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125852909",
+ "title": "Sequence 02 1",
+ "thumb": "http://i.vimeocdn.com/video/516097710_640.jpg"
+ }
+ ],
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F1f954d01-f614-48fb-9f31-2c3da4c51107.jpg",
+ "caption": ""
+ },
+ "__index": 9
+ },
+ {
+ "id": "diesel-tribute-2014-digital-remixes",
+ "title": "DIESEL TRIBUTE 2014 DIGITAL REMIXES",
+ "menu": "DIESEL TRIBUTE 2014",
+ "description": "THE WORLD’S FIRST FASHION CAMPAIGN SHOT ON AN IPHONE AND EDITED USING MOBILE APPS. \r\n\r\nMADE WITH DIESEL + NICK KNIGHT + MYKKI BLANCO + iPhone ©",
+ "media": [
+ {
+ "type": "vimeo",
+ "token": "125851697",
+ "title": "A-TRIBUTE-GRID-1-TEST",
+ "thumb": "http://i.vimeocdn.com/video/516095975_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125851698",
+ "title": "A-TRIBUTE-GRID-4-TEST",
+ "thumb": "http://i.vimeocdn.com/video/516095976_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125851699",
+ "title": "A-TRIBUTE-GRID-2-TEST",
+ "thumb": "http://i.vimeocdn.com/video/516095971_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125851577",
+ "title": "IMG 0875",
+ "thumb": "http://i.vimeocdn.com/video/516095853_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125851578",
+ "title": "IMG 1038",
+ "thumb": "http://i.vimeocdn.com/video/516095743_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125851579",
+ "title": "IMG 8769",
+ "thumb": "http://i.vimeocdn.com/video/516095739_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125851580",
+ "title": "IMG 1029",
+ "thumb": "http://i.vimeocdn.com/video/516095746_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125851580",
+ "title": "IMG 1029",
+ "thumb": "http://i.vimeocdn.com/video/516095746_640.jpg"
+ }
+ ],
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F35873942-a7ea-442b-aa56-f18ee3e75221.jpg",
+ "caption": ""
+ },
+ "__index": "2",
+ "dateCreated": ""
+ },
+ {
+ "id": "diesel-fall-winter-2013-digital-remixes",
+ "title": "DIESEL FALL/WINTER 2013 DIGITAL REMIXES",
+ "menu": "DIESEL F/W 2013",
+ "description": "THE WORLD’S FIRST USER GENERATED FASHION CAMPAIGN, SPOTLIGHTING TALENT AND CREATIVE DIRECTLY FROM THE TUMBLR COMMUNITY. THE #DIESELREBOOT CAMPAIGN RECEIVED MULTIPLE AWARDS FROM HERMES TO CLIO’S AND DIESEL WAS THE MOST ENGAGED BRAND ON TUMBLR IN 2013.\r\n\r\nMADE WITH DIESEL + INEZ & VINOODH + TUMBLR",
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F014c51b7-cc4a-4a97-8b18-14a969336f94.jpg",
+ "caption": ""
+ },
+ "__index": "3",
+ "media": [
+ {
+ "type": "vimeo",
+ "token": "125847510",
+ "title": "Benjamin",
+ "thumb": "http://i.vimeocdn.com/video/516089972_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125847511",
+ "title": "Bob",
+ "thumb": "http://i.vimeocdn.com/video/516089987_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125847513",
+ "title": "Casey",
+ "thumb": "http://i.vimeocdn.com/video/516089983_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125847517",
+ "title": "Dylan",
+ "thumb": "http://i.vimeocdn.com/video/516089999_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125847643",
+ "title": "Ira",
+ "thumb": "http://i.vimeocdn.com/video/516090036_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125847765",
+ "title": "Jakob",
+ "thumb": "http://i.vimeocdn.com/video/516090284_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125847763",
+ "title": "Jake",
+ "thumb": "http://i.vimeocdn.com/video/516090300_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125847766",
+ "title": "James",
+ "thumb": "http://i.vimeocdn.com/video/516090250_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125847768",
+ "title": "Joe",
+ "thumb": "http://i.vimeocdn.com/video/516090287_640.jpg"
+ },
+ {
+ "type": "vimeo",
+ "token": "125847770",
+ "title": "Kiko",
+ "thumb": "http://i.vimeocdn.com/video/516090273_640.jpg"
+ }
+ ],
+ "dateCreated": ""
+ }
+ ],
+ "advertising": [
+ {
+ "id": "diesel-spring-summer-2015",
+ "title": "DIESEL SPRING/SUMMER 2015",
+ "menu": "DIESEL S/S 2015",
+ "description": "MADE WITH DIESEL + NICK KNIGHT",
+ "media": [
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fe22fd077-ca52-42a1-ab9c-e0508bf4408e.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F1afaa719-c18f-4155-a42f-3e7fc10247c3.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F1b55cd3c-eb7d-4ed6-bfe9-2bc53960987d.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fe402bfbb-b101-4b42-afcb-818f7b616db9.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F15cc7c05-89fe-4cba-82fd-0d4118496f94.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F38cb4454-34a4-44af-8243-53da4d2b7c47.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F86a3edfe-bdbb-44ac-9e50-e167c16c89b9.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F5bdc8f95-b18f-407a-b2f3-33df1025bf8a.jpg",
+ "caption": ""
+ }
+ ],
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fa28c3d22-a627-4fed-abb2-fbe940347e38.jpg",
+ "caption": ""
+ },
+ "__index": 0
+ },
+ {
+ "id": "diesel-fall-winter-2014",
+ "title": "DIESEL FALL/WINTER 2014",
+ "menu": "DIESEL F/W 2014",
+ "description": "MADE WITH DIESEL + NICK KNIGHT",
+ "media": [
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F38ea6ad0-f689-491f-857a-12d4fa0d4748.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F12184bdd-0aff-43db-882c-8efcb1e583de.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fb61bd44f-d074-4a20-a641-fc11957e8cd5.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F2a0b26ae-cc35-406e-923b-e60409e53eb8.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fd2a68db8-018b-4fdf-8f69-c2e4d0aff76a.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F0b24ebbd-07e8-446e-83db-60484f0f3dd9.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F1f8c6b75-c694-4d31-a790-b042b75b3606.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F907a0fbd-1455-4f3d-b28e-ebcba658f2d3.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F17ee7deb-dee5-497a-a8a6-dfe3f9c3105d.jpg",
+ "caption": ""
+ }
+ ],
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F94c3bb9d-7d11-43f7-be86-5348a677845f.jpg",
+ "caption": ""
+ },
+ "__index": "1",
+ "dateCreated": ""
+ },
+ {
+ "id": "diesel-spring-summer-2014",
+ "title": "DIESEL SPRING/SUMMER 2014",
+ "menu": "DIESEL S/S 2014",
+ "description": "THE WORLD’S FIRST USER GENERATED FASHION CAMPAIGN, SPOTLIGHTING TALENT AND CREATIVE DIRECTLY FROM THE TUMBLR COMMUNITY. THE #DIESELREBOOT CAMPAIGN RECEIVED MULTIPLE AWARDS FROM HERMES TO CLIO’S AND DIESEL WAS THE MOST ENGAGED BRAND ON TUMBLR IN 2013.\r\n\r\nMADE WITH DIESEL + INEZ & VINOODH + TUMBLR",
+ "media": [
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F5911dfde-f042-4eb6-b9fe-7f0b3d9f45b5.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F6d7126bd-9dbd-45b8-a1d5-f31f8a376948.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F86621d22-7506-4843-b6c9-13255971b89f.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F46e88d25-c01f-41fd-b8dc-73973ba34326.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F508f72cc-afdf-4c6e-b9e3-6399db2c42c7.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fe1192c9e-16f8-4149-93b7-6b717de123ec.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fb1f12189-4a38-4999-a152-3cddd8a500d7.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fd2cfb23c-96a6-4561-8168-8f9522651aa8.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fff370cd2-9759-4316-ba16-7493b9809385.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F9fd9fa28-4b23-411f-b7b8-484e91f669c9.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Ff969cb50-bd4c-40ab-8d85-7a4cc4437fb4.jpg",
+ "caption": ""
+ }
+ ],
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F1c952512-c765-4a67-a21e-7146c1051ed9.jpg",
+ "caption": ""
+ },
+ "__index": "3",
+ "dateCreated": ""
+ },
+ {
+ "id": "-dieselreboot",
+ "title": "#DIESELREBOOT",
+ "menu": "DIESEL F/W 2013",
+ "description": "THE WORLD’S FIRST USER GENERATED FASHION CAMPAIGN, SPOTLIGHTING TALENT AND CREATIVE DIRECTLY FROM THE TUMBLR COMMUNITY. THE #DIESELREBOOT CAMPAIGN RECEIVED MULTIPLE AWARDS FROM HERMES TO CLIO’S AND DIESEL WAS THE MOST ENGAGED BRAND ON TUMBLR IN 2013.\r\n\r\nMADE WITH DIESEL + INEZ & VINOODH + TUMBLR + FACEBOOK + INSTAGRAM",
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fc7fe29d9-4d56-4564-8d85-01e95e115093.jpg",
+ "caption": ""
+ },
+ "__index": "7",
+ "media": [
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F3ae62a21-3c63-41e8-ac49-d8dc20df56bd.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F21ae80a6-dc85-4e35-902d-22f1789738e5.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F81a0feac-a054-47b0-aa90-80062b39bbbc.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Ff6738b0b-2510-4803-8bf8-8c37938cc904.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F9b75595b-5606-4934-b85f-19ae0b46149f.jpg",
+ "caption": ""
+ }
+ ],
+ "dateCreated": ""
+ },
+ {
+ "id": "diesel-tribute-2014",
+ "title": "DIESEL TRIBUTE 2014",
+ "menu": "DIESEL TRIBUTE 2014",
+ "description": "THE WORLD’S FIRST FASHION CAMPAIGN SHOT ON AN IPHONE AND EDITED USING MOBILE APPS. \r\n\r\nMADE WITH DIESEL + NICK KNIGHT + MYKKI BLANCO + iPhone ©",
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F77c735ea-8df8-4328-9ab2-31e4d0a629b8.jpg",
+ "caption": ""
+ },
+ "__index": "4",
+ "media": [
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Ff0a191fa-d340-4aa7-8afd-bb536b1c433e.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F9b52e21d-d653-423d-85cd-6b8c7d8c9284.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F8351a548-fc66-49de-bcc7-5121e8f9f730.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F71627c1b-9257-4a89-aac2-0561e0ce837d.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Ff5bef22a-d795-40e8-8d6c-1f2d8120eabc.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F7a2b9538-8ad0-4199-af2d-b010106477d0.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F35f50a3a-e09e-410e-9890-18ca5d8faa49.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F37d9be8e-e998-4df8-8a95-13cd0102dc72.jpg",
+ "caption": ""
+ }
+ ],
+ "dateCreated": ""
+ },
+ {
+ "id": "jogg-jeans-2014",
+ "title": "JOGG JEANS 2014",
+ "menu": "DIESEL JOGG JEANS ",
+ "description": "CREATED VIRAL CONTENT FEATURING ARTISTS FROM YOUTUBE AND EXCLUSIVE MUSIC FROM PHARRELL & AZEALIA BANKS, GARNERING OVER 1.3 MILLION VIEWS UPON RELEASE. \r\n\r\nMADE WITH DIESEL + TIM RICHARDSON + PHARRELL + AZEALIA BANKS + BONES THE MACHINE + YOUTUBE ",
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F4a53e5f4-add1-4ace-961a-dbf10d981cbd.jpg",
+ "caption": ""
+ },
+ "__index": "5",
+ "media": [
+ {
+ "type": "vimeo",
+ "token": "84691967",
+ "title": "Diesel Jogg Jeans",
+ "thumb": "http://i.vimeocdn.com/video/461657307_640.jpg"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Ff6de46ef-2bea-4310-a9b9-e998dab3c1ba.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F0c2f4b69-74c7-4668-b88d-0cb87b5c7fd7.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F44b2d181-852d-4485-a817-84c9d52785cd.gif",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F627d7101-87a7-4cb9-bf48-4db4fd1aa29b.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F9591ca55-dff5-42e3-a212-9efb9588ea78.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fa637355b-9c8c-4e70-baef-32065b28d40e.gif",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F020ac547-17d3-4130-89d2-720cb65ac550.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F24c721b9-dbfc-40fd-a916-5e723fad7b74.gif",
+ "caption": ""
+ }
+ ],
+ "dateCreated": ""
+ },
+ {
+ "id": "mugler-menswear-fall-winter-2011",
+ "title": "MUGLER MENSWEAR FALL/WINTER 2011",
+ "menu": "MUGLER MENSWEAR F/W 2011",
+ "description": "CREATED ORIGINAL CONTENT FEATURING ZOMBIE BOY, THE NEWLY DISCOVERED TALENT THROUGH FACEBOOK, ESTABLISHING THE NEW TONE AND VOICE FOR THE RESURGENCE OF MUGLER. \r\n\r\nMADE WITH MUGLER + MARIANO VIVANCO + ZOMBIE BOY + LADY GAGA + AOL STYLELIST",
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F5d467909-372d-4e93-9a47-865b866117af.jpg",
+ "caption": ""
+ },
+ "__index": "9",
+ "media": [
+ {
+ "type": "vimeo",
+ "token": "48895044",
+ "title": "MUGLER, MENS FW11 TEASER",
+ "thumb": "http://i.vimeocdn.com/video/337250831_640.jpg"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F9cb172e8-15b8-43d2-992c-d3eb7e5ec0dd.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fd67a2380-2d9b-4ed0-b442-e5339d0d39d8.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F23dae9cf-8d4b-433e-ae7f-9949e2844335.jpeg",
+ "caption": ""
+ }
+ ],
+ "dateCreated": ""
+ },
+ {
+ "id": "playboy-diesel",
+ "title": "PLAYBOY + DIESEL",
+ "menu": "PLAYBOY",
+ "description": "MADE WITH PLAYBOY + DIESEL + TERRY RICHARDSON ",
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F4055eb1f-fa1c-42bc-a132-756861a4a5b4.jpg",
+ "caption": ""
+ },
+ "__index": 8,
+ "media": [
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Ff069bfd9-1b38-49c7-8977-8c44a6aeb447.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F3881f13f-f9b0-4ac7-9fd3-b6f4a64faac2.jpg",
+ "caption": ""
+ }
+ ],
+ "dateCreated": ""
+ },
+ {
+ "id": "diesel-accessories-2014",
+ "title": "DIESEL ACCESSORIES 2014",
+ "menu": "DIESEL ACCESSORIES ",
+ "description": "MADE WITH DIESEL + INEZ & VINOODH + BROOKE CANDY + TESSA KURAGI + YOUTUBE",
+ "media": [
+ {
+ "type": "vimeo",
+ "token": "126925545",
+ "title": "DIESEL 20 CUTDOWN 1920x1080 proHQ",
+ "thumb": "http://i.vimeocdn.com/video/517530659_640.jpg"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F246bf84c-3ce5-499a-81ca-ff4caad99377.jpg",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F89d33a08-3919-4046-9afb-2254b38c14ed.jpg",
+ "caption": ""
+ }
+ ],
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F99ea0b82-dbca-4281-9afb-f816be3a0eb2.jpg",
+ "caption": ""
+ },
+ "__index": 6
+ },
+ {
+ "id": "fossil-diesel-2014-watch-campaign-",
+ "title": "FOSSIL + DIESEL 2014 WATCH CAMPAIGN ",
+ "menu": "FOSSIL WATCHES",
+ "description": "MADE WITH DIESEL + FOSSIL + TIM RICHARDSON",
+ "media": [
+ {
+ "type": "vimeo",
+ "token": "126925546",
+ "title": "Diesel Mohican 10sec GENERIC HD UNSLATED",
+ "thumb": "http://i.vimeocdn.com/video/517534976_640.jpg"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fa4353c8c-6a07-429b-b190-daf508c7ea32.jpg",
+ "caption": ""
+ }
+ ],
+ "thumbnail": {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F5a860e2b-1e27-4954-bd52-3251241cd46d.jpg",
+ "caption": ""
+ },
+ "__index": 2
}
],
- "advertising": [],
- "experiential": [],
- "content": [],
"page": [
{
"id": "about",
"title": "WHO WE ARE",
- "body": "WE ARE A COLLECTIVE OF DIGITAL NATIVES, INDUSTRY INFLUENCERS, TRENDSETTERS, MILLENNIAL COMMUNICATORS & UNORTHODOX STRATEGISTS – A NEW MEDIA CREATIVE LAB. TOGETHER WE CREATE LIVING, BREATHING, CONTENT DRIVEN EXPERIENCES THAT ENGAGE TODAY’S CONSUMER AUDIENCE. WE ARE WILD, PUNK, PROVOCATIVE, RADICAL, FEARLESS, SUBVERSIVE, BOISTEROUS, ANARCHIC, UNEXPECTED & DISRUPTIVE. MOST OF ALL WE ARE CURIOUS. WELCOME TO THE WORLD OF TWO HUSTLERS.",
- "image": "http://www.lansdowneresort.com/meetings/assets/images/masthead/meetings-team-building.jpg"
+ "body": "TWO HUSTLERS IS A CREATIVE COLLECTIVE OF RADICAL THINKERS, DESIGNERS AND STORYTELLERS.\r\n\r\nWE BUILD TRANSFORMATIVE EXPERIENCES FOR PASSIONATE BRANDS. \r\n\r\nWE ARE PLAYFUL. WE ARE REBELLIOUS. WE ARE OBSESSED. ",
+ "image": "http://www.lansdowneresort.com/meetings/assets/images/masthead/meetings-team-building.jpg",
+ "__index": "1",
+ "contact": "FOR BRANDS WHO WANT TO PLAY WITH US, <a href=\"mailto:collaborate@twohustlers.com?subject=SAY HELLO!\">SAY HELLO!</a>\r\n\r\nFOR ANYONE WHO WANTS TO JOIN OUR FAMILY, <a href=\"mailto:jobs@twohustlers.com?subject=JOIN THE FAMILY!\"> SHOW US WHAT YOU ARE MADE OF!</a>",
+ "dateCreated": "",
+ "collabs": "\"NONE OF US IS AS SMART AS ALL OF US\"\r\n\r\nWE MAKE THINGS WITH OUR FRIENDS:\r\n\r\nMARK FOSTER GAGE ARCHITECTS\r\nMERI MEDIA\r\nMOVING IMAGE & CONTENT \r\nNR2154\r\nOKFOCUS\r\nSHADES OF GREY\r\nTABLE OF CONTENTS \r\nTAKE OUT MEDIA\r\n\r\nWEBSITE BY <a href=\"http://okfoc.us/\">OKFOCUS</a>"
},
{
"id": "contact",
"title": "CONTACT",
- "body": "TWOHUSTLERS\r\n50 WHITE STREET\r\nNEW YORK, NY 10013\r\nINFO@TWOHUSTLERS.COM\r\n+1 646 370-1180\r\nTWOHUSTLERS ©2014\r\nWEBSITE BY OKFOCUS",
- "image": "http://checkingintocollege.com/wp/wp-content/uploads/2014/08/angryphone.jpg"
+ "body": "50 WHITE STREET\r\nNEW YORK, NY 10013\r\n<a href=\"mailto:info@twohustlers.com\">INFO@TWOHUSTLERS.COM</a>\r\n+1 646 370-1180\r\nTWOHUSTLERS ©2015",
+ "image": "",
+ "__index": "0",
+ "contact": "",
+ "dateCreated": ""
+ }
+ ],
+ "shape": [
+ {
+ "id": "shape-images",
+ "title": "Shape Images",
+ "images": [
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fbaef86ee-ffd3-4a86-926a-58de6abbeffa.gif",
+ "label": "",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fe622fde6-518b-4e03-9d10-25136116614f.gif",
+ "label": "",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F6a8315e9-7a65-4953-85ed-5c15c0a2a700.gif",
+ "label": "",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F9d73411e-813d-4760-9593-38f7c368c8dc.gif",
+ "label": "",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fa12bfef3-d48c-4c2d-8563-c41624e79b44.gif",
+ "label": "",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fdf2b499d-3b7c-4944-a7c5-33ab13937896.gif",
+ "label": "",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F8c6858ee-3586-479f-91ba-b31d39339bee.gif",
+ "label": "",
+ "caption": ""
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F82261917-21fe-45a9-90cd-6af4517bde3b.gif",
+ "label": "",
+ "caption": ""
+ },
+ {
+ "uri": "http://okfocus.s3.amazonaws.com/2h/5.gif",
+ "label": "",
+ "caption": ""
+ },
+ {
+ "uri": "http://okfocus.s3.amazonaws.com/2h/12.gif",
+ "label": "",
+ "caption": ""
+ },
+ {
+ "uri": "http://okfocus.s3.amazonaws.com/2h/13.gif",
+ "label": "",
+ "caption": ""
+ },
+ {
+ "uri": "http://okfocus.s3.amazonaws.com/2h/15.gif",
+ "label": "",
+ "caption": ""
+ }
+ ],
+ "__index": "0",
+ "dateCreated": ""
+ },
+ {
+ "id": "about-images",
+ "title": "About Images",
+ "__index": "1",
+ "images": [
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F7eca88a2-94e1-4d41-ae77-af01a947ad44.gif",
+ "label": "Tracy le Marquand",
+ "caption": "tracy@twohustlers.com"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F5bece78f-bf0b-4422-abc6-d306f8fae700.gif",
+ "label": "Devin Savage",
+ "caption": "propersavage@gmail.com"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F4bd5a1e5-38b1-4dba-af04-48ce3f4bc74d.gif",
+ "label": "Daniel Cingari",
+ "caption": "daniel@twohustlers.com"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F05af3d86-b78d-44aa-a416-0b225bcffc16.gif",
+ "label": "Tyler Rose",
+ "caption": "tyler@nicopanda.com"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fe85e3d1f-6191-496f-acca-f370687c69fe.gif",
+ "label": "Max de Castro",
+ "caption": "max@twohustlers.com"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F17b0d9b9-cd22-43ac-9055-f8bc8cb54700.gif",
+ "label": "Sarah Kim",
+ "caption": "Sara@nicopanda.com"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F3031754c-9295-4690-bb38-d1b21249f542.gif",
+ "label": "Nicola Formichetti",
+ "caption": "info@twohustlers.com"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F55f0fef9-bc7c-4dbe-baa8-c0d74c9c9ab0.gif",
+ "label": "Latif Newab",
+ "caption": "latif@nicopanda.com"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F343ae47e-8669-4c57-9975-e4c3fc5a02d4.gif",
+ "label": "Steve Gershman",
+ "caption": "steve@twohustlers.com"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F06a6a4c3-10ad-4b75-8351-85ffc0e74c98.gif",
+ "label": "Kevin Kollenda",
+ "caption": "kevin@twohustlers.com"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F2b71ee1e-3de9-4a3d-9b39-a96065ae4ec1.gif",
+ "label": "Ian Milan",
+ "caption": "ian@studioformichetti.com"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F971dec94-c49d-46e5-a332-f1cdb497ccbe.gif",
+ "label": "Eddie Schimmerman",
+ "caption": "eddieschimmerman25@gmail.com"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F724e1ff5-7683-43cb-a637-9dae58214185.gif",
+ "label": "Kei Furuichi",
+ "caption": "kei@twohustlers.com"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F7655a0ec-e56c-4383-a22a-7e987949f52e.gif",
+ "label": "Juan Quiceno",
+ "caption": "Juan@nicopanda.com"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F97c09ed8-27d7-4a38-8877-c8712640cbd5.gif",
+ "label": "Frankie The Pug",
+ "caption": "info@twohustlers.com"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F7ee0e3d4-4312-41dc-8fff-943b68ae6171.gif",
+ "label": "Angelo Balassone",
+ "caption": "angelo@twohustlers.com"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F70fffb9c-7fc9-4dd1-af65-e39ebd99e930.gif",
+ "label": "Derrick Murdock",
+ "caption": "dereklmurdock@gmail.com"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2Fa547b434-b48d-43ff-986b-ed9c217b9257.gif",
+ "label": "Tiffanie Baine",
+ "caption": "tiffanie@twohustlers.com"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/twohustlers%2F71c71033-d36f-4375-bdd1-271db3b9e75c.gif",
+ "label": "Zak Krevitt",
+ "caption": "zak@twohustlers.com"
+ }
+ ],
+ "dateCreated": ""
}
]
} \ No newline at end of file
diff --git a/site/index.js b/site/index.js
index a7a8a6f..b81b3ab 100644
--- a/site/index.js
+++ b/site/index.js
@@ -1,38 +1,52 @@
var okcms = require('..');
var projectSchema = {
- id: {type: 'string', id: true},
+ id: {type: 'string', id: true, hidden: true},
title: {type: 'string'},
- shortname: {type: 'string'},
+ menu: {type: 'string'},
description: {type: 'text'},
- video: {type: 'video'},
- images: {type: 'captioned-image-list'}
+ media: {type: 'media-list'},
+ thumbnail: {type: 'image'},
}
var app = okcms.createApp({
+ meta: {
+ project: 'TwoHustlers'
+ },
+
root: 'public',
+ debug: false,
+ production: true,
+
schemas: {
page: {
- id: {type: 'string'},
+ id: {type: 'string', hidden: true},
title: {type: 'string'},
body: {type: 'text'},
+ collabs: {type: 'text'},
+ contact: {type: 'text'},
image: {type: 'string'}
},
- retail: projectSchema,
- advertising: projectSchema,
- experiential: projectSchema,
- content: projectSchema,
+ advertising: projectSchema,
+ content: projectSchema,
+ experiential: projectSchema,
+ shape: {
+ id: {type: 'string', id: true, hidden: true},
+ title: {type: 'string'},
+ images: {type: 'double-captioned-image-list'},
+ }
},
resources: [
{ type: 'page', static: {id: 'about'}},
{ type: 'page', static: {id: 'contact'}},
- { type: 'retail' },
+ { type: 'shape', static: {id: 'shape-images'}},
+ { type: 'shape', static: {id: 'about-images'}},
{ type: 'advertising' },
- { type: 'experiential' },
{ type: 'content' },
+ { type: 'experiential' },
],
services: {
@@ -40,39 +54,81 @@ var app = okcms.createApp({
key: process.env.S3_KEY,
secret: process.env.S3_SECRET,
bucket: process.env.S3_BUCKET,
+ dirname: "twohustlers",
+ maxbytes: 1024*1024*2,
}
},
views: {
'/': {
data: [
- {type: 'retail', query: '*'},
+ {type: 'page', query: 'contact'},
+// {type: 'shape', query: 'about-images'},
+ {type: 'shape', query: 'shape-images'},
+// {type: 'retail', query: '*'},
{type: 'advertising', query: '*'},
{type: 'experiential', query: '*'},
{type: 'content', query: '*'},
- {type: 'page', query: '*'}
]
},
'/about': {
- data: {type: 'page', query: 'about'}
+ data: [
+ {type: 'page', query: 'about'},
+ {type: 'shape', query: 'about-images'},
+ ],
+ template: 'about'
},
'/contact': {
data: {type: 'page', query: 'contact'}
},
- '/retail/:id': {
- data: {type: 'retail', query: ':id'},
- template: 'project'
+ '/all': {
+ data: [
+// {type: 'retail', query: '*'},
+ {type: 'advertising', query: '*'},
+ {type: 'experiential', query: '*'},
+ {type: 'content', query: '*'},
+ {type: 'page', query: 'about'}
+ ],
+ template: 'all'
},
+// '/retail/:id': {
+// data: {
+// type: 'retail',
+// as: 'project',
+// query: {
+// id: ':id'
+// }
+// },
+// template: 'project'
+// },
'/advertising/:id': {
- data: {type: 'advertising', query: ':id'},
+ data: {
+ type: 'advertising',
+ as: 'project',
+ query: {
+ id: ':id'
+ }
+ },
template: 'project'
},
'/experiential/:id': {
- data: {type: 'experiential', query: ':id'},
+ data: {
+ type: 'experiential',
+ as: 'project',
+ query: {
+ id: ':id'
+ }
+ },
template: 'project'
},
'/content/:id': {
- data: {type: 'content', query: ':id'},
+ data: {
+ type: 'content',
+ as: 'project',
+ query: {
+ id: ':id'
+ }
+ },
template: 'project'
}
}
diff --git a/site/public/assets/app.min.js b/site/public/assets/app.min.js
new file mode 100644
index 0000000..a550860
--- /dev/null
+++ b/site/public/assets/app.min.js
@@ -0,0 +1,8 @@
+/* okfoc.us 2o15 */
+function FastClick(a,b){"use strict";function c(a,b){return function(){return a.apply(b,arguments)}}var d;if(b=b||{},this.trackingClick=!1,this.trackingClickStart=0,this.targetElement=null,this.touchStartX=0,this.touchStartY=0,this.lastTouchIdentifier=0,this.touchBoundary=b.touchBoundary||10,this.layer=a,this.tapDelay=b.tapDelay||200,!FastClick.notNeeded(a)){for(var e=["onMouse","onClick","onTouchStart","onTouchMove","onTouchEnd","onTouchCancel"],f=this,g=0,h=e.length;h>g;g++)f[e[g]]=c(f[e[g]],f);deviceIsAndroid&&(a.addEventListener("mouseover",this.onMouse,!0),a.addEventListener("mousedown",this.onMouse,!0),a.addEventListener("mouseup",this.onMouse,!0)),a.addEventListener("click",this.onClick,!0),a.addEventListener("touchstart",this.onTouchStart,!1),a.addEventListener("touchmove",this.onTouchMove,!1),a.addEventListener("touchend",this.onTouchEnd,!1),a.addEventListener("touchcancel",this.onTouchCancel,!1),Event.prototype.stopImmediatePropagation||(a.removeEventListener=function(b,c,d){var e=Node.prototype.removeEventListener;"click"===b?e.call(a,b,c.hijacked||c,d):e.call(a,b,c,d)},a.addEventListener=function(b,c,d){var e=Node.prototype.addEventListener;"click"===b?e.call(a,b,c.hijacked||(c.hijacked=function(a){a.propagationStopped||c(a)}),d):e.call(a,b,c,d)}),"function"==typeof a.onclick&&(d=a.onclick,a.addEventListener("click",function(a){d(a)},!1),a.onclick=null)}}function wheel(a){function b(b){if(!a.locked){a.propagate||(b.stopPropagation(),b.preventDefault());var c=0,d=0;event.deltaY?(d-=event.deltaY*a.ratio,c-=event.deltaX*a.ratio):event.wheelDeltaY?(d-=event.wheelDeltaY*a.ratio,c-=event.wheelDeltaX*a.ratio):event.wheelDelta?d-=event.wheelDelta*a.ratio:event.detail&&(d+=2*event.detail),!a.reversible&&0>d&&0>c||a.update(b,d,c)}}a=defaults(a,{el:document,update:function(a,b){},propagate:!1,locked:!1,reversible:!0,ratio:.02,val:0});var c=1;return a.el.addEventListener("gesturestart",function(a){c=a.scale},!1),a.el.addEventListener("gesturechange",function(b){var d=(c-b.scale)*window.innerWidth;c=b.scale,a.update(b,d)},!1),a.el.addEventListener("wheel",b,!1),a.el.addEventListener("DOMMouseScroll",b,!1),a.lock=function(){a.locked=!0},a.unlock=function(){a.locked=!1},a}function has3d(){var a,b,c=$("<p>")[0],d=$("<iframe>"),e={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",transform:"transform"};d.appendTo("body").contents().find("body").append(c);for(b in e)void 0!==c.style[b]&&(c.style[b]="translate3d(1px,1px,1px)",a=window.getComputedStyle(c).getPropertyValue(e[b]));return d.remove(),void 0!==a&&a.length>0&&"none"!==a}function fullscreen(a){a.requestFullscreen?a.requestFullscreen():a.msRequestFullscreen?a.msRequestFullscreen():a.mozRequestFullScreen?a.mozRequestFullScreen():a.webkitRequestFullscreen&&a.webkitRequestFullscreen()}function isFullScreen(){return!!getFullScreenElement()}function getFullScreenElement(){return document.fullScreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement}function trim(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function sanitize(a){return(a||"").replace(new RegExp("[<>&]","g"),"")}function stripHTML(a){return(a||"").replace(/<[^>]+>/g,"")}function capitalize(a){return a.split(" ").map(capitalizeWord).join(" ")}function capitalizeWord(a){return a.charAt(0).toUpperCase()+a.slice(1)}function slugify(a){return(a||"").toLowerCase().replace(/\s/g,"-").replace(/[^-_a-zA-Z0-9]/g,"-").replace(/-+/g,"-")}function rgb_string(a){return"rgb("+a.map(Math.round).join(",")+")"}function rgba_string(a,b){return"rgba("+a.map(Math.round).join(",")+","+b+")"}function hex_string(a){return"#"+a.map(Math.round).map(function(a){var b=a.toString(16);return 1==b.length?"0"+b:b}).join("")}function parse_rgba_string(a){return a.match(/(\d+)/g).slice(0,3)}function clamp(a,b,c){return b>a?b:c>a?a:c}function norm(a,b,c){return(a-b)/(c-b)}function lerp(a,b,c){return(c-b)*a+b}function mix(a,b,c){return b*(1-a)+c*a}function ceil(a){return Math.ceil(a)}function floor(a){return Math.floor(a)}function round(a){return Math.round(a)}function quantize(a,b){return round(a/b)*b}function max(a,b){return Math.max(a,b)}function min(a,b){return Math.min(a,b)}function abs(a){return Math.abs(a)}function sign(a){return a?Math.abs(a)/a:0}function pow(a,b){return Math.pow(a,b)}function exp(a){return Math.exp(a)}function log(a){return Math.log(a)}function ln(a){return Math.log(a)/LN10}function sqrt(a){return Math.sqrt(a)}function cos(a){return Math.cos(a)}function sin(a){return Math.sin(a)}function tan(a){return Math.tan(a)}function acos(a){return Math.cos(a)}function asin(a){return Math.sin(a)}function atan(a){return Math.atan(a)}function atan2(a,b){return Math.atan2(a,b)}function sec(a){return 1/cos(a)}function csc(a){return 1/sin(a)}function cot(a){return 1/tan(a)}function cosp(a){return(1+Math.cos(a))/2}function sinp(a){return(1+Math.sin(a))/2}function random(){return Math.random()}function rand(a){return Math.random()*a}function randint(a){return 0|rand(a)}function randrange(a,b){return a+rand(b-a)}function choice(a){return a[randint(a.length)]}function deg(a){return 180*a/PI}function rad(a){return a*PI/180}function xor(a,b){return a=!!a,b=!!b,(a||b)&&!(a&&b)}function mod(a,b){return a-b*floor(a/b)}function dist(a,b,c,d){return sqrt(pow(c-a,2)+pow(d-b,2))}function angle(a,b,c,d){return atan2(d-b,c-a)}function avg(a,b,c){return(a*(c-1)+b)/c}function noop(){}function pixel(a,b){return 4*(mod(b,actual_h)*actual_w+mod(a,actual_w))}function rgbpixel(c,d,e){var f=pixel(~~d,~~e);r=c[f],g=c[f+1],b=c[f+2],a=c[f+3]}function fit(a,b,c){rgbpixel(a,b*actual_w/w,c*actual_h/h)}function step(a,b){return(b>=a)+0}function julestep(a,b,c){return clamp(norm(c,a,b),0,1)}function smoothstep(a,b,c){var d=clamp((c-a)/(b-a),0,1);return d*d*(3-2*d)}function shuffle(a){for(var b,c,d=a.length;d>0;d--)b=randint(d),c=a[d-1],a[d-1]=a[b],a[b]=c;return a}function reverse(a){for(var b=[],c=0,d=a.length-1;d>=c;c++)b[c]=a[d-c];return b}function deinterlace(a){for(var b=[],c=[],d=0,e=a.length;e>d;d++)d%2?c.push(a[d]):b.push(a[d]);return[c,b]}function weave(a){var b=deinterlace(a),c=[];return b[0].forEach(function(a){c.push(a)}),reverse(b[1]).forEach(function(a){c.push(a)}),c}function range(a,b,c){var d=[];c=c||1;for(var e=a;b>=e;e+=c)d.push(e);return d}function guid(a){var b=guid_syllables.length;return(++guid_n*(b-1)*~~log(guid_n)).toString(b).split("").map(function(a){return guid_syllables[parseInt(a,b)%b--]}).join("")}function defaults(a,b){a=a||{};for(var c in b)a[c]="undefined"==typeof a[c]?b[c]:a[c];return a}function smarten(a){return a=a.replace(/(^|[-\u2014\s(\["])'/g,"$1‘"),a=a.replace(/'/g,"’"),a=a.replace(/(^|[-\u2014/\[(\u2018\s])"/g,"$1“"),a=a.replace(/"/g,"”"),a=a.replace(/--/g,"—")}function pairs(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push([c,a[c]]);return b}function invert_hash(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[a[c]]=c);return b}function filenameFromUrl(a){var b=a.split("/");return b[b.length-1].split(".")[0]}function bitcount(a){return a-=a>>>1&1431655765,a=(858993459&a)+(a>>>2&858993459),16843009*(a+(a>>>4)&252645135)>>>24}function throttle(a,b){b=b||100;var c,d=!0;return function(){var e=Date.now();return d?(c=e,a.apply(this,arguments)):void(e-c>b&&(d=!0))}}function selectElementContents(a){if(window.getSelection&&document.createRange){var b=window.getSelection(),c=document.createRange();c.selectNodeContents(a),b.removeAllRanges(),b.addRange(c)}else if(document.selection&&document.body.createTextRange){var d=document.body.createTextRange();d.moveToElementText(a),d.select()}}function onFullScreenSettle(a,b,c,d){function e(b,e){var g=f(e),h=throttle(function(){g()?c(b):a(h)},d);a(h)}function f(a){var b,c=0,d=2;return function(){var e=a();if(b){var f=e===b&&++c===d;return b=e,f}b=e}}d=d||200,b?e(!0,function(){return b.offsetHeight}):e(!1,function(){return window.innerHeight})}function build_scene(){function a(){navWidth=$("nav").width()}controls.setZoom(1e5),controls.zoom(1e3),strips.push(new Strip({images:boxImages.slice(0,5),x:-100,y:100,rotationY:PI/4,offset:100})),strips.push(new Strip({images:boxImages.slice(5,10),x:100,y:100,rotationX:PI/4,rotationY:PI/-100,offset:200})),strips.push(new Strip({images:boxImages.slice(10,15),x:0,y:100,z:100,rotationY:PI/6,offset:300})),strips.push(new Strip({images:boxImages.slice(15,20),x:0,y:100,z:-50,rotationX:PI/2,rotationY:PI/100,offset:200})),a(),$(window).resize(a),$(window).mousemove(function(a){gallery&&(prev=(a.pageX-navWidth)/window.innerWidth<.415,prev!==wasPrev&&(wasPrev=prev,$("#okgallery").toggleClass("prev",prev)))}),strips.forEach(function(a){a.update(0)}),scene.update(),environment.update=environment.updateOnReady}function load_index(a){a&&a.preventDefault(),$("nav a.active").removeClass("active"),open_entry(!0),window.location.hash="#",$("#entry_container").removeClass("visible");var b=$("<div>");b.load("all .entry",function(){$("body").addClass("menuActive"),display_entry(b.children()[0])})}function as_hash(a){return a.replace(/\s/g,"_")}function load_hash(a){var b=$(hashes[a]);$(".active").removeClass("active"),b.parent().addClass("active"),b.parent().prev(".cat").addClass("active"),b.trigger("click")}function open_entry(a){is_mobile&&!a&&$("body").removeClass("menuActive"),entry_open||(entry_open=!0,controls.zoom(40),controls.wheel.lock(),$("#scene").addClass("fade"),setTimeout(function(){$("#scene").hide()},200)),entry_open_time=+new Date,$("#entry_container").addClass("fade")}function display_entry(a){var b=+new Date,c=$(a),d=c.hasClass("all");if(is_mobile&&$("body").toggleClass("menuActive",d),d){var e=c.find("#project_list"),f=e.find(".project");if(!shuffled_indexes){shuffled_indexes=[];for(var g=0;g<f.length;g++)shuffled_indexes[g]=g;shuffle(shuffled_indexes)}e.html("");for(var g=0;g<f.length;g++)e.append(f[shuffled_indexes[g]])}setTimeout(function(){$("#entry_container").empty().append(c),$("#entry_container").removeClass("fade"),setTimeout(function(){build_gallery()}),is_mobile&&$(".video").each(function(){load_video($(this))}),window.location.hash.match(/about|contact/)||$(".entry").hasClass("all")?setTimeout(function(){$(".entry").addClass("ready"),$(".entry").hasClass("all")&&setTimeout(function(){$(".entry").removeClass("undone")},500)},100):$(".entry").addClass("ready")},max(0,200-(b-entry_open_time))+20),$("#entry_container").scrollTop(0),$("#entry_container").addClass("visible"),$("#scene").addClass("fade"),$(".cat").removeClass("hover").removeClass("no-hover"),setTimeout(function(){$("#scene").hide()},200)}function hide_entry(){$("nav .active").removeClass("active"),$("#entry_container").addClass("fade"),setTimeout(function(){$("#entry_container").empty()},200),$("#scene").show().removeClass("fade"),controls.zoom(1500),window.location.hash="#"}function toggle_menu(a){$("body").toggleClass("menuActive"),menu_open=$("body").hasClass("menuActive"),is_mobile||$("#entry_container").removeClass("visible"),menu_open&&a!==!1&&(controls.pause(),load_index()),menu_open||!entry_open||is_mobile||(entry_open=!1,controls.wheel.unlock(),setTimeout(function(){$("#scene").removeClass("fade")}),$("nav a.active").removeClass("active")),menu_open||entry_open||(window.location.hash="#",$("#scene").show(),$("#entry_container").empty(),controls.zoom(1500),$(".cat").removeClass("active"),$(".sub").removeClass("active"))}function build_gallery(){videos=[],wasPrev=-1;var a=$("#entry_container #okgallery");if(!a.length)return void(gallery=null);var b=$("#entry_container #okgallery .cell");1==b.length&&$(".entry").addClass("singleton");var c=(a.next(".next"),a.next(".caption"));gallery=new Flickity("#okgallery",{cellSelector:".cell",cellAlign:"left",wrapAround:!0,prevNextButtons:!1,pageDots:!0,setGallerySize:!1,draggable:!0,imagesLoaded:!0}),$("#okgallery .video").each(function(){var a=$(this);if(!is_mobile){var b=$('<div class="underlay"></div>');b.css("background-image",a.css("background-image")),a.css("background-image","none")}var c=$('<div class="play"></div>');a.append(c),a.append(b),is_desktop&&c.on("click",function(b){if(b.stopPropagation(),b.preventDefault(),a.hasClass("loaded")){var c=a.data("player");c.api("play")}else load_video(a)})}),$(".caption").click(function(){fullscreen($(".gallery")[0])}),gallery.on("cellSelect",function(){gallery.selectedElement&&(c.html($(gallery.selectedElement).data("caption")),videos.forEach(function(a){a.api("pause")}))}),gallery.on("settle",function(){gallery&&gallery.selectedElement&&c.html($(gallery.selectedElement).data("caption"))}),gallery.on("staticClick",function(a){var b=$(a.target);b.hasClass("play")||($("#okgallery").hasClass("prev")?gallery.previous():gallery.next())}),gallery.loader.on("progress",function(a,b){$(b.img).addClass("loaded"),$(b.img).parent().removeClass("loading")}),$(".nextbutton").click(function(){gallery.next()}),$(".prevbutton").click(function(){gallery.previous()})}function resize_gallery(a){if(gallery){var b=getFullScreenElement(),c=$("#okgallery");c.find(".cell img").each(function(){var d=a?$(b).height():c.height(),e=a?"auto":this.naturalWidth/this.naturalHeight*d;$(this).css({width:e,height:d})}),$(".flickity-viewport").css("height",""),gallery.resize()}}function load_video(a){if(!a.hasClass("loaded")){a.addClass("loaded");var b=a.data("video").match(/\d+/)[0],c=$('<iframe src="https://player.vimeo.com/video/'+b+'?autoplay=1&title=0&byline=0&portrait=0" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>');a.append(c);var d=$f(a.find("iframe")[0]);a.data("player",d),d.addEvent("ready",function(){a.addClass("playing"),d.addEvent("play",function(){a.addClass("playing")}),d.addEvent("pause",function(){a.removeClass("playing")})}),videos.push(d)}}function HustleLoader(){function a(){b()}function b(){setTimeout(function(){$("#loader_svg").addClass("slide")},100)}var c=document.getElementById("loader_svg_status");this.update=function(a){var b=lerp(1-a,336,118);c.setAttribute("y",b)},this.finish=function(a){$("#loader_rapper").addClass("hidden"),setTimeout(a,100),setTimeout(function(){$("#loader_rapper").hide()},500)},a()}var MX=MX||function(a){function b(){var a=document.body.style;r.prefix="webkitTransform"in a?"webkit":"mozTransform"in a?"moz":"msTransform"in a?"ms":"",k=r.transformProp=h("transform"),l=r.transitionProp=h("transition"),m=r.transformOriginProp=h("transformOrigin"),n=r.transformStyleProp=h("transformStyle"),o=r.perspectiveProp=h("perspective"),p=r.transitionEndEvent="webkit"===r.prefix?"webkitTransitionEnd":"transitionend";for(var b=["webkit","moz","ms"],d=0;d<b.length&&!window.requestAnimationFrame;++d)window.requestAnimationFrame=window[b[d]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[d]+"CancelAnimationFrame"]||window[b[d]+"CancelRequestAnimationFrame"];q=document.createElement("style"),q.type="text/css",q.innerHTML=".mx-object3d {position: absolute;top: 50%;left: 50%;}",c(),window.scrollTo(0,0)}function c(){document.head.appendChild(q)}function d(){document.head.removeChild(q)}function e(a){return a/Math.PI*180}function f(a){return a/180*Math.PI}function g(a){var b=a.rotationOrigin;if(b){var c=b.x-a.x,d=-(b.y-a.y),e=-(b.z-a.z);return{before:"translate3d("+c.toFixed(s)+"px,"+d.toFixed(s)+"px,"+e.toFixed(s)+"px) ",after:"translate3d("+(-c).toFixed(s)+"px,"+(-d).toFixed(s)+"px,"+(-e).toFixed(s)+"px) "}}}function h(a){return r.prefix&&(a=r.prefix+a.charAt(0).toUpperCase()+a.slice(1)),a}function i(b){this.setupDomElement(b),this.setCSSTransformStyle("preserve-3d"),this.el.classList.add("mx-object3d"),this.parent=a,this.children=[],this.updateChildren=!0,this.inverseLookAt=!1,this.persisted=!0,this.reset();var c,d,e=this;Object.defineProperty(this,"width",{get:function(){return c||parseInt(e.el.style.width,10)*app_devicePixelRatio||0},set:function(a){c=a,this.el.style.width=c/app_devicePixelRatio+"px"}}),Object.defineProperty(this,"height",{get:function(){return d||parseInt(e.el.style.height,10)*app_devicePixelRatio||0},set:function(a){d=a,this.el.style.height=d/app_devicePixelRatio+"px"}})}function j(a){var b=this,c=function(){b.call(this),a.init&&a.init.apply(this,arguments)};c.prototype=Object.create(b.prototype);for(var d in a)a.hasOwnProperty(d)&&"init"!==d&&(c.prototype[d]=a[d]);return c.extend=j.bind(c),c}var k,l,m,n,o,p,q,r={version:"0.1.0",prefix:a,rotationUnit:"rad"},s=5,t=!0;return document.addEventListener("DOMContentLoaded",b),i.prototype={constructor:i,reset:function(){this.x=this.__x=0,this.y=this.__y=0,this.z=this.__z=0,this.rotationX=this.__rotationX=0,this.rotationY=this.__rotationY=0,this.rotationZ=this.__rotationZ=0,this.scaleX=this.__scaleX=1,this.scaleY=this.__scaleY=1,this.scaleZ=this.__scaleZ=1,this.skewX=this.__skewX=0,this.skewY=this.__skewY=0,this.scale=this.__scale=1,this.perspective=this.__perspective=0,this.rotationOrigin=a,this.followTarget=a,this.dirty=!0,this.update()},setupDomElement:function(b){if(this.el=a,b instanceof HTMLElement)this.el=b;else if("string"==typeof b){var c=b.match(/^[^.#\s]*/)[1],d=b.match(/#[^.#\s]*/),e=b.match(/\.[^.#\s]*/g);if(this.el=document.createElement(c||"div"),d&&(this.el.id=d[0].slice(1)),e)for(var f=e.length;f--;)this.el.classList.add(e[f].slice(1))}else this.el=document.createElement("div")},update:function(){if(this.updateChildren)for(var a=this.children.length;a--;)this.children[a].update();if(this.followTarget&&this.lookAt(this.followTarget,!1),(this.scaleX!==this.__scaleX||this.scaleY!==this.__scaleY||this.scaleZ!==this.__scaleZ)&&(this.__scaleX=this.scaleX,this.__scaleY=this.scaleY,this.__scaleZ=this.scaleZ,this.dirty=!0),(this.skewX!==this.__skewX||this.skewY!==this.__skewY)&&(this.__skewX=this.skewX,this.__skewY=this.skewY,this.dirty=!0),this.scale!==this.__scale&&(this.scaleX=this.scaleY=this.scaleZ=this.__scaleX=this.__scaleY=this.__scaleZ=this.__scale=this.scale,this.dirty=!0),(this.rotationX!==this.__rotationX||this.rotationY!==this.__rotationY||this.rotationZ!==this.__rotationZ)&&(this.__rotationX=this.rotationX,this.__rotationY=this.rotationY,this.__rotationZ=this.rotationZ,this.dirty=!0),(this.x!==this.__x||this.y!==this.__y||this.z!==this.__z)&&(this.__x=this.x,this.__y=this.y,this.__z=this.z,this.dirty=!0),this.perspective!==this.__perspective&&(this.__perspective=this.perspective,this.dirty=!0),this.dirty&&this.el){var b=g(this),c="rotateX("+this.rotationX.toFixed(s)+r.rotationUnit+") rotateY("+this.rotationY.toFixed(s)+r.rotationUnit+") rotateZ("+this.rotationZ.toFixed(s)+r.rotationUnit+") ",d=(r.positionAtCenter?"translate3d(-50%, -50%, 0) ":"")+(this.perspective?"perspective("+this.perspective+"px) ":"")+"translate3d("+this.x.toFixed(s||0)+"px,"+(-this.y).toFixed(s)+"px,"+(-this.z).toFixed(s)+"px) scale3d("+(app_devicePixelRatio*this.scaleX).toFixed(s)+","+(app_devicePixelRatio*this.scaleY).toFixed(s)+","+(app_devicePixelRatio*this.scaleZ).toFixed(s)+") skew("+(app_devicePixelRatio*this.skewX).toFixed(s)+"rad,"+(app_devicePixelRatio*this.skewY).toFixed(s)+"rad) ";d+=b?b.before+c+b.after:c,this.el.style[k]=d,this.dirty=!1}return this},setFromQuaternion:function(a,b,c){var d=a.x*a.x,e=a.y*a.y,f=a.z*a.z,g=a.w*a.w;this.rotationX=Math.atan2(2*(a.x*a.w-a.y*a.z),g-d-e+f),this.rotationY=Math.asin(clamp(2*(a.x*a.z+a.y*a.w),-1,1)),this.rotationZ=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-e-f)},lookAt:function(a,b){var c=this.getLookAtEuler(a);return this.setRotation(c),b!==!1&&this.update(),this},getLookAtEuler:function(a){var b={},c=a.x-this.x,d=a.y-this.y,f=a.z-this.z;this.inverseLookAt&&(c=-c,d=-d,f=-f),0===f&&(f=.001),b.x=-Math.atan2(d,f);var g=f>0?1:-1;return b.y=g*Math.atan2(c*Math.cos(b.x),f*-g),b.z=Math.atan2(Math.cos(b.x),Math.sin(b.x)*Math.sin(b.y))-Math.PI/2,"deg"===r.rotationUnit&&(b.x=e(b.x),b.y=e(b.y),b.z=e(b.z)),b},add:function(){if(this.el){var a=this;return Array.prototype.forEach.call(arguments,function(b){!b instanceof i||(a.el.appendChild(b.el),a.children||(a.children=[]),a.children.push(b),b.parent=a)}),this}},remove:function(){var b=this;return Array.prototype.forEach.call(arguments,function(c){var d=b.children.indexOf(c);-1!==d&&(b.children.splice(d,1),b.el.removeChild(c.el),c.parent=a)}),this},addTo:function(a){return"string"==typeof a&&(a=document.querySelector(a)),a instanceof HTMLElement&&a.appendChild?a.appendChild(this.el):(a instanceof i||a instanceof r.Scene)&&a.add(this),this},removeElement:function(){this.el.parentNode&&this.el.parentNode.removeChild(this.el)},setPosition:function(a){this.x=a.x||0===a.x?a.x:this.x,this.y=a.y||0===a.y?a.y:this.y,this.z=a.z||0===a.z?a.z:this.z},setRotation:function(a){this.rotationX=a.x||0===a.x?a.x:this.rotationX,this.rotationY=a.y||0===a.y?a.y:this.rotationY,this.rotationZ=a.z||0===a.z?a.z:this.rotationZ},setScale:function(a){this.scaleX=a.x||0===a.x?a.x:this.scaleX,this.scaleY=a.y||0===a.y?a.y:this.scaleY,this.scaleZ=a.z||0===a.z?a.z:this.scaleZ},setSkew:function(a){this.skewX=a.x||0===a.x?a.x:this.skewX,this.skewY=a.y||0===a.y?a.y:this.skewY},setCSSTransformOrigin:function(a){return this.el&&(this.el.style[m]=a),this},setCSSTransformStyle:function(a){return this.el&&(this.el.style[n]=a),this},setCSSTransition:function(a){return this.el&&(this.el.style[l]=a),this},setCSSPerspective:function(a){return this.el&&(this.el.style[o]=a),this},move:function(a){var b=this;b.ops=defaults(a,b.ops);for(var c in a)b[c]=a[c];b.dirty=!0,b.update()},onTransitionEnd:function(a){function b(){c.removeEventListener(p,b),a()}this.cancelTransitionEnd();var c=this.el;c.addEventListener(p,b)},cancelTransitionEnd:function(){this.el.removeEventListener(p)},toString:function(a){return a=a||"id width height depth x y z rotationX rotationY rotationZ scale".split(" "),this.__toString(a)},__toString:function(b,c){this.id=this.id||"undef";var d,e,f={},g=this.type||"Object3d",h=g.toLowerCase();for(var i in b)e=b[i],d=this[e],(0!==d||c)&&("number"==typeof d?-1!=e.indexOf("rotation")?f[e]=Number(d.toFixed(3)):f[e]=~~d:f[e]=d);return(c||"var "+h+" = new MX."+g)+"("+JSON.stringify(f,a,2)+")\n"+(c?"":"scene.add("+h+")")},contains:function(a,b,c){var d=!1,e=!1,f=!1;return d=null===a?!0:abs(this.x-a)<=this.width/2,e=null===b?!0:abs(this.y-b)<=this.height/2,f=null===c?!0:abs(this.z-c)<=this.depth/2,d&&e&&f}},i.extend=j.bind(i),r.Object3D=i,r.toRad=f,r.toDeg=e,Object.defineProperty(r,"positionAtCenter",{get:function(){return t},set:function(a){"boolean"==typeof a&&(t=a,t?c():d())}}),r}();MX.Camera=MX.Object3D.extend({init:function(){this.el=null,this.type="Camera"},move:function(a){for(var b in a)this[b]=a[b]},toString:function(){var a="x y z rotationX rotationY".split(" ");return this.__toString(a,"scene.camera.move")},getCameraEuler:function(a){var b=a.x-this.x,c=a.y-this.y,d=a.z-this.z;return r={},r.y=Math.atan2(-b,d),r.x=Math.atan2(-c,Math.sqrt(b*b+d*d)),r.z=0,"deg"===MX.rotationUnit&&(r.x=MX.toDeg(r.x),r.y=MX.toDeg(r.y)),r}}),MX.Scene=function(){function a(){this.el=document.createElement("div"),this.el.classList.add("mx-scene");var a=this.el.style;a[MX.transformProp]="preserve-3d",a.webkitPerspectiveOrigin="50% 50%",a.mozPerspectiveOrigin="50% 50%",a.perspectiveOrigin="50% 50%",a.webkitUserSelect="none",a.mozUserSelect="none",a.userSelect="none",a.overflow="hidden",this.inner=(new MX.Object3D).addTo(this.el),this.inner.el.style.width="0",this.inner.el.style.height="0";var b,c,d,e=this;Object.defineProperty(this,"width",{get:function(){return b},set:function(a){b=a,e.el.style.width=a+"px"}}),Object.defineProperty(this,"height",{get:function(){return c},set:function(a){c=a,e.el.style.height=a+"px"}}),Object.defineProperty(this,"perspective",{get:function(){return d},set:function(a){d=a,e.el.style[MX.perspectiveProp]=a+"px",e.inner.z=-a-e.camera.z,e.inner.rotationOrigin.z=-a}});this.camera=new MX.Camera;this.inner.rotationOrigin={x:0,y:0,z:0},this.perspective=0}var b=MX.Object3D.prototype.add,c=MX.Object3D.prototype.remove;return a.prototype={constructor:a,add:function(){return b.apply(this.inner,arguments),this},remove:function(){return c.apply(this.inner,arguments),this},addTo:function(a){return"string"==typeof a&&(a=document.querySelector(a)),a instanceof HTMLElement&&a.appendChild?a.appendChild(this.el):console.warn("You can only add a Scene to an HTML element."),this},update:function(){var a=this.inner,b=this.camera;return b.update(),a.z=-this.perspective-b.z,a.x=-b.x,a.y=-b.y,a.rotationX=-b.rotationX,a.rotationY=-b.rotationY,a.update(),this}},a}(),MX.OrbitCamera=function(a){function b(a){return function(b){a(b.touches[0])}}function c(a){k=a.pageX,l=a.pageY,f.dragging=!0}function d(a){f.dragging&&(f.delta(k-a.pageX,l-a.pageY),k=a.pageX,l=a.pageY)}function e(a){f.dragging=!1}var f={},g=!1;f.opt=a=defaults(a,{el:window,camera:scene.camera,radius:100,radiusRange:[10,1e3],rotationX:PI/2,rotationY:0,center:{x:0,y:0,z:0},sensitivity:10,wheelSensitivity:10,ease:10,wheelEase:10});var h,i,j,k,l,m=1e-10;return f.dragging=!1,f.init=function(){i=a.rotationY,h=a.rotationX,j=a.radius,f.wheel=new wheel({el:a.el,update:function(b,c){a.radius=clamp(a.radius+c*a.wheelSensitivity,a.radiusRange[0],a.radiusRange[1])}}),f.bind()},f.toggle=function(a){a?f.bind():f.unbind()},f.bind=function(){g||(g=!0,a.el.addEventListener("mousedown",c),window.addEventListener("mousemove",d),window.addEventListener("mouseup",e),a.el.addEventListener("touchstart",b(c)),window.addEventListener("touchmove",b(d)),window.addEventListener("touchend",b(e)),f.wheel.unlock())},f.unbind=function(){g&&(g=!1,a.el.removeEventListener("mousedown",c),window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",e),f.wheel.lock())},f.delta=function(b,c){a.rotationY+=b/window.innerWidth*a.sensitivity,a.rotationX=a.rotationX+c/window.innerHeight*a.sensitivity},f.move=function(b,c){a.rotationY=b,"number"==typeof c&&(a.rotationX=c)},f.zoom=function(b){a.radius=b},f.setZoom=function(b){j=a.radius=b},f.zoomPercent=function(b){a.radius=lerp(b,a.radiusRange[0],a.radiusRange[1])},f.zoomDelta=function(b){a.radius+=b},f.pause=function(){var b=sign(a.rotationY-i),c=sign(a.rotationX-h);a.rotationY=i+.1*b,a.rotationX=h+.1*c},f.update=function(){i=abs(i-a.rotationY)>m?avg(i,a.rotationY,a.ease):a.rotationY,h=abs(h-a.rotationX)>m?avg(h,a.rotationX,a.ease):a.rotationX,j=abs(j-a.radius)>m?avg(j,a.radius,a.wheelEase):a.radius,a.camera.x=a.center.x+j*sin(h)*cos(i),a.camera.z=a.center.y+j*sin(h)*sin(i),a.camera.y=a.center.z+j*cos(h),a.camera.rotationX=PI/2-h,a.camera.rotationY=i+PI/2},f},MX.OrbitCameraMobile=function(a){function b(a){return function(b){a(b.touches[0])}}function c(a){k=a.pageX,l=a.pageY,f.dragging=!0}function d(a){f.dragging&&(f.delta(k-a.pageX,l-a.pageY),k=a.pageX,l=a.pageY)}function e(a){f.dragging=!1}var f={},g=!1;f.opt=a=defaults(a,{el:window,camera:scene.camera,radius:100,radiusRange:[10,1e3],rotationX:PI/2,rotationY:0,center:{x:0,y:0,z:0},sensitivity:10,wheelSensitivity:10,ease:10,wheelEase:10});var h,i,j,k,l,m,n=1e-10,o=0,p=0,q=0,r=0,s=20;return f.dragging=!1,f.init=function(){i=a.rotationY,h=a.rotationX,j=a.radius,f.wheel=new wheel({el:a.el,update:function(b,c){a.radius=clamp(a.radius+c*a.wheelSensitivity,a.radiusRange[0],a.radiusRange[1])}}),f.bind(),f.orientationchange()},f.toggle=function(a){a?f.bind():f.unbind()},f.bind=function(){g||(g=!0,a.el.addEventListener("touchstart",b(c)),window.addEventListener("touchmove",b(d)),window.addEventListener("touchend",b(e)),window.addEventListener("orientationchange",f.orientationchange),window.addEventListener("devicemotion",f.devicemotion),window.addEventListener("deviceorientation",f.deviceorientation),f.wheel.unlock())},f.unbind=function(){g&&(g=!1,f.wheel.lock())},f.orientationchange=function(a){is_portrait=window.innerWidth<window.innerHeight,is_portrait&&(m=0)},f.devicemotion=function(a){if(is_portrait){var b=a.rotationRate.alpha;o+=b,r+=1}},f.deviceorientation=function(a){m||(m=a.alpha),is_portrait?f.portraitorientation(a):f.landscapeorientation(a)},f.portraitorientation=function(b){var c,d=0,e=0;c=b.webkitCompassHeading?180-b.webkitCompassHeading:180-b.alpha,is_android&&(c=360-c),b.beta>q&&(q=b.beta,p=o);b.beta+7;d=!is_android&&r>s?o>p?b.beta-90:90-b.beta:0,(Math.abs(c-m)<100||Math.abs(c-m)>300)&&(e=c-m,m=c),e>300?e-=360:-300>e&&(e+=360),a.rotationX=MX.toRad(-5*d),a.rotationY+=MX.toRad(10*e)},f.landscapeorientation=function(b){var c,d;c=b.gamma>0?90-b.gamma:90+b.gamma,d=b.alpha-m,m=b.alpha,d>300?d-=360:-300>d&&(d+=360),a.rotationX=c>45?0:MX.toRad(c),a.rotationY+=MX.toRad(d)},f.delta=function(b,c){a.rotationY+=b/window.innerWidth*a.sensitivity,a.rotationX=a.rotationX+c/window.innerHeight*a.sensitivity},f.move=function(b,c){a.rotationY=b,"number"==typeof c&&(a.rotationX=c)},f.zoom=function(b){a.radius=b},f.setZoom=function(b){j=a.radius=b},f.zoomPercent=function(b){a.radius=lerp(b,a.radiusRange[0],a.radiusRange[1])},f.zoomDelta=function(b){a.radius+=b},f.pause=function(){var b=sign(a.rotationY-i),c=sign(a.rotationX-h);a.rotationY=i+.1*b,a.rotationX=h+.1*c},f.update=function(){i=abs(i-a.rotationY)>n?avg(i,a.rotationY,a.ease):a.rotationY,h=abs(h-a.rotationX)>n?avg(h,a.rotationX,a.ease):a.rotationX,j=abs(j-a.radius)>n?avg(j,a.radius,a.wheelEase):a.radius,a.camera.x=a.center.x+j*sin(h)*cos(i),a.camera.z=a.center.y+j*sin(h)*sin(i),a.camera.y=a.center.z+j*cos(h),a.camera.rotationX=PI/2-h,a.camera.rotationY=i+PI/2},f},MX.Image=MX.Object3D.extend({init:function(a){this.type="Image",this.media=a.media,this.width=0,this.height=0,this.x=a.x||0,this.y=a.y||0,this.z=a.z||0,this.scale=a.scale||1,this.backface=a.backface||!1,a.className&&this.el.classList.add(a.className),this.backface&&this.el.classList.add("backface-visible"),this.el.classList.add("image"),this.el.classList.add("mx-scenery"),this.el.style.backgroundRepeat="no-repeat",this.load(a)},load:function(a){var b=this;b.ops=defaults(a,b.ops);var c=new Image;c.onload=function(){b.ops&&(b.scale=b.ops.scale||1,b.width=b.ops.width||c.naturalWidth,b.height=b.ops.height||c.naturalHeight,b.el.style.backgroundImage="url("+c.src+")",b.el.classList.add("image"),b.dirty=!0,b.ops.onload&&b.ops.onload(c),b.update())},c.src=a.src,c.complete&&setTimeout(c.onload)}}),!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){function c(a){var b=a.length,c=fa.type(a);return"function"===c||fa.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}function d(a,b,c){if(fa.isFunction(b))return fa.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return fa.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(na.test(b))return fa.filter(b,a,c);b=fa.filter(b,a)}return fa.grep(a,function(a){return fa.inArray(a,b)>=0!==c})}function e(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}function f(a){var b=va[a]={};return fa.each(a.match(ua)||[],function(a,c){b[c]=!0}),b}function g(){pa.addEventListener?(pa.removeEventListener("DOMContentLoaded",h,!1),a.removeEventListener("load",h,!1)):(pa.detachEvent("onreadystatechange",h),a.detachEvent("onload",h))}function h(){(pa.addEventListener||"load"===event.type||"complete"===pa.readyState)&&(g(),fa.ready())}function i(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(Aa,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:za.test(c)?fa.parseJSON(c):c}catch(e){}fa.data(a,b,c)}else c=void 0}return c}function j(a){var b;for(b in a)if(("data"!==b||!fa.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function k(a,b,c,d){if(fa.acceptData(a)){var e,f,g=fa.expando,h=a.nodeType,i=h?fa.cache:a,j=h?a[g]:a[g]&&g;if(j&&i[j]&&(d||i[j].data)||void 0!==c||"string"!=typeof b)return j||(j=h?a[g]=W.pop()||fa.guid++:g),i[j]||(i[j]=h?{}:{toJSON:fa.noop}),("object"==typeof b||"function"==typeof b)&&(d?i[j]=fa.extend(i[j],b):i[j].data=fa.extend(i[j].data,b)),f=i[j],d||(f.data||(f.data={}),
+f=f.data),void 0!==c&&(f[fa.camelCase(b)]=c),"string"==typeof b?(e=f[b],null==e&&(e=f[fa.camelCase(b)])):e=f,e}}function l(a,b,c){if(fa.acceptData(a)){var d,e,f=a.nodeType,g=f?fa.cache:a,h=f?a[fa.expando]:fa.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){fa.isArray(b)?b=b.concat(fa.map(b,fa.camelCase)):b in d?b=[b]:(b=fa.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;for(;e--;)delete d[b[e]];if(c?!j(d):!fa.isEmptyObject(d))return}(c||(delete g[h].data,j(g[h])))&&(f?fa.cleanData([a],!0):da.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}function m(){return!0}function n(){return!1}function o(){try{return pa.activeElement}catch(a){}}function p(a){var b=La.split("|"),c=a.createDocumentFragment();if(c.createElement)for(;b.length;)c.createElement(b.pop());return c}function q(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==ya?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==ya?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||fa.nodeName(d,b)?f.push(d):fa.merge(f,q(d,b));return void 0===b||b&&fa.nodeName(a,b)?fa.merge([a],f):f}function r(a){Fa.test(a.type)&&(a.defaultChecked=a.checked)}function s(a,b){return fa.nodeName(a,"table")&&fa.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function t(a){return a.type=(null!==fa.find.attr(a,"type"))+"/"+a.type,a}function u(a){var b=Wa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function v(a,b){for(var c,d=0;null!=(c=a[d]);d++)fa._data(c,"globalEval",!b||fa._data(b[d],"globalEval"))}function w(a,b){if(1===b.nodeType&&fa.hasData(a)){var c,d,e,f=fa._data(a),g=fa._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)fa.event.add(b,c,h[c][d])}g.data&&(g.data=fa.extend({},g.data))}}function x(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!da.noCloneEvent&&b[fa.expando]){e=fa._data(b);for(d in e.events)fa.removeEvent(b,d,e.handle);b.removeAttribute(fa.expando)}"script"===c&&b.text!==a.text?(t(b).text=a.text,u(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),da.html5Clone&&a.innerHTML&&!fa.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&Fa.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}function y(b,c){var d=fa(c.createElement(b)).appendTo(c.body),e=a.getDefaultComputedStyle?a.getDefaultComputedStyle(d[0]).display:fa.css(d[0],"display");return d.detach(),e}function z(a){var b=pa,c=ab[a];return c||(c=y(a,b),"none"!==c&&c||(_a=(_a||fa("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(_a[0].contentWindow||_a[0].contentDocument).document,b.write(),b.close(),c=y(a,b),_a.detach()),ab[a]=c),c}function A(a,b){return{get:function(){var c=a();return null!=c?c?void delete this.get:(this.get=b).apply(this,arguments):void 0}}}function B(a,b){if(b in a)return b;for(var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=nb.length;e--;)if(b=nb[e]+c,b in a)return b;return d}function C(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=fa._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&Da(d)&&(f[g]=fa._data(d,"olddisplay",z(d.nodeName)))):f[g]||(e=Da(d),(c&&"none"!==c||!e)&&fa._data(d,"olddisplay",e?c:fa.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function D(a,b,c){var d=jb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function E(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=fa.css(a,c+Ca[f],!0,e)),d?("content"===c&&(g-=fa.css(a,"padding"+Ca[f],!0,e)),"margin"!==c&&(g-=fa.css(a,"border"+Ca[f]+"Width",!0,e))):(g+=fa.css(a,"padding"+Ca[f],!0,e),"padding"!==c&&(g+=fa.css(a,"border"+Ca[f]+"Width",!0,e)));return g}function F(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=bb(a),g=da.boxSizing()&&"border-box"===fa.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=cb(a,b,f),(0>e||null==e)&&(e=a.style[b]),eb.test(e))return e;d=g&&(da.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+E(a,b,c||(g?"border":"content"),d,f)+"px"}function G(a,b,c,d,e){return new G.prototype.init(a,b,c,d,e)}function H(){return setTimeout(function(){ob=void 0}),ob=fa.now()}function I(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=Ca[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function J(a,b,c){for(var d,e=(ub[b]||[]).concat(ub["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function K(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},n=a.style,o=a.nodeType&&Da(a),p=fa._data(a,"fxshow");c.queue||(h=fa._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,fa.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[n.overflow,n.overflowX,n.overflowY],j=fa.css(a,"display"),k=z(a.nodeName),"none"===j&&(j=k),"inline"===j&&"none"===fa.css(a,"float")&&(da.inlineBlockNeedsLayout&&"inline"!==k?n.zoom=1:n.display="inline-block")),c.overflow&&(n.overflow="hidden",da.shrinkWrapBlocks()||l.always(function(){n.overflow=c.overflow[0],n.overflowX=c.overflow[1],n.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],qb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(o?"hide":"show")){if("show"!==e||!p||void 0===p[d])continue;o=!0}m[d]=p&&p[d]||fa.style(a,d)}if(!fa.isEmptyObject(m)){p?"hidden"in p&&(o=p.hidden):p=fa._data(a,"fxshow",{}),f&&(p.hidden=!o),o?fa(a).show():l.done(function(){fa(a).hide()}),l.done(function(){var b;fa._removeData(a,"fxshow");for(b in m)fa.style(a,b,m[b])});for(d in m)g=J(o?p[d]:0,d,l),d in p||(p[d]=g.start,o&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function L(a,b){var c,d,e,f,g;for(c in a)if(d=fa.camelCase(c),e=b[d],f=a[c],fa.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=fa.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function M(a,b,c){var d,e,f=0,g=tb.length,h=fa.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=ob||H(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:fa.extend({},b),opts:fa.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:ob||H(),duration:c.duration,tweens:[],createTween:function(b,c){var d=fa.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(L(k,j.opts.specialEasing);g>f;f++)if(d=tb[f].call(j,a,k,j.opts))return d;return fa.map(k,J,j),fa.isFunction(j.opts.start)&&j.opts.start.call(a,j),fa.fx.timer(fa.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function N(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(ua)||[];if(fa.isFunction(c))for(;d=f[e++];)"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function O(a,b,c,d){function e(h){var i;return f[h]=!0,fa.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||g||f[j]?g?!(i=j):void 0:(b.dataTypes.unshift(j),e(j),!1)}),i}var f={},g=a===Sb;return e(b.dataTypes[0])||!f["*"]&&e("*")}function P(a,b){var c,d,e=fa.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&fa.extend(!0,a,c),a}function Q(a,b,c){for(var d,e,f,g,h=a.contents,i=a.dataTypes;"*"===i[0];)i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function R(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];for(f=k.shift();f;)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}function S(a,b,c,d){var e;if(fa.isArray(b))fa.each(b,function(b,e){c||Wb.test(a)?d(a,e):S(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==fa.type(b))d(a,b);else for(e in b)S(a+"["+e+"]",b[e],c,d)}function T(){try{return new a.XMLHttpRequest}catch(b){}}function U(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function V(a){return fa.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}var W=[],X=W.slice,Y=W.concat,Z=W.push,$=W.indexOf,_={},aa=_.toString,ba=_.hasOwnProperty,ca="".trim,da={},ea="1.11.0",fa=function(a,b){return new fa.fn.init(a,b)},ga=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,ha=/^-ms-/,ia=/-([\da-z])/gi,ja=function(a,b){return b.toUpperCase()};fa.fn=fa.prototype={jquery:ea,constructor:fa,selector:"",length:0,toArray:function(){return X.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:X.call(this)},pushStack:function(a){var b=fa.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return fa.each(this,a,b)},map:function(a){return this.pushStack(fa.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(X.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:Z,sort:W.sort,splice:W.splice},fa.extend=fa.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||fa.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(fa.isPlainObject(c)||(b=fa.isArray(c)))?(b?(b=!1,f=a&&fa.isArray(a)?a:[]):f=a&&fa.isPlainObject(a)?a:{},g[d]=fa.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},fa.extend({expando:"jQuery"+(ea+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===fa.type(a)},isArray:Array.isArray||function(a){return"array"===fa.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==fa.type(a)||a.nodeType||fa.isWindow(a))return!1;try{if(a.constructor&&!ba.call(a,"constructor")&&!ba.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(da.ownLast)for(b in a)return ba.call(a,b);for(b in a);return void 0===b||ba.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?_[aa.call(a)]||"object":typeof a},globalEval:function(b){b&&fa.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(ha,"ms-").replace(ia,ja)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,d){var e,f=0,g=a.length,h=c(a);if(d){if(h)for(;g>f&&(e=b.apply(a[f],d),e!==!1);f++);else for(f in a)if(e=b.apply(a[f],d),e===!1)break}else if(h)for(;g>f&&(e=b.call(a[f],f,a[f]),e!==!1);f++);else for(f in a)if(e=b.call(a[f],f,a[f]),e===!1)break;return a},trim:ca&&!ca.call("\ufeff ")?function(a){return null==a?"":ca.call(a)}:function(a){return null==a?"":(a+"").replace(ga,"")},makeArray:function(a,b){var d=b||[];return null!=a&&(c(Object(a))?fa.merge(d,"string"==typeof a?[a]:a):Z.call(d,a)),d},inArray:function(a,b,c){var d;if(b){if($)return $.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;)a[e++]=b[d++];if(c!==c)for(;void 0!==b[d];)a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,d){var e,f=0,g=a.length,h=c(a),i=[];if(h)for(;g>f;f++)e=b(a[f],f,d),null!=e&&i.push(e);else for(f in a)e=b(a[f],f,d),null!=e&&i.push(e);return Y.apply([],i)},guid:1,proxy:function(a,b){var c,d,e;return"string"==typeof b&&(e=a[b],b=a,a=e),fa.isFunction(a)?(c=X.call(arguments,2),d=function(){return a.apply(b||this,c.concat(X.call(arguments)))},d.guid=a.guid=a.guid||fa.guid++,d):void 0},now:function(){return+new Date},support:da}),fa.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){_["[object "+b+"]"]=b.toLowerCase()});var ka=function(a){function b(a,b,c,d){var e,f,g,h,i,j,l,o,p,q;if((b?b.ownerDocument||b:O)!==G&&F(b),b=b||G,c=c||[],!a||"string"!=typeof a)return c;if(1!==(h=b.nodeType)&&9!==h)return[];if(I&&!d){if(e=sa.exec(a))if(g=e[1]){if(9===h){if(f=b.getElementById(g),!f||!f.parentNode)return c;if(f.id===g)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(g))&&M(b,f)&&f.id===g)return c.push(f),c}else{if(e[2])return _.apply(c,b.getElementsByTagName(a)),c;if((g=e[3])&&x.getElementsByClassName&&b.getElementsByClassName)return _.apply(c,b.getElementsByClassName(g)),c}if(x.qsa&&(!J||!J.test(a))){if(o=l=N,p=b,q=9===h&&a,1===h&&"object"!==b.nodeName.toLowerCase()){for(j=m(a),(l=b.getAttribute("id"))?o=l.replace(ua,"\\$&"):b.setAttribute("id",o),o="[id='"+o+"'] ",i=j.length;i--;)j[i]=o+n(j[i]);p=ta.test(a)&&k(b.parentNode)||b,q=j.join(",")}if(q)try{return _.apply(c,p.querySelectorAll(q)),c}catch(r){}finally{l||b.removeAttribute("id")}}}return v(a.replace(ia,"$1"),b,c,d)}function c(){function a(c,d){return b.push(c+" ")>y.cacheLength&&delete a[b.shift()],a[c+" "]=d}var b=[];return a}function d(a){return a[N]=!0,a}function e(a){var b=G.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function f(a,b){for(var c=a.split("|"),d=a.length;d--;)y.attrHandle[c[d]]=b}function g(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||W)-(~a.sourceIndex||W);if(d)return d;if(c)for(;c=c.nextSibling;)if(c===b)return-1;return a?1:-1}function h(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function i(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function j(a){return d(function(b){return b=+b,d(function(c,d){for(var e,f=a([],c.length,b),g=f.length;g--;)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function k(a){return a&&typeof a.getElementsByTagName!==V&&a}function l(){}function m(a,c){var d,e,f,g,h,i,j,k=S[a+" "];if(k)return c?0:k.slice(0);for(h=a,i=[],j=y.preFilter;h;){(!d||(e=ja.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),d=!1,(e=ka.exec(h))&&(d=e.shift(),f.push({value:d,type:e[0].replace(ia," ")}),h=h.slice(d.length));for(g in y.filter)!(e=oa[g].exec(h))||j[g]&&!(e=j[g](e))||(d=e.shift(),f.push({value:d,type:g,matches:e}),h=h.slice(d.length));if(!d)break}return c?h.length:h?b.error(a):S(a,i).slice(0)}function n(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function o(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=Q++;return b.first?function(b,c,f){for(;b=b[d];)if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[P,f];if(g){for(;b=b[d];)if((1===b.nodeType||e)&&a(b,c,g))return!0}else for(;b=b[d];)if(1===b.nodeType||e){if(i=b[N]||(b[N]={}),(h=i[d])&&h[0]===P&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function p(a){return a.length>1?function(b,c,d){for(var e=a.length;e--;)if(!a[e](b,c,d))return!1;return!0}:a[0]}function q(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function r(a,b,c,e,f,g){return e&&!e[N]&&(e=r(e)),f&&!f[N]&&(f=r(f,g)),d(function(d,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=d||u(b||"*",h.nodeType?[h]:h,[]),r=!a||!d&&b?p:q(p,m,a,h,i),s=c?f||(d?a:o||e)?[]:g:r;if(c&&c(r,s,h,i),e)for(j=q(s,n),e(j,[],h,i),k=j.length;k--;)(l=j[k])&&(s[n[k]]=!(r[n[k]]=l));if(d){if(f||a){if(f){for(j=[],k=s.length;k--;)(l=s[k])&&j.push(r[k]=l);f(null,s=[],j,i)}for(k=s.length;k--;)(l=s[k])&&(j=f?ba.call(d,l):m[k])>-1&&(d[j]=!(g[j]=l))}}else s=q(s===g?s.splice(o,s.length):s),f?f(null,g,s,i):_.apply(g,s)})}function s(a){for(var b,c,d,e=a.length,f=y.relative[a[0].type],g=f||y.relative[" "],h=f?1:0,i=o(function(a){return a===b},g,!0),j=o(function(a){return ba.call(b,a)>-1},g,!0),k=[function(a,c,d){return!f&&(d||c!==C)||((b=c).nodeType?i(a,c,d):j(a,c,d))}];e>h;h++)if(c=y.relative[a[h].type])k=[o(p(k),c)];else{if(c=y.filter[a[h].type].apply(null,a[h].matches),c[N]){for(d=++h;e>d&&!y.relative[a[d].type];d++);return r(h>1&&p(k),h>1&&n(a.slice(0,h-1).concat({value:" "===a[h-2].type?"*":""})).replace(ia,"$1"),c,d>h&&s(a.slice(h,d)),e>d&&s(a=a.slice(d)),e>d&&n(a))}k.push(c)}return p(k)}function t(a,c){var e=c.length>0,f=a.length>0,g=function(d,g,h,i,j){var k,l,m,n=0,o="0",p=d&&[],r=[],s=C,t=d||f&&y.find.TAG("*",j),u=P+=null==s?1:Math.random()||.1,v=t.length;for(j&&(C=g!==G&&g);o!==v&&null!=(k=t[o]);o++){if(f&&k){for(l=0;m=a[l++];)if(m(k,g,h)){i.push(k);break}j&&(P=u)}e&&((k=!m&&k)&&n--,d&&p.push(k))}if(n+=o,e&&o!==n){for(l=0;m=c[l++];)m(p,r,g,h);if(d){if(n>0)for(;o--;)p[o]||r[o]||(r[o]=Z.call(i));r=q(r)}_.apply(i,r),j&&!d&&r.length>0&&n+c.length>1&&b.uniqueSort(i)}return j&&(P=u,C=s),p};return e?d(g):g}function u(a,c,d){for(var e=0,f=c.length;f>e;e++)b(a,c[e],d);return d}function v(a,b,c,d){var e,f,g,h,i,j=m(a);if(!d&&1===j.length){if(f=j[0]=j[0].slice(0),f.length>2&&"ID"===(g=f[0]).type&&x.getById&&9===b.nodeType&&I&&y.relative[f[1].type]){if(b=(y.find.ID(g.matches[0].replace(va,wa),b)||[])[0],!b)return c;a=a.slice(f.shift().value.length)}for(e=oa.needsContext.test(a)?0:f.length;e--&&(g=f[e],!y.relative[h=g.type]);)if((i=y.find[h])&&(d=i(g.matches[0].replace(va,wa),ta.test(f[0].type)&&k(b.parentNode)||b))){if(f.splice(e,1),a=d.length&&n(f),!a)return _.apply(c,d),c;break}}return B(a,j)(d,b,!I,c,ta.test(a)&&k(b.parentNode)||b),c}var w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N="sizzle"+-new Date,O=a.document,P=0,Q=0,R=c(),S=c(),T=c(),U=function(a,b){return a===b&&(E=!0),0},V="undefined",W=1<<31,X={}.hasOwnProperty,Y=[],Z=Y.pop,$=Y.push,_=Y.push,aa=Y.slice,ba=Y.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},ca="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",da="[\\x20\\t\\r\\n\\f]",ea="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",fa=ea.replace("w","w#"),ga="\\["+da+"*("+ea+")"+da+"*(?:([*^$|!~]?=)"+da+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+fa+")|)|)"+da+"*\\]",ha=":("+ea+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+ga.replace(3,8)+")*)|.*)\\)|)",ia=new RegExp("^"+da+"+|((?:^|[^\\\\])(?:\\\\.)*)"+da+"+$","g"),ja=new RegExp("^"+da+"*,"+da+"*"),ka=new RegExp("^"+da+"*([>+~]|"+da+")"+da+"*"),la=new RegExp("="+da+"*([^\\]'\"]*?)"+da+"*\\]","g"),ma=new RegExp(ha),na=new RegExp("^"+fa+"$"),oa={ID:new RegExp("^#("+ea+")"),CLASS:new RegExp("^\\.("+ea+")"),TAG:new RegExp("^("+ea.replace("w","w*")+")"),ATTR:new RegExp("^"+ga),PSEUDO:new RegExp("^"+ha),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+da+"*(even|odd|(([+-]|)(\\d*)n|)"+da+"*(?:([+-]|)"+da+"*(\\d+)|))"+da+"*\\)|)","i"),bool:new RegExp("^(?:"+ca+")$","i"),needsContext:new RegExp("^"+da+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+da+"*((?:-\\d)?\\d*)"+da+"*\\)|)(?=[^-]|$)","i")},pa=/^(?:input|select|textarea|button)$/i,qa=/^h\d$/i,ra=/^[^{]+\{\s*\[native \w/,sa=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ta=/[+~]/,ua=/'|\\/g,va=new RegExp("\\\\([\\da-f]{1,6}"+da+"?|("+da+")|.)","ig"),wa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{_.apply(Y=aa.call(O.childNodes),O.childNodes),Y[O.childNodes.length].nodeType}catch(xa){_={apply:Y.length?function(a,b){$.apply(a,aa.call(b))}:function(a,b){for(var c=a.length,d=0;a[c++]=b[d++];);a.length=c-1}}}x=b.support={},A=b.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},F=b.setDocument=function(a){var b,c=a?a.ownerDocument||a:O,d=c.defaultView;return c!==G&&9===c.nodeType&&c.documentElement?(G=c,H=c.documentElement,I=!A(c),d&&d!==d.top&&(d.addEventListener?d.addEventListener("unload",function(){F()},!1):d.attachEvent&&d.attachEvent("onunload",function(){F()})),x.attributes=e(function(a){return a.className="i",!a.getAttribute("className")}),x.getElementsByTagName=e(function(a){return a.appendChild(c.createComment("")),!a.getElementsByTagName("*").length}),x.getElementsByClassName=ra.test(c.getElementsByClassName)&&e(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),x.getById=e(function(a){return H.appendChild(a).id=N,!c.getElementsByName||!c.getElementsByName(N).length}),x.getById?(y.find.ID=function(a,b){if(typeof b.getElementById!==V&&I){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},y.filter.ID=function(a){var b=a.replace(va,wa);return function(a){return a.getAttribute("id")===b}}):(delete y.find.ID,y.filter.ID=function(a){var b=a.replace(va,wa);return function(a){var c=typeof a.getAttributeNode!==V&&a.getAttributeNode("id");return c&&c.value===b}}),y.find.TAG=x.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==V?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){for(;c=f[e++];)1===c.nodeType&&d.push(c);return d}return f},y.find.CLASS=x.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==V&&I?b.getElementsByClassName(a):void 0},K=[],J=[],(x.qsa=ra.test(c.querySelectorAll))&&(e(function(a){a.innerHTML="<select t=''><option selected=''></option></select>",a.querySelectorAll("[t^='']").length&&J.push("[*^$]="+da+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||J.push("\\["+da+"*(?:value|"+ca+")"),a.querySelectorAll(":checked").length||J.push(":checked")}),e(function(a){var b=c.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&J.push("name"+da+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||J.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),J.push(",.*:")})),(x.matchesSelector=ra.test(L=H.webkitMatchesSelector||H.mozMatchesSelector||H.oMatchesSelector||H.msMatchesSelector))&&e(function(a){x.disconnectedMatch=L.call(a,"div"),L.call(a,"[s!='']:x"),K.push("!=",ha)}),J=J.length&&new RegExp(J.join("|")),K=K.length&&new RegExp(K.join("|")),b=ra.test(H.compareDocumentPosition),M=b||ra.test(H.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)for(;b=b.parentNode;)if(b===a)return!0;return!1},U=b?function(a,b){if(a===b)return E=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!x.sortDetached&&b.compareDocumentPosition(a)===d?a===c||a.ownerDocument===O&&M(O,a)?-1:b===c||b.ownerDocument===O&&M(O,b)?1:D?ba.call(D,a)-ba.call(D,b):0:4&d?-1:1)}:function(a,b){if(a===b)return E=!0,0;var d,e=0,f=a.parentNode,h=b.parentNode,i=[a],j=[b];if(!f||!h)return a===c?-1:b===c?1:f?-1:h?1:D?ba.call(D,a)-ba.call(D,b):0;if(f===h)return g(a,b);for(d=a;d=d.parentNode;)i.unshift(d);for(d=b;d=d.parentNode;)j.unshift(d);for(;i[e]===j[e];)e++;return e?g(i[e],j[e]):i[e]===O?-1:j[e]===O?1:0},c):G},b.matches=function(a,c){return b(a,null,null,c)},b.matchesSelector=function(a,c){if((a.ownerDocument||a)!==G&&F(a),c=c.replace(la,"='$1']"),!(!x.matchesSelector||!I||K&&K.test(c)||J&&J.test(c)))try{var d=L.call(a,c);if(d||x.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return b(c,G,null,[a]).length>0},b.contains=function(a,b){return(a.ownerDocument||a)!==G&&F(a),M(a,b)},b.attr=function(a,b){(a.ownerDocument||a)!==G&&F(a);var c=y.attrHandle[b.toLowerCase()],d=c&&X.call(y.attrHandle,b.toLowerCase())?c(a,b,!I):void 0;return void 0!==d?d:x.attributes||!I?a.getAttribute(b):(d=a.getAttributeNode(b))&&d.specified?d.value:null},b.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},b.uniqueSort=function(a){var b,c=[],d=0,e=0;if(E=!x.detectDuplicates,D=!x.sortStable&&a.slice(0),a.sort(U),E){for(;b=a[e++];)b===a[e]&&(d=c.push(e));for(;d--;)a.splice(c[d],1)}return D=null,a},z=b.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(1===e||9===e||11===e){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=z(a)}else if(3===e||4===e)return a.nodeValue}else for(;b=a[d++];)c+=z(b);return c},y=b.selectors={cacheLength:50,createPseudo:d,match:oa,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(va,wa),a[3]=(a[4]||a[5]||"").replace(va,wa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||b.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&b.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return oa.CHILD.test(a[0])?null:(a[3]&&void 0!==a[4]?a[2]=a[4]:c&&ma.test(c)&&(b=m(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(va,wa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=R[a+" "];return b||(b=new RegExp("(^|"+da+")"+a+"("+da+"|$)"))&&R(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==V&&a.getAttribute("class")||"")})},ATTR:function(a,c,d){return function(e){var f=b.attr(e,a);return null==f?"!="===c:c?(f+="","="===c?f===d:"!="===c?f!==d:"^="===c?d&&0===f.indexOf(d):"*="===c?d&&f.indexOf(d)>-1:"$="===c?d&&f.slice(-d.length)===d:"~="===c?(" "+f+" ").indexOf(d)>-1:"|="===c?f===d||f.slice(0,d.length+1)===d+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){for(;p;){for(l=b;l=l[p];)if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){for(k=q[N]||(q[N]={}),j=k[a]||[],n=j[0]===P&&j[1],m=j[0]===P&&j[2],l=n&&q.childNodes[n];l=++n&&l&&l[p]||(m=n=0)||o.pop();)if(1===l.nodeType&&++m&&l===b){k[a]=[P,n,m];break}}else if(s&&(j=(b[N]||(b[N]={}))[a])&&j[0]===P)m=j[1];else for(;(l=++n&&l&&l[p]||(m=n=0)||o.pop())&&((h?l.nodeName.toLowerCase()!==r:1!==l.nodeType)||!++m||(s&&((l[N]||(l[N]={}))[a]=[P,m]),l!==b)););return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,c){var e,f=y.pseudos[a]||y.setFilters[a.toLowerCase()]||b.error("unsupported pseudo: "+a);return f[N]?f(c):f.length>1?(e=[a,a,"",c],y.setFilters.hasOwnProperty(a.toLowerCase())?d(function(a,b){for(var d,e=f(a,c),g=e.length;g--;)d=ba.call(a,e[g]),a[d]=!(b[d]=e[g])}):function(a){return f(a,0,e)}):f}},pseudos:{not:d(function(a){var b=[],c=[],e=B(a.replace(ia,"$1"));return e[N]?d(function(a,b,c,d){for(var f,g=e(a,null,d,[]),h=a.length;h--;)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,d,f){return b[0]=a,e(b,null,f,c),!c.pop()}}),has:d(function(a){return function(c){return b(a,c).length>0}}),contains:d(function(a){return function(b){return(b.textContent||b.innerText||z(b)).indexOf(a)>-1}}),lang:d(function(a){return na.test(a||"")||b.error("unsupported lang: "+a),a=a.replace(va,wa).toLowerCase(),function(b){var c;do if(c=I?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===H},focus:function(a){return a===G.activeElement&&(!G.hasFocus||G.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!y.pseudos.empty(a)},header:function(a){return qa.test(a.nodeName)},input:function(a){return pa.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:j(function(){return[0]}),last:j(function(a,b){return[b-1]}),eq:j(function(a,b,c){return[0>c?c+b:c]}),even:j(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:j(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:j(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:j(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},y.pseudos.nth=y.pseudos.eq;for(w in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})y.pseudos[w]=h(w);for(w in{submit:!0,reset:!0})y.pseudos[w]=i(w);return l.prototype=y.filters=y.pseudos,y.setFilters=new l,B=b.compile=function(a,b){var c,d=[],e=[],f=T[a+" "];if(!f){for(b||(b=m(a)),c=b.length;c--;)f=s(b[c]),f[N]?d.push(f):e.push(f);f=T(a,t(e,d))}return f},x.sortStable=N.split("").sort(U).join("")===N,x.detectDuplicates=!!E,F(),x.sortDetached=e(function(a){return 1&a.compareDocumentPosition(G.createElement("div"))}),e(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||f("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),x.attributes&&e(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||f("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),e(function(a){return null==a.getAttribute("disabled")})||f(ca,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),b}(a);fa.find=ka,fa.expr=ka.selectors,fa.expr[":"]=fa.expr.pseudos,fa.unique=ka.uniqueSort,fa.text=ka.getText,fa.isXMLDoc=ka.isXML,fa.contains=ka.contains;var la=fa.expr.match.needsContext,ma=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,na=/^.[^:#\[\.,]*$/;fa.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?fa.find.matchesSelector(d,a)?[d]:[]:fa.find.matches(a,fa.grep(b,function(a){return 1===a.nodeType}))},fa.fn.extend({
+find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(fa(a).filter(function(){for(b=0;e>b;b++)if(fa.contains(d[b],this))return!0}));for(b=0;e>b;b++)fa.find(a,d[b],c);return c=this.pushStack(e>1?fa.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(d(this,a||[],!1))},not:function(a){return this.pushStack(d(this,a||[],!0))},is:function(a){return!!d(this,"string"==typeof a&&la.test(a)?fa(a):a||[],!1).length}});var oa,pa=a.document,qa=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ra=fa.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:qa.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||oa).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof fa?b[0]:b,fa.merge(this,fa.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:pa,!0)),ma.test(c[1])&&fa.isPlainObject(b))for(c in b)fa.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=pa.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return oa.find(a);this.length=1,this[0]=d}return this.context=pa,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):fa.isFunction(a)?"undefined"!=typeof oa.ready?oa.ready(a):a(fa):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),fa.makeArray(a,this))};ra.prototype=fa.fn,oa=fa(pa);var sa=/^(?:parents|prev(?:Until|All))/,ta={children:!0,contents:!0,next:!0,prev:!0};fa.extend({dir:function(a,b,c){for(var d=[],e=a[b];e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!fa(e).is(c));)1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),fa.fn.extend({has:function(a){var b,c=fa(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(fa.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=la.test(a)||"string"!=typeof a?fa(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&fa.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?fa.unique(f):f)},index:function(a){return a?"string"==typeof a?fa.inArray(this[0],fa(a)):fa.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(fa.unique(fa.merge(this.get(),fa(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}}),fa.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return fa.dir(a,"parentNode")},parentsUntil:function(a,b,c){return fa.dir(a,"parentNode",c)},next:function(a){return e(a,"nextSibling")},prev:function(a){return e(a,"previousSibling")},nextAll:function(a){return fa.dir(a,"nextSibling")},prevAll:function(a){return fa.dir(a,"previousSibling")},nextUntil:function(a,b,c){return fa.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return fa.dir(a,"previousSibling",c)},siblings:function(a){return fa.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return fa.sibling(a.firstChild)},contents:function(a){return fa.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:fa.merge([],a.childNodes)}},function(a,b){fa.fn[a]=function(c,d){var e=fa.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=fa.filter(d,e)),this.length>1&&(ta[a]||(e=fa.unique(e)),sa.test(a)&&(e=e.reverse())),this.pushStack(e)}});var ua=/\S+/g,va={};fa.Callbacks=function(a){a="string"==typeof a?va[a]||f(a):fa.extend({},a);var b,c,d,e,g,h,i=[],j=!a.once&&[],k=function(f){for(c=a.memory&&f,d=!0,g=h||0,h=0,e=i.length,b=!0;i&&e>g;g++)if(i[g].apply(f[0],f[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,i&&(j?j.length&&k(j.shift()):c?i=[]:l.disable())},l={add:function(){if(i){var d=i.length;!function f(b){fa.each(b,function(b,c){var d=fa.type(c);"function"===d?a.unique&&l.has(c)||i.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=i.length:c&&(h=d,k(c))}return this},remove:function(){return i&&fa.each(arguments,function(a,c){for(var d;(d=fa.inArray(c,i,d))>-1;)i.splice(d,1),b&&(e>=d&&e--,g>=d&&g--)}),this},has:function(a){return a?fa.inArray(a,i)>-1:!(!i||!i.length)},empty:function(){return i=[],e=0,this},disable:function(){return i=j=c=void 0,this},disabled:function(){return!i},lock:function(){return j=void 0,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,c){return!i||d&&!j||(c=c||[],c=[a,c.slice?c.slice():c],b?j.push(c):k(c)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},fa.extend({Deferred:function(a){var b=[["resolve","done",fa.Callbacks("once memory"),"resolved"],["reject","fail",fa.Callbacks("once memory"),"rejected"],["notify","progress",fa.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return fa.Deferred(function(c){fa.each(b,function(b,f){var g=fa.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&fa.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?fa.extend(a,d):d}},e={};return d.pipe=d.then,fa.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b,c,d,e=0,f=X.call(arguments),g=f.length,h=1!==g||a&&fa.isFunction(a.promise)?g:0,i=1===h?a:fa.Deferred(),j=function(a,c,d){return function(e){c[a]=this,d[a]=arguments.length>1?X.call(arguments):e,d===b?i.notifyWith(c,d):--h||i.resolveWith(c,d)}};if(g>1)for(b=new Array(g),c=new Array(g),d=new Array(g);g>e;e++)f[e]&&fa.isFunction(f[e].promise)?f[e].promise().done(j(e,d,f)).fail(i.reject).progress(j(e,c,b)):--h;return h||i.resolveWith(d,f),i.promise()}});var wa;fa.fn.ready=function(a){return fa.ready.promise().done(a),this},fa.extend({isReady:!1,readyWait:1,holdReady:function(a){a?fa.readyWait++:fa.ready(!0)},ready:function(a){if(a===!0?!--fa.readyWait:!fa.isReady){if(!pa.body)return setTimeout(fa.ready);fa.isReady=!0,a!==!0&&--fa.readyWait>0||(wa.resolveWith(pa,[fa]),fa.fn.trigger&&fa(pa).trigger("ready").off("ready"))}}}),fa.ready.promise=function(b){if(!wa)if(wa=fa.Deferred(),"complete"===pa.readyState)setTimeout(fa.ready);else if(pa.addEventListener)pa.addEventListener("DOMContentLoaded",h,!1),a.addEventListener("load",h,!1);else{pa.attachEvent("onreadystatechange",h),a.attachEvent("onload",h);var c=!1;try{c=null==a.frameElement&&pa.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!fa.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}g(),fa.ready()}}()}return wa.promise(b)};var xa,ya="undefined";for(xa in fa(da))break;da.ownLast="0"!==xa,da.inlineBlockNeedsLayout=!1,fa(function(){var a,b,c=pa.getElementsByTagName("body")[0];c&&(a=pa.createElement("div"),a.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",b=pa.createElement("div"),c.appendChild(a).appendChild(b),typeof b.style.zoom!==ya&&(b.style.cssText="border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1",(da.inlineBlockNeedsLayout=3===b.offsetWidth)&&(c.style.zoom=1)),c.removeChild(a),a=b=null)}),function(){var a=pa.createElement("div");if(null==da.deleteExpando){da.deleteExpando=!0;try{delete a.test}catch(b){da.deleteExpando=!1}}a=null}(),fa.acceptData=function(a){var b=fa.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var za=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Aa=/([A-Z])/g;fa.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?fa.cache[a[fa.expando]]:a[fa.expando],!!a&&!j(a)},data:function(a,b,c){return k(a,b,c)},removeData:function(a,b){return l(a,b)},_data:function(a,b,c){return k(a,b,c,!0)},_removeData:function(a,b){return l(a,b,!0)}}),fa.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=fa.data(f),1===f.nodeType&&!fa._data(f,"parsedAttrs"))){for(c=g.length;c--;)d=g[c].name,0===d.indexOf("data-")&&(d=fa.camelCase(d.slice(5)),i(f,d,e[d]));fa._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){fa.data(this,a)}):arguments.length>1?this.each(function(){fa.data(this,a,b)}):f?i(f,a,fa.data(f,a)):void 0},removeData:function(a){return this.each(function(){fa.removeData(this,a)})}}),fa.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=fa._data(a,b),c&&(!d||fa.isArray(c)?d=fa._data(a,b,fa.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=fa.queue(a,b),d=c.length,e=c.shift(),f=fa._queueHooks(a,b),g=function(){fa.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return fa._data(a,c)||fa._data(a,c,{empty:fa.Callbacks("once memory").add(function(){fa._removeData(a,b+"queue"),fa._removeData(a,c)})})}}),fa.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?fa.queue(this[0],a):void 0===b?this:this.each(function(){var c=fa.queue(this,a,b);fa._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&fa.dequeue(this,a)})},dequeue:function(a){return this.each(function(){fa.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=fa.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};for("string"!=typeof a&&(b=a,a=void 0),a=a||"fx";g--;)c=fa._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var Ba=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Ca=["Top","Right","Bottom","Left"],Da=function(a,b){return a=b||a,"none"===fa.css(a,"display")||!fa.contains(a.ownerDocument,a)},Ea=fa.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===fa.type(c)){e=!0;for(h in c)fa.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,fa.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(fa(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},Fa=/^(?:checkbox|radio)$/i;!function(){var a=pa.createDocumentFragment(),b=pa.createElement("div"),c=pa.createElement("input");if(b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a>",da.leadingWhitespace=3===b.firstChild.nodeType,da.tbody=!b.getElementsByTagName("tbody").length,da.htmlSerialize=!!b.getElementsByTagName("link").length,da.html5Clone="<:nav></:nav>"!==pa.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,a.appendChild(c),da.appendChecked=c.checked,b.innerHTML="<textarea>x</textarea>",da.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,a.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",da.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,da.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){da.noCloneEvent=!1}),b.cloneNode(!0).click()),null==da.deleteExpando){da.deleteExpando=!0;try{delete b.test}catch(d){da.deleteExpando=!1}}a=b=c=null}(),function(){var b,c,d=pa.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(da[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),da[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var Ga=/^(?:input|select|textarea)$/i,Ha=/^key/,Ia=/^(?:mouse|contextmenu)|click/,Ja=/^(?:focusinfocus|focusoutblur)$/,Ka=/^([^.]*)(?:\.(.+)|)$/;fa.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=fa._data(a);if(q){for(c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=fa.guid++),(g=q.events)||(g=q.events={}),(k=q.handle)||(k=q.handle=function(a){return typeof fa===ya||a&&fa.event.triggered===a.type?void 0:fa.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(ua)||[""],h=b.length;h--;)f=Ka.exec(b[h])||[],n=p=f[1],o=(f[2]||"").split(".").sort(),n&&(j=fa.event.special[n]||{},n=(e?j.delegateType:j.bindType)||n,j=fa.event.special[n]||{},l=fa.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&fa.expr.match.needsContext.test(e),namespace:o.join(".")},i),(m=g[n])||(m=g[n]=[],m.delegateCount=0,j.setup&&j.setup.call(a,d,o,k)!==!1||(a.addEventListener?a.addEventListener(n,k,!1):a.attachEvent&&a.attachEvent("on"+n,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,l):m.push(l),fa.event.global[n]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=fa.hasData(a)&&fa._data(a);if(q&&(k=q.events)){for(b=(b||"").match(ua)||[""],j=b.length;j--;)if(h=Ka.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){for(l=fa.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=k[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;f--;)g=m[f],!e&&p!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||fa.removeEvent(a,n,q.handle),delete k[n])}else for(n in k)fa.event.remove(a,n+b[j],c,d,!0);fa.isEmptyObject(k)&&(delete q.handle,fa._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,j,k,l,m=[d||pa],n=ba.call(b,"type")?b.type:b,o=ba.call(b,"namespace")?b.namespace.split("."):[];if(h=k=d=d||pa,3!==d.nodeType&&8!==d.nodeType&&!Ja.test(n+fa.event.triggered)&&(n.indexOf(".")>=0&&(o=n.split("."),n=o.shift(),o.sort()),g=n.indexOf(":")<0&&"on"+n,b=b[fa.expando]?b:new fa.Event(n,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=o.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:fa.makeArray(c,[b]),j=fa.event.special[n]||{},e||!j.trigger||j.trigger.apply(d,c)!==!1)){if(!e&&!j.noBubble&&!fa.isWindow(d)){for(i=j.delegateType||n,Ja.test(i+n)||(h=h.parentNode);h;h=h.parentNode)m.push(h),k=h;k===(d.ownerDocument||pa)&&m.push(k.defaultView||k.parentWindow||a)}for(l=0;(h=m[l++])&&!b.isPropagationStopped();)b.type=l>1?i:j.bindType||n,f=(fa._data(h,"events")||{})[b.type]&&fa._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&fa.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=n,!e&&!b.isDefaultPrevented()&&(!j._default||j._default.apply(m.pop(),c)===!1)&&fa.acceptData(d)&&g&&d[n]&&!fa.isWindow(d)){k=d[g],k&&(d[g]=null),fa.event.triggered=n;try{d[n]()}catch(p){}fa.event.triggered=void 0,k&&(d[g]=k)}return b.result}},dispatch:function(a){a=fa.event.fix(a);var b,c,d,e,f,g=[],h=X.call(arguments),i=(fa._data(this,"events")||{})[a.type]||[],j=fa.event.special[a.type]||{};if(h[0]=a,a.delegateTarget=this,!j.preDispatch||j.preDispatch.call(this,a)!==!1){for(g=fa.event.handlers.call(this,a,i),b=0;(e=g[b++])&&!a.isPropagationStopped();)for(a.currentTarget=e.elem,f=0;(d=e.handlers[f++])&&!a.isImmediatePropagationStopped();)(!a.namespace_re||a.namespace_re.test(d.namespace))&&(a.handleObj=d,a.data=d.data,c=((fa.event.special[d.origType]||{}).handle||d.handler).apply(e.elem,h),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()));return j.postDispatch&&j.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?fa(c,this).index(i)>=0:fa.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[fa.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];for(g||(this.fixHooks[e]=g=Ia.test(e)?this.mouseHooks:Ha.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new fa.Event(f),b=d.length;b--;)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||pa),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||pa,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==o()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===o()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return fa.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return fa.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=fa.extend(new fa.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?fa.event.trigger(e,null,b):fa.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},fa.removeEvent=pa.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===ya&&(a[d]=null),a.detachEvent(d,c))},fa.Event=function(a,b){return this instanceof fa.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&(a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault())?m:n):this.type=a,b&&fa.extend(this,b),this.timeStamp=a&&a.timeStamp||fa.now(),void(this[fa.expando]=!0)):new fa.Event(a,b)},fa.Event.prototype={isDefaultPrevented:n,isPropagationStopped:n,isImmediatePropagationStopped:n,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=m,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=m,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=m,this.stopPropagation()}},fa.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){fa.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!fa.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),da.submitBubbles||(fa.event.special.submit={setup:function(){return fa.nodeName(this,"form")?!1:void fa.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=fa.nodeName(b,"input")||fa.nodeName(b,"button")?b.form:void 0;c&&!fa._data(c,"submitBubbles")&&(fa.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),fa._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&fa.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return fa.nodeName(this,"form")?!1:void fa.event.remove(this,"._submit")}}),da.changeBubbles||(fa.event.special.change={setup:function(){return Ga.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(fa.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),fa.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),fa.event.simulate("change",this,a,!0)})),!1):void fa.event.add(this,"beforeactivate._change",function(a){var b=a.target;Ga.test(b.nodeName)&&!fa._data(b,"changeBubbles")&&(fa.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||fa.event.simulate("change",this.parentNode,a,!0)}),fa._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return fa.event.remove(this,"._change"),!Ga.test(this.nodeName)}}),da.focusinBubbles||fa.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){fa.event.simulate(b,a.target,fa.event.fix(a),!0)};fa.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=fa._data(d,b);e||d.addEventListener(a,c,!0),fa._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=fa._data(d,b)-1;e?fa._data(d,b,e):(d.removeEventListener(a,c,!0),fa._removeData(d,b))}}}),fa.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=n;else if(!d)return this;return 1===e&&(g=d,d=function(a){return fa().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=fa.guid++)),this.each(function(){fa.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,fa(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=n),this.each(function(){fa.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){fa.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?fa.event.trigger(a,b,c,!0):void 0}});var La="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Ma=/ jQuery\d+="(?:null|\d+)"/g,Na=new RegExp("<(?:"+La+")[\\s/>]","i"),Oa=/^\s+/,Pa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Qa=/<([\w:]+)/,Ra=/<tbody/i,Sa=/<|&#?\w+;/,Ta=/<(?:script|style|link)/i,Ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Va=/^$|\/(?:java|ecma)script/i,Wa=/^true\/(.*)/,Xa=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Ya={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:da.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},Za=p(pa),$a=Za.appendChild(pa.createElement("div"));Ya.optgroup=Ya.option,Ya.tbody=Ya.tfoot=Ya.colgroup=Ya.caption=Ya.thead,Ya.th=Ya.td,fa.extend({clone:function(a,b,c){var d,e,f,g,h,i=fa.contains(a.ownerDocument,a);if(da.html5Clone||fa.isXMLDoc(a)||!Na.test("<"+a.nodeName+">")?f=a.cloneNode(!0):($a.innerHTML=a.outerHTML,$a.removeChild(f=$a.firstChild)),!(da.noCloneEvent&&da.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||fa.isXMLDoc(a)))for(d=q(f),h=q(a),g=0;null!=(e=h[g]);++g)d[g]&&x(e,d[g]);if(b)if(c)for(h=h||q(a),d=d||q(f),g=0;null!=(e=h[g]);g++)w(e,d[g]);else w(a,f);return d=q(f,"script"),d.length>0&&v(d,!i&&q(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k,l=a.length,m=p(b),n=[],o=0;l>o;o++)if(f=a[o],f||0===f)if("object"===fa.type(f))fa.merge(n,f.nodeType?[f]:f);else if(Sa.test(f)){for(h=h||m.appendChild(b.createElement("div")),i=(Qa.exec(f)||["",""])[1].toLowerCase(),k=Ya[i]||Ya._default,h.innerHTML=k[1]+f.replace(Pa,"<$1></$2>")+k[2],e=k[0];e--;)h=h.lastChild;if(!da.leadingWhitespace&&Oa.test(f)&&n.push(b.createTextNode(Oa.exec(f)[0])),!da.tbody)for(f="table"!==i||Ra.test(f)?"<table>"!==k[1]||Ra.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;e--;)fa.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j);for(fa.merge(n,h.childNodes),h.textContent="";h.firstChild;)h.removeChild(h.firstChild);h=m.lastChild}else n.push(b.createTextNode(f));for(h&&m.removeChild(h),da.appendChecked||fa.grep(q(n,"input"),r),o=0;f=n[o++];)if((!d||-1===fa.inArray(f,d))&&(g=fa.contains(f.ownerDocument,f),h=q(m.appendChild(f),"script"),g&&v(h),c))for(e=0;f=h[e++];)Va.test(f.type||"")&&c.push(f);return h=null,m},cleanData:function(a,b){for(var c,d,e,f,g=0,h=fa.expando,i=fa.cache,j=da.deleteExpando,k=fa.event.special;null!=(c=a[g]);g++)if((b||fa.acceptData(c))&&(e=c[h],f=e&&i[e])){if(f.events)for(d in f.events)k[d]?fa.event.remove(c,d):fa.removeEvent(c,d,f.handle);i[e]&&(delete i[e],j?delete c[h]:typeof c.removeAttribute!==ya?c.removeAttribute(h):c[h]=null,W.push(e))}}}),fa.fn.extend({text:function(a){return Ea(this,function(a){return void 0===a?fa.text(this):this.empty().append((this[0]&&this[0].ownerDocument||pa).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=s(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=s(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?fa.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||fa.cleanData(q(c)),c.parentNode&&(b&&fa.contains(c.ownerDocument,c)&&v(q(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){for(1===a.nodeType&&fa.cleanData(q(a,!1));a.firstChild;)a.removeChild(a.firstChild);a.options&&fa.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return fa.clone(this,a,b)})},html:function(a){return Ea(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(Ma,""):void 0;if(!("string"!=typeof a||Ta.test(a)||!da.htmlSerialize&&Na.test(a)||!da.leadingWhitespace&&Oa.test(a)||Ya[(Qa.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(Pa,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(fa.cleanData(q(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,fa.cleanData(q(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=Y.apply([],a);var c,d,e,f,g,h,i=0,j=this.length,k=this,l=j-1,m=a[0],n=fa.isFunction(m);if(n||j>1&&"string"==typeof m&&!da.checkClone&&Ua.test(m))return this.each(function(c){var d=k.eq(c);n&&(a[0]=m.call(this,c,d.html())),d.domManip(a,b)});if(j&&(h=fa.buildFragment(a,this[0].ownerDocument,!1,this),c=h.firstChild,1===h.childNodes.length&&(h=c),c)){for(f=fa.map(q(h,"script"),t),e=f.length;j>i;i++)d=h,i!==l&&(d=fa.clone(d,!0,!0),e&&fa.merge(f,q(d,"script"))),b.call(this[i],d,i);if(e)for(g=f[f.length-1].ownerDocument,fa.map(f,u),i=0;e>i;i++)d=f[i],Va.test(d.type||"")&&!fa._data(d,"globalEval")&&fa.contains(g,d)&&(d.src?fa._evalUrl&&fa._evalUrl(d.src):fa.globalEval((d.text||d.textContent||d.innerHTML||"").replace(Xa,"")));h=c=null}return this}}),fa.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){fa.fn[a]=function(a){for(var c,d=0,e=[],f=fa(a),g=f.length-1;g>=d;d++)c=d===g?this:this.clone(!0),fa(f[d])[b](c),Z.apply(e,c.get());return this.pushStack(e)}});var _a,ab={};!function(){var a,b,c=pa.createElement("div"),d="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;padding:0;margin:0;border:0";c.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=c.getElementsByTagName("a")[0],a.style.cssText="float:left;opacity:.5",da.opacity=/^0.5/.test(a.style.opacity),da.cssFloat=!!a.style.cssFloat,c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",da.clearCloneStyle="content-box"===c.style.backgroundClip,a=c=null,da.shrinkWrapBlocks=function(){var a,c,e,f;if(null==b){if(a=pa.getElementsByTagName("body")[0],!a)return;f="border:0;width:0;height:0;position:absolute;top:0;left:-9999px",c=pa.createElement("div"),e=pa.createElement("div"),a.appendChild(c).appendChild(e),b=!1,typeof e.style.zoom!==ya&&(e.style.cssText=d+";width:1px;padding:1px;zoom:1",e.innerHTML="<div></div>",e.firstChild.style.width="5px",b=3!==e.offsetWidth),a.removeChild(c),a=c=e=null}return b}}();var bb,cb,db=/^margin/,eb=new RegExp("^("+Ba+")(?!px)[a-z%]+$","i"),fb=/^(top|right|bottom|left)$/;a.getComputedStyle?(bb=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)},cb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||bb(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||fa.contains(a.ownerDocument,a)||(g=fa.style(a,b)),eb.test(g)&&db.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):pa.documentElement.currentStyle&&(bb=function(a){return a.currentStyle},cb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||bb(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),eb.test(g)&&!fb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"}),!function(){function b(){var b,c,d=pa.getElementsByTagName("body")[0];d&&(b=pa.createElement("div"),c=pa.createElement("div"),b.style.cssText=j,d.appendChild(b).appendChild(c),c.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;display:block;padding:1px;border:1px;width:4px;margin-top:1%;top:1%",fa.swap(d,null!=d.style.zoom?{zoom:1}:{},function(){e=4===c.offsetWidth}),f=!0,g=!1,h=!0,a.getComputedStyle&&(g="1%"!==(a.getComputedStyle(c,null)||{}).top,f="4px"===(a.getComputedStyle(c,null)||{width:"4px"}).width),d.removeChild(b),c=d=null)}var c,d,e,f,g,h,i=pa.createElement("div"),j="border:0;width:0;height:0;position:absolute;top:0;left:-9999px",k="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;padding:0;margin:0;border:0";i.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",c=i.getElementsByTagName("a")[0],c.style.cssText="float:left;opacity:.5",da.opacity=/^0.5/.test(c.style.opacity),da.cssFloat=!!c.style.cssFloat,i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",da.clearCloneStyle="content-box"===i.style.backgroundClip,c=i=null,fa.extend(da,{reliableHiddenOffsets:function(){if(null!=d)return d;var a,b,c,e=pa.createElement("div"),f=pa.getElementsByTagName("body")[0];return f?(e.setAttribute("className","t"),e.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",
+a=pa.createElement("div"),a.style.cssText=j,f.appendChild(a).appendChild(e),e.innerHTML="<table><tr><td></td><td>t</td></tr></table>",b=e.getElementsByTagName("td"),b[0].style.cssText="padding:0;margin:0;border:0;display:none",c=0===b[0].offsetHeight,b[0].style.display="",b[1].style.display="none",d=c&&0===b[0].offsetHeight,f.removeChild(a),e=f=null,d):void 0},boxSizing:function(){return null==e&&b(),e},boxSizingReliable:function(){return null==f&&b(),f},pixelPosition:function(){return null==g&&b(),g},reliableMarginRight:function(){var b,c,d,e;if(null==h&&a.getComputedStyle){if(b=pa.getElementsByTagName("body")[0],!b)return;c=pa.createElement("div"),d=pa.createElement("div"),c.style.cssText=j,b.appendChild(c).appendChild(d),e=d.appendChild(pa.createElement("div")),e.style.cssText=d.style.cssText=k,e.style.marginRight=e.style.width="0",d.style.width="1px",h=!parseFloat((a.getComputedStyle(e,null)||{}).marginRight),b.removeChild(c)}return h}})}(),fa.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var gb=/alpha\([^)]*\)/i,hb=/opacity\s*=\s*([^)]*)/,ib=/^(none|table(?!-c[ea]).+)/,jb=new RegExp("^("+Ba+")(.*)$","i"),kb=new RegExp("^([+-])=("+Ba+")","i"),lb={position:"absolute",visibility:"hidden",display:"block"},mb={letterSpacing:0,fontWeight:400},nb=["Webkit","O","Moz","ms"];fa.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=cb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":da.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=fa.camelCase(b),i=a.style;if(b=fa.cssProps[h]||(fa.cssProps[h]=B(i,h)),g=fa.cssHooks[b]||fa.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=kb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(fa.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||fa.cssNumber[h]||(c+="px"),da.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]="",i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=fa.camelCase(b);return b=fa.cssProps[h]||(fa.cssProps[h]=B(a.style,h)),g=fa.cssHooks[b]||fa.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=cb(a,b,d)),"normal"===f&&b in mb&&(f=mb[b]),""===c||c?(e=parseFloat(f),c===!0||fa.isNumeric(e)?e||0:f):f}}),fa.each(["height","width"],function(a,b){fa.cssHooks[b]={get:function(a,c,d){return c?0===a.offsetWidth&&ib.test(fa.css(a,"display"))?fa.swap(a,lb,function(){return F(a,b,d)}):F(a,b,d):void 0},set:function(a,c,d){var e=d&&bb(a);return D(a,c,d?E(a,b,d,da.boxSizing()&&"border-box"===fa.css(a,"boxSizing",!1,e),e):0)}}}),da.opacity||(fa.cssHooks.opacity={get:function(a,b){return hb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=fa.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===fa.trim(f.replace(gb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=gb.test(f)?f.replace(gb,e):f+" "+e)}}),fa.cssHooks.marginRight=A(da.reliableMarginRight,function(a,b){return b?fa.swap(a,{display:"inline-block"},cb,[a,"marginRight"]):void 0}),fa.each({margin:"",padding:"",border:"Width"},function(a,b){fa.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+Ca[d]+b]=f[d]||f[d-2]||f[0];return e}},db.test(a)||(fa.cssHooks[a+b].set=D)}),fa.fn.extend({css:function(a,b){return Ea(this,function(a,b,c){var d,e,f={},g=0;if(fa.isArray(b)){for(d=bb(a),e=b.length;e>g;g++)f[b[g]]=fa.css(a,b[g],!1,d);return f}return void 0!==c?fa.style(a,b,c):fa.css(a,b)},a,b,arguments.length>1)},show:function(){return C(this,!0)},hide:function(){return C(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){Da(this)?fa(this).show():fa(this).hide()})}}),fa.Tween=G,G.prototype={constructor:G,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(fa.cssNumber[c]?"":"px")},cur:function(){var a=G.propHooks[this.prop];return a&&a.get?a.get(this):G.propHooks._default.get(this)},run:function(a){var b,c=G.propHooks[this.prop];return this.pos=b=this.options.duration?fa.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):G.propHooks._default.set(this),this}},G.prototype.init.prototype=G.prototype,G.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=fa.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){fa.fx.step[a.prop]?fa.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[fa.cssProps[a.prop]]||fa.cssHooks[a.prop])?fa.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},G.propHooks.scrollTop=G.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},fa.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},fa.fx=G.prototype.init,fa.fx.step={};var ob,pb,qb=/^(?:toggle|show|hide)$/,rb=new RegExp("^(?:([+-])=|)("+Ba+")([a-z%]*)$","i"),sb=/queueHooks$/,tb=[K],ub={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=rb.exec(b),f=e&&e[3]||(fa.cssNumber[a]?"":"px"),g=(fa.cssNumber[a]||"px"!==f&&+d)&&rb.exec(fa.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,fa.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};fa.Animation=fa.extend(M,{tweener:function(a,b){fa.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],ub[c]=ub[c]||[],ub[c].unshift(b)},prefilter:function(a,b){b?tb.unshift(a):tb.push(a)}}),fa.speed=function(a,b,c){var d=a&&"object"==typeof a?fa.extend({},a):{complete:c||!c&&b||fa.isFunction(a)&&a,duration:a,easing:c&&b||b&&!fa.isFunction(b)&&b};return d.duration=fa.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in fa.fx.speeds?fa.fx.speeds[d.duration]:fa.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){fa.isFunction(d.old)&&d.old.call(this),d.queue&&fa.dequeue(this,d.queue)},d},fa.fn.extend({fadeTo:function(a,b,c,d){return this.filter(Da).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=fa.isEmptyObject(a),f=fa.speed(b,c,d),g=function(){var b=M(this,fa.extend({},a),f);(e||fa._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=fa.timers,g=fa._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&sb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&fa.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=fa._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=fa.timers,g=d?d.length:0;for(c.finish=!0,fa.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),fa.each(["toggle","show","hide"],function(a,b){var c=fa.fn[b];fa.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(I(b,!0),a,d,e)}}),fa.each({slideDown:I("show"),slideUp:I("hide"),slideToggle:I("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){fa.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),fa.timers=[],fa.fx.tick=function(){var a,b=fa.timers,c=0;for(ob=fa.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||fa.fx.stop(),ob=void 0},fa.fx.timer=function(a){fa.timers.push(a),a()?fa.fx.start():fa.timers.pop()},fa.fx.interval=13,fa.fx.start=function(){pb||(pb=setInterval(fa.fx.tick,fa.fx.interval))},fa.fx.stop=function(){clearInterval(pb),pb=null},fa.fx.speeds={slow:600,fast:200,_default:400},fa.fn.delay=function(a,b){return a=fa.fx?fa.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e=pa.createElement("div");e.setAttribute("className","t"),e.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=e.getElementsByTagName("a")[0],c=pa.createElement("select"),d=c.appendChild(pa.createElement("option")),b=e.getElementsByTagName("input")[0],a.style.cssText="top:1px",da.getSetAttribute="t"!==e.className,da.style=/top/.test(a.getAttribute("style")),da.hrefNormalized="/a"===a.getAttribute("href"),da.checkOn=!!b.value,da.optSelected=d.selected,da.enctype=!!pa.createElement("form").enctype,c.disabled=!0,da.optDisabled=!d.disabled,b=pa.createElement("input"),b.setAttribute("value",""),da.input=""===b.getAttribute("value"),b.value="t",b.setAttribute("type","radio"),da.radioValue="t"===b.value,a=b=c=d=e=null}();var vb=/\r/g;fa.fn.extend({val:function(a){var b,c,d,e=this[0];return arguments.length?(d=fa.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,fa(this).val()):a,null==e?e="":"number"==typeof e?e+="":fa.isArray(e)&&(e=fa.map(e,function(a){return null==a?"":a+""})),b=fa.valHooks[this.type]||fa.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))})):e?(b=fa.valHooks[e.type]||fa.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(vb,""):null==c?"":c)):void 0}}),fa.extend({valHooks:{option:{get:function(a){var b=fa.find.attr(a,"value");return null!=b?b:fa.text(a)}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(da.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&fa.nodeName(c.parentNode,"optgroup"))){if(b=fa(c).val(),f)return b;g.push(b)}return g},set:function(a,b){for(var c,d,e=a.options,f=fa.makeArray(b),g=e.length;g--;)if(d=e[g],fa.inArray(fa.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),fa.each(["radio","checkbox"],function(){fa.valHooks[this]={set:function(a,b){return fa.isArray(b)?a.checked=fa.inArray(fa(a).val(),b)>=0:void 0}},da.checkOn||(fa.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var wb,xb,yb=fa.expr.attrHandle,zb=/^(?:checked|selected)$/i,Ab=da.getSetAttribute,Bb=da.input;fa.fn.extend({attr:function(a,b){return Ea(this,fa.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){fa.removeAttr(this,a)})}}),fa.extend({attr:function(a,b,c){var d,e,f=a.nodeType;return a&&3!==f&&8!==f&&2!==f?typeof a.getAttribute===ya?fa.prop(a,b,c):(1===f&&fa.isXMLDoc(a)||(b=b.toLowerCase(),d=fa.attrHooks[b]||(fa.expr.match.bool.test(b)?xb:wb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=fa.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void fa.removeAttr(a,b)):void 0},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(ua);if(f&&1===a.nodeType)for(;c=f[e++];)d=fa.propFix[c]||c,fa.expr.match.bool.test(c)?Bb&&Ab||!zb.test(c)?a[d]=!1:a[fa.camelCase("default-"+c)]=a[d]=!1:fa.attr(a,c,""),a.removeAttribute(Ab?c:d)},attrHooks:{type:{set:function(a,b){if(!da.radioValue&&"radio"===b&&fa.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),xb={set:function(a,b,c){return b===!1?fa.removeAttr(a,c):Bb&&Ab||!zb.test(c)?a.setAttribute(!Ab&&fa.propFix[c]||c,c):a[fa.camelCase("default-"+c)]=a[c]=!0,c}},fa.each(fa.expr.match.bool.source.match(/\w+/g),function(a,b){var c=yb[b]||fa.find.attr;yb[b]=Bb&&Ab||!zb.test(b)?function(a,b,d){var e,f;return d||(f=yb[b],yb[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,yb[b]=f),e}:function(a,b,c){return c?void 0:a[fa.camelCase("default-"+b)]?b.toLowerCase():null}}),Bb&&Ab||(fa.attrHooks.value={set:function(a,b,c){return fa.nodeName(a,"input")?void(a.defaultValue=b):wb&&wb.set(a,b,c)}}),Ab||(wb={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},yb.id=yb.name=yb.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},fa.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:wb.set},fa.attrHooks.contenteditable={set:function(a,b,c){wb.set(a,""===b?!1:b,c)}},fa.each(["width","height"],function(a,b){fa.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),da.style||(fa.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var Cb=/^(?:input|select|textarea|button|object)$/i,Db=/^(?:a|area)$/i;fa.fn.extend({prop:function(a,b){return Ea(this,fa.prop,a,b,arguments.length>1)},removeProp:function(a){return a=fa.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),fa.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;return a&&3!==g&&8!==g&&2!==g?(f=1!==g||!fa.isXMLDoc(a),f&&(b=fa.propFix[b]||b,e=fa.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]):void 0},propHooks:{tabIndex:{get:function(a){var b=fa.find.attr(a,"tabindex");return b?parseInt(b,10):Cb.test(a.nodeName)||Db.test(a.nodeName)&&a.href?0:-1}}}}),da.hrefNormalized||fa.each(["href","src"],function(a,b){fa.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),da.optSelected||(fa.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),fa.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){fa.propFix[this.toLowerCase()]=this}),da.enctype||(fa.propFix.enctype="encoding");var Eb=/[\t\r\n\f]/g;fa.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(fa.isFunction(a))return this.each(function(b){fa(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(ua)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(Eb," "):" ")){for(f=0;e=b[f++];)d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=fa.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(fa.isFunction(a))return this.each(function(b){fa(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(ua)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(Eb," "):"")){for(f=0;e=b[f++];)for(;d.indexOf(" "+e+" ")>=0;)d=d.replace(" "+e+" "," ");g=a?fa.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(fa.isFunction(a)?function(c){fa(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c)for(var b,d=0,e=fa(this),f=a.match(ua)||[];b=f[d++];)e.hasClass(b)?e.removeClass(b):e.addClass(b);else(c===ya||"boolean"===c)&&(this.className&&fa._data(this,"__className__",this.className),this.className=this.className||a===!1?"":fa._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(Eb," ").indexOf(b)>=0)return!0;return!1}}),fa.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){fa.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),fa.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var Fb=fa.now(),Gb=/\?/,Hb=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;fa.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=fa.trim(b+"");return e&&!fa.trim(e.replace(Hb,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():fa.error("Invalid JSON: "+b)},fa.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||fa.error("Invalid XML: "+b),c};var Ib,Jb,Kb=/#.*$/,Lb=/([?&])_=[^&]*/,Mb=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ob=/^(?:GET|HEAD)$/,Pb=/^\/\//,Qb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Rb={},Sb={},Tb="*/".concat("*");try{Jb=location.href}catch(Ub){Jb=pa.createElement("a"),Jb.href="",Jb=Jb.href}Ib=Qb.exec(Jb.toLowerCase())||[],fa.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Jb,type:"GET",isLocal:Nb.test(Ib[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Tb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":fa.parseJSON,"text xml":fa.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?P(P(a,fa.ajaxSettings),b):P(fa.ajaxSettings,a)},ajaxPrefilter:N(Rb),ajaxTransport:N(Sb),ajax:function(a,b){function c(a,b,c,d){var e,k,r,s,u,w=b;2!==t&&(t=2,h&&clearTimeout(h),j=void 0,g=d||"",v.readyState=a>0?4:0,e=a>=200&&300>a||304===a,c&&(s=Q(l,v,c)),s=R(l,s,v,e),e?(l.ifModified&&(u=v.getResponseHeader("Last-Modified"),u&&(fa.lastModified[f]=u),u=v.getResponseHeader("etag"),u&&(fa.etag[f]=u)),204===a||"HEAD"===l.type?w="nocontent":304===a?w="notmodified":(w=s.state,k=s.data,r=s.error,e=!r)):(r=w,(a||!w)&&(w="error",0>a&&(a=0))),v.status=a,v.statusText=(b||w)+"",e?o.resolveWith(m,[k,w,v]):o.rejectWith(m,[v,w,r]),v.statusCode(q),q=void 0,i&&n.trigger(e?"ajaxSuccess":"ajaxError",[v,l,e?k:r]),p.fireWith(m,[v,w]),i&&(n.trigger("ajaxComplete",[v,l]),--fa.active||fa.event.trigger("ajaxStop")))}"object"==typeof a&&(b=a,a=void 0),b=b||{};var d,e,f,g,h,i,j,k,l=fa.ajaxSetup({},b),m=l.context||l,n=l.context&&(m.nodeType||m.jquery)?fa(m):fa.event,o=fa.Deferred(),p=fa.Callbacks("once memory"),q=l.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!k)for(k={};b=Mb.exec(g);)k[b[1].toLowerCase()]=b[2];b=k[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?g:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(l.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return j&&j.abort(b),c(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,l.url=((a||l.url||Jb)+"").replace(Kb,"").replace(Pb,Ib[1]+"//"),l.type=b.method||b.type||l.method||l.type,l.dataTypes=fa.trim(l.dataType||"*").toLowerCase().match(ua)||[""],null==l.crossDomain&&(d=Qb.exec(l.url.toLowerCase()),l.crossDomain=!(!d||d[1]===Ib[1]&&d[2]===Ib[2]&&(d[3]||("http:"===d[1]?"80":"443"))===(Ib[3]||("http:"===Ib[1]?"80":"443")))),l.data&&l.processData&&"string"!=typeof l.data&&(l.data=fa.param(l.data,l.traditional)),O(Rb,l,b,v),2===t)return v;i=l.global,i&&0===fa.active++&&fa.event.trigger("ajaxStart"),l.type=l.type.toUpperCase(),l.hasContent=!Ob.test(l.type),f=l.url,l.hasContent||(l.data&&(f=l.url+=(Gb.test(f)?"&":"?")+l.data,delete l.data),l.cache===!1&&(l.url=Lb.test(f)?f.replace(Lb,"$1_="+Fb++):f+(Gb.test(f)?"&":"?")+"_="+Fb++)),l.ifModified&&(fa.lastModified[f]&&v.setRequestHeader("If-Modified-Since",fa.lastModified[f]),fa.etag[f]&&v.setRequestHeader("If-None-Match",fa.etag[f])),(l.data&&l.hasContent&&l.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",l.contentType),v.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+("*"!==l.dataTypes[0]?", "+Tb+"; q=0.01":""):l.accepts["*"]);for(e in l.headers)v.setRequestHeader(e,l.headers[e]);if(l.beforeSend&&(l.beforeSend.call(m,v,l)===!1||2===t))return v.abort();u="abort";for(e in{success:1,error:1,complete:1})v[e](l[e]);if(j=O(Sb,l,b,v)){v.readyState=1,i&&n.trigger("ajaxSend",[v,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){v.abort("timeout")},l.timeout));try{t=1,j.send(r,c)}catch(w){if(!(2>t))throw w;c(-1,w)}}else c(-1,"No Transport");return v},getJSON:function(a,b,c){return fa.get(a,b,c,"json")},getScript:function(a,b){return fa.get(a,void 0,b,"script")}}),fa.each(["get","post"],function(a,b){fa[b]=function(a,c,d,e){return fa.isFunction(c)&&(e=e||d,d=c,c=void 0),fa.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),fa.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){fa.fn[b]=function(a){return this.on(b,a)}}),fa._evalUrl=function(a){return fa.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},fa.fn.extend({wrapAll:function(a){if(fa.isFunction(a))return this.each(function(b){fa(this).wrapAll(a.call(this,b))});if(this[0]){var b=fa(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){for(var a=this;a.firstChild&&1===a.firstChild.nodeType;)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(fa.isFunction(a)?function(b){fa(this).wrapInner(a.call(this,b))}:function(){var b=fa(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=fa.isFunction(a);return this.each(function(c){fa(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){fa.nodeName(this,"body")||fa(this).replaceWith(this.childNodes)}).end()}}),fa.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!da.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||fa.css(a,"display"))},fa.expr.filters.visible=function(a){return!fa.expr.filters.hidden(a)};var Vb=/%20/g,Wb=/\[\]$/,Xb=/\r?\n/g,Yb=/^(?:submit|button|image|reset|file)$/i,Zb=/^(?:input|select|textarea|keygen)/i;fa.param=function(a,b){var c,d=[],e=function(a,b){b=fa.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=fa.ajaxSettings&&fa.ajaxSettings.traditional),fa.isArray(a)||a.jquery&&!fa.isPlainObject(a))fa.each(a,function(){e(this.name,this.value)});else for(c in a)S(c,a[c],b,e);return d.join("&").replace(Vb,"+")},fa.fn.extend({serialize:function(){return fa.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=fa.prop(this,"elements");return a?fa.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!fa(this).is(":disabled")&&Zb.test(this.nodeName)&&!Yb.test(a)&&(this.checked||!Fa.test(a))}).map(function(a,b){var c=fa(this).val();return null==c?null:fa.isArray(c)?fa.map(c,function(a){return{name:b.name,value:a.replace(Xb,"\r\n")}}):{name:b.name,value:c.replace(Xb,"\r\n")}}).get()}}),fa.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&T()||U()}:T;var $b=0,_b={},ac=fa.ajaxSettings.xhr();a.ActiveXObject&&fa(a).on("unload",function(){for(var a in _b)_b[a](void 0,!0)}),da.cors=!!ac&&"withCredentials"in ac,ac=da.ajax=!!ac,ac&&fa.ajaxTransport(function(a){if(!a.crossDomain||da.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++$b;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete _b[g],b=void 0,f.onreadystatechange=fa.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=_b[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}}),fa.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return fa.globalEval(a),a}}}),fa.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),fa.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=pa.head||fa("head")[0]||pa.documentElement;return{send:function(d,e){b=pa.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var bc=[],cc=/(=)\?(?=&|$)|\?\?/;fa.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=bc.pop()||fa.expando+"_"+Fb++;return this[a]=!0,a}}),fa.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(cc.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&cc.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=fa.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(cc,"$1"+e):b.jsonp!==!1&&(b.url+=(Gb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||fa.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,bc.push(e)),g&&fa.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),fa.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||pa;var d=ma.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=fa.buildFragment([a],b,e),e&&e.length&&fa(e).remove(),fa.merge([],d.childNodes))};var dc=fa.fn.load;fa.fn.load=function(a,b,c){if("string"!=typeof a&&dc)return dc.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=a.slice(h,a.length),a=a.slice(0,h)),fa.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&fa.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?fa("<div>").append(fa.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},fa.expr.filters.animated=function(a){return fa.grep(fa.timers,function(b){return a===b.elem}).length};var ec=a.document.documentElement;fa.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=fa.css(a,"position"),l=fa(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=fa.css(a,"top"),i=fa.css(a,"left"),j=("absolute"===k||"fixed"===k)&&fa.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),fa.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},fa.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){fa.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;return f?(b=f.documentElement,fa.contains(b,e)?(typeof e.getBoundingClientRect!==ya&&(d=e.getBoundingClientRect()),c=V(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d):void 0},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===fa.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),fa.nodeName(a[0],"html")||(c=a.offset()),c.top+=fa.css(a[0],"borderTopWidth",!0),c.left+=fa.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-fa.css(d,"marginTop",!0),left:b.left-c.left-fa.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||ec;a&&!fa.nodeName(a,"html")&&"static"===fa.css(a,"position");)a=a.offsetParent;return a||ec})}}),fa.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);fa.fn[a]=function(d){return Ea(this,function(a,d,e){var f=V(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?fa(f).scrollLeft():e,c?e:fa(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),fa.each(["top","left"],function(a,b){fa.cssHooks[b]=A(da.pixelPosition,function(a,c){return c?(c=cb(a,b),eb.test(c)?fa(a).position()[b]+"px":c):void 0})}),fa.each({Height:"height",Width:"width"},function(a,b){fa.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){fa.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return Ea(this,function(b,c,d){var e;return fa.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?fa.css(b,c,g):fa.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),fa.fn.size=function(){return this.length},fa.fn.andSelf=fa.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return fa});var fc=a.jQuery,gc=a.$;return fa.noConflict=function(b){return a.$===fa&&(a.$=gc),b&&a.jQuery===fa&&(a.jQuery=fc),fa},typeof b===ya&&(a.jQuery=a.$=fa),fa});var Froogaloop=function(){function a(b){return new a.fn.init(b)}function b(a,b,c){if(!c.contentWindow.postMessage)return!1;var d=c.getAttribute("src").split("?")[0],e=JSON.stringify({method:a,value:b});"//"===d.substr(0,2)&&(d=window.location.protocol+d),c.contentWindow.postMessage(e,d)}function c(a){var b,c;try{b=JSON.parse(a.data),c=b.event||b.method}catch(d){}if("ready"!=c||j||(j=!0),a.origin!=k)return!1;var f=b.value,g=b.data,h=""===h?null:b.player_id,i=e(c,h),l=[];return i?(void 0!==f&&l.push(f),g&&l.push(g),h&&l.push(h),l.length>0?i.apply(null,l):i.call()):!1}function d(a,b,c){c?(i[c]||(i[c]={}),i[c][a]=b):i[a]=b}function e(a,b){return b?i[b][a]:i[a]}function f(a,b){if(b&&i[b]){if(!i[b][a])return!1;i[b][a]=null}else{if(!i[a])return!1;i[a]=null}return!0}function g(a){"//"===a.substr(0,2)&&(a=window.location.protocol+a);for(var b=a.split("/"),c="",d=0,e=b.length;e>d&&3>d;d++)c+=b[d],
+2>d&&(c+="/");return c}function h(a){return!!(a&&a.constructor&&a.call&&a.apply)}var i={},j=!1,k=(Array.prototype.slice,"");return a.fn=a.prototype={element:null,init:function(a){return"string"==typeof a&&(a=document.getElementById(a)),this.element=a,k=g(this.element.getAttribute("src")),this},api:function(a,c){if(!this.element||!a)return!1;var e=this,f=e.element,g=""!==f.id?f.id:null,i=h(c)?null:c,j=h(c)?c:null;return j&&d(a,j,g),b(a,i,f),e},addEvent:function(a,c){if(!this.element)return!1;var e=this,f=e.element,g=""!==f.id?f.id:null;return d(a,c,g),"ready"!=a?b("addEventListener",a,f):"ready"==a&&j&&c.call(null,g),e},removeEvent:function(a){if(!this.element)return!1;var c=this,d=c.element,e=""!==d.id?d.id:null,g=f(a,e);"ready"!=a&&g&&b("removeEventListener",a,d)}},a.fn.init.prototype=a.fn,window.addEventListener?window.addEventListener("message",c,!1):window.attachEvent("onmessage",c),window.Froogaloop=window.$f=a}(),deviceIsAndroid=navigator.userAgent.indexOf("Android")>0,deviceIsIOS=/iP(ad|hone|od)/.test(navigator.userAgent),deviceIsIOS4=deviceIsIOS&&/OS 4_\d(_\d)?/.test(navigator.userAgent),deviceIsIOSWithBadTarget=deviceIsIOS&&/OS ([6-9]|\d{2})_\d/.test(navigator.userAgent);FastClick.prototype.needsClick=function(a){"use strict";switch(a.nodeName.toLowerCase()){case"button":case"select":case"textarea":if(a.disabled)return!0;break;case"input":if(deviceIsIOS&&"file"===a.type||a.disabled)return!0;break;case"label":case"video":return!0}return/\bneedsclick\b/.test(a.className)},FastClick.prototype.needsFocus=function(a){"use strict";switch(a.nodeName.toLowerCase()){case"textarea":return!0;case"select":return!deviceIsAndroid;case"input":switch(a.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return!1}return!a.disabled&&!a.readOnly;default:return/\bneedsfocus\b/.test(a.className)}},FastClick.prototype.sendClick=function(a,b){"use strict";var c,d;document.activeElement&&document.activeElement!==a&&document.activeElement.blur(),d=b.changedTouches[0],c=document.createEvent("MouseEvents"),c.initMouseEvent(this.determineEventType(a),!0,!0,window,1,d.screenX,d.screenY,d.clientX,d.clientY,!1,!1,!1,!1,0,null),c.forwardedTouchEvent=!0,a.dispatchEvent(c)},FastClick.prototype.determineEventType=function(a){"use strict";return deviceIsAndroid&&"select"===a.tagName.toLowerCase()?"mousedown":"click"},FastClick.prototype.focus=function(a){"use strict";var b;deviceIsIOS&&a.setSelectionRange&&0!==a.type.indexOf("date")&&"time"!==a.type?(b=a.value.length,a.setSelectionRange(b,b)):a.focus()},FastClick.prototype.updateScrollParent=function(a){"use strict";var b,c;if(b=a.fastClickScrollParent,!b||!b.contains(a)){c=a;do{if(c.scrollHeight>c.offsetHeight){b=c,a.fastClickScrollParent=c;break}c=c.parentElement}while(c)}b&&(b.fastClickLastScrollTop=b.scrollTop)},FastClick.prototype.getTargetElementFromEventTarget=function(a){"use strict";return a.nodeType===Node.TEXT_NODE?a.parentNode:a},FastClick.prototype.onTouchStart=function(a){"use strict";var b,c,d;if(a.targetTouches.length>1)return!0;if(b=this.getTargetElementFromEventTarget(a.target),c=a.targetTouches[0],deviceIsIOS){if(d=window.getSelection(),d.rangeCount&&!d.isCollapsed)return!0;if(!deviceIsIOS4){if(c.identifier===this.lastTouchIdentifier)return a.preventDefault(),!1;this.lastTouchIdentifier=c.identifier,this.updateScrollParent(b)}}return this.trackingClick=!0,this.trackingClickStart=a.timeStamp,this.targetElement=b,this.touchStartX=c.pageX,this.touchStartY=c.pageY,a.timeStamp-this.lastClickTime<this.tapDelay&&a.preventDefault(),!0},FastClick.prototype.touchHasMoved=function(a){"use strict";var b=a.changedTouches[0],c=this.touchBoundary;return Math.abs(b.pageX-this.touchStartX)>c||Math.abs(b.pageY-this.touchStartY)>c?!0:!1},FastClick.prototype.onTouchMove=function(a){"use strict";return this.trackingClick?((this.targetElement!==this.getTargetElementFromEventTarget(a.target)||this.touchHasMoved(a))&&(this.trackingClick=!1,this.targetElement=null),!0):!0},FastClick.prototype.findControl=function(a){"use strict";return void 0!==a.control?a.control:a.htmlFor?document.getElementById(a.htmlFor):a.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")},FastClick.prototype.onTouchEnd=function(a){"use strict";var b,c,d,e,f,g=this.targetElement;if(!this.trackingClick)return!0;if(a.timeStamp-this.lastClickTime<this.tapDelay)return this.cancelNextClick=!0,!0;if(this.cancelNextClick=!1,this.lastClickTime=a.timeStamp,c=this.trackingClickStart,this.trackingClick=!1,this.trackingClickStart=0,deviceIsIOSWithBadTarget&&(f=a.changedTouches[0],g=document.elementFromPoint(f.pageX-window.pageXOffset,f.pageY-window.pageYOffset)||g,g.fastClickScrollParent=this.targetElement.fastClickScrollParent),d=g.tagName.toLowerCase(),"label"===d){if(b=this.findControl(g)){if(this.focus(g),deviceIsAndroid)return!1;g=b}}else if(this.needsFocus(g))return a.timeStamp-c>100||deviceIsIOS&&window.top!==window&&"input"===d?(this.targetElement=null,!1):(this.focus(g),this.sendClick(g,a),deviceIsIOS&&"select"===d||(this.targetElement=null,a.preventDefault()),!1);return deviceIsIOS&&!deviceIsIOS4&&(e=g.fastClickScrollParent,e&&e.fastClickLastScrollTop!==e.scrollTop)?!0:(this.needsClick(g)||(a.preventDefault(),this.sendClick(g,a)),!1)},FastClick.prototype.onTouchCancel=function(){"use strict";this.trackingClick=!1,this.targetElement=null},FastClick.prototype.onMouse=function(a){"use strict";return this.targetElement?a.forwardedTouchEvent?!0:a.cancelable&&(!this.needsClick(this.targetElement)||this.cancelNextClick)?(a.stopImmediatePropagation?a.stopImmediatePropagation():a.propagationStopped=!0,a.stopPropagation(),a.preventDefault(),!1):!0:!0},FastClick.prototype.onClick=function(a){"use strict";var b;return this.trackingClick?(this.targetElement=null,this.trackingClick=!1,!0):"submit"===a.target.type&&0===a.detail?!0:(b=this.onMouse(a),b||(this.targetElement=null),b)},FastClick.prototype.destroy=function(){"use strict";var a=this.layer;deviceIsAndroid&&(a.removeEventListener("mouseover",this.onMouse,!0),a.removeEventListener("mousedown",this.onMouse,!0),a.removeEventListener("mouseup",this.onMouse,!0)),a.removeEventListener("click",this.onClick,!0),a.removeEventListener("touchstart",this.onTouchStart,!1),a.removeEventListener("touchmove",this.onTouchMove,!1),a.removeEventListener("touchend",this.onTouchEnd,!1),a.removeEventListener("touchcancel",this.onTouchCancel,!1)},FastClick.notNeeded=function(a){"use strict";var b,c;if("undefined"==typeof window.ontouchstart)return!0;if(c=+(/Chrome\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1]){if(!deviceIsAndroid)return!0;if(b=document.querySelector("meta[name=viewport]")){if(-1!==b.content.indexOf("user-scalable=no"))return!0;if(c>31&&document.documentElement.scrollWidth<=window.outerWidth)return!0}}return"none"===a.style.msTouchAction?!0:!1},FastClick.attach=function(a,b){"use strict";return new FastClick(a,b)},"undefined"!=typeof define&&define.amd?define(function(){"use strict";return FastClick}):"undefined"!=typeof module&&module.exports?(module.exports=FastClick.attach,module.exports.FastClick=FastClick):window.FastClick=FastClick,function(a){function b(){}function c(a){function c(b){b.prototype.option||(b.prototype.option=function(b){a.isPlainObject(b)&&(this.options=a.extend(!0,this.options,b))})}function e(b,c){a.fn[b]=function(e){if("string"==typeof e){for(var g=d.call(arguments,1),h=0,i=this.length;i>h;h++){var j=this[h],k=a.data(j,b);if(k)if(a.isFunction(k[e])&&"_"!==e.charAt(0)){var l=k[e].apply(k,g);if(void 0!==l)return l}else f("no such method '"+e+"' for "+b+" instance");else f("cannot call methods on "+b+" prior to initialization; attempted to call '"+e+"'")}return this}return this.each(function(){var d=a.data(this,b);d?(d.option(e),d._init()):(d=new c(this,e),a.data(this,b,d))})}}if(a){var f="undefined"==typeof console?b:function(a){console.error(a)};return a.bridget=function(a,b){c(b),e(a,b)},a.bridget}}var d=Array.prototype.slice;"function"==typeof define&&define.amd?define("jquery-bridget/jquery.bridget",["jquery"],c):c("object"==typeof exports?require("jquery"):a.jQuery)}(window),function(a){function b(a){return new RegExp("(^|\\s+)"+a+"(\\s+|$)")}function c(a,b){var c=d(a,b)?f:e;c(a,b)}var d,e,f;"classList"in document.documentElement?(d=function(a,b){return a.classList.contains(b)},e=function(a,b){a.classList.add(b)},f=function(a,b){a.classList.remove(b)}):(d=function(a,c){return b(c).test(a.className)},e=function(a,b){d(a,b)||(a.className=a.className+" "+b)},f=function(a,c){a.className=a.className.replace(b(c)," ")});var g={hasClass:d,addClass:e,removeClass:f,toggleClass:c,has:d,add:e,remove:f,toggle:c};"function"==typeof define&&define.amd?define("classie/classie",g):"object"==typeof exports?module.exports=g:a.classie=g}(window),function(){function a(){}function b(a,b){for(var c=a.length;c--;)if(a[c].listener===b)return c;return-1}function c(a){return function(){return this[a].apply(this,arguments)}}var d=a.prototype,e=this,f=e.EventEmitter;d.getListeners=function(a){var b,c,d=this._getEvents();if(a instanceof RegExp){b={};for(c in d)d.hasOwnProperty(c)&&a.test(c)&&(b[c]=d[c])}else b=d[a]||(d[a]=[]);return b},d.flattenListeners=function(a){var b,c=[];for(b=0;b<a.length;b+=1)c.push(a[b].listener);return c},d.getListenersAsObject=function(a){var b,c=this.getListeners(a);return c instanceof Array&&(b={},b[a]=c),b||c},d.addListener=function(a,c){var d,e=this.getListenersAsObject(a),f="object"==typeof c;for(d in e)e.hasOwnProperty(d)&&-1===b(e[d],c)&&e[d].push(f?c:{listener:c,once:!1});return this},d.on=c("addListener"),d.addOnceListener=function(a,b){return this.addListener(a,{listener:b,once:!0})},d.once=c("addOnceListener"),d.defineEvent=function(a){return this.getListeners(a),this},d.defineEvents=function(a){for(var b=0;b<a.length;b+=1)this.defineEvent(a[b]);return this},d.removeListener=function(a,c){var d,e,f=this.getListenersAsObject(a);for(e in f)f.hasOwnProperty(e)&&(d=b(f[e],c),-1!==d&&f[e].splice(d,1));return this},d.off=c("removeListener"),d.addListeners=function(a,b){return this.manipulateListeners(!1,a,b)},d.removeListeners=function(a,b){return this.manipulateListeners(!0,a,b)},d.manipulateListeners=function(a,b,c){var d,e,f=a?this.removeListener:this.addListener,g=a?this.removeListeners:this.addListeners;if("object"!=typeof b||b instanceof RegExp)for(d=c.length;d--;)f.call(this,b,c[d]);else for(d in b)b.hasOwnProperty(d)&&(e=b[d])&&("function"==typeof e?f.call(this,d,e):g.call(this,d,e));return this},d.removeEvent=function(a){var b,c=typeof a,d=this._getEvents();if("string"===c)delete d[a];else if(a instanceof RegExp)for(b in d)d.hasOwnProperty(b)&&a.test(b)&&delete d[b];else delete this._events;return this},d.removeAllListeners=c("removeEvent"),d.emitEvent=function(a,b){var c,d,e,f,g=this.getListenersAsObject(a);for(e in g)if(g.hasOwnProperty(e))for(d=g[e].length;d--;)c=g[e][d],c.once===!0&&this.removeListener(a,c.listener),f=c.listener.apply(this,b||[]),f===this._getOnceReturnValue()&&this.removeListener(a,c.listener);return this},d.trigger=c("emitEvent"),d.emit=function(a){var b=Array.prototype.slice.call(arguments,1);return this.emitEvent(a,b)},d.setOnceReturnValue=function(a){return this._onceReturnValue=a,this},d._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},d._getEvents=function(){return this._events||(this._events={})},a.noConflict=function(){return e.EventEmitter=f,a},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return a}):"object"==typeof module&&module.exports?module.exports=a:e.EventEmitter=a}.call(this),function(a){function b(b){var c=a.event;return c.target=c.target||c.srcElement||b,c}var c=document.documentElement,d=function(){};c.addEventListener?d=function(a,b,c){a.addEventListener(b,c,!1)}:c.attachEvent&&(d=function(a,c,d){a[c+d]=d.handleEvent?function(){var c=b(a);d.handleEvent.call(d,c)}:function(){var c=b(a);d.call(a,c)},a.attachEvent("on"+c,a[c+d])});var e=function(){};c.removeEventListener?e=function(a,b,c){a.removeEventListener(b,c,!1)}:c.detachEvent&&(e=function(a,b,c){a.detachEvent("on"+b,a[b+c]);try{delete a[b+c]}catch(d){a[b+c]=void 0}});var f={bind:d,unbind:e};"function"==typeof define&&define.amd?define("eventie/eventie",f):"object"==typeof exports?module.exports=f:a.eventie=f}(window),function(a){function b(a){if(a){if("string"==typeof d[a])return a;a=a.charAt(0).toUpperCase()+a.slice(1);for(var b,e=0,f=c.length;f>e;e++)if(b=c[e]+a,"string"==typeof d[b])return b}}var c="Webkit Moz ms Ms O".split(" "),d=document.documentElement.style;"function"==typeof define&&define.amd?define("get-style-property/get-style-property",[],function(){return b}):"object"==typeof exports?module.exports=b:a.getStyleProperty=b}(window),function(a,b){function c(a){var b=parseFloat(a),c=-1===a.indexOf("%")&&!isNaN(b);return c&&b}function d(){}function e(){for(var a={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},b=0,c=h.length;c>b;b++){var d=h[b];a[d]=0}return a}function f(b){function d(){if(!m){m=!0;var d=a.getComputedStyle;if(j=function(){var a=d?function(a){return d(a,null)}:function(a){return a.currentStyle};return function(b){var c=a(b);return c||g("Style returned "+c+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),c}}(),k=b("boxSizing")){var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style[k]="border-box";var f=document.body||document.documentElement;f.appendChild(e);var h=j(e);l=200===c(h.width),f.removeChild(e)}}}function f(a){if(d(),"string"==typeof a&&(a=document.querySelector(a)),a&&"object"==typeof a&&a.nodeType){var b=j(a);if("none"===b.display)return e();var f={};f.width=a.offsetWidth,f.height=a.offsetHeight;for(var g=f.isBorderBox=!(!k||!b[k]||"border-box"!==b[k]),m=0,n=h.length;n>m;m++){var o=h[m],p=b[o];p=i(a,p);var q=parseFloat(p);f[o]=isNaN(q)?0:q}var r=f.paddingLeft+f.paddingRight,s=f.paddingTop+f.paddingBottom,t=f.marginLeft+f.marginRight,u=f.marginTop+f.marginBottom,v=f.borderLeftWidth+f.borderRightWidth,w=f.borderTopWidth+f.borderBottomWidth,x=g&&l,y=c(b.width);y!==!1&&(f.width=y+(x?0:r+v));var z=c(b.height);return z!==!1&&(f.height=z+(x?0:s+w)),f.innerWidth=f.width-(r+v),f.innerHeight=f.height-(s+w),f.outerWidth=f.width+t,f.outerHeight=f.height+u,f}}function i(b,c){if(a.getComputedStyle||-1===c.indexOf("%"))return c;var d=b.style,e=d.left,f=b.runtimeStyle,g=f&&f.left;return g&&(f.left=b.currentStyle.left),d.left=c,c=d.pixelLeft,d.left=e,g&&(f.left=g),c}var j,k,l,m=!1;return f}var g="undefined"==typeof console?d:function(a){console.error(a)},h=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"];"function"==typeof define&&define.amd?define("get-size/get-size",["get-style-property/get-style-property"],f):"object"==typeof exports?module.exports=f(require("desandro-get-style-property")):a.getSize=f(a.getStyleProperty)}(window),function(a){function b(a){"function"==typeof a&&(b.isReady?a():g.push(a))}function c(a){var c="readystatechange"===a.type&&"complete"!==f.readyState;b.isReady||c||d()}function d(){b.isReady=!0;for(var a=0,c=g.length;c>a;a++){var d=g[a];d()}}function e(e){return"complete"===f.readyState?d():(e.bind(f,"DOMContentLoaded",c),e.bind(f,"readystatechange",c),e.bind(a,"load",c)),b}var f=a.document,g=[];b.isReady=!1,"function"==typeof define&&define.amd?define("doc-ready/doc-ready",["eventie/eventie"],e):"object"==typeof exports?module.exports=e(require("eventie")):a.docReady=e(a.eventie)}(window),function(a){function b(a,b){return a[g](b)}function c(a){if(!a.parentNode){var b=document.createDocumentFragment();b.appendChild(a)}}function d(a,b){c(a);for(var d=a.parentNode.querySelectorAll(b),e=0,f=d.length;f>e;e++)if(d[e]===a)return!0;return!1}function e(a,d){return c(a),b(a,d)}var f,g=function(){if(a.matches)return"matches";if(a.matchesSelector)return"matchesSelector";for(var b=["webkit","moz","ms","o"],c=0,d=b.length;d>c;c++){var e=b[c],f=e+"MatchesSelector";if(a[f])return f}}();if(g){var h=document.createElement("div"),i=b(h,"div");f=i?b:e}else f=d;"function"==typeof define&&define.amd?define("matches-selector/matches-selector",[],function(){return f}):"object"==typeof exports?module.exports=f:window.matchesSelector=f}(Element.prototype),function(a,b){"function"==typeof define&&define.amd?define("fizzy-ui-utils/utils",["doc-ready/doc-ready","matches-selector/matches-selector"],function(c,d){return b(a,c,d)}):"object"==typeof exports?module.exports=b(a,require("doc-ready"),require("desandro-matches-selector")):a.fizzyUIUtils=b(a,a.docReady,a.matchesSelector)}(window,function(a,b,c){var d={};d.extend=function(a,b){for(var c in b)a[c]=b[c];return a},d.modulo=function(a,b){return(a%b+b)%b};var e=Object.prototype.toString;d.isArray=function(a){return"[object Array]"==e.call(a)},d.makeArray=function(a){var b=[];if(d.isArray(a))b=a;else if(a&&"number"==typeof a.length)for(var c=0,e=a.length;e>c;c++)b.push(a[c]);else b.push(a);return b},d.indexOf=Array.prototype.indexOf?function(a,b){return a.indexOf(b)}:function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},d.removeFrom=function(a,b){var c=d.indexOf(a,b);-1!=c&&a.splice(c,1)},d.isElement="function"==typeof HTMLElement||"object"==typeof HTMLElement?function(a){return a instanceof HTMLElement}:function(a){return a&&"object"==typeof a&&1==a.nodeType&&"string"==typeof a.nodeName},d.setText=function(){function a(a,c){b=b||(void 0!==document.documentElement.textContent?"textContent":"innerText"),a[b]=c}var b;return a}(),d.getParent=function(a,b){for(;a!=document.body;)if(a=a.parentNode,c(a,b))return a},d.getQueryElement=function(a){return"string"==typeof a?document.querySelector(a):a},d.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},d.filterFindElements=function(a,b){a=d.makeArray(a);for(var e=[],f=0,g=a.length;g>f;f++){var h=a[f];if(d.isElement(h))if(b){c(h,b)&&e.push(h);for(var i=h.querySelectorAll(b),j=0,k=i.length;k>j;j++)e.push(i[j])}else e.push(h)}return e},d.debounceMethod=function(a,b,c){var d=a.prototype[b],e=b+"Timeout";a.prototype[b]=function(){var a=this[e];a&&clearTimeout(a);var b=arguments,f=this;this[e]=setTimeout(function(){d.apply(f,b),delete f[e]},c||100)}},d.toDashed=function(a){return a.replace(/(.)([A-Z])/g,function(a,b,c){return b+"-"+c}).toLowerCase()};var f=a.console;return d.htmlInit=function(c,e){b(function(){for(var b=d.toDashed(e),g=document.querySelectorAll(".js-"+b),h="data-"+b+"-options",i=0,j=g.length;j>i;i++){var k,l=g[i],m=l.getAttribute(h);try{k=m&&JSON.parse(m)}catch(n){f&&f.error("Error parsing "+h+" on "+l.nodeName.toLowerCase()+(l.id?"#"+l.id:"")+": "+n);continue}var o=new c(l,k),p=a.jQuery;p&&p.data(l,e,o)}})},d}),function(a,b){"function"==typeof define&&define.amd?define("flickity/js/cell",["get-size/get-size"],function(c){return b(a,c)}):"object"==typeof exports?module.exports=b(a,require("get-size")):(a.Flickity=a.Flickity||{},a.Flickity.Cell=b(a,a.getSize))}(window,function(a,b){function c(a,b){this.element=a,this.parent=b,this.create()}var d="attachEvent"in a;return c.prototype.create=function(){this.element.style.position="absolute",d&&this.element.setAttribute("unselectable","on"),this.x=0,this.shift=0},c.prototype.destroy=function(){this.element.style.position="";var a=this.parent.originSide;this.element.style[a]=""},c.prototype.getSize=function(){this.size=b(this.element)},c.prototype.setPosition=function(a){this.x=a,this.setDefaultTarget(),this.renderPosition(a)},c.prototype.setDefaultTarget=function(){var a="left"==this.parent.originSide?"marginLeft":"marginRight";this.target=this.x+this.size[a]+this.size.width*this.parent.cellAlign},c.prototype.renderPosition=function(a){var b=this.parent.originSide;this.element.style[b]=this.parent.getPositionValue(a)},c.prototype.wrapShift=function(a){this.shift=a,this.renderPosition(this.x+this.parent.slideableWidth*a)},c.prototype.remove=function(){this.element.parentNode.removeChild(this.element)},c}),function(a,b){"function"==typeof define&&define.amd?define("flickity/js/animate",["get-style-property/get-style-property","fizzy-ui-utils/utils"],function(c,d){return b(a,c,d)}):"object"==typeof exports?module.exports=b(a,require("desandro-get-style-property"),require("fizzy-ui-utils")):(a.Flickity=a.Flickity||{},a.Flickity.animatePrototype=b(a,a.getStyleProperty,a.fizzyUIUtils))}(window,function(a,b,c){for(var d,e=0,f="webkit moz ms o".split(" "),g=a.requestAnimationFrame,h=a.cancelAnimationFrame,i=0;i<f.length&&(!g||!h);i++)d=f[i],g=g||a[d+"RequestAnimationFrame"],h=h||a[d+"CancelAnimationFrame"]||a[d+"CancelRequestAnimationFrame"];g&&h||(g=function(b){var c=(new Date).getTime(),d=Math.max(0,16-(c-e)),f=a.setTimeout(function(){b(c+d)},d);return e=c+d,f},h=function(b){a.clearTimeout(b)});var j={};j.startAnimation=function(){this.isAnimating||(this.isAnimating=!0,this.restingFrames=0,this.animate())},j.animate=function(){this.applySelectedAttraction();var a=this.x;if(this.integratePhysics(),this.positionSlider(),this.settle(a),this.isAnimating){var b=this;g(function(){b.animate()})}};var k=b("transform"),l=!!b("perspective");return j.positionSlider=function(){var a=this.x;this.options.wrapAround&&this.cells.length>1&&(a=c.modulo(a,this.slideableWidth),a-=this.slideableWidth,this.shiftWrapCells(a)),a+=this.cursorPosition,a=this.options.rightToLeft&&k?-a:a;var b=this.getPositionValue(a);k?this.slider.style[k]=l&&this.isAnimating?"translate3d("+b+",0,0)":"translateX("+b+")":this.slider.style[this.originSide]=b},j.positionSliderAtSelected=function(){if(this.cells.length){var a=this.cells[this.selectedIndex];this.x=-a.target,this.positionSlider()}},j.getPositionValue=function(a){return this.options.percentPosition?.01*Math.round(a/this.size.innerWidth*1e4)+"%":Math.round(a)+"px"},j.settle=function(a){this.isPointerDown||Math.round(100*this.x)!=Math.round(100*a)||this.restingFrames++,this.restingFrames>2&&(this.isAnimating=!1,delete this.isFreeScrolling,l&&this.positionSlider(),this.dispatchEvent("settle"))},j.shiftWrapCells=function(a){var b=this.cursorPosition+a;this._shiftCells(this.beforeShiftCells,b,-1);var c=this.size.innerWidth-(a+this.slideableWidth+this.cursorPosition);this._shiftCells(this.afterShiftCells,c,1)},j._shiftCells=function(a,b,c){for(var d=0,e=a.length;e>d;d++){var f=a[d],g=b>0?c:0;f.wrapShift(g),b-=f.size.outerWidth}},j._unshiftCells=function(a){if(a&&a.length)for(var b=0,c=a.length;c>b;b++)a[b].wrapShift(0)},j.integratePhysics=function(){this.velocity+=this.accel,this.x+=this.velocity,this.velocity*=this.getFrictionFactor(),this.accel=0},j.applyForce=function(a){this.accel+=a},j.getFrictionFactor=function(){return 1-this.options[this.isFreeScrolling?"freeScrollFriction":"friction"]},j.getRestingPosition=function(){return this.x+this.velocity/(1-this.getFrictionFactor())},j.applySelectedAttraction=function(){var a=this.cells.length;if(!this.isPointerDown&&!this.isFreeScrolling&&a){var b=this.cells[this.selectedIndex],c=this.options.wrapAround&&a>1?this.slideableWidth*Math.floor(this.selectedIndex/a):0,d=-1*(b.target+c)-this.x,e=d*this.options.selectedAttraction;this.applyForce(e)}},j}),function(a,b){if("function"==typeof define&&define.amd)define("flickity/js/flickity",["classie/classie","eventEmitter/EventEmitter","eventie/eventie","get-size/get-size","fizzy-ui-utils/utils","./cell","./animate"],function(c,d,e,f,g,h,i){return b(a,c,d,e,f,g,h,i)});else if("object"==typeof exports)module.exports=b(a,require("desandro-classie"),require("wolfy87-eventemitter"),require("eventie"),require("get-size"),require("fizzy-ui-utils"),require("./cell"),require("./animate"));else{var c=a.Flickity;a.Flickity=b(a,a.classie,a.EventEmitter,a.eventie,a.getSize,a.fizzyUIUtils,c.Cell,c.animatePrototype)}}(window,function(a,b,c,d,e,f,g,h){function i(a,b){for(a=f.makeArray(a);a.length;)b.appendChild(a.shift())}function j(a,b){var c=f.getQueryElement(a);return c?(this.element=c,k&&(this.$element=k(this.element)),this.options=f.extend({},this.constructor.defaults),this.option(b),void this._create()):void(m&&m.error("Bad element for Flickity: "+(c||a)))}var k=a.jQuery,l=a.getComputedStyle,m=a.console,n=0,o={};j.defaults={accessibility:!0,cellAlign:"center",freeScrollFriction:.075,friction:.28,percentPosition:!0,resize:!0,selectedAttraction:.025,setGallerySize:!0},j.createMethods=[],f.extend(j.prototype,c.prototype),j.prototype._create=function(){var b=this.guid=++n;this.element.flickityGUID=b,o[b]=this,this.selectedIndex=this.options.initialIndex||0,this.restingFrames=0,this.x=0,this.velocity=0,this.accel=0,this.originSide=this.options.rightToLeft?"right":"left",this.viewport=document.createElement("div"),this.viewport.className="flickity-viewport",j.setUnselectable(this.viewport),this._createSlider(),(this.options.resize||this.options.watchCSS)&&(d.bind(a,"resize",this),this.isResizeBound=!0);for(var c=0,e=j.createMethods.length;e>c;c++){var f=j.createMethods[c];this[f]()}this.options.watchCSS?this.watchCSS():this.activate()},j.prototype.option=function(a){f.extend(this.options,a)},j.prototype.activate=function(){if(!this.isActive){this.isActive=!0,b.add(this.element,"flickity-enabled"),this.options.rightToLeft&&b.add(this.element,"flickity-rtl");var a=this._filterFindCellElements(this.element.children);i(a,this.slider),this.viewport.appendChild(this.slider),this.element.appendChild(this.viewport),this.getSize(),this.reloadCells(),this.options.accessibility&&(this.element.tabIndex=0,d.bind(this.element,"keydown",this)),this.emit("activate"),this.positionSliderAtSelected(),this.select(this.selectedIndex)}},j.prototype._createSlider=function(){var a=document.createElement("div");a.className="flickity-slider",a.style[this.originSide]=0,this.slider=a},j.prototype._filterFindCellElements=function(a){return f.filterFindElements(a,this.options.cellSelector)},j.prototype.reloadCells=function(){this.cells=this._makeCells(this.slider.children),this.positionCells(),this._getWrapShiftCells(),this.setGallerySize()},j.prototype._makeCells=function(a){for(var b=this._filterFindCellElements(a),c=[],d=0,e=b.length;e>d;d++){var f=b[d],h=new g(f,this);c.push(h)}return c},j.prototype.getLastCell=function(){return this.cells[this.cells.length-1]},j.prototype.positionCells=function(){this._sizeCells(this.cells),this._positionCells(0)},j.prototype._positionCells=function(a){this.maxCellHeight=a?this.maxCellHeight||0:0;var b=0;if(a>0){var c=this.cells[a-1];b=c.x+c.size.outerWidth}for(var d,e=this.cells.length,f=a;e>f;f++)d=this.cells[f],d.setPosition(b),b+=d.size.outerWidth,this.maxCellHeight=Math.max(d.size.outerHeight,this.maxCellHeight);this.slideableWidth=b,this._containCells()},j.prototype._sizeCells=function(a){for(var b=0,c=a.length;c>b;b++){var d=a[b];d.getSize()}},j.prototype._init=j.prototype.reposition=function(){this.positionCells(),this.positionSliderAtSelected()},j.prototype.getSize=function(){this.size=e(this.element),this.setCellAlign(),this.cursorPosition=this.size.innerWidth*this.cellAlign};var p={center:{left:.5,right:.5},left:{left:0,right:1},right:{right:0,left:1}};j.prototype.setCellAlign=function(){var a=p[this.options.cellAlign];this.cellAlign=a?a[this.originSide]:this.options.cellAlign},j.prototype.setGallerySize=function(){this.options.setGallerySize&&(this.viewport.style.height=this.maxCellHeight+"px")},j.prototype._getWrapShiftCells=function(){if(this.options.wrapAround){this._unshiftCells(this.beforeShiftCells),this._unshiftCells(this.afterShiftCells);var a=this.cursorPosition,b=this.cells.length-1;this.beforeShiftCells=this._getGapCells(a,b,-1),a=this.size.innerWidth-this.cursorPosition,this.afterShiftCells=this._getGapCells(a,0,1)}},j.prototype._getGapCells=function(a,b,c){for(var d=[];a>0;){var e=this.cells[b];if(!e)break;d.push(e),b+=c,a-=e.size.outerWidth}return d},j.prototype._containCells=function(){if(this.options.contain&&!this.options.wrapAround&&this.cells.length)for(var a=this.options.rightToLeft?"marginRight":"marginLeft",b=this.options.rightToLeft?"marginLeft":"marginRight",c=this.cells[0].size[a],d=this.getLastCell(),e=this.slideableWidth-d.size[b],f=e-this.size.innerWidth*(1-this.cellAlign),g=e<this.size.innerWidth,h=0,i=this.cells.length;i>h;h++){var j=this.cells[h];j.setDefaultTarget(),g?j.target=e*this.cellAlign:(j.target=Math.max(j.target,this.cursorPosition+c),j.target=Math.min(j.target,f))}},j.prototype.dispatchEvent=function(a,b,c){var d=[b].concat(c);if(this.emitEvent(a,d),k&&this.$element)if(b){var e=k.Event(b);e.type=a,this.$element.trigger(e,c)}else this.$element.trigger(a,c)},j.prototype.select=function(a,b){if(this.isActive){var c=this.cells.length;this.options.wrapAround&&c>1&&(0>a?this.x-=this.slideableWidth:a>=c&&(this.x+=this.slideableWidth)),(this.options.wrapAround||b)&&(a=f.modulo(a,c)),this.cells[a]&&(this.selectedIndex=a,this.setSelectedCell(),this.startAnimation(),this.dispatchEvent("cellSelect"))}},j.prototype.previous=function(a){this.select(this.selectedIndex-1,a)},j.prototype.next=function(a){this.select(this.selectedIndex+1,a)},j.prototype.setSelectedCell=function(){this._removeSelectedCellClass(),this.selectedCell=this.cells[this.selectedIndex],this.selectedElement=this.selectedCell.element,b.add(this.selectedElement,"is-selected")},j.prototype._removeSelectedCellClass=function(){this.selectedCell&&b.remove(this.selectedCell.element,"is-selected")},j.prototype.getCell=function(a){for(var b=0,c=this.cells.length;c>b;b++){var d=this.cells[b];if(d.element==a)return d}},j.prototype.getCells=function(a){a=f.makeArray(a);for(var b=[],c=0,d=a.length;d>c;c++){var e=a[c],g=this.getCell(e);g&&b.push(g)}return b},j.prototype.getCellElements=function(){for(var a=[],b=0,c=this.cells.length;c>b;b++)a.push(this.cells[b].element);return a},j.prototype.getParentCell=function(a){var b=this.getCell(a);return b?b:(a=f.getParent(a,".flickity-slider > *"),this.getCell(a))},j.prototype.uiChange=function(){this.emit("uiChange")},j.prototype.childUIPointerDown=function(a){this.emitEvent("childUIPointerDown",[a])},j.prototype.onresize=function(){this.watchCSS(),this.resize()},f.debounceMethod(j,"onresize",150),j.prototype.resize=function(){this.isActive&&(this.getSize(),this.options.wrapAround&&(this.x=f.modulo(this.x,this.slideableWidth)),this.positionCells(),this._getWrapShiftCells(),this.setGallerySize(),this.positionSliderAtSelected())};var q=j.supportsConditionalCSS=function(){var a;return function(){if(void 0!==a)return a;if(!l)return void(a=!1);var b=document.createElement("style"),c=document.createTextNode('body:after { content: "foo"; display: none; }');b.appendChild(c),document.head.appendChild(b);var d=l(document.body,":after").content;return a=-1!=d.indexOf("foo"),document.head.removeChild(b),a}}();j.prototype.watchCSS=function(){var a=this.options.watchCSS;if(a){var b=q();if(!b){var c="fallbackOn"==a?"activate":"deactivate";return void this[c]()}var d=l(this.element,":after").content;-1!=d.indexOf("flickity")?this.activate():this.deactivate()}},j.prototype.onkeydown=function(a){if(this.options.accessibility&&(!document.activeElement||document.activeElement==this.element))if(37==a.keyCode){var b=this.options.rightToLeft?"next":"previous";this.uiChange(),this[b]()}else if(39==a.keyCode){var c=this.options.rightToLeft?"previous":"next";this.uiChange(),this[c]()}},j.prototype.deactivate=function(){if(this.isActive){b.remove(this.element,"flickity-enabled"),b.remove(this.element,"flickity-rtl");for(var a=0,c=this.cells.length;c>a;a++){var e=this.cells[a];e.destroy()}this._removeSelectedCellClass(),this.element.removeChild(this.viewport),i(this.slider.children,this.element),this.options.accessibility&&(this.element.removeAttribute("tabIndex"),d.unbind(this.element,"keydown",this)),this.isActive=!1,this.emit("deactivate");
+}},j.prototype.destroy=function(){this.deactivate(),this.isResizeBound&&d.unbind(a,"resize",this),this.emit("destroy"),k&&this.$element&&k.removeData(this.element,"flickity"),delete this.element.flickityGUID,delete o[this.guid]},f.extend(j.prototype,h);var r="attachEvent"in a;return j.setUnselectable=function(a){r&&a.setAttribute("unselectable","on")},j.data=function(a){a=f.getQueryElement(a);var b=a&&a.flickityGUID;return b&&o[b]},f.htmlInit(j,"flickity"),k&&k.bridget&&k.bridget("flickity",j),j.Cell=g,j}),function(a,b){"function"==typeof define&&define.amd?define("unipointer/unipointer",["eventEmitter/EventEmitter","eventie/eventie"],function(c,d){return b(a,c,d)}):"object"==typeof exports?module.exports=b(a,require("wolfy87-eventemitter"),require("eventie")):a.Unipointer=b(a,a.EventEmitter,a.eventie)}(window,function(a,b,c){function d(){}function e(){}e.prototype=new b,e.prototype.bindStartEvent=function(a){this._bindStartEvent(a,!0)},e.prototype.unbindStartEvent=function(a){this._bindStartEvent(a,!1)},e.prototype._bindStartEvent=function(b,d){d=void 0===d?!0:!!d;var e=d?"bind":"unbind";a.navigator.pointerEnabled?c[e](b,"pointerdown",this):a.navigator.msPointerEnabled?c[e](b,"MSPointerDown",this):(c[e](b,"mousedown",this),c[e](b,"touchstart",this))},e.prototype.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},e.prototype.getTouch=function(a){for(var b=0,c=a.length;c>b;b++){var d=a[b];if(d.identifier==this.pointerIdentifier)return d}},e.prototype.onmousedown=function(a){var b=a.button;b&&0!==b&&1!==b||this._pointerDown(a,a)},e.prototype.ontouchstart=function(a){this._pointerDown(a,a.changedTouches[0])},e.prototype.onMSPointerDown=e.prototype.onpointerdown=function(a){this._pointerDown(a,a)},e.prototype._pointerDown=function(a,b){this.isPointerDown||(this.isPointerDown=!0,this.pointerIdentifier=void 0!==b.pointerId?b.pointerId:b.identifier,this.pointerDown(a,b))},e.prototype.pointerDown=function(a,b){this._bindPostStartEvents(a),this.emitEvent("pointerDown",[a,b])};var f={mousedown:["mousemove","mouseup"],touchstart:["touchmove","touchend","touchcancel"],pointerdown:["pointermove","pointerup","pointercancel"],MSPointerDown:["MSPointerMove","MSPointerUp","MSPointerCancel"]};return e.prototype._bindPostStartEvents=function(b){if(b){for(var d=f[b.type],e=b.preventDefault?a:document,g=0,h=d.length;h>g;g++){var i=d[g];c.bind(e,i,this)}this._boundPointerEvents={events:d,node:e}}},e.prototype._unbindPostStartEvents=function(){var a=this._boundPointerEvents;if(a&&a.events){for(var b=0,d=a.events.length;d>b;b++){var e=a.events[b];c.unbind(a.node,e,this)}delete this._boundPointerEvents}},e.prototype.onmousemove=function(a){this._pointerMove(a,a)},e.prototype.onMSPointerMove=e.prototype.onpointermove=function(a){a.pointerId==this.pointerIdentifier&&this._pointerMove(a,a)},e.prototype.ontouchmove=function(a){var b=this.getTouch(a.changedTouches);b&&this._pointerMove(a,b)},e.prototype._pointerMove=function(a,b){this.pointerMove(a,b)},e.prototype.pointerMove=function(a,b){this.emitEvent("pointerMove",[a,b])},e.prototype.onmouseup=function(a){this._pointerUp(a,a)},e.prototype.onMSPointerUp=e.prototype.onpointerup=function(a){a.pointerId==this.pointerIdentifier&&this._pointerUp(a,a)},e.prototype.ontouchend=function(a){var b=this.getTouch(a.changedTouches);b&&this._pointerUp(a,b)},e.prototype._pointerUp=function(a,b){this._pointerDone(),this.pointerUp(a,b)},e.prototype.pointerUp=function(a,b){this.emitEvent("pointerUp",[a,b])},e.prototype._pointerDone=function(){this.isPointerDown=!1,delete this.pointerIdentifier,this._unbindPostStartEvents(),this.pointerDone()},e.prototype.pointerDone=d,e.prototype.onMSPointerCancel=e.prototype.onpointercancel=function(a){a.pointerId==this.pointerIdentifier&&this._pointerCancel(a,a)},e.prototype.ontouchcancel=function(a){var b=this.getTouch(a.changedTouches);b&&this._pointerCancel(a,b)},e.prototype._pointerCancel=function(a,b){this._pointerDone(),this.pointerCancel(a,b)},e.prototype.pointerCancel=function(a,b){this.emitEvent("pointerCancel",[a,b])},e.getPointerPoint=function(a){return{x:void 0!==a.pageX?a.pageX:a.clientX,y:void 0!==a.pageY?a.pageY:a.clientY}},e}),function(a,b){"function"==typeof define&&define.amd?define("unidragger/unidragger",["eventie/eventie","unipointer/unipointer"],function(c,d){return b(a,c,d)}):"object"==typeof exports?module.exports=b(a,require("eventie"),require("unipointer")):a.Unidragger=b(a,a.eventie,a.Unipointer)}(window,function(a,b,c){function d(){}function e(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function f(){}function g(){return!1}f.prototype=new c,f.prototype.bindHandles=function(){this._bindHandles(!0)},f.prototype.unbindHandles=function(){this._bindHandles(!1)};var h=a.navigator;f.prototype._bindHandles=function(a){a=void 0===a?!0:!!a;var c;c=h.pointerEnabled?function(b){b.style.touchAction=a?"none":""}:h.msPointerEnabled?function(b){b.style.msTouchAction=a?"none":""}:function(){a&&j(g)};for(var d=a?"bind":"unbind",e=0,f=this.handles.length;f>e;e++){var g=this.handles[e];this._bindStartEvent(g,a),c(g),b[d](g,"click",this)}};var i="attachEvent"in document.documentElement,j=i?function(a){"IMG"==a.nodeName&&(a.ondragstart=g);for(var b=a.querySelectorAll("img"),c=0,d=b.length;d>c;c++){var e=b[c];e.ondragstart=g}}:d;return f.prototype.pointerDown=function(a,b){this._dragPointerDown(a,b);var c=document.activeElement;c&&c.blur&&c.blur(),this._bindPostStartEvents(a),this.emitEvent("pointerDown",[a,b])},f.prototype._dragPointerDown=function(a,b){this.pointerDownPoint=c.getPointerPoint(b);var d="touchstart"==a.type,f=a.target.nodeName;d||"SELECT"==f||e(a)},f.prototype.pointerMove=function(a,b){var c=this._dragPointerMove(a,b);this.emitEvent("pointerMove",[a,b,c]),this._dragMove(a,b,c)},f.prototype._dragPointerMove=function(a,b){var d=c.getPointerPoint(b),e={x:d.x-this.pointerDownPoint.x,y:d.y-this.pointerDownPoint.y};return!this.isDragging&&this.hasDragStarted(e)&&this._dragStart(a,b),e},f.prototype.hasDragStarted=function(a){return Math.abs(a.x)>3||Math.abs(a.y)>3},f.prototype.pointerUp=function(a,b){this.emitEvent("pointerUp",[a,b]),this._dragPointerUp(a,b)},f.prototype._dragPointerUp=function(a,b){this.isDragging?this._dragEnd(a,b):this._staticClick(a,b)},f.prototype._dragStart=function(a,b){this.isDragging=!0,this.dragStartPoint=f.getPointerPoint(b),this.isPreventingClicks=!0,this.dragStart(a,b)},f.prototype.dragStart=function(a,b){this.emitEvent("dragStart",[a,b])},f.prototype._dragMove=function(a,b,c){this.isDragging&&this.dragMove(a,b,c)},f.prototype.dragMove=function(a,b,c){e(a),this.emitEvent("dragMove",[a,b,c])},f.prototype._dragEnd=function(a,b){this.isDragging=!1;var c=this;setTimeout(function(){delete c.isPreventingClicks}),this.dragEnd(a,b)},f.prototype.dragEnd=function(a,b){this.emitEvent("dragEnd",[a,b])},f.prototype.onclick=function(a){this.isPreventingClicks&&e(a)},f.prototype._staticClick=function(a,b){var c=a.target.nodeName;("INPUT"==c||"TEXTAREA"==c)&&a.target.focus(),this.staticClick(a,b)},f.prototype.staticClick=function(a,b){this.emitEvent("staticClick",[a,b])},f.getPointerPoint=function(a){return{x:void 0!==a.pageX?a.pageX:a.clientX,y:void 0!==a.pageY?a.pageY:a.clientY}},f.getPointerPoint=c.getPointerPoint,f}),function(a,b){"function"==typeof define&&define.amd?define("flickity/js/drag",["classie/classie","eventie/eventie","./flickity","unidragger/unidragger","fizzy-ui-utils/utils"],function(c,d,e,f,g){return b(a,c,d,e,f,g)}):"object"==typeof exports?module.exports=b(a,require("desandro-classie"),require("eventie"),require("./flickity"),require("unidragger"),require("fizzy-ui-utils")):(a.Flickity=a.Flickity||{},a.Flickity.dragPrototype=b(a,a.classie,a.eventie,a.Flickity,a.Unidragger,a.fizzyUIUtils))}(window,function(a,b,c,d,e,f){function g(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function h(b){var c=e.getPointerPoint(b);return c.y-a.pageYOffset}f.extend(d.defaults,{draggable:!0,touchVerticalScroll:!0}),d.createMethods.push("_createDrag");var i={};f.extend(i,e.prototype),i._createDrag=function(){this.on("activate",this.bindDrag),this.on("uiChange",this._uiChangeDrag),this.on("childUIPointerDown",this._childUIPointerDownDrag),this.on("deactivate",this.unbindDrag)},i.bindDrag=function(){this.options.draggable&&!this.isDragBound&&(b.add(this.element,"is-draggable"),this.handles=[this.viewport],this.bindHandles(),this.isDragBound=!0)},i.unbindDrag=function(){this.isDragBound&&(b.remove(this.element,"is-draggable"),this.unbindHandles(),delete this.isDragBound)},i._uiChangeDrag=function(){delete this.isFreeScrolling},i._childUIPointerDownDrag=function(a){g(a),this.pointerDownFocus(a)},i.pointerDown=function(a,c){this._dragPointerDown(a,c);var d=document.activeElement;d&&d.blur&&d!=this.element&&d!=document.body&&d.blur(),this.pointerDownFocus(a),this.velocity=0,b.add(this.viewport,"is-pointer-down"),this._bindPostStartEvents(a),this.dispatchEvent("pointerDown",a,[c])};var j={touchstart:!0,MSPointerDown:!0},k={INPUT:!0,SELECT:!0};i.pointerDownFocus=function(a){!this.options.accessibility||j[a.type]||k[a.target.nodeName]||this.element.focus()},i.pointerMove=function(a,b){var c=this._dragPointerMove(a,b);this.touchVerticalScrollMove(a,b,c),this._dragMove(a,b,c),this.dispatchEvent("pointerMove",a,[b,c])},i.hasDragStarted=function(a){return!this.isTouchScrolling&&Math.abs(a.x)>3},i.pointerUp=function(a,c){delete this.isTouchScrolling,b.remove(this.viewport,"is-pointer-down"),this.dispatchEvent("pointerUp",a,[c]),this._dragPointerUp(a,c)};var l={touchmove:!0,MSPointerMove:!0};return i.touchVerticalScrollMove=function(b,c,d){var e=this.options.touchVerticalScroll,f="withDrag"==e?!e:this.isDragging||!e;!f&&l[b.type]&&!this.isTouchScrolling&&Math.abs(d.y)>10&&(this.startScrollY=a.pageYOffset,this.pointerWindowStartY=h(c),this.isTouchScrolling=!0)},i.dragStart=function(a,b){this.dragStartPosition=this.x,this.startAnimation(),this.dispatchEvent("dragStart",a,[b])},i.dragMove=function(a,b,c){g(a),this.previousDragX=this.x;var d=c.x,e=this.options.rightToLeft?-1:1;if(this.x=this.dragStartPosition+d*e,!this.options.wrapAround&&this.cells.length){var f=Math.max(-this.cells[0].target,this.dragStartPosition);this.x=this.x>f?.5*(this.x-f)+f:this.x;var h=Math.min(-this.getLastCell().target,this.dragStartPosition);this.x=this.x<h?.5*(this.x-h)+h:this.x}this.previousDragMoveTime=this.dragMoveTime,this.dragMoveTime=new Date,this.dispatchEvent("dragMove",a,[b,c])},i.dragEnd=function(a,b){this.dragEndFlick(),this.options.freeScroll&&(this.isFreeScrolling=!0);var c=this.dragEndRestingSelect();if(this.options.freeScroll&&!this.options.wrapAround){var d=this.getRestingPosition();this.isFreeScrolling=-d>this.cells[0].target&&-d<this.getLastCell().target}else this.options.freeScroll||c!=this.selectedIndex||(c+=this.dragEndBoostSelect());this.select(c),this.dispatchEvent("dragEnd",a,[b])},i.dragEndFlick=function(){if(isFinite(this.previousDragX)){var a=this.dragMoveTime-this.previousDragMoveTime;if(a){a/=1e3/60;var b=this.x-this.previousDragX;this.velocity=b/a}delete this.previousDragX}},i.dragEndRestingSelect=function(){var a=this.getRestingPosition(),b=Math.abs(this.getCellDistance(-a,this.selectedIndex)),c=this._getClosestResting(a,b,1),d=this._getClosestResting(a,b,-1),e=c.distance<d.distance?c.index:d.index;return this.options.contain&&!this.options.wrapAround&&(e=Math.abs(e-this.selectedIndex)<=1?this.selectedIndex:e),e},i._getClosestResting=function(a,b,c){for(var d=this.selectedIndex,e=1/0,f=this.options.contain&&!this.options.wrapAround?function(a,b){return b>=a}:function(a,b){return b>a};f(b,e)&&(d+=c,e=b,b=this.getCellDistance(-a,d),null!==b);)b=Math.abs(b);return{distance:e,index:d-c}},i.getCellDistance=function(a,b){var c=this.cells.length,d=this.options.wrapAround&&c>1,e=d?f.modulo(b,c):b,g=this.cells[e];if(!g)return null;var h=d?this.slideableWidth*Math.floor(b/c):0;return a-(g.target+h)},i.dragEndBoostSelect=function(){var a=this.getCellDistance(-this.x,this.selectedIndex);return a>0&&this.velocity<-1?1:0>a&&this.velocity>1?-1:0},i.staticClick=function(a,b){var c=this.getParentCell(a.target),d=c&&c.element,e=c&&f.indexOf(this.cells,c);this.dispatchEvent("staticClick",a,[b,d,e])},f.extend(d.prototype,i),d}),function(a,b){"function"==typeof define&&define.amd?define("tap-listener/tap-listener",["unipointer/unipointer"],function(c){return b(a,c)}):"object"==typeof exports?module.exports=b(a,require("unipointer")):a.TapListener=b(a,a.Unipointer)}(window,function(a,b){function c(a){this.bindTap(a)}c.prototype=new b,c.prototype.bindTap=function(a){a&&(this.unbindTap(),this.tapElement=a,this._bindStartEvent(a,!0))},c.prototype.unbindTap=function(){this.tapElement&&(this._bindStartEvent(this.tapElement,!0),delete this.tapElement)};var d=void 0!==a.pageYOffset;return c.prototype.pointerUp=function(c,e){var f=b.getPointerPoint(e),g=this.tapElement.getBoundingClientRect(),h=d?a.pageXOffset:document.body.scrollLeft,i=d?a.pageYOffset:document.body.scrollTop,j=f.x>=g.left+h&&f.x<=g.right+h&&f.y>=g.top+i&&f.y<=g.bottom+i;j&&this.emitEvent("tap",[c,e])},c.prototype.destroy=function(){this.pointerDone(),this.unbindTap()},c}),function(a,b){"function"==typeof define&&define.amd?define("flickity/js/prev-next-button",["eventie/eventie","./flickity","tap-listener/tap-listener","fizzy-ui-utils/utils"],function(c,d,e,f){return b(a,c,d,e,f)}):"object"==typeof exports?module.exports=b(a,require("eventie"),require("./flickity"),require("tap-listener"),require("fizzy-ui-utils")):(a.Flickity=a.Flickity||{},a.Flickity.PrevNextButton=b(a,a.eventie,a.Flickity,a.TapListener,a.fizzyUIUtils))}(window,function(a,b,c,d,e){function f(a,b){this.direction=a,this.parent=b,this._create()}var g="http://www.w3.org/2000/svg",h=function(){function a(){if(void 0!==b)return b;var a=document.createElement("div");return a.innerHTML="<svg/>",b=(a.firstChild&&a.firstChild.namespaceURI)==g}var b;return a}();return f.prototype=new d,f.prototype._create=function(){this.isEnabled=!0,this.isPrevious=-1==this.direction;var a=this.parent.options.rightToLeft?1:-1;this.isLeft=this.direction==a;var b=this.element=document.createElement("button");if(b.className="flickity-prev-next-button",b.className+=this.isPrevious?" previous":" next",b.setAttribute("type","button"),c.setUnselectable(b),h()){var d=this.createSVG();b.appendChild(d)}else this.setArrowText(),b.className+=" no-svg";var e=this;this.onCellSelect=function(){e.update()},this.parent.on("cellSelect",this.onCellSelect),this.on("tap",this.onTap),this.on("pointerDown",function(a,b){e.parent.childUIPointerDown(b)})},f.prototype.activate=function(){this.update(),this.bindTap(this.element),b.bind(this.element,"click",this),this.parent.element.appendChild(this.element)},f.prototype.deactivate=function(){this.parent.element.removeChild(this.element),d.prototype.destroy.call(this),b.unbind(this.element,"click",this)},f.prototype.createSVG=function(){var a=document.createElementNS(g,"svg");a.setAttribute("viewBox","0 0 100 100");var b=document.createElementNS(g,"path");b.setAttribute("d","M 50,0 L 60,10 L 20,50 L 60,90 L 50,100 L 0,50 Z"),b.setAttribute("class","arrow");var c=this.isLeft?"translate(15,0)":"translate(85,100) rotate(180)";return b.setAttribute("transform",c),a.appendChild(b),a},f.prototype.setArrowText=function(){var a=this.parent.options,b=this.isLeft?a.leftArrowText:a.rightArrowText;e.setText(this.element,b)},f.prototype.onTap=function(){if(this.isEnabled){this.parent.uiChange();var a=this.isPrevious?"previous":"next";this.parent[a]()}},f.prototype.handleEvent=e.handleEvent,f.prototype.onclick=function(){var a=document.activeElement;a&&a==this.element&&this.onTap()},f.prototype.enable=function(){this.isEnabled||(this.element.disabled=!1,this.isEnabled=!0)},f.prototype.disable=function(){this.isEnabled&&(this.element.disabled=!0,this.isEnabled=!1)},f.prototype.update=function(){var a=this.parent.cells;if(this.parent.options.wrapAround&&a.length>1)return void this.enable();var b=a.length?a.length-1:0,c=this.isPrevious?0:b,d=this.parent.selectedIndex==c?"disable":"enable";this[d]()},f.prototype.destroy=function(){this.deactivate()},e.extend(c.defaults,{prevNextButtons:!0,leftArrowText:"‹",rightArrowText:"›"}),c.createMethods.push("_createPrevNextButtons"),c.prototype._createPrevNextButtons=function(){this.options.prevNextButtons&&(this.prevButton=new f(-1,this),this.nextButton=new f(1,this),this.on("activate",this.activatePrevNextButtons))},c.prototype.activatePrevNextButtons=function(){this.prevButton.activate(),this.nextButton.activate(),this.on("deactivate",this.deactivatePrevNextButtons)},c.prototype.deactivatePrevNextButtons=function(){this.prevButton.deactivate(),this.nextButton.deactivate(),this.off("deactivate",this.deactivatePrevNextButtons)},c.PrevNextButton=f,f}),function(a,b){"function"==typeof define&&define.amd?define("flickity/js/page-dots",["eventie/eventie","./flickity","tap-listener/tap-listener","fizzy-ui-utils/utils"],function(c,d,e,f){return b(a,c,d,e,f)}):"object"==typeof exports?module.exports=b(a,require("eventie"),require("./flickity"),require("tap-listener"),require("fizzy-ui-utils")):(a.Flickity=a.Flickity||{},a.Flickity.PageDots=b(a,a.eventie,a.Flickity,a.TapListener,a.fizzyUIUtils))}(window,function(a,b,c,d,e){function f(a){this.parent=a,this._create()}return f.prototype=new d,f.prototype._create=function(){this.holder=document.createElement("ol"),this.holder.className="flickity-page-dots",c.setUnselectable(this.holder),this.dots=[];var a=this;this.onCellSelect=function(){a.updateSelected()},this.parent.on("cellSelect",this.onCellSelect),this.on("tap",this.onTap),this.on("pointerDown",function(b,c){a.parent.childUIPointerDown(c)})},f.prototype.activate=function(){this.setDots(),this.updateSelected(),this.bindTap(this.holder),this.parent.element.appendChild(this.holder)},f.prototype.deactivate=function(){this.parent.element.removeChild(this.holder),d.prototype.destroy.call(this)},f.prototype.setDots=function(){var a=this.parent.cells.length-this.dots.length;a>0?this.addDots(a):0>a&&this.removeDots(-a)},f.prototype.addDots=function(a){for(var b=document.createDocumentFragment(),c=[];a;){var d=document.createElement("li");d.className="dot",b.appendChild(d),c.push(d),a--}this.holder.appendChild(b),this.dots=this.dots.concat(c)},f.prototype.removeDots=function(a){for(var b=this.dots.splice(this.dots.length-a,a),c=0,d=b.length;d>c;c++){var e=b[c];this.holder.removeChild(e)}},f.prototype.updateSelected=function(){this.selectedDot&&(this.selectedDot.className="dot"),this.dots.length&&(this.selectedDot=this.dots[this.parent.selectedIndex],this.selectedDot.className="dot is-selected")},f.prototype.onTap=function(a){var b=a.target;if("LI"==b.nodeName){this.parent.uiChange();var c=e.indexOf(this.dots,b);this.parent.select(c)}},f.prototype.destroy=function(){this.deactivate()},c.PageDots=f,e.extend(c.defaults,{pageDots:!0}),c.createMethods.push("_createPageDots"),c.prototype._createPageDots=function(){this.options.pageDots&&(this.pageDots=new f(this),this.on("activate",this.activatePageDots),this.on("cellAddedRemoved",this.onCellAddedRemovedPageDots),this.on("deactivate",this.deactivatePageDots))},c.prototype.activatePageDots=function(){this.pageDots.activate()},c.prototype.onCellAddedRemovedPageDots=function(){this.pageDots.setDots()},c.prototype.deactivatePageDots=function(){this.pageDots.deactivate()},c.PageDots=f,f}),function(a,b){"function"==typeof define&&define.amd?define("flickity/js/player",["eventEmitter/EventEmitter","eventie/eventie","./flickity"],function(a,c,d){return b(a,c,d)}):"object"==typeof exports?module.exports=b(require("wolfy87-eventemitter"),require("eventie"),require("./flickity")):(a.Flickity=a.Flickity||{},a.Flickity.Player=b(a.EventEmitter,a.eventie,a.Flickity))}(window,function(a,b,c){function d(a){if(this.isPlaying=!1,this.parent=a,f){var b=this;this.onVisibilityChange=function(){b.visibilityChange()}}}var e,f;return"hidden"in document?(e="hidden",f="visibilitychange"):"webkitHidden"in document&&(e="webkitHidden",f="webkitvisibilitychange"),d.prototype=new a,d.prototype.play=function(){this.isPlaying=!0,delete this.isPaused,f&&document.addEventListener(f,this.onVisibilityChange,!1),this.tick()},d.prototype.tick=function(){if(this.isPlaying&&!this.isPaused){this.tickTime=new Date;var a=this.parent.options.autoPlay;a="number"==typeof a?a:3e3;var b=this;this.timeout=setTimeout(function(){b.parent.next(!0),b.tick()},a)}},d.prototype.stop=function(){this.isPlaying=!1,delete this.isPaused,this.clear(),f&&document.removeEventListener(f,this.onVisibilityChange,!1)},d.prototype.clear=function(){clearTimeout(this.timeout)},d.prototype.pause=function(){this.isPlaying&&(this.isPaused=!0,this.clear())},d.prototype.unpause=function(){this.isPaused&&this.play()},d.prototype.visibilityChange=function(){var a=document[e];this[a?"pause":"unpause"]()},c.createMethods.push("_createPlayer"),c.prototype._createPlayer=function(){this.player=new d(this),this.on("activate",this.activatePlayer),this.on("uiChange",this.stopPlayer),this.on("pointerDown",this.stopPlayer),this.on("deactivate",this.deactivatePlayer)},c.prototype.activatePlayer=function(){this.options.autoPlay&&(this.player.play(),b.bind(this.element,"mouseenter",this),this.isMouseenterBound=!0)},c.prototype.stopPlayer=function(){this.player.stop()},c.prototype.deactivatePlayer=function(){this.player.stop(),this.isMouseenterBound&&(b.unbind(this.element,"mouseenter",this),delete this.isMouseenterBound)},c.prototype.onmouseenter=function(){this.player.pause(),b.bind(this.element,"mouseleave",this)},c.prototype.onmouseleave=function(){this.player.unpause(),b.unbind(this.element,"mouseleave",this)},c.Player=d,d}),function(a,b){"function"==typeof define&&define.amd?define("flickity/js/add-remove-cell",["./flickity","fizzy-ui-utils/utils"],function(c,d){return b(a,c,d)}):"object"==typeof exports?module.exports=b(a,require("./flickity"),require("fizzy-ui-utils")):(a.Flickity=a.Flickity||{},a.Flickity=b(a,a.Flickity,a.fizzyUIUtils))}(window,function(a,b,c){function d(a){for(var b=document.createDocumentFragment(),c=0,d=a.length;d>c;c++){var e=a[c];b.appendChild(e.element)}return b}return b.prototype.insert=function(a,b){var c=this._makeCells(a);if(c&&c.length){var e=this.cells.length;b=void 0===b?e:b;var f=d(c),g=b==e;if(g)this.slider.appendChild(f);else{var h=this.cells[b].element;this.slider.insertBefore(f,h)}if(0===b)this.cells=c.concat(this.cells);else if(g)this.cells=this.cells.concat(c);else{var i=this.cells.splice(b,e-b);this.cells=this.cells.concat(c).concat(i)}this._sizeCells(c);var j=b>this.selectedIndex?0:c.length;this._cellAddedRemoved(b,j)}},b.prototype.append=function(a){this.insert(a,this.cells.length)},b.prototype.prepend=function(a){this.insert(a,0)},b.prototype.remove=function(a){var b,d,e,f=this.getCells(a),g=0;for(b=0,d=f.length;d>b;b++){e=f[b];var h=c.indexOf(this.cells,e)<this.selectedIndex;g-=h?1:0}for(b=0,d=f.length;d>b;b++)e=f[b],e.remove(),c.removeFrom(this.cells,e);f.length&&this._cellAddedRemoved(0,g)},b.prototype._cellAddedRemoved=function(a,b){b=b||0,this.selectedIndex+=b,this.selectedIndex=Math.max(0,Math.min(this.cells.length-1,this.selectedIndex)),this.emitEvent("cellAddedRemoved",[a,b]),this.cellChange(a)},b.prototype.cellSizeChange=function(a){var b=this.getCell(a);if(b){b.getSize();var d=c.indexOf(this.cells,b);this.cellChange(d)}},b.prototype.cellChange=function(a){a=a||0,this._positionCells(a),this._getWrapShiftCells(),this.setGallerySize(),this.options.freeScroll?this.positionSlider():(this.positionSliderAtSelected(),this.select(this.selectedIndex))},b}),function(a,b){"function"==typeof define&&define.amd?define("flickity/js/index",["./flickity","./drag","./prev-next-button","./page-dots","./player","./add-remove-cell"],b):"object"==typeof exports&&(module.exports=b(require("./flickity"),require("./drag"),require("./prev-next-button"),require("./page-dots"),require("./player"),require("./add-remove-cell")))}(window,function(a){return a}),function(a,b){"function"==typeof define&&define.amd?define("flickity-as-nav-for/as-nav-for",["classie/classie","flickity/js/index","fizzy-ui-utils/utils"],function(c,d,e){return b(a,c,d,e)}):"object"==typeof exports?module.exports=b(a,require("desandro-classie"),require("flickity"),require("fizzy-ui-utils")):a.Flickity=b(a,a.classie,a.Flickity,a.fizzyUIUtils)}(window,function(a,b,c,d){return c.createMethods.push("_createAsNavFor"),c.prototype._createAsNavFor=function(){this.on("activate",this.activateAsNavFor),this.on("deactivate",this.deactivateAsNavFor),this.on("destroy",this.destroyAsNavFor);var a=this.options.asNavFor;if(a){var b=this;setTimeout(function(){b.setNavCompanion(a)})}},c.prototype.setNavCompanion=function(a){a=d.getQueryElement(a);var b=c.data(a);if(b&&b!=this){this.navCompanion=b;var e=this;this.onNavCompanionSelect=function(){e.navCompanionSelect()},b.on("cellSelect",this.onNavCompanionSelect),this.on("staticClick",this.onNavStaticClick),this.navCompanionSelect()}},c.prototype.navCompanionSelect=function(){if(this.navCompanion){var a=this.navCompanion.selectedIndex;this.select(a),this.removeNavSelectedElement(),this.selectedIndex==a&&(this.navSelectedElement=this.cells[a].element,b.add(this.navSelectedElement,"is-nav-selected"))}},c.prototype.activateAsNavFor=function(){this.navCompanionSelect()},c.prototype.removeNavSelectedElement=function(){this.navSelectedElement&&(b.remove(this.navSelectedElement,"is-nav-selected"),delete this.navSelectedElement)},c.prototype.onNavStaticClick=function(a,b,c,d){"number"==typeof d&&this.navCompanion.select(d)},c.prototype.deactivateAsNavFor=function(){this.removeNavSelectedElement()},c.prototype.destroyAsNavFor=function(){this.navCompanion&&(this.navCompanion.off("cellSelect",this.onNavCompanionSelect),this.off("staticClick",this.onNavStaticClick),delete this.navCompanion)},c}),function(a,b){"function"==typeof define&&define.amd?define("imagesloaded/imagesloaded",["eventEmitter/EventEmitter","eventie/eventie"],function(c,d){return b(a,c,d)}):"object"==typeof exports?module.exports=b(a,require("wolfy87-eventemitter"),require("eventie")):a.imagesLoaded=b(a,a.EventEmitter,a.eventie)}(window,function(a,b,c){function d(a,b){for(var c in b)a[c]=b[c];return a}function e(a){return"[object Array]"===m.call(a)}function f(a){var b=[];if(e(a))b=a;else if("number"==typeof a.length)for(var c=0,d=a.length;d>c;c++)b.push(a[c]);else b.push(a);return b}function g(a,b,c){if(!(this instanceof g))return new g(a,b);"string"==typeof a&&(a=document.querySelectorAll(a)),this.elements=f(a),this.options=d({},this.options),"function"==typeof b?c=b:d(this.options,b),c&&this.on("always",c),this.getImages(),j&&(this.jqDeferred=new j.Deferred);var e=this;setTimeout(function(){e.check()})}function h(a){this.img=a}function i(a){this.src=a,n[a]=this}var j=a.jQuery,k=a.console,l="undefined"!=typeof k,m=Object.prototype.toString;g.prototype=new b,g.prototype.options={},g.prototype.getImages=function(){this.images=[];for(var a=0,b=this.elements.length;b>a;a++){var c=this.elements[a];"IMG"===c.nodeName&&this.addImage(c);var d=c.nodeType;if(d&&(1===d||9===d||11===d))for(var e=c.querySelectorAll("img"),f=0,g=e.length;g>f;f++){var h=e[f];this.addImage(h)}}},g.prototype.addImage=function(a){var b=new h(a);this.images.push(b)},g.prototype.check=function(){function a(a,e){return b.options.debug&&l&&k.log("confirm",a,e),b.progress(a),c++,c===d&&b.complete(),!0}var b=this,c=0,d=this.images.length;if(this.hasAnyBroken=!1,!d)return void this.complete();for(var e=0;d>e;e++){var f=this.images[e];f.on("confirm",a),f.check()}},g.prototype.progress=function(a){this.hasAnyBroken=this.hasAnyBroken||!a.isLoaded;var b=this;setTimeout(function(){b.emit("progress",b,a),b.jqDeferred&&b.jqDeferred.notify&&b.jqDeferred.notify(b,a)})},g.prototype.complete=function(){var a=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var b=this;setTimeout(function(){if(b.emit(a,b),b.emit("always",b),b.jqDeferred){var c=b.hasAnyBroken?"reject":"resolve";b.jqDeferred[c](b)}})},j&&(j.fn.imagesLoaded=function(a,b){var c=new g(this,a,b);return c.jqDeferred.promise(j(this))}),h.prototype=new b,h.prototype.check=function(){var a=n[this.img.src]||new i(this.img.src);if(a.isConfirmed)return void this.confirm(a.isLoaded,"cached was confirmed");if(this.img.complete&&void 0!==this.img.naturalWidth)return void this.confirm(0!==this.img.naturalWidth,"naturalWidth");var b=this;a.on("confirm",function(a,c){return b.confirm(a.isLoaded,c),!0}),a.check()},h.prototype.confirm=function(a,b){this.isLoaded=a,this.emit("confirm",this,b)};var n={};return i.prototype=new b,i.prototype.check=function(){if(!this.isChecked){var a=new Image;c.bind(a,"load",this),c.bind(a,"error",this),a.src=this.src,this.isChecked=!0}},i.prototype.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},i.prototype.onload=function(a){this.confirm(!0,"onload"),this.unbindProxyEvents(a)},i.prototype.onerror=function(a){this.confirm(!1,"onerror"),this.unbindProxyEvents(a)},i.prototype.confirm=function(a,b){this.isConfirmed=!0,this.isLoaded=a,this.emit("confirm",this,b)},i.prototype.unbindProxyEvents=function(a){c.unbind(a.target,"load",this),c.unbind(a.target,"error",this)},g}),function(a,b){"function"==typeof define&&define.amd?define(["flickity/js/index","imagesloaded/imagesloaded"],function(c,d){return b(a,c,d)}):"object"==typeof exports?module.exports=b(a,require("flickity"),require("imagesloaded")):a.Flickity=b(a,a.Flickity,a.imagesLoaded)}(window,function(a,b,c){return b.createMethods.push("_createImagesLoaded"),b.prototype._createImagesLoaded=function(){this.on("activate",this.imagesLoaded)},b.prototype.imagesLoaded=function(){function a(a,c){var d=b.getParentCell(c.img);b.cellSizeChange(d&&d.element)}if(this.options.imagesLoaded){var b=this;this.loader=c(this.slider).on("progress",a)}},b});var Loader=Loader||function(){function a(a,b){this.assets={},this.images=[],this.readyCallback=a,this.count=0,this.view=b,this.loaded=!1}return a.prototype.register=function(a){this.assets[a]=!1,this.count+=1},a.prototype.ready=function(a){window.debug&&console.log("ready >> "+a),this.assets[a]=!0,this.loaded||(this.view&&this.view.update(this.percentRemaining()),this.isReady()&&(this.loaded=!0,this.view?this.view&&this.view.finish(this.readyCallback):this.readyCallback&&this.readyCallback()))},a.prototype.isReady=function(){for(var a in this.assets)if(this.assets.hasOwnProperty(a)&&1!=this.assets[a])return!1;return!0},a.prototype.percentRemaining=function(){return this.remainingAssets()/this.count},a.prototype.remainingAssets=function(){var a=0;for(var b in this.assets)this.assets.hasOwnProperty(b)&&1!=this.assets[b]&&a++;return a},a.prototype.preloadImages=function(a){this.register("preload");for(var b=0;b<a.length;b++)this.preloadImage(a[b]);this.ready("preload")},a.prototype.preloadImage=function(a){var b=this;this.register(a);var c=new Image;c.onload=function(){b.ready(a)},c.src=a,c.complete&&c.onload(),b.images.push(c)},a}();!function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[],c={browser:b[1]||"",version:b[2]||"0"};return browser={},c.browser&&(browser[c.browser]=!0,browser.version=c.version),browser.chrome?browser.webkit=!0:browser.webkit&&(browser.safari=!0),window.$&&($.browser=browser),browser}(navigator.userAgent);var is_iphone=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPod/i),is_ipad=navigator.userAgent.match(/iPad/i),is_android=navigator.userAgent.match(/Android/i),is_mobile=is_iphone||is_ipad||is_android,is_desktop=!is_mobile,app_devicePixelRatio=1;!function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"];
+window.requestAnimationFrame||(window.requestAnimationFrame=function(b,c){var d=(new Date).getTime(),e=Math.max(0,16-(d-a)),f=window.setTimeout(function(){b(d+e)},e);return a=d+e,f}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(a){clearTimeout(a)})}();var raf=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame,caf=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame;window.$&&($.fn["int"]=function(){return parseInt($(this).val(),10)},$.fn["float"]=function(){return parseFloat($(this).val())},$.fn.string=function(){return trim($(this).val())},$.fn.enable=function(){return $(this).attr("disabled",null)},$.fn.disable=function(){return $(this).attr("disabled","disabled")},$.fn.sanitize=function(a){return trim(sanitize($(this).val()))},$.fn.htmlSafe=function(a){return $(this).html(sanitize(a))},$.fn.toDollars=function(a){return $(this).html((a/100).toFixed(2))});var E=Math.E,PI=Math.PI,PHI=(1+Math.sqrt(5))/2,TWO_PI=2*PI,HALF_PI=PI/2,LN10=Math.LN10,guid_syllables="iz az ez or iv ex baz el lo lum ot un no".split(" "),guid_n=0;Function.prototype.bind||(Function.prototype.bind=function(a){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d&&a?this:a,b.concat(Array.prototype.slice.call(arguments)))};return d.prototype=this.prototype,e.prototype=new d,e}),function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(b,c){var d=(new Date).getTime(),e=Math.max(0,16-(d-a)),f=window.setTimeout(function(){b(d+e)},e);return a=d+e,f}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(a){clearTimeout(a)})}();var strips=[],boxImages=[],done_loading=!1,menu_open=!1,entry_open=!1,shuffled_indexes,wasPrev=!1,navWidth,environment={},hashes={};environment.init=function(){$("#scene").addClass("fade");var a=new Loader(environment.ready,new HustleLoader),b=$("#preload-image-list").html().split("\n").filter(function(a){return!!a});boxImages=$("#box-image-list").html().split("\n");var c=$(".sub a").toArray().map(function(a){return $(a).data("image")}),d=b.concat(c).concat(boxImages).filter(function(a){return!!a});a.preloadImages(d),a.ready()},environment.ready=function(){window.innerWidth<500&&document.body.classList.add("mobile"),is_mobile?controls=new MX.OrbitCameraMobile({radius:1e5,radiusRange:[10,2e3],rotationX:PI/2,rotationY:PI,wheelEase:20,ease:100}):controls=new MX.OrbitCamera({radius:1e5,radiusRange:[10,2e3],rotationX:PI/2,rotationY:PI,wheelEase:20,ease:100}),controls.init(),$(".cat").click(function(){$(this).hasClass("active")?($(".cat").removeClass("active"),$(".sub").removeClass("active")):($(".cat").removeClass("active"),$(".sub").removeClass("active"),$(this).addClass("active"),$(this).next(".sub").addClass("active"))}),$("nav a").click(function(a){if(!$(this).parent().hasClass("contact")){a.preventDefault();var b="/"+$(this).data("type")+"/"+$(this).data("id"),c="#"+b;if(!done_loading||window.location.hash!=c){window.location.hash=c,$("nav a.active").removeClass("active");var d=$(this);d.addClass("active"),open_entry(),$("#entry_container").removeClass("visible");var e=$("<div>");e.load(b+" .entry",function(){display_entry(e.children()[0])})}}}),$("nav .about").click(function(a){if(a.preventDefault(),!done_loading||"#/about"!=window.location.hash){window.location.hash="#/about",$("nav a.active").removeClass("active"),open_entry(),$("#entry_container").removeClass("visible");var b=$("<div>");b.load("/about/ .entry",function(){console.log(b.html()),display_entry(b.children()[0])})}}),$(".toggleRapper").click(toggle_menu),$(document).on("click",".project",function(){var a="/"+$(this).data("type")+"/"+$(this).data("id");$(".entry").css("pointer-events","none"),load_hash(a)}),$(".toplogo,.logo").click(function(a){a.preventDefault(),$(".active").removeClass("active"),$(".cat.active, .sub.active, .sub.a").addClass("active"),controls.pause(),window.location.hash="#",load_index()}),Share.init(),$(window).mousedown(function(a){menu_open||(controls.pause(),controls.opt.ease=10)}),$(window).mouseup(function(a){menu_open||controls.pause(),controls.opt.ease=100}),$(window).mousemove(function(a){if(!menu_open&&!controls.dragging){var b=a.pageX/window.innerWidth,c=pow(abs(2*(b-.5)),.5),d=a.pageY/window.innerHeight,e=pow(abs(2*(d-.5)),.5),f=dist(c,e,0,0);controls.zoomPercent(clamp(f-.3,0,1)),controls.move(b*TWO_PI*4,PI/2+(1-d)*TWO_PI*4)}}),$("body").removeClass("loading");var a=window.location.hash.replace("#","");$("nav a").each(function(){var a="/"+$(this).data("type")+"/"+$(this).data("id");hashes[a]=this,$(this).data("hash",a)}),hashes["/about"]=$("nav .about"),a in hashes?(toggle_menu(!1),load_hash(a),setTimeout(build_scene,200)):(build_scene(),setTimeout(function(){$("#scene").removeClass("fade")},100)),setTimeout(function(){done_loading=!0},200),$(document).on("webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange",function(){function a(a){a?$("html").addClass("full-screen"):$("html").removeClass("full-screen"),resize_gallery(a)}onFullScreenSettle(requestAnimationFrame,getFullScreenElement(),a)}),$("#scene_container").click(function(a){$("body").hasClass("menuActive")||$(".entry").length||toggle_menu()}),is_desktop&&($(document).on("mouseenter",".project",function(){var a=$(this).data("type");$(".entry").addClass("hover"),$(this).addClass("hover"),$(".top .cat").not("[data-type="+a+"]").addClass("no-hover"),$(".cat[data-type="+a+"]").addClass("hover")}),$(document).on("mouseleave",".project",function(){$(this).data("type");$(".entry").removeClass("hover"),$(this).removeClass("hover"),$(".cat").removeClass("hover").removeClass("no-hover")}))};var entry_open_time=0,gallery=null,videos=[];environment.update=noop,environment.updateOnReady=function(a){controls.delta(menu_open?0:1/16,0),scene.update(),controls.update()};var Strip=function(a){this.opt=a;var b=this.root=new MX.Object3D;b.x=a.x||0,b.y=a.y||0,b.z=a.z||0,b.rotationX=a.rotationX||0,b.rotationY=a.rotationY||0,b.rotationZ=a.rotationZ||0,b.addTo(scene);var c=b;this.els=(a.images.toArray?a.images.toArray():a.images).map(function(a,b){var d;if("string"==typeof a)d=a;else{var e=$(a).data();d=e.image}var a=new MX.Image({src:d,onload:function(a){}});return a.setCSSTransformOrigin("50% 100%"),a.addTo(c),a.update(),c=a,a})};Strip.prototype.update=function(a){var b=this.els.length,c=this.opt.offset;a+=c,this.els.forEach(function(c,d){c.rotationX=d/b*Math.PI*2,c.skewY=cos(2*(1+d)*Math.PI*a/1e5+100)/10,c.y=c.height/2})};var Share={init:function(){$(document).on("click",".fb",Share.facebook),$(document).on("click",".tw",Share.twitter),setTimeout(function(){window.fbAsyncInit=function(){FB.init({appId:"643786815755427",xfbml:!0,version:"v2.3"})},function(a,b,c){var d,e=a.getElementsByTagName(b)[0];a.getElementById(c)||(d=a.createElement(b),d.id=c,d.src="//connect.facebook.net/en_US/sdk.js",e.parentNode.insertBefore(d,e))}(document,"script","facebook-jssdk")},1e3)},facebook:function(a){a.preventDefault();var b=$(".gallery img").first().attr("src")||($(".gallery .underlay").css("background-image")||"").replace("url(","").replace(")","")||"http://twohustlers.com/assets/images/2H_LOGOMARK.png";FB.ui({method:"feed",link:window.location.href,caption:$(".postname").html(),picture:b},function(a){})},twitter:function(a){a.preventDefault();var b=window.location.href,c=$(".postname").html(),d="https://twitter.com/home?status="+encodeURIComponent(c+" "+b);window.open(d,"_blank")}};is_mobile?$("html").addClass("mobile"):$("html").addClass("desktop");var scene,cam,map,app=new function(){};app.mode={editor:!1,builder:!1},app.init=function(){app.launch()},app.launch=function(){function a(c){b=c,requestAnimationFrame(a),environment.update(c)}$.browser.msie?$("html").addClass("msie"):$("html").addClass("notmsie"),scene=(new MX.Scene).addTo("#scene"),$(window).resize(app.resize),app.resize(),cam=scene.camera;var b=0;FastClick.attach(document.body),window.environment&&window.environment.init(),a(),window.scrollTo(0,0)},app.resize=function(){scene.width=window.innerWidth,scene.height=window.innerHeight,scene.perspective=min(window.innerWidth,scene.height),scene.update()},app.fallback=function(){app.unsupported=!0;var a="Sorry, your browser is not supported.<br><br>Please use <a href='http://chrome.com/'>Chrome</a> or <a href='https://www.apple.com/safari/'>Safari</a> or <a href='http://getfirefox.com/'>Firefox</a>.",b=$("<div>");b.attr("id","fallback"),b.html(a),$("body").append(b)},app.on=function(){app.tube.on.apply(app.tube,arguments)},app.off=function(){app.tube.off.apply(app.tube,arguments)},app.position=function(a){var b={x:a.x,y:a.y,z:a.z,rotationX:a.rotationX,rotationY:a.rotationY};return 1!==a.scale&&(b.scale=a.scale),b},document.addEventListener("DOMContentLoaded",app.init); \ No newline at end of file
diff --git a/site/public/assets/images/2H_LOGOMARK.svg b/site/public/assets/images/2H_LOGOMARK.svg
new file mode 100644
index 0000000..43a9691
--- /dev/null
+++ b/site/public/assets/images/2H_LOGOMARK.svg
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="338.1 278.3 660.5 819.7" enable-background="new 338.1 278.3 660.5 819.7" xml:space="preserve">
+<g id="Layer_1_1_">
+</g>
+<g id="Isolation_Mode">
+ <g>
+ <polygon fill="#ffffff" points="720.7,802.9 659.5,827.3 790.3,937.6 930.1,881.7 998.6,939.5 998.6,866.8 926.7,806.2 789.5,860.9 "/>
+ <polygon fill="#ffffff" points="721.2,711.6 340.2,863.7 405.8,919 549.2,861.8 695.4,985.1 552.2,1042.3 618.2,1098 994.4,947.6 928.4,891.9
+ 788.8,947.8 642.5,824.5 789.5,765.7 789.5,690.6 721.2,633 "/>
+ <polygon fill="#ffffff" points="616.5,930.1 548.3,957.4 548.3,1034.3 678.5,982.3 "/>
+ <path fill="#ffffff" d="M690.5,318.7c0.4,0.7,0.8,1.4,1.1,2.2l0.1,0.4c0.4,0.8,0.8,1.7,1.3,2.5c1.3,2.8,2.5,5.7,3.6,8.9c0.3,0.7,0.6,1.5,0.8,2.5
+ l0.1,0.3c0,0.3,0.1,0.4,0.3,0.7c0.3,0.6,0.4,1.3,0.6,1.8c0.1,0.6,0.4,1.3,0.6,2c0.7,2.2,1.1,4,1.5,5.7c0.3,1,0.4,2,0.7,2.9
+ c0.1,0.6,0.3,1,0.3,1.5c0.3,1.1,0.4,2.2,0.6,3.4c0.1,1.1,0.4,2.4,0.6,3.5v0.1c0.4,2.7,0.7,5.4,0.8,8.1c0.1,1.3,0.1,2.4,0.3,3.6
+ c0.1,2.9,0.3,5.6,0.3,8.1v1.8c0,0.3,0,0.6,0,0.8v0.4c0,0.3,0,0.6,0,0.8c0,0.8,0,1.8-0.1,2.7c0,1,0,2-0.1,2.9
+ c-0.1,3.1-0.4,6.3-0.7,9.6c-0.1,1.5-0.4,3.2-0.6,4.7c-0.1,1-0.3,2-0.4,3.1c-0.3,1.7-0.6,3.6-1,5.7c-1.3,7.1-3.1,14.5-5.2,21.9
+ c-0.3,0.7-0.4,1.4-0.7,2.1l-0.1,0.6c-0.1,0.6-0.4,1.1-0.6,1.8c-0.3,0.7-0.6,1.5-0.8,2.4c-0.7,2.2-1.5,4.3-2.2,6.4l-0.8,2.4
+ c-0.4,1.3-0.8,2.4-1.4,3.5c-0.4,1-0.8,2-1.3,2.9c-5.9,14.1-13.4,28.5-22.3,42.7l-0.1,0.3c-0.6,0.8-1.1,1.7-1.5,2.5l-0.1,0.1
+ c-1,1.4-1.8,2.8-2.8,4.2c-1.1,1.5-2.1,3.2-3.2,4.7c-3.8,5.3-7.7,10.6-11.4,15.6c-1.4,1.7-2.7,3.5-4,5.2
+ c-4.2,5.3-8.4,10.1-12.4,14.8l-0.8,1c-0.6,0.7-1.3,1.4-1.8,2.1c-5.4,6-11,11.9-16.6,17.5c-1,1-2,2-2.8,2.8l-0.1,0.1L512.9,661
+ c-1.4,1.4-30.3,32.5-39.8,57.8l156.8-62.5c4.9-4.7,10.2-10.1,12.4-12.1c30.4-29.7,61.7-60.6,84.9-97.4
+ c22.9-36.9,35.3-71.8,36.6-103.7c1.7-22.3-0.1-63.8-30.4-91.2c-6.6-5.9-13.7-11.7-20-16.9c-3.4-2.7-6.7-5.4-9.9-8.2l-7.3-6.1
+ l-8.1-6.7c0.1,0.1,0.1,0.3,0.3,0.4C688.7,315.3,689.5,316.9,690.5,318.7z"/>
+ <path fill="#ffffff" d="M403.3,590.8l100.2-40.1c0-0.1,0-0.4,0-0.6l0,0V550c0-0.4,0-0.8,0-1.4c0-0.8,0-1.5,0.1-2.4c0-0.6,0-1.1,0.1-1.7
+ c0-0.7,0.1-1.3,0.1-2s0.1-1.3,0.1-2c0-0.6,0.1-1.1,0.1-1.5c0-0.7,0.1-1.4,0.3-2.1c0-0.4,0.1-0.8,0.1-1.3c0.1-0.7,0.1-1.5,0.3-2.2
+ c0-0.3,0.1-0.7,0.1-1c0.1-0.8,0.3-1.5,0.4-2.4c0-0.3,0.1-0.4,0.1-0.7c0.1-0.8,0.3-1.8,0.4-2.7l0,0c11.4-58.9,60.7-81.7,78.9-88.1
+ c0.1-0.7,0.3-1.4,0.3-2.1l0.1-0.6c0.1-0.7,0.3-1.5,0.3-2.4c0.1-0.8,0.1-1.5,0.1-2.4v-0.3c0-0.1,0-0.3,0-0.4c0-0.1,0-0.3,0-0.4v-1
+ c0-1,0.1-1.8,0.1-2.8v-0.1c0-1,0-2,0-2.9v-1c0-13.7-4.5-24.9-12.3-31.6c-0.8-0.7-1.8-1.4-2.7-2c-5.6-3.6-12.6-5.6-20.8-5.6
+ c-5.2,0-10.8,0.7-16.6,2.2c-0.6,0.1-1,0.3-1.5,0.4l-0.3,0.1c-4.5,1.1-9.2,2.7-13.8,4.6c-6.4,2.5-12.6,5.6-18.3,9.1
+ c-2.1,1.3-3.9,2.4-5.6,3.5c-1.5,1-2.9,2.1-4.5,3.2c0,0-0.1,0-0.1,0.1c-3.8,2.9-6.7,5.3-8.2,6.7c-1.4,1.3-4.9,4.6-5.3,5l-0.1,0.1
+ c-1.1,1.1-2,2.1-2.9,3.1c-1.4,1.5-2.8,3.2-4.2,4.9c-0.8,1.1-1.7,2.2-2.7,3.4c-0.3,0.4-2.5,3.5-3.6,5.2c-0.8,1.1-1.5,2.4-2.2,3.5
+ c-0.7,1.1-1.4,2.4-2.1,3.6c-0.7,1.1-1.3,2.2-2,3.6c-1,1.8-1.8,3.8-2.7,5.6c-6.4,14.4-9.6,29.9-9.6,46.1c0,0.8,0,1.7,0,2.4l0.3,3.2
+ l-98.6,39.4L403.3,590.8z"/>
+ <path fill="#ffffff" d="M712.3,705.6v-72.9L459.9,733.2l1.5-8c5.7-29.3,43-69,44.5-70.6l0.1-0.1l95.1-94c1-1,2-1.8,2.8-2.8
+ c5.6-5.6,11-11.3,16.3-17.2c0.6-0.7,1.1-1.3,1.7-2l0.8-1c4-4.6,8.1-9.4,12.1-14.4c1.4-1.7,2.7-3.4,4-5c3.8-4.9,7.5-10.1,11.2-15.2
+ c1.1-1.5,2.1-3.1,3.2-4.7c1-1.4,1.8-2.8,2.8-4.2v-0.1c0.6-0.8,1-1.5,1.5-2.4l0.1-0.3c8.8-13.8,16.1-27.8,21.8-41.5
+ c0.4-1,0.8-2,1.1-2.8c0.4-1.1,0.8-2.2,1.3-3.2l0.8-2.4c0.7-2,1.4-4,2.1-6.1v-0.1c0.3-0.7,0.6-1.4,0.7-2.1v-0.1
+ c0.1-0.6,0.4-1.1,0.6-1.7l0.1-0.6c0.1-0.7,0.4-1.4,0.7-2.1c2.1-7,3.8-14,5-20.8c0.4-2.1,0.7-3.9,1-5.4c0.1-1,0.3-2,0.4-2.8
+ c0.1-1.5,0.4-3.1,0.6-4.6c0.3-3.2,0.6-6.3,0.7-9.2v-0.1c0-0.8,0.1-1.7,0.1-2.7v-0.1c0-0.8,0-1.8,0.1-2.7v-0.3v-0.1v-1v-0.1v-1.8
+ c0-2.4,0-4.9-0.1-7.7c0-1.1-0.1-2.2-0.3-3.4c-0.1-2.5-0.4-5-0.8-7.5v-0.1c-0.1-1.1-0.3-2.2-0.6-3.4c-0.1-1.1-0.4-2.1-0.6-3.1
+ c-0.1-0.4-0.1-1-0.3-1.4c-0.1-1-0.4-1.8-0.6-2.8c-0.4-1.5-0.8-3.2-1.4-5.3c-0.1-0.6-0.3-1.1-0.4-1.7v-0.1c-0.1-0.6-0.3-1-0.4-1.5
+ c-0.1-0.3-0.3-0.7-0.3-1l-0.1-0.3c-0.3-0.7-0.4-1.4-0.7-2.1c-1.1-2.9-2.2-5.7-3.4-8.2v-0.1c-0.3-0.7-0.6-1.3-1-2
+ c-0.1-0.3-0.3-0.4-0.3-0.7c-0.3-0.7-0.7-1.3-1-2c-0.8-1.5-1.7-2.9-2.5-4.3V318c-0.3-0.4-0.6-0.8-1-1.4l-0.1-0.1
+ c-0.3-0.6-0.7-1-1-1.5c-0.6-0.8-1-1.5-1.4-2.1l-0.1-0.1c-0.4-0.6-1-1.3-1.5-2c-0.8-1-1.5-1.8-2.2-2.7c-0.7-0.7-1.3-1.5-2-2.2
+ c-0.4-0.6-1-1.1-1.5-1.5l-0.1-0.1c-0.3-0.3-0.6-0.6-0.8-0.8l-0.1-0.1c-1.5-1.4-2.7-2.7-3.9-3.6c-4.6-3.9-9.6-7.4-15.1-10.2
+ c-14-7.3-30.6-11-49.1-11c-23.6,0-50.3,5.9-79.2,17.5c-122.7,49-178.3,153.6-178.1,229.9c0,2.2,0.1,4.7,0.3,7.5l92.3-36.9
+ c0-17.3,3.5-34.1,10.3-49.4c0.8-2.1,2-4,2.9-6.1c0.8-1.5,1.5-2.8,2.2-4c0.7-1.3,1.5-2.7,2.2-3.9c0.8-1.3,1.5-2.5,2.5-3.8
+ c1.3-1.8,3.8-5.3,3.9-5.4l0.1-0.1c1-1.1,1.8-2.4,2.8-3.5c1.4-1.8,2.9-3.5,4.5-5.2c1-1.1,2-2.1,3.1-3.4c0.8-0.8,4.5-4.3,5.9-5.6
+ c2.2-2,6.4-5.3,8.7-7.1l0,0l0.3-0.1c1.5-1.1,3.2-2.4,4.7-3.4c1.7-1.3,3.8-2.4,6-3.8c6.1-3.6,12.7-6.8,19.5-9.6
+ c5-2,9.9-3.6,14.8-4.9h0.3c0.6-0.1,1.1-0.3,1.8-0.4c6.6-1.5,13-2.4,18.7-2.4c9.9,0,18.6,2.4,25.5,7c1.1,0.8,2.4,1.7,3.5,2.7
+ c9.9,8.4,15.5,21.9,15.5,38.3v1c0,1.1,0,2.1,0,3.2c0,1,0,2.1-0.1,3.1l-0.1,1.3c0,0.1,0,0.3,0,0.4c0,0.1,0,0.3,0,0.6
+ c0,1-0.1,1.8-0.3,2.7c-0.1,0.8-0.1,1.7-0.3,2.5c0,0.3,0,0.6-0.1,0.8c-4,29.5-20.9,56.4-58.2,93.1l-81.8,80.1
+ c-53.5,52.1-85.9,103.9-101.6,162.9c-6.7,25.1-13.7,52.6-14.5,81L712.3,705.6z"/>
+ </g>
+</g>
+</svg>
diff --git a/site/public/assets/images/next.png b/site/public/assets/images/next.png
index 7997259..b5782ed 100644
--- a/site/public/assets/images/next.png
+++ b/site/public/assets/images/next.png
Binary files differ
diff --git a/site/public/assets/images/prev.png b/site/public/assets/images/prev.png
new file mode 100644
index 0000000..82050a4
--- /dev/null
+++ b/site/public/assets/images/prev.png
Binary files differ
diff --git a/site/public/assets/javascripts/_env.js b/site/public/assets/javascripts/_env.js
index 3badf41..95afd50 100644
--- a/site/public/assets/javascripts/_env.js
+++ b/site/public/assets/javascripts/_env.js
@@ -1,59 +1,128 @@
-var base_href = "http://okfocus.s3.amazonaws.com/2h/"
-var box_images = shuffle([
- "1.gif", "2.gif", "3.gif", "4.gif", "5.gif",
-// "dies2.gif", "dies3.gif",
- "6.gif", "7.gif", "8.gif", "9.gif",
- "12.gif", "13.gif", "14.gif", "15.gif",
- "16.gif", "17.gif", // "CCP-GIF.gif", "dies1.gif",
-])
-
-var strips = []
+var strips = [], boxImages = []
var done_loading = false, menu_open = false, entry_open = false
+var shuffled_indexes
+
+var wasPrev = false, navWidth
+
+/**
+ * Polls the viewport to check when fullscreening is settled
+ * TODO Doesn't work in IE10 and under
+ */
+function onFullScreenSettle(raf, fullScreenEl, fn, freq) {
+ freq = freq || 200
+
+ function pollSettled(fullscreen, getHeight) {
+ var isSettled = settledPredicate(getHeight)
+ var poll = throttle(function doPoll() {
+ if (isSettled()) {
+ fn(fullscreen)
+ } else {
+ raf(poll)
+ }
+ }, freq)
+ raf(poll)
+ }
+
+ function settledPredicate(getHeight) {
+ var count = 0
+ // Guard against a false positive by requiring predicate to match
+ // passCount number of times
+ var passCount = 2
+ var last
+ /**
+ * Checks whether the fullscreen element height has changed
+ * since the last poll
+ */
+ return function isSettled() {
+ var height = getHeight()
+ if (!last) {
+ last = height
+ } else {
+ var result = height === last && (++count === passCount)
+ last = height
+ return result
+ }
+ }
+ }
+
+ // If fullscreening in progress
+ if (fullScreenEl) {
+ pollSettled(true, function() {
+ return fullScreenEl.offsetHeight
+ })
+ // Otherwise, fullscreen is turning off
+ } else {
+ pollSettled(false, function() {
+ return window.innerHeight
+ })
+ }
+}
var environment = {}, hashes = {}
environment.init = function(){
- var loader = new Loader(function(){
- environment.ready()
- })
- loader.preloadImages(box_images.map(function(url){
- return base_href + url
- }))
+ $("#scene").addClass("fade")
+ var loader = new Loader(environment.ready, new HustleLoader)
+ var preloadImages = $("#preload-image-list").html().split("\n").filter(function(s){ return !!s })
+ boxImages = $("#box-image-list").html().split("\n")
+ var postImages = $(".sub a").toArray().map(function(el){ return $(el).data("image") })
+
+ var images = preloadImages.concat(postImages).concat(boxImages).filter(function(s){ return !!s })
+ loader.preloadImages( images )
loader.ready()
}
environment.ready = function(){
if (window.innerWidth < 500) document.body.classList.add('mobile')
- controls = new MX.OrbitCamera({
- radius: 1000,
- radiusRange: [ 10, 2000 ],
- rotationX: PI/2,
- rotationY: PI,
- wheelEase: 20,
- ease: 100
- })
+ if (is_mobile) {
+ controls = new MX.OrbitCameraMobile({
+ radius: 100000,
+ radiusRange: [ 10, 2000 ],
+ rotationX: PI/2,
+ rotationY: PI,
+ wheelEase: 20,
+ ease: 100
+ })
+ }
+ else {
+ controls = new MX.OrbitCamera({
+ radius: 100000,
+ radiusRange: [ 10, 2000 ],
+ rotationX: PI/2,
+ rotationY: PI,
+ wheelEase: 20,
+ ease: 100
+ })
+ }
controls.init()
$('.cat').click( function(){
- $('.cat').removeClass('active')
- $('.sub').removeClass('active')
- $(this).addClass('active')
- $(this).next('.sub').addClass('active')
+ if ($(this).hasClass('active')) {
+ $('.cat').removeClass('active')
+ $('.sub').removeClass('active')
+ }
+ else {
+ $('.cat').removeClass('active')
+ $('.sub').removeClass('active')
+ $(this).addClass('active')
+ $(this).next('.sub').addClass('active')
+ }
})
$("nav a").click(function(e){
+ if ($(this).parent().hasClass("contact")) return;
+
e.preventDefault()
-
- var hash = "#" + $(this).data("hash")
+
+ var page = "/" + $(this).data("type") + "/" + $(this).data("id")
+ var hash = "#" + page
if (done_loading && window.location.hash == hash) return
window.location.hash = hash
$("nav a.active").removeClass("active")
- $(this).addClass("active")
+ var $link = $(this)
+ $link.addClass("active")
open_entry()
-
- var page = $(this).attr("href")
- if (page.indexOf("#") !== -1) page = "#"
$("#entry_container").removeClass("visible")
@@ -61,29 +130,30 @@ environment.ready = function(){
$loader.load(page + " .entry", function(){
display_entry($loader.children()[0])
})
-
})
$("nav .about").click(function(e){
e.preventDefault()
- if (done_loading && window.location.hash == "#about") return
- window.location.hash = "#about"
+ if (done_loading && window.location.hash == "#/about") return
+ window.location.hash = "#/about"
$("nav a.active").removeClass("active")
open_entry()
$("#entry_container").removeClass("visible")
var $loader = $("<div>")
- $loader.load("about .entry", function(){
+ $loader.load("/about/ .entry", function(){
+ console.log($loader.html())
display_entry($loader.children()[0])
})
})
+/*
$("nav .contact").click(function(e){
e.preventDefault()
- if (done_loading && window.location.hash == "#contact") return
- window.location.hash = "#contact"
+ if (done_loading && window.location.hash == "#/contact") return
+ window.location.hash = "#/contact"
$("nav a.active").removeClass("active")
open_entry()
@@ -94,29 +164,28 @@ environment.ready = function(){
display_entry($loader.children()[0])
})
})
- $("nav .index").click(function(e){
- e.preventDefault()
-
- if (done_loading && window.location.hash == "#index") return
- window.location.hash = "#index"
-
- $("nav a.active").removeClass("active")
- open_entry()
-
- $("#entry_container").removeClass("visible")
- var $loader = $("<div>")
- $loader.load("all .entry", function(){
- display_entry($loader.children()[0])
- })
- })
+*/
+ // $("nav .index").click()
$(".toggleRapper").click(toggle_menu)
- $(".toplogo").click(hide_entry)
$(document).on("click", ".project", function(){
- var hash = as_hash( $(this).find("span").text() )
- load_hash(hash)
+ var page = "/" + $(this).data("type") + "/" + $(this).data("id")
+ $(".entry").css("pointer-events", "none")
+ load_hash(page)
+ })
+ $(".toplogo,.logo").click(function(e){
+ e.preventDefault()
+ $(".active").removeClass('active')
+ $('.cat.active, .sub.active, .sub.a').addClass('active')
+ controls.pause()
+ window.location.hash = "#"
+ // $(".index").trigger("click")
+ load_index()
+ // hide_entry()
})
+ Share.init()
+
$(window).mousedown(function(e){
if (! menu_open) {
controls.pause()
@@ -147,52 +216,75 @@ environment.ready = function(){
var current_hash = window.location.hash.replace("#","")
$("nav a").each(function(){
- var key = as_hash(this.innerHTML)
- hashes[key] = this
- $(this).data("hash", key)
+ var page = "/" + $(this).data("type") + "/" + $(this).data("id")
+ hashes[page] = this
+ $(this).data("hash", page)
})
- hashes['about'] = $("nav .about")
- hashes['contact'] = $("nav .contact")
- hashes['index'] = $("nav .index")
+ hashes['/about'] = $("nav .about")
+ // hashes['/contact'] = $("nav .contact")
+ // hashes['/index'] = $("nav .index")
if (current_hash in hashes) {
- toggle_menu()
+ toggle_menu(false)
load_hash(current_hash)
setTimeout(build_scene, 200)
}
else {
build_scene()
+ setTimeout(function(){
+ $("#scene").removeClass("fade")
+ }, 100)
}
setTimeout(function(){ done_loading = true }, 200)
-// $(".mx-scenery").on("mouseenter", function(e){
-// e.stopPropagation()
-// $(this).addClass("red")
-// })
-// $(".mx-scenery").on("mouseleave", function(e){
-// e.stopPropagation()
-// $(".red").removeClass("red")
-// })
$(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange', function(){
- setTimeout(function(){
- if (window.innerHeight == screen.height) {
+ onFullScreenSettle(requestAnimationFrame, getFullScreenElement(), onSettle)
+
+ function onSettle(isFullScreen) {
+ if (isFullScreen) {
$("html").addClass("full-screen")
}
else {
$("html").removeClass("full-screen")
}
- setTimeout(function(){
- resize_gallery()
- }, 100)
- }, 500)
+ resize_gallery(isFullScreen)
+ }
})
+
+ $("#scene_container").click(function(e){
+ if ( $("body").hasClass("menuActive") || $(".entry").length ) {
+ return
+ }
+ else {
+ toggle_menu()
+ }
+ })
+ if (is_desktop) {
+ $(document).on("mouseenter", ".project", function(){
+ var type = $(this).data("type")
+ $(".entry").addClass("hover")
+ $(this).addClass("hover")
+ $(".top .cat").not("[data-type=" + type + "]").addClass("no-hover")
+ $(".cat[data-type=" + type + "]").addClass("hover")
+ })
+ $(document).on("mouseleave", ".project", function(){
+ var type = $(this).data("type")
+ $(".entry").removeClass("hover")
+ $(this).removeClass("hover")
+ $(".cat").removeClass("hover").removeClass("no-hover")
+ })
+ }
}
function build_scene () {
+ controls.setZoom(100000)
+ controls.zoom(1000)
+
+/*
strips.push( new Strip({
- images: box_images.slice(0, 5),
+ images: $(".sub[data-type=advertising] a"),
x: -100,
y: 100,
rotationY: PI/4,
@@ -200,7 +292,7 @@ function build_scene () {
}) )
strips.push( new Strip({
- images: box_images.slice(5, 10),
+ images: $(".sub[data-type=retail] a"),
x: 100,
y: 100,
rotationX: PI/4,
@@ -209,7 +301,7 @@ function build_scene () {
}) )
strips.push( new Strip({
- images: box_images.slice(10, 15),
+ images: $(".sub[data-type=experiential] a"),
x: 0,
y: 100,
z: 100,
@@ -218,7 +310,44 @@ function build_scene () {
}) )
strips.push( new Strip({
- images: box_images.slice(15, 20),
+ images: $(".sub[data-type=content] a"),
+ x: 0,
+ y: 100,
+ z: -50,
+ rotationX: PI/2,
+ rotationY: PI/100,
+ offset: 200,
+ }) )
+*/
+
+ strips.push( new Strip({
+ images: boxImages.slice(0, 5),
+ x: -100,
+ y: 100,
+ rotationY: PI/4,
+ offset: 100,
+ }) )
+
+ strips.push( new Strip({
+ images: boxImages.slice(5, 10),
+ x: 100,
+ y: 100,
+ rotationX: PI/4,
+ rotationY: PI/-100,
+ offset: 200,
+ }) )
+
+ strips.push( new Strip({
+ images: boxImages.slice(10, 15),
+ x: 0,
+ y: 100,
+ z: 100,
+ rotationY: PI/6,
+ offset: 300,
+ }) )
+
+ strips.push( new Strip({
+ images: boxImages.slice(15, 20),
x: 0,
y: 100,
z: -50,
@@ -227,6 +356,20 @@ function build_scene () {
offset: 200,
}) )
+ function resize_for_prev_next(){
+ navWidth = $("nav").width()
+ }
+ resize_for_prev_next()
+ $(window).resize(resize_for_prev_next)
+ $(window).mousemove(function(e){
+ if (! gallery) return
+ prev = ((e.pageX - navWidth) / window.innerWidth) < 0.415
+ if (prev !== wasPrev) {
+ wasPrev = prev
+ $("#okgallery").toggleClass("prev", prev)
+ }
+ })
+
strips.forEach(function(strip){ strip.update(0) })
scene.update()
@@ -235,6 +378,25 @@ function build_scene () {
var entry_open_time = 0;
+function load_index (e){
+ e && e.preventDefault()
+ // if (done_loading && window.location.hash == "#/index") return
+ // window.location.hash = "#/index"
+ // console.log("load index")
+
+ $("nav a.active").removeClass("active")
+ open_entry(true)
+
+ window.location.hash = "#"
+
+ $("#entry_container").removeClass("visible")
+ var $loader = $("<div>")
+ $loader.load("all .entry", function(){
+ $("body").addClass("menuActive")
+ display_entry($loader.children()[0])
+ })
+}
+
function as_hash (txt) {
return txt.replace(/\s/g,'_')
}
@@ -245,8 +407,8 @@ function load_hash (hash) {
$menu.parent().prev(".cat").addClass('active')
$menu.trigger("click")
}
-function open_entry () {
- if (is_mobile) {
+function open_entry (entryIsAll) {
+ if (is_mobile && ! entryIsAll) {
$("body").removeClass("menuActive")
}
if (! entry_open) {
@@ -259,24 +421,49 @@ function open_entry () {
entry_open_time = +new Date
$("#entry_container").addClass("fade")
}
-function display_entry ($el) {
+function display_entry (el) {
var now = +new Date
+ var $el = $(el)
+ var isIndex = $el.hasClass("all")
+ if (is_mobile) {
+ $("body").toggleClass("menuActive", isIndex)
+// $el.find(".brady > a").remove()
+ }
+ if (isIndex) {
+ var $project_list = $el.find("#project_list")
+ var $projects = $project_list.find(".project")
+ if (! shuffled_indexes) {
+ shuffled_indexes = []
+ for (var i = 0; i < $projects.length; i++) {
+ shuffled_indexes[i] = i
+ }
+ shuffle(shuffled_indexes)
+ }
+ $project_list.html("")
+ for (var i = 0; i < $projects.length; i++) {
+ $project_list.append($projects[shuffled_indexes[i]])
+ }
+ }
setTimeout(function(){
$("#entry_container").empty().append($el)
$("#entry_container").removeClass("fade")
- build_gallery()
+ setTimeout(function(){
+ build_gallery()
+ })
if (is_mobile) {
$(".video").each(function(){
load_video( $(this) )
})
}
- if (window.location.hash.match(/about|contact|index/)) {
+ if (window.location.hash.match(/about|contact/) || $(".entry").hasClass("all")) {
setTimeout(function(){
$(".entry").addClass("ready")
+ if ($(".entry").hasClass("all")) {
+ setTimeout(function(){
+ $(".entry").removeClass("undone")
+ }, 500)
+ }
}, 100)
- setTimeout(function(){
- $(".entry").addClass("done")
- }, 600)
}
else {
$(".entry").addClass("ready")
@@ -285,8 +472,11 @@ function display_entry ($el) {
$("#entry_container").scrollTop(0)
$("#entry_container").addClass("visible")
- controls.setZoom(100000)
- setTimeout(function(){ controls.zoom(100) }, 100)
+ $("#scene").addClass("fade")
+ $(".cat").removeClass("hover").removeClass("no-hover")
+ setTimeout(function(){
+ $("#scene").hide()
+ }, 200)
}
function hide_entry () {
$("nav .active").removeClass("active")
@@ -298,7 +488,7 @@ function hide_entry () {
controls.zoom(1500)
window.location.hash = "#"
}
-function toggle_menu (){
+function toggle_menu (isInitialLoad){
$("body").toggleClass("menuActive")
menu_open = $("body").hasClass("menuActive")
@@ -306,8 +496,10 @@ function toggle_menu (){
$("#entry_container").removeClass("visible")
}
- if (menu_open) {
+ if (menu_open && isInitialLoad !== false) {
controls.pause()
+ // $(".index").trigger("click")
+ load_index()
}
if (! menu_open && entry_open && ! is_mobile) {
entry_open = false
@@ -328,11 +520,16 @@ function toggle_menu (){
var gallery = null
function build_gallery () {
videos = []
+ wasPrev = -1
var $el = $("#entry_container #okgallery")
if (! $el.length) {
gallery = null
return
}
+ var $cells = $("#entry_container #okgallery .cell")
+ if ($cells.length == 1) {
+ $(".entry").addClass("singleton")
+ }
var $next = $el.next(".next")
var $caption = $el.next(".caption")
gallery = new Flickity( "#okgallery", {
@@ -347,20 +544,28 @@ function build_gallery () {
})
$("#okgallery .video").each(function(){
- var $play = $('<div class="play"></div>')
var $el = $(this)
+ if (! is_mobile) {
+ var $underlay = $('<div class="underlay"></div>')
+ $underlay.css("background-image", $el.css("background-image"))
+ $el.css("background-image", 'none')
+ }
+ var $play = $('<div class="play"></div>')
$el.append($play)
- $play.click(function(e){
- e.stopPropagation()
- e.preventDefault()
- if ($el.hasClass('loaded')) {
- var player = $el.data('player')
- player.api('play')
- }
- else {
- load_video($el)
- }
- })
+ $el.append($underlay)
+ if (is_desktop) {
+ $play.on("click", function(e){
+ e.stopPropagation()
+ e.preventDefault()
+ if ($el.hasClass('loaded')) {
+ var player = $el.data('player')
+ player.api('play')
+ }
+ else {
+ load_video($el)
+ }
+ })
+ }
})
$(".caption").click(function(){
@@ -368,12 +573,14 @@ function build_gallery () {
})
gallery.on("cellSelect", function(){
+ if (! gallery.selectedElement) return
$caption.html( $(gallery.selectedElement).data("caption") )
videos.forEach(function(player){
player.api('pause')
})
})
gallery.on("settle", function(){
+ if (! gallery || ! gallery.selectedElement) { return }
$caption.html( $(gallery.selectedElement).data("caption") )
})
gallery.on("staticClick", function(e){
@@ -383,23 +590,27 @@ function build_gallery () {
// load_video($el)
}
else {
- next()
+ if ($("#okgallery").hasClass("prev")) {
+ gallery.previous()
+ } else {
+ gallery.next()
+ }
}
})
- // $next.on("click", next)
- function next(){
- gallery.next()
- }
gallery.loader.on("progress", function(imagesLoaded, loadingImage){
$(loadingImage.img).addClass('loaded')
+ $(loadingImage.img).parent().removeClass('loading')
})
+ $(".nextbutton").click(function(){ gallery.next() })
+ $(".prevbutton").click(function(){ gallery.previous() })
}
-function resize_gallery () {
+function resize_gallery (isFullScreen) {
if (! gallery) return;
- var isFullscreen = $("html").hasClass("full-screen")
- $("#okgallery").find(".cell img").each(function(){
- var h = isFullscreen ? window.innerHeight : 0.6 * window.innerHeight
- var w = isFullscreen ? "auto" : this.naturalWidth / this.naturalHeight * h
+ var fullScreenElement = getFullScreenElement()
+ var $gallery = $("#okgallery")
+ $gallery.find(".cell img").each(function(){
+ var h = isFullScreen ? $(fullScreenElement).height() : $gallery.height()
+ var w = isFullScreen ? "auto" : this.naturalWidth / this.naturalHeight * h
$(this).css({
width: w, height: h,
})
@@ -414,12 +625,17 @@ function load_video ($el) {
var vimeo_id = $el.data("video").match(/\d+/)[0]
var $embed = $('<iframe src="https://player.vimeo.com/video/' + vimeo_id + '?autoplay=1&title=0&byline=0&portrait=0" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>')
$el.append($embed)
- var $mask = $('<div class="mask"></div>')
- $el.append($mask)
+ if (! is_mobile) {
+// var $mask = $('<div class="mask"></div>')
+// $el.append($mask)
+ }
var player = $f( $el.find("iframe")[0] )
$el.data('player', player)
player.addEvent('ready', function(){
+// console.log("ready")
+ $el.addClass('playing')
player.addEvent('play', function(){
+// console.log("playing")
$el.addClass('playing')
})
player.addEvent('pause', function(){
@@ -436,24 +652,6 @@ environment.updateOnReady = function(t){
controls.update()
}
-var titles = [
- "BARNEY'S, GAGA CONSTELLATION",
- "CCP GAMES, EVE ONLINE",
- "DIESEL ACCESSORIES",
- "DIESEL CAMPAIGN FW13/SS14",
- "DIESEL CAMPAIGN FW14",
- "#DIESELREBOOT",
- "#DIESELTRIBUTE",
- "DIESEL JOGG JEANS",
- "DIESEL WATCHES",
- 'MAC, "UNTITLED, SELF-PORTRAIT"',
- "MUGLER, BROTHERS OF ARCADIA",
- "MUGLER, LADY GAGA",
- "MUGLER, MEN’S FW11",
- "NICOLA’S, HO HO HO CHRISTMAS SHOP",
- "NICOLA'S, LANE CRAWFORD",
- "NICOLA’S, NEW YORK"
-]
var Strip = function( opt ){
this.opt = opt
@@ -467,13 +665,20 @@ var Strip = function( opt ){
root.addTo(scene)
var prev = root
- this.els = opt.images.map(function(url, i){
+ this.els = ( opt.images.toArray ? opt.images.toArray() : opt.images ).map(function(el, i){
+ var url
+ if (typeof el == "string") {
+ url = el
+ }
+ else {
+ var data = $(el).data()
+ url = data.image
+ }
var el = new MX.Image({
- src: base_href + url,
+ src: url,
onload: function(img){
}
})
- $(el.el).attr("data-title", choice(titles))
el.setCSSTransformOrigin( "50% 100%" )
el.addTo(prev)
el.update()
@@ -494,3 +699,73 @@ Strip.prototype.update = function(t){
el.y = el.height / 2
})
}
+
+function HustleLoader () {
+ var svg = document.getElementById("loader_svg_status")
+ function init(){
+ build()
+ }
+ function build(){
+ setTimeout(function(){ $("#loader_svg").addClass("slide") }, 100)
+ }
+ this.update = function (i) {
+ var y = lerp(1-i, 336, 118)
+ svg.setAttribute("y", y )
+ }
+ this.finish = function(cb){
+ $("#loader_rapper").addClass("hidden")
+ setTimeout(cb, 100)
+ setTimeout(function(){
+ $("#loader_rapper").hide()
+ }, 500)
+ }
+ init()
+}
+
+var Share = {
+ init: function(){
+ $(document).on("click", ".fb", Share.facebook)
+ $(document).on("click", ".tw", Share.twitter)
+ setTimeout(function(){
+ window.fbAsyncInit = function() {
+ FB.init({
+ appId : '643786815755427',
+ xfbml : true,
+ version : 'v2.3'
+ });
+ };
+
+ (function(d, s, id){
+ var js, fjs = d.getElementsByTagName(s)[0];
+ if (d.getElementById(id)) {return;}
+ js = d.createElement(s); js.id = id;
+ js.src = "//connect.facebook.net/en_US/sdk.js";
+ fjs.parentNode.insertBefore(js, fjs);
+ }(document, 'script', 'facebook-jssdk'));
+ }, 1000)
+ },
+
+ facebook: function (e) {
+ e.preventDefault()
+ // var link = window.location.href
+ // var msg = $(".postname").html()
+ // var url = "https://www.facebook.com/share.php?u=" + encodeURIComponent(link) + "&t=" + encodeURIComponent(msg)
+ // window.open(url, "_blank")
+
+ var picture = $(".gallery img").first().attr("src") || ($(".gallery .underlay").css('background-image') || "").replace("url(","").replace(")","") || "http://twohustlers.com/assets/images/2H_LOGOMARK.png"
+ FB.ui({
+ method: 'feed',
+ link: window.location.href,
+ caption: $(".postname").html(),
+ picture: picture,
+ }, function(response){});
+ },
+
+ twitter: function (e) {
+ e.preventDefault()
+ var link = window.location.href
+ var msg = $(".postname").html()
+ var url = "https://twitter.com/home?status=" + encodeURIComponent(msg + " " + link)
+ window.open(url, "_blank")
+ },
+} \ No newline at end of file
diff --git a/site/public/assets/javascripts/app.js b/site/public/assets/javascripts/app.js
index dd68726..4e00f30 100644
--- a/site/public/assets/javascripts/app.js
+++ b/site/public/assets/javascripts/app.js
@@ -18,7 +18,13 @@ app.init = function () {
}
app.launch = function () {
- if ($.browser.msie || ! has3d()) { return app.fallback() }
+ // if ($.browser.msie || ! has3d()) { return app.fallback() }
+ if ($.browser.msie) {
+ $("html").addClass("msie")
+ }
+ else {
+ $("html").addClass("notmsie")
+ }
scene = new MX.Scene().addTo('#scene')
@@ -36,14 +42,10 @@ app.launch = function () {
// app.movements.update(dt || 0)
}
- var loader = new Loader(function(){
- $("#loader").hide()
- window.environment && window.environment.init()
- animate()
- })
-
- // loader.preloadImages([])
- loader.ready()
+ FastClick.attach(document.body)
+
+ window.environment && window.environment.init()
+ animate()
window.scrollTo(0,0)
}
diff --git a/site/public/assets/javascripts/mx/extensions/mx.unclampedOrbitCameraMobile.js b/site/public/assets/javascripts/mx/extensions/mx.unclampedOrbitCameraMobile.js
new file mode 100644
index 0000000..510a002
--- /dev/null
+++ b/site/public/assets/javascripts/mx/extensions/mx.unclampedOrbitCameraMobile.js
@@ -0,0 +1,225 @@
+MX.OrbitCameraMobile = function(opt){
+ var exports = {}, bound = false
+ exports.opt = opt = defaults(opt, {
+ el: window, // object to bind events on
+ camera: scene.camera, // camera object we'll be moving
+ radius: 100,
+ radiusRange: [ 10, 1000 ],
+ rotationX: PI/2,
+ rotationY: 0,
+ center: { x: 0, y: 0, z: 0 },
+ sensitivity: 10, // moving 1 pixel is like moving N radians
+ wheelSensitivity: 10,
+ ease: 10,
+ wheelEase: 10,
+ })
+ var rx, ry, radius, px, py, epsilon = 1e-10
+ var rotationSum = 0
+ var rotationMedian = 0
+ var orientationMax = 0
+ var samples = 0
+ var sampleThreshold = 20
+ var lastAlpha
+
+ exports.dragging = false
+ exports.init = function(){
+ ry = opt.rotationY
+ rx = opt.rotationX
+ radius = opt.radius
+ exports.wheel = new wheel({
+ el: opt.el,
+ update: function(e, delta){
+ opt.radius = clamp( opt.radius + delta * opt.wheelSensitivity, opt.radiusRange[0], opt.radiusRange[1] )
+ },
+ })
+ exports.bind()
+
+ exports.orientationchange()
+ }
+ exports.toggle = function(state){
+ if (state) exports.bind()
+ else exports.unbind()
+ }
+ exports.bind = function(){
+ if (bound) return;
+ bound = true
+ opt.el.addEventListener("touchstart", touch(down))
+ window.addEventListener("touchmove", touch(move))
+ window.addEventListener("touchend", touch(up))
+
+ window.addEventListener('orientationchange', exports.orientationchange)
+ window.addEventListener("devicemotion", exports.devicemotion)
+ window.addEventListener("deviceorientation", exports.deviceorientation)
+
+ exports.wheel.unlock()
+ }
+ exports.unbind = function(){
+ if (! bound) return;
+ bound = false
+ exports.wheel.lock()
+ }
+ function cancelable (fn) {
+ return function(e){
+ e.preventDefault()
+ fn(e)
+ }
+ }
+ function touch (fn){
+ return function(e){
+ fn(e.touches[0])
+ }
+ }
+ function down (e) {
+ px = e.pageX
+ py = e.pageY
+ exports.dragging = true
+ }
+ function move (e) {
+ if (! exports.dragging) return
+ exports.delta(px- e.pageX, py - e.pageY)
+ px = e.pageX
+ py = e.pageY
+ }
+ function up (e) {
+ exports.dragging = false
+ }
+
+ exports.orientationchange = function(e){
+ is_portrait = window.innerWidth < window.innerHeight
+ if (is_portrait) {
+ lastAlpha = 0
+ }
+ }
+ exports.devicemotion = function(e) {
+ if (! is_portrait) return;
+ var rotationBeta = e.rotationRate.alpha; // weird!
+ rotationSum += rotationBeta;
+ samples += 1;
+ }
+ exports.deviceorientation = function (e) {
+ if (! lastAlpha) { lastAlpha = e.alpha }
+ is_portrait ? exports.portraitorientation(e) : exports.landscapeorientation(e)
+ }
+ exports.portraitorientation = function(e) {
+ // compass gives most accurate orientation in portrait mode
+ var alpha, dx = 0, dy = 0
+
+ if (e.webkitCompassHeading) {
+ alpha = 180 - e.webkitCompassHeading;
+ }
+ else {
+ alpha = 180 - e.alpha;
+ }
+
+ // android rotates in reverse
+ if (is_android) {
+ alpha = 360 - alpha
+ }
+
+ // use rotationRate to gauge if we've tilted the screen past vertical
+ // for looking at ceiling
+ if (e.beta > orientationMax) {
+ orientationMax = e.beta
+ rotationMedian = rotationSum
+ }
+
+ // this number was only going to 83 max.. not 90.. weird
+ var beta = e.beta + 7;
+
+ // if we've got enough motion data, we should be able to determine
+ // if we've tilted backwards. otherwise, lock to the horizon.
+ if (! is_android && samples > sampleThreshold) {
+ dx = rotationSum > rotationMedian ? e.beta - 90 : 90 - e.beta
+ }
+ else {
+ dx = 0
+ }
+
+ // avoid jumping around in a circle
+ if (Math.abs(alpha - lastAlpha) < 100 || Math.abs(alpha - lastAlpha) > 300) {
+ dy = alpha - lastAlpha
+ lastAlpha = alpha
+ }
+
+ // avoid jumping around in a circle #2
+ if (dy > 300) {
+ dy -= 360
+ } else if (dy < -300) {
+ dy += 360
+ }
+ opt.rotationX = MX.toRad(dx * -5)
+ opt.rotationY += MX.toRad(dy * 10)
+ }
+ exports.landscapeorientation = function (e) {
+ var dx, dy
+
+ dx = e.gamma > 0 ? 90 - e.gamma : 90 + e.gamma
+ dy = e.alpha - lastAlpha
+ lastAlpha = e.alpha
+
+ // avoid the sudden jump from 0 to -360
+ if (dy > 300) {
+ dy -= 360
+ }
+ else if (dy < -300) {
+ dy += 360
+ }
+
+ opt.rotationX = dx > 45 ? 0 : MX.toRad(dx)
+ opt.rotationY += MX.toRad(dy)
+ }
+
+
+ exports.delta = function(x,y){
+ opt.rotationY += x/window.innerWidth * opt.sensitivity
+ opt.rotationX = opt.rotationX + y/window.innerHeight * opt.sensitivity
+ }
+ exports.move = function(y, x){
+ opt.rotationY = y
+ if (typeof x == "number") { opt.rotationX = x }
+ }
+ exports.zoom = function(r){
+ opt.radius = r
+ }
+ exports.setZoom = function(r){
+ radius = opt.radius = r
+ }
+ exports.zoomPercent = function(n){
+ opt.radius = lerp(n, opt.radiusRange[0], opt.radiusRange[1])
+ }
+ exports.zoomDelta = function(r){
+ opt.radius += r
+ }
+ exports.pause = function(){
+ var sy = sign(opt.rotationY-ry)
+ var sx = sign(opt.rotationX-rx)
+ opt.rotationY = ry + sy * 0.1
+ opt.rotationX = rx + sx * 0.1
+ }
+ exports.update = function(){
+ if (abs(ry - opt.rotationY) > epsilon) {
+ ry = avg(ry, opt.rotationY, opt.ease)
+ }
+ else {
+ ry = opt.rotationY
+ }
+ if (abs(rx - opt.rotationX) > epsilon) {
+ rx = avg(rx, opt.rotationX, opt.ease)
+ }
+ else {
+ rx = opt.rotationX
+ }
+ if (abs(radius - opt.radius) > epsilon) {
+ radius = avg(radius, opt.radius, opt.wheelEase)
+ }
+ else {
+ radius = opt.radius
+ }
+ opt.camera.x = opt.center.x + radius * sin(rx) * cos(ry)
+ opt.camera.z = opt.center.y + radius * sin(rx) * sin(ry)
+ opt.camera.y = opt.center.z + radius * cos(rx)
+ opt.camera.rotationX = PI/2 - rx
+ opt.camera.rotationY = ry + PI/2
+ }
+ return exports
+}
diff --git a/site/public/assets/javascripts/vendor/fastclick.js b/site/public/assets/javascripts/vendor/fastclick.js
new file mode 100644
index 0000000..9c746c2
--- /dev/null
+++ b/site/public/assets/javascripts/vendor/fastclick.js
@@ -0,0 +1,790 @@
+/**
+ * @preserve FastClick: polyfill to remove click delays on browsers with touch UIs.
+ *
+ * @version 1.0.1
+ * @codingstandard ftlabs-jsv2
+ * @copyright The Financial Times Limited [All Rights Reserved]
+ * @license MIT License (see LICENSE.txt)
+ */
+
+/*jslint browser:true, node:true*/
+/*global define, Event, Node*/
+
+
+/**
+ * Instantiate fast-clicking listeners on the specified layer.
+ *
+ * @constructor
+ * @param {Element} layer The layer to listen on
+ * @param {Object} options The options to override the defaults
+ */
+function FastClick(layer, options) {
+ 'use strict';
+ var oldOnClick;
+
+ options = options || {};
+
+ /**
+ * Whether a click is currently being tracked.
+ *
+ * @type boolean
+ */
+ this.trackingClick = false;
+
+
+ /**
+ * Timestamp for when click tracking started.
+ *
+ * @type number
+ */
+ this.trackingClickStart = 0;
+
+
+ /**
+ * The element being tracked for a click.
+ *
+ * @type EventTarget
+ */
+ this.targetElement = null;
+
+
+ /**
+ * X-coordinate of touch start event.
+ *
+ * @type number
+ */
+ this.touchStartX = 0;
+
+
+ /**
+ * Y-coordinate of touch start event.
+ *
+ * @type number
+ */
+ this.touchStartY = 0;
+
+
+ /**
+ * ID of the last touch, retrieved from Touch.identifier.
+ *
+ * @type number
+ */
+ this.lastTouchIdentifier = 0;
+
+
+ /**
+ * Touchmove boundary, beyond which a click will be cancelled.
+ *
+ * @type number
+ */
+ this.touchBoundary = options.touchBoundary || 10;
+
+
+ /**
+ * The FastClick layer.
+ *
+ * @type Element
+ */
+ this.layer = layer;
+
+ /**
+ * The minimum time between tap(touchstart and touchend) events
+ *
+ * @type number
+ */
+ this.tapDelay = options.tapDelay || 200;
+
+ if (FastClick.notNeeded(layer)) {
+ return;
+ }
+
+ // Some old versions of Android don't have Function.prototype.bind
+ function bind(method, context) {
+ return function() { return method.apply(context, arguments); };
+ }
+
+
+ var methods = ['onMouse', 'onClick', 'onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'];
+ var context = this;
+ for (var i = 0, l = methods.length; i < l; i++) {
+ context[methods[i]] = bind(context[methods[i]], context);
+ }
+
+ // Set up event handlers as required
+ if (deviceIsAndroid) {
+ layer.addEventListener('mouseover', this.onMouse, true);
+ layer.addEventListener('mousedown', this.onMouse, true);
+ layer.addEventListener('mouseup', this.onMouse, true);
+ }
+
+ layer.addEventListener('click', this.onClick, true);
+ layer.addEventListener('touchstart', this.onTouchStart, false);
+ layer.addEventListener('touchmove', this.onTouchMove, false);
+ layer.addEventListener('touchend', this.onTouchEnd, false);
+ layer.addEventListener('touchcancel', this.onTouchCancel, false);
+
+ // Hack is required for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)
+ // which is how FastClick normally stops click events bubbling to callbacks registered on the FastClick
+ // layer when they are cancelled.
+ if (!Event.prototype.stopImmediatePropagation) {
+ layer.removeEventListener = function(type, callback, capture) {
+ var rmv = Node.prototype.removeEventListener;
+ if (type === 'click') {
+ rmv.call(layer, type, callback.hijacked || callback, capture);
+ } else {
+ rmv.call(layer, type, callback, capture);
+ }
+ };
+
+ layer.addEventListener = function(type, callback, capture) {
+ var adv = Node.prototype.addEventListener;
+ if (type === 'click') {
+ adv.call(layer, type, callback.hijacked || (callback.hijacked = function(event) {
+ if (!event.propagationStopped) {
+ callback(event);
+ }
+ }), capture);
+ } else {
+ adv.call(layer, type, callback, capture);
+ }
+ };
+ }
+
+ // If a handler is already declared in the element's onclick attribute, it will be fired before
+ // FastClick's onClick handler. Fix this by pulling out the user-defined handler function and
+ // adding it as listener.
+ if (typeof layer.onclick === 'function') {
+
+ // Android browser on at least 3.2 requires a new reference to the function in layer.onclick
+ // - the old one won't work if passed to addEventListener directly.
+ oldOnClick = layer.onclick;
+ layer.addEventListener('click', function(event) {
+ oldOnClick(event);
+ }, false);
+ layer.onclick = null;
+ }
+}
+
+
+/**
+ * Android requires exceptions.
+ *
+ * @type boolean
+ */
+var deviceIsAndroid = navigator.userAgent.indexOf('Android') > 0;
+
+
+/**
+ * iOS requires exceptions.
+ *
+ * @type boolean
+ */
+var deviceIsIOS = /iP(ad|hone|od)/.test(navigator.userAgent);
+
+
+/**
+ * iOS 4 requires an exception for select elements.
+ *
+ * @type boolean
+ */
+var deviceIsIOS4 = deviceIsIOS && (/OS 4_\d(_\d)?/).test(navigator.userAgent);
+
+
+/**
+ * iOS 6.0(+?) requires the target element to be manually derived
+ *
+ * @type boolean
+ */
+var deviceIsIOSWithBadTarget = deviceIsIOS && (/OS ([6-9]|\d{2})_\d/).test(navigator.userAgent);
+
+
+/**
+ * Determine whether a given element requires a native click.
+ *
+ * @param {EventTarget|Element} target Target DOM element
+ * @returns {boolean} Returns true if the element needs a native click
+ */
+FastClick.prototype.needsClick = function(target) {
+ 'use strict';
+ switch (target.nodeName.toLowerCase()) {
+
+ // Don't send a synthetic click to disabled inputs (issue #62)
+ case 'button':
+ case 'select':
+ case 'textarea':
+ if (target.disabled) {
+ return true;
+ }
+
+ break;
+ case 'input':
+
+ // File inputs need real clicks on iOS 6 due to a browser bug (issue #68)
+ if ((deviceIsIOS && target.type === 'file') || target.disabled) {
+ return true;
+ }
+
+ break;
+ case 'label':
+ case 'video':
+ return true;
+ }
+
+ return (/\bneedsclick\b/).test(target.className);
+};
+
+
+/**
+ * Determine whether a given element requires a call to focus to simulate click into element.
+ *
+ * @param {EventTarget|Element} target Target DOM element
+ * @returns {boolean} Returns true if the element requires a call to focus to simulate native click.
+ */
+FastClick.prototype.needsFocus = function(target) {
+ 'use strict';
+ switch (target.nodeName.toLowerCase()) {
+ case 'textarea':
+ return true;
+ case 'select':
+ return !deviceIsAndroid;
+ case 'input':
+ switch (target.type) {
+ case 'button':
+ case 'checkbox':
+ case 'file':
+ case 'image':
+ case 'radio':
+ case 'submit':
+ return false;
+ }
+
+ // No point in attempting to focus disabled inputs
+ return !target.disabled && !target.readOnly;
+ default:
+ return (/\bneedsfocus\b/).test(target.className);
+ }
+};
+
+
+/**
+ * Send a click event to the specified element.
+ *
+ * @param {EventTarget|Element} targetElement
+ * @param {Event} event
+ */
+FastClick.prototype.sendClick = function(targetElement, event) {
+ 'use strict';
+ var clickEvent, touch;
+
+ // On some Android devices activeElement needs to be blurred otherwise the synthetic click will have no effect (#24)
+ if (document.activeElement && document.activeElement !== targetElement) {
+ document.activeElement.blur();
+ }
+
+ touch = event.changedTouches[0];
+
+ // Synthesise a click event, with an extra attribute so it can be tracked
+ clickEvent = document.createEvent('MouseEvents');
+ clickEvent.initMouseEvent(this.determineEventType(targetElement), true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null);
+ clickEvent.forwardedTouchEvent = true;
+ targetElement.dispatchEvent(clickEvent);
+};
+
+FastClick.prototype.determineEventType = function(targetElement) {
+ 'use strict';
+
+ //Issue #159: Android Chrome Select Box does not open with a synthetic click event
+ if (deviceIsAndroid && targetElement.tagName.toLowerCase() === 'select') {
+ return 'mousedown';
+ }
+
+ return 'click';
+};
+
+
+/**
+ * @param {EventTarget|Element} targetElement
+ */
+FastClick.prototype.focus = function(targetElement) {
+ 'use strict';
+ var length;
+
+ // Issue #160: on iOS 7, some input elements (e.g. date datetime) throw a vague TypeError on setSelectionRange. These elements don't have an integer value for the selectionStart and selectionEnd properties, but unfortunately that can't be used for detection because accessing the properties also throws a TypeError. Just check the type instead. Filed as Apple bug #15122724.
+ if (deviceIsIOS && targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time') {
+ length = targetElement.value.length;
+ targetElement.setSelectionRange(length, length);
+ } else {
+ targetElement.focus();
+ }
+};
+
+
+/**
+ * Check whether the given target element is a child of a scrollable layer and if so, set a flag on it.
+ *
+ * @param {EventTarget|Element} targetElement
+ */
+FastClick.prototype.updateScrollParent = function(targetElement) {
+ 'use strict';
+ var scrollParent, parentElement;
+
+ scrollParent = targetElement.fastClickScrollParent;
+
+ // Attempt to discover whether the target element is contained within a scrollable layer. Re-check if the
+ // target element was moved to another parent.
+ if (!scrollParent || !scrollParent.contains(targetElement)) {
+ parentElement = targetElement;
+ do {
+ if (parentElement.scrollHeight > parentElement.offsetHeight) {
+ scrollParent = parentElement;
+ targetElement.fastClickScrollParent = parentElement;
+ break;
+ }
+
+ parentElement = parentElement.parentElement;
+ } while (parentElement);
+ }
+
+ // Always update the scroll top tracker if possible.
+ if (scrollParent) {
+ scrollParent.fastClickLastScrollTop = scrollParent.scrollTop;
+ }
+};
+
+
+/**
+ * @param {EventTarget} targetElement
+ * @returns {Element|EventTarget}
+ */
+FastClick.prototype.getTargetElementFromEventTarget = function(eventTarget) {
+ 'use strict';
+
+ // On some older browsers (notably Safari on iOS 4.1 - see issue #56) the event target may be a text node.
+ if (eventTarget.nodeType === Node.TEXT_NODE) {
+ return eventTarget.parentNode;
+ }
+
+ return eventTarget;
+};
+
+
+/**
+ * On touch start, record the position and scroll offset.
+ *
+ * @param {Event} event
+ * @returns {boolean}
+ */
+FastClick.prototype.onTouchStart = function(event) {
+ 'use strict';
+ var targetElement, touch, selection;
+
+ // Ignore multiple touches, otherwise pinch-to-zoom is prevented if both fingers are on the FastClick element (issue #111).
+ if (event.targetTouches.length > 1) {
+ return true;
+ }
+
+ targetElement = this.getTargetElementFromEventTarget(event.target);
+ touch = event.targetTouches[0];
+
+ if (deviceIsIOS) {
+
+ // Only trusted events will deselect text on iOS (issue #49)
+ selection = window.getSelection();
+ if (selection.rangeCount && !selection.isCollapsed) {
+ return true;
+ }
+
+ if (!deviceIsIOS4) {
+
+ // Weird things happen on iOS when an alert or confirm dialog is opened from a click event callback (issue #23):
+ // when the user next taps anywhere else on the page, new touchstart and touchend events are dispatched
+ // with the same identifier as the touch event that previously triggered the click that triggered the alert.
+ // Sadly, there is an issue on iOS 4 that causes some normal touch events to have the same identifier as an
+ // immediately preceeding touch event (issue #52), so this fix is unavailable on that platform.
+ if (touch.identifier === this.lastTouchIdentifier) {
+ event.preventDefault();
+ return false;
+ }
+
+ this.lastTouchIdentifier = touch.identifier;
+
+ // If the target element is a child of a scrollable layer (using -webkit-overflow-scrolling: touch) and:
+ // 1) the user does a fling scroll on the scrollable layer
+ // 2) the user stops the fling scroll with another tap
+ // then the event.target of the last 'touchend' event will be the element that was under the user's finger
+ // when the fling scroll was started, causing FastClick to send a click event to that layer - unless a check
+ // is made to ensure that a parent layer was not scrolled before sending a synthetic click (issue #42).
+ this.updateScrollParent(targetElement);
+ }
+ }
+
+ this.trackingClick = true;
+ this.trackingClickStart = event.timeStamp;
+ this.targetElement = targetElement;
+
+ this.touchStartX = touch.pageX;
+ this.touchStartY = touch.pageY;
+
+ // Prevent phantom clicks on fast double-tap (issue #36)
+ if ((event.timeStamp - this.lastClickTime) < this.tapDelay) {
+ event.preventDefault();
+ }
+
+ return true;
+};
+
+
+/**
+ * Based on a touchmove event object, check whether the touch has moved past a boundary since it started.
+ *
+ * @param {Event} event
+ * @returns {boolean}
+ */
+FastClick.prototype.touchHasMoved = function(event) {
+ 'use strict';
+ var touch = event.changedTouches[0], boundary = this.touchBoundary;
+
+ if (Math.abs(touch.pageX - this.touchStartX) > boundary || Math.abs(touch.pageY - this.touchStartY) > boundary) {
+ return true;
+ }
+
+ return false;
+};
+
+
+/**
+ * Update the last position.
+ *
+ * @param {Event} event
+ * @returns {boolean}
+ */
+FastClick.prototype.onTouchMove = function(event) {
+ 'use strict';
+ if (!this.trackingClick) {
+ return true;
+ }
+
+ // If the touch has moved, cancel the click tracking
+ if (this.targetElement !== this.getTargetElementFromEventTarget(event.target) || this.touchHasMoved(event)) {
+ this.trackingClick = false;
+ this.targetElement = null;
+ }
+
+ return true;
+};
+
+
+/**
+ * Attempt to find the labelled control for the given label element.
+ *
+ * @param {EventTarget|HTMLLabelElement} labelElement
+ * @returns {Element|null}
+ */
+FastClick.prototype.findControl = function(labelElement) {
+ 'use strict';
+
+ // Fast path for newer browsers supporting the HTML5 control attribute
+ if (labelElement.control !== undefined) {
+ return labelElement.control;
+ }
+
+ // All browsers under test that support touch events also support the HTML5 htmlFor attribute
+ if (labelElement.htmlFor) {
+ return document.getElementById(labelElement.htmlFor);
+ }
+
+ // If no for attribute exists, attempt to retrieve the first labellable descendant element
+ // the list of which is defined here: http://www.w3.org/TR/html5/forms.html#category-label
+ return labelElement.querySelector('button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea');
+};
+
+
+/**
+ * On touch end, determine whether to send a click event at once.
+ *
+ * @param {Event} event
+ * @returns {boolean}
+ */
+FastClick.prototype.onTouchEnd = function(event) {
+ 'use strict';
+ var forElement, trackingClickStart, targetTagName, scrollParent, touch, targetElement = this.targetElement;
+
+ if (!this.trackingClick) {
+ return true;
+ }
+
+ // Prevent phantom clicks on fast double-tap (issue #36)
+ if ((event.timeStamp - this.lastClickTime) < this.tapDelay) {
+ this.cancelNextClick = true;
+ return true;
+ }
+
+ // Reset to prevent wrong click cancel on input (issue #156).
+ this.cancelNextClick = false;
+
+ this.lastClickTime = event.timeStamp;
+
+ trackingClickStart = this.trackingClickStart;
+ this.trackingClick = false;
+ this.trackingClickStart = 0;
+
+ // On some iOS devices, the targetElement supplied with the event is invalid if the layer
+ // is performing a transition or scroll, and has to be re-detected manually. Note that
+ // for this to function correctly, it must be called *after* the event target is checked!
+ // See issue #57; also filed as rdar://13048589 .
+ if (deviceIsIOSWithBadTarget) {
+ touch = event.changedTouches[0];
+
+ // In certain cases arguments of elementFromPoint can be negative, so prevent setting targetElement to null
+ targetElement = document.elementFromPoint(touch.pageX - window.pageXOffset, touch.pageY - window.pageYOffset) || targetElement;
+ targetElement.fastClickScrollParent = this.targetElement.fastClickScrollParent;
+ }
+
+ targetTagName = targetElement.tagName.toLowerCase();
+ if (targetTagName === 'label') {
+ forElement = this.findControl(targetElement);
+ if (forElement) {
+ this.focus(targetElement);
+ if (deviceIsAndroid) {
+ return false;
+ }
+
+ targetElement = forElement;
+ }
+ } else if (this.needsFocus(targetElement)) {
+
+ // Case 1: If the touch started a while ago (best guess is 100ms based on tests for issue #36) then focus will be triggered anyway. Return early and unset the target element reference so that the subsequent click will be allowed through.
+ // Case 2: Without this exception for input elements tapped when the document is contained in an iframe, then any inputted text won't be visible even though the value attribute is updated as the user types (issue #37).
+ if ((event.timeStamp - trackingClickStart) > 100 || (deviceIsIOS && window.top !== window && targetTagName === 'input')) {
+ this.targetElement = null;
+ return false;
+ }
+
+ this.focus(targetElement);
+ this.sendClick(targetElement, event);
+
+ // Select elements need the event to go through on iOS 4, otherwise the selector menu won't open.
+ // Also this breaks opening selects when VoiceOver is active on iOS6, iOS7 (and possibly others)
+ if (!deviceIsIOS || targetTagName !== 'select') {
+ this.targetElement = null;
+ event.preventDefault();
+ }
+
+ return false;
+ }
+
+ if (deviceIsIOS && !deviceIsIOS4) {
+
+ // Don't send a synthetic click event if the target element is contained within a parent layer that was scrolled
+ // and this tap is being used to stop the scrolling (usually initiated by a fling - issue #42).
+ scrollParent = targetElement.fastClickScrollParent;
+ if (scrollParent && scrollParent.fastClickLastScrollTop !== scrollParent.scrollTop) {
+ return true;
+ }
+ }
+
+ // Prevent the actual click from going though - unless the target node is marked as requiring
+ // real clicks or if it is in the whitelist in which case only non-programmatic clicks are permitted.
+ if (!this.needsClick(targetElement)) {
+ event.preventDefault();
+ this.sendClick(targetElement, event);
+ }
+
+ return false;
+};
+
+
+/**
+ * On touch cancel, stop tracking the click.
+ *
+ * @returns {void}
+ */
+FastClick.prototype.onTouchCancel = function() {
+ 'use strict';
+ this.trackingClick = false;
+ this.targetElement = null;
+};
+
+
+/**
+ * Determine mouse events which should be permitted.
+ *
+ * @param {Event} event
+ * @returns {boolean}
+ */
+FastClick.prototype.onMouse = function(event) {
+ 'use strict';
+
+ // If a target element was never set (because a touch event was never fired) allow the event
+ if (!this.targetElement) {
+ return true;
+ }
+
+ if (event.forwardedTouchEvent) {
+ return true;
+ }
+
+ // Programmatically generated events targeting a specific element should be permitted
+ if (!event.cancelable) {
+ return true;
+ }
+
+ // Derive and check the target element to see whether the mouse event needs to be permitted;
+ // unless explicitly enabled, prevent non-touch click events from triggering actions,
+ // to prevent ghost/doubleclicks.
+ if (!this.needsClick(this.targetElement) || this.cancelNextClick) {
+
+ // Prevent any user-added listeners declared on FastClick element from being fired.
+ if (event.stopImmediatePropagation) {
+ event.stopImmediatePropagation();
+ } else {
+
+ // Part of the hack for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)
+ event.propagationStopped = true;
+ }
+
+ // Cancel the event
+ event.stopPropagation();
+ event.preventDefault();
+
+ return false;
+ }
+
+ // If the mouse event is permitted, return true for the action to go through.
+ return true;
+};
+
+
+/**
+ * On actual clicks, determine whether this is a touch-generated click, a click action occurring
+ * naturally after a delay after a touch (which needs to be cancelled to avoid duplication), or
+ * an actual click which should be permitted.
+ *
+ * @param {Event} event
+ * @returns {boolean}
+ */
+FastClick.prototype.onClick = function(event) {
+ 'use strict';
+ var permitted;
+
+ // It's possible for another FastClick-like library delivered with third-party code to fire a click event before FastClick does (issue #44). In that case, set the click-tracking flag back to false and return early. This will cause onTouchEnd to return early.
+ if (this.trackingClick) {
+ this.targetElement = null;
+ this.trackingClick = false;
+ return true;
+ }
+
+ // Very odd behaviour on iOS (issue #18): if a submit element is present inside a form and the user hits enter in the iOS simulator or clicks the Go button on the pop-up OS keyboard the a kind of 'fake' click event will be triggered with the submit-type input element as the target.
+ if (event.target.type === 'submit' && event.detail === 0) {
+ return true;
+ }
+
+ permitted = this.onMouse(event);
+
+ // Only unset targetElement if the click is not permitted. This will ensure that the check for !targetElement in onMouse fails and the browser's click doesn't go through.
+ if (!permitted) {
+ this.targetElement = null;
+ }
+
+ // If clicks are permitted, return true for the action to go through.
+ return permitted;
+};
+
+
+/**
+ * Remove all FastClick's event listeners.
+ *
+ * @returns {void}
+ */
+FastClick.prototype.destroy = function() {
+ 'use strict';
+ var layer = this.layer;
+
+ if (deviceIsAndroid) {
+ layer.removeEventListener('mouseover', this.onMouse, true);
+ layer.removeEventListener('mousedown', this.onMouse, true);
+ layer.removeEventListener('mouseup', this.onMouse, true);
+ }
+
+ layer.removeEventListener('click', this.onClick, true);
+ layer.removeEventListener('touchstart', this.onTouchStart, false);
+ layer.removeEventListener('touchmove', this.onTouchMove, false);
+ layer.removeEventListener('touchend', this.onTouchEnd, false);
+ layer.removeEventListener('touchcancel', this.onTouchCancel, false);
+};
+
+
+/**
+ * Check whether FastClick is needed.
+ *
+ * @param {Element} layer The layer to listen on
+ */
+FastClick.notNeeded = function(layer) {
+ 'use strict';
+ var metaViewport;
+ var chromeVersion;
+
+ // Devices that don't support touch don't need FastClick
+ if (typeof window.ontouchstart === 'undefined') {
+ return true;
+ }
+
+ // Chrome version - zero for other browsers
+ chromeVersion = +(/Chrome\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1];
+
+ if (chromeVersion) {
+
+ if (deviceIsAndroid) {
+ metaViewport = document.querySelector('meta[name=viewport]');
+
+ if (metaViewport) {
+ // Chrome on Android with user-scalable="no" doesn't need FastClick (issue #89)
+ if (metaViewport.content.indexOf('user-scalable=no') !== -1) {
+ return true;
+ }
+ // Chrome 32 and above with width=device-width or less don't need FastClick
+ if (chromeVersion > 31 && document.documentElement.scrollWidth <= window.outerWidth) {
+ return true;
+ }
+ }
+
+ // Chrome desktop doesn't need FastClick (issue #15)
+ } else {
+ return true;
+ }
+ }
+
+ // IE10 with -ms-touch-action: none, which disables double-tap-to-zoom (issue #97)
+ if (layer.style.msTouchAction === 'none') {
+ return true;
+ }
+
+ return false;
+};
+
+
+/**
+ * Factory method for creating a FastClick object
+ *
+ * @param {Element} layer The layer to listen on
+ * @param {Object} options The options to override the defaults
+ */
+FastClick.attach = function(layer, options) {
+ 'use strict';
+ return new FastClick(layer, options);
+};
+
+
+if (typeof define !== 'undefined' && define.amd) {
+
+ // AMD. Register as an anonymous module.
+ define(function() {
+ 'use strict';
+ return FastClick;
+ });
+} else if (typeof module !== 'undefined' && module.exports) {
+ module.exports = FastClick.attach;
+ module.exports.FastClick = FastClick;
+} else {
+ window.FastClick = FastClick;
+}
diff --git a/site/public/assets/javascripts/vendor/flickity.pkgd.js b/site/public/assets/javascripts/vendor/flickity.pkgd.js
index 6389014..0471fa5 100644
--- a/site/public/assets/javascripts/vendor/flickity.pkgd.js
+++ b/site/public/assets/javascripts/vendor/flickity.pkgd.js
@@ -1,6 +1,10 @@
/*!
- * Flickity PACKAGED v0.2.3
+ * Flickity PACKAGED v1.0.1
* Touch, responsive, flickable galleries
+ *
+ * Licensed GPLv3 for open source use
+ * or Flickity Commercial License for commercial use
+ *
* http://flickity.metafizzy.co
* Copyright 2015 Metafizzy
*/
@@ -1176,7 +1180,7 @@ if ( typeof define === 'function' && define.amd ) {
})( window );
/**
- * matchesSelector v1.0.2
+ * matchesSelector v1.0.3
* matchesSelector( element, '.selector' )
* MIT license
*/
@@ -1189,6 +1193,10 @@ if ( typeof define === 'function' && define.amd ) {
var matchesMethod = ( function() {
+ // check for the standard method name first
+ if ( ElemProto.matches ) {
+ return 'matches';
+ }
// check un-prefixed
if ( ElemProto.matchesSelector ) {
return 'matchesSelector';
@@ -1280,7 +1288,7 @@ if ( typeof define === 'function' && define.amd ) {
})( Element.prototype );
/**
- * Fizzy UI utils v0.1.1
+ * Fizzy UI utils v1.0.1
* MIT license
*/
@@ -1380,7 +1388,7 @@ utils.indexOf = Array.prototype.indexOf ? function( ary, obj ) {
// ----- removeFrom ----- //
-utils.removeFrom = function( obj, ary ) {
+utils.removeFrom = function( ary, obj ) {
var index = utils.indexOf( ary, obj );
if ( index != -1 ) {
ary.splice( index, 1 );
@@ -1499,14 +1507,12 @@ utils.debounceMethod = function( _class, methodName, threshold ) {
// ----- htmlInit ----- //
-var jQuery = window.jQuery;
-
// http://jamesroberts.name/blog/2010/02/22/string-functions-for-javascript-trim-to-camel-case-to-dashed-and-to-underscore/
-function toDashed( str ) {
+utils.toDashed = function( str ) {
return str.replace( /(.)([A-Z])/g, function( match, $1, $2 ) {
return $1 + '-' + $2;
}).toLowerCase();
-}
+};
var console = window.console;
/**
@@ -1516,7 +1522,7 @@ var console = window.console;
*/
utils.htmlInit = function( WidgetClass, namespace ) {
docReady( function() {
- var dashedNamespace = toDashed( namespace );
+ var dashedNamespace = utils.toDashed( namespace );
var elems = document.querySelectorAll( '.js-' + dashedNamespace );
var dataAttr = 'data-' + dashedNamespace + '-options';
@@ -1538,6 +1544,7 @@ utils.htmlInit = function( WidgetClass, namespace ) {
// initialize
var instance = new WidgetClass( elem, options );
// make available via $().data('layoutname')
+ var jQuery = window.jQuery;
if ( jQuery ) {
jQuery.data( elem, namespace, instance );
}
@@ -1893,8 +1900,12 @@ return proto;
}));
/*!
- * Flickity v0.2.3
+ * Flickity v1.0.1
* Touch, responsive, flickable galleries
+ *
+ * Licensed GPLv3 for open source use
+ * or Flickity Commercial License for commercial use
+ *
* http://flickity.metafizzy.co
* Copyright 2015 Metafizzy
*/
@@ -1999,7 +2010,8 @@ Flickity.defaults = {
// initialIndex: 0,
percentPosition: true,
resize: true,
- selectedAttraction: 0.025
+ selectedAttraction: 0.025,
+ setGallerySize: true
// watchCSS: false,
// wrapAround: false
};
@@ -2075,7 +2087,6 @@ Flickity.prototype.activate = function() {
this.getSize();
// get cells from children
this.reloadCells();
- this.setContainerSize();
if ( this.options.accessibility ) {
// allow element to focusable
@@ -2109,7 +2120,7 @@ Flickity.prototype.reloadCells = function() {
this.cells = this._makeCells( this.slider.children );
this.positionCells();
this._getWrapShiftCells();
- this.setContainerSize();
+ this.setGallerySize();
};
/**
@@ -2215,8 +2226,10 @@ Flickity.prototype.setCellAlign = function() {
this.cellAlign = shorthand ? shorthand[ this.originSide ] : this.options.cellAlign;
};
-Flickity.prototype.setContainerSize = function() {
- this.viewport.style.height = this.maxCellHeight + 'px';
+Flickity.prototype.setGallerySize = function() {
+ if ( this.options.setGallerySize ) {
+ this.viewport.style.height = this.maxCellHeight + 'px';
+ }
};
Flickity.prototype._getWrapShiftCells = function() {
@@ -2267,13 +2280,21 @@ Flickity.prototype._containCells = function() {
var lastCell = this.getLastCell();
var contentWidth = this.slideableWidth - lastCell.size[ endMargin ];
var endLimit = contentWidth - this.size.innerWidth * ( 1 - this.cellAlign );
+ // content is less than gallery size
+ var isContentSmaller = contentWidth < this.size.innerWidth;
// contain each cell target
for ( var i=0, len = this.cells.length; i < len; i++ ) {
var cell = this.cells[i];
// reset default target
cell.setDefaultTarget();
- cell.target = Math.max( cell.target, this.cursorPosition + firstCellStartMargin );
- cell.target = Math.min( cell.target, endLimit );
+ if ( isContentSmaller ) {
+ // all cells fit inside gallery
+ cell.target = contentWidth * this.cellAlign;
+ } else {
+ // contain to bounds
+ cell.target = Math.max( cell.target, this.cursorPosition + firstCellStartMargin );
+ cell.target = Math.min( cell.target, endLimit );
+ }
}
};
@@ -2293,7 +2314,7 @@ Flickity.prototype.dispatchEvent = function( type, event, args ) {
if ( event ) {
// create jQuery event
var $event = jQuery.Event( event );
- $event.type = type + '.flickity';
+ $event.type = type;
this.$element.trigger( $event, args );
} else {
// just trigger with type if no event available
@@ -2330,7 +2351,7 @@ Flickity.prototype.select = function( index, isWrap ) {
this.selectedIndex = index;
this.setSelectedCell();
this.startAnimation();
- this.dispatchEvent('select');
+ this.dispatchEvent('cellSelect');
}
};
@@ -2448,7 +2469,7 @@ Flickity.prototype.resize = function() {
}
this.positionCells();
this._getWrapShiftCells();
- this.setContainerSize();
+ this.setGallerySize();
this.positionSliderAtSelected();
};
@@ -2554,6 +2575,9 @@ Flickity.prototype.destroy = function() {
eventie.unbind( window, 'resize', this );
}
this.emit('destroy');
+ if ( jQuery && this.$element ) {
+ jQuery.removeData( this.element, 'flickity' );
+ }
delete this.element.flickityGUID;
delete instances[ this.guid ];
};
@@ -2599,7 +2623,7 @@ return Flickity;
}));
/*!
- * Unipointer v0.1.0
+ * Unipointer v1.1.0
* base class for doing one thing with pointer event
* MIT license
*/
@@ -2736,7 +2760,7 @@ Unipointer.prototype._pointerDown = function( event, pointer ) {
Unipointer.prototype.pointerDown = function( event, pointer ) {
this._bindPostStartEvents( event );
- this.emitEvent( 'pointerDown', [ this, event, pointer ] );
+ this.emitEvent( 'pointerDown', [ event, pointer ] );
};
// hash of events to be bound after start event
@@ -2813,7 +2837,7 @@ Unipointer.prototype._pointerMove = function( event, pointer ) {
// public
Unipointer.prototype.pointerMove = function( event, pointer ) {
- this.emitEvent( 'pointerMove', [ this, event, pointer ] );
+ this.emitEvent( 'pointerMove', [ event, pointer ] );
};
// ----- end event ----- //
@@ -2850,7 +2874,7 @@ Unipointer.prototype._pointerUp = function( event, pointer ) {
// public
Unipointer.prototype.pointerUp = function( event, pointer ) {
- this.emitEvent( 'pointerUp', [ this, event, pointer ] );
+ this.emitEvent( 'pointerUp', [ event, pointer ] );
};
// ----- pointer done ----- //
@@ -2896,7 +2920,7 @@ Unipointer.prototype._pointerCancel = function( event, pointer ) {
// public
Unipointer.prototype.pointerCancel = function( event, pointer ) {
- this.emitEvent( 'pointerCancel', [ this, event, pointer ] );
+ this.emitEvent( 'pointerCancel', [ event, pointer ] );
};
// ----- ----- //
@@ -2916,7 +2940,7 @@ return Unipointer;
}));
/*!
- * Unidragger v0.2.0
+ * Unidragger v1.1.3
* Draggable base class
* MIT license
*/
@@ -3050,13 +3074,6 @@ var disableImgOndragstart = !isIE8 ? noop : function( handle ) {
// ----- start event ----- //
-var allowTouchstartNodes = Unidragger.allowTouchstartNodes = {
- INPUT: true,
- A: true,
- BUTTON: true,
- SELECT: true
-};
-
/**
* pointer start
* @param {Event} event
@@ -3071,7 +3088,7 @@ Unidragger.prototype.pointerDown = function( event, pointer ) {
}
// bind move and end events
this._bindPostStartEvents( event );
- this.emitEvent( 'pointerDown', [ this, event, pointer ] );
+ this.emitEvent( 'pointerDown', [ event, pointer ] );
};
// base pointer down logic
@@ -3079,11 +3096,10 @@ Unidragger.prototype._dragPointerDown = function( event, pointer ) {
// track to see when dragging starts
this.pointerDownPoint = Unipointer.getPointerPoint( pointer );
+ // prevent default, unless touchstart or <select>
+ var isTouchstart = event.type == 'touchstart';
var targetNodeName = event.target.nodeName;
- // HACK iOS, allow clicks on buttons, inputs, and links
- var isTouchstartNode = event.type == 'touchstart' && allowTouchstartNodes[ targetNodeName ];
- // do not prevent default on touchstart nodes or <select>
- if ( !isTouchstartNode && targetNodeName != 'SELECT' ) {
+ if ( !isTouchstart && targetNodeName != 'SELECT' ) {
preventDefaultEvent( event );
}
};
@@ -3097,7 +3113,7 @@ Unidragger.prototype._dragPointerDown = function( event, pointer ) {
*/
Unidragger.prototype.pointerMove = function( event, pointer ) {
var moveVector = this._dragPointerMove( event, pointer );
- this.emitEvent( 'pointerMove', [ this, event, pointer, moveVector ] );
+ this.emitEvent( 'pointerMove', [ event, pointer, moveVector ] );
this._dragMove( event, pointer, moveVector );
};
@@ -3129,7 +3145,7 @@ Unidragger.prototype.hasDragStarted = function( moveVector ) {
* @param {Event or Touch} pointer
*/
Unidragger.prototype.pointerUp = function( event, pointer ) {
- this.emitEvent( 'pointerUp', [ this, event, pointer ] );
+ this.emitEvent( 'pointerUp', [ event, pointer ] );
this._dragPointerUp( event, pointer );
};
@@ -3155,7 +3171,7 @@ Unidragger.prototype._dragStart = function( event, pointer ) {
};
Unidragger.prototype.dragStart = function( event, pointer ) {
- this.emitEvent( 'dragStart', [ this, event, pointer ] );
+ this.emitEvent( 'dragStart', [ event, pointer ] );
};
// dragMove
@@ -3169,7 +3185,8 @@ Unidragger.prototype._dragMove = function( event, pointer, moveVector ) {
};
Unidragger.prototype.dragMove = function( event, pointer, moveVector ) {
- this.emitEvent( 'dragMove', [ this, event, pointer, moveVector ] );
+ preventDefaultEvent( event );
+ this.emitEvent( 'dragMove', [ event, pointer, moveVector ] );
};
// dragEnd
@@ -3186,7 +3203,7 @@ Unidragger.prototype._dragEnd = function( event, pointer ) {
};
Unidragger.prototype.dragEnd = function( event, pointer ) {
- this.emitEvent( 'dragEnd', [ this, event, pointer ] );
+ this.emitEvent( 'dragEnd', [ event, pointer ] );
};
// ----- onclick ----- //
@@ -3202,15 +3219,16 @@ Unidragger.prototype.onclick = function( event ) {
// triggered after pointer down & up with no/tiny movement
Unidragger.prototype._staticClick = function( event, pointer ) {
- // allow click in text input
- if ( event.target.nodeName == 'INPUT' && event.target.type == 'text' ) {
+ // allow click in <input>s and <textarea>s
+ var nodeName = event.target.nodeName;
+ if ( nodeName == 'INPUT' || nodeName == 'TEXTAREA' ) {
event.target.focus();
}
this.staticClick( event, pointer );
};
Unidragger.prototype.staticClick = function( event, pointer ) {
- this.emitEvent( 'staticClick', [ this, event, pointer ] );
+ this.emitEvent( 'staticClick', [ event, pointer ] );
};
// ----- ----- //
@@ -3325,10 +3343,6 @@ proto.unbindDrag = function() {
delete this.isDragBound;
};
-proto.hasDragStarted = function( moveVector ) {
- return Math.abs( moveVector.x ) > 3;
-};
-
proto._uiChangeDrag = function() {
delete this.isFreeScrolling;
};
@@ -3345,7 +3359,9 @@ proto.pointerDown = function( event, pointer ) {
// kludge to blur focused inputs in dragger
var focused = document.activeElement;
- if ( focused && focused.blur && focused != this.element ) {
+ if ( focused && focused.blur && focused != this.element &&
+ // do not blur body for IE9 & 10, #117
+ focused != document.body ) {
focused.blur();
}
this.pointerDownFocus( event );
@@ -3375,6 +3391,8 @@ proto.pointerDownFocus = function( event ) {
}
};
+// ----- move ----- //
+
proto.pointerMove = function( event, pointer ) {
var moveVector = this._dragPointerMove( event, pointer );
this.touchVerticalScrollMove( event, pointer, moveVector );
@@ -3382,6 +3400,12 @@ proto.pointerMove = function( event, pointer ) {
this.dispatchEvent( 'pointerMove', event, [ pointer, moveVector ] );
};
+proto.hasDragStarted = function( moveVector ) {
+ return !this.isTouchScrolling && Math.abs( moveVector.x ) > 3;
+};
+
+// ----- up ----- //
+
proto.pointerUp = function( event, pointer ) {
delete this.isTouchScrolling;
classie.remove( this.viewport, 'is-pointer-down' );
@@ -3405,11 +3429,16 @@ function getPointerWindowY( pointer ) {
}
proto.touchVerticalScrollMove = function( event, pointer, moveVector ) {
- if ( !this.options.touchVerticalScroll || !touchScrollEvents[ event.type ] ) {
+ // do not scroll if already dragging, if disabled
+ var touchVerticalScroll = this.options.touchVerticalScroll;
+ // if touchVerticalScroll is 'withDrag', allow scrolling and dragging
+ var canNotScroll = touchVerticalScroll == 'withDrag' ? !touchVerticalScroll :
+ this.isDragging || !touchVerticalScroll;
+ if ( canNotScroll || !touchScrollEvents[ event.type ] ) {
return;
}
- // don't start vertical scrolling until pointer has moved 16 pixels in a direction
- if ( !this.isTouchScrolling && Math.abs( moveVector.y ) > 16 ) {
+ // don't start vertical scrolling until pointer has moved 10 pixels in a direction
+ if ( !this.isTouchScrolling && Math.abs( moveVector.y ) > 10 ) {
// start touch vertical scrolling
// scroll & pointerY when started
this.startScrollY = window.pageYOffset;
@@ -3417,13 +3446,6 @@ proto.touchVerticalScrollMove = function( event, pointer, moveVector ) {
// start scroll animation
this.isTouchScrolling = true;
}
- if ( !this.isTouchScrolling ) {
- return;
- }
- // scroll window
- var scrollDelta = this.pointerWindowStartY - getPointerWindowY( pointer );
- var scrollY = this.startScrollY + scrollDelta;
- window.scroll( window.pageXOffset, scrollY );
};
// -------------------------- dragging -------------------------- //
@@ -3435,6 +3457,8 @@ proto.dragStart = function( event, pointer ) {
};
proto.dragMove = function( event, pointer, moveVector ) {
+ preventDefaultEvent( event );
+
this.previousDragX = this.x;
var movedX = moveVector.x;
@@ -3584,11 +3608,9 @@ proto.dragEndBoostSelect = function() {
proto.staticClick = function( event, pointer ) {
// get clickedCell, if cell was clicked
var clickedCell = this.getParentCell( event.target );
- var clickedCellIndex = clickedCell &&
- utils.indexOf( this.cells, clickedCell );
- var clickedCellElem = clickedCell && clickedCell.element;
- this.dispatchEvent( 'staticClick', event,
- [ pointer, clickedCellIndex, clickedCellElem ] );
+ var cellElem = clickedCell && clickedCell.element;
+ var cellIndex = clickedCell && utils.indexOf( this.cells, clickedCell );
+ this.dispatchEvent( 'staticClick', event, [ pointer, cellElem, cellIndex ] );
};
// ----- ----- //
@@ -3602,7 +3624,7 @@ return Flickity;
}));
/*!
- * Tap listener v0.1.0
+ * Tap listener v1.1.0
* listens to taps
* MIT license
*/
@@ -3688,7 +3710,7 @@ TapListener.prototype.pointerUp = function( event, pointer ) {
pointerPoint.y <= boundingRect.bottom + scrollY;
// trigger callback if pointer is inside element
if ( isInside ) {
- this.emitEvent( 'tap', [ this, event, pointer ] );
+ this.emitEvent( 'tap', [ event, pointer ] );
}
};
@@ -3797,10 +3819,10 @@ PrevNextButton.prototype._create = function() {
}
// update on select
var _this = this;
- this.onselect = function() {
+ this.onCellSelect = function() {
_this.update();
};
- this.parent.on( 'select', this.onselect );
+ this.parent.on( 'cellSelect', this.onCellSelect );
// tap
this.on( 'tap', this.onTap );
// pointerDown
@@ -3906,8 +3928,8 @@ PrevNextButton.prototype.destroy = function() {
utils.extend( Flickity.defaults, {
prevNextButtons: true,
- leftArrowText: '‹',
- rightArrowText: '›'
+ leftArrowText: '‹',
+ rightArrowText: '›'
});
Flickity.createMethods.push('_createPrevNextButtons');
@@ -4000,10 +4022,10 @@ PageDots.prototype._create = function() {
this.dots = [];
// update on select
var _this = this;
- this.onselect = function() {
+ this.onCellSelect = function() {
_this.updateSelected();
};
- this.parent.on( 'select', this.onselect );
+ this.parent.on( 'cellSelect', this.onCellSelect );
// tap
this.on( 'tap', this.onTap );
// pointerDown
@@ -4073,7 +4095,7 @@ PageDots.prototype.updateSelected = function() {
this.selectedDot.className = 'dot is-selected';
};
-PageDots.prototype.onTap = function( instance, event ) {
+PageDots.prototype.onTap = function( event ) {
var target = event.target;
// only care about dot clicks
if ( target.nodeName != 'LI' ) {
@@ -4430,7 +4452,7 @@ Flickity.prototype.remove = function( elems ) {
cell = cells[i];
cell.remove();
// remove item from collection
- utils.removeFrom( cell, this.cells );
+ utils.removeFrom( this.cells, cell );
}
if ( cells.length ) {
@@ -4479,7 +4501,7 @@ Flickity.prototype.cellChange = function( changedCellIndex ) {
this._positionCells( changedCellIndex );
this._getWrapShiftCells();
- this.setContainerSize();
+ this.setGallerySize();
// position slider
if ( this.options.freeScroll ) {
this.positionSlider();
@@ -4532,7 +4554,7 @@ return Flickity;
});
/*!
- * Flickity asNavFor v0.1.1
+ * Flickity asNavFor v1.0.1
* enable asNavFor for Flickity
*/
@@ -4556,7 +4578,7 @@ return Flickity;
// CommonJS
module.exports = factory(
window,
- require('dessandro-classie'),
+ require('desandro-classie'),
require('flickity'),
require('fizzy-ui-utils')
);
@@ -4610,7 +4632,7 @@ Flickity.prototype.setNavCompanion = function( elem ) {
this.onNavCompanionSelect = function() {
_this.navCompanionSelect();
};
- companion.on( 'select', this.onNavCompanionSelect );
+ companion.on( 'cellSelect', this.onNavCompanionSelect );
// click
this.on( 'staticClick', this.onNavStaticClick );
@@ -4645,9 +4667,9 @@ Flickity.prototype.removeNavSelectedElement = function() {
delete this.navSelectedElement;
};
-Flickity.prototype.onNavStaticClick = function( event, pointer, clickedCellIndex ) {
- if ( typeof clickedCellIndex == 'number' ) {
- this.navCompanion.select( clickedCellIndex );
+Flickity.prototype.onNavStaticClick = function( event, pointer, cellElement, cellIndex ) {
+ if ( typeof cellIndex == 'number' ) {
+ this.navCompanion.select( cellIndex );
}
};
@@ -4659,7 +4681,7 @@ Flickity.prototype.destroyAsNavFor = function() {
if ( !this.navCompanion ) {
return;
}
- this.navCompanion.off( 'select', this.onNavCompanionSelect );
+ this.navCompanion.off( 'cellSelect', this.onNavCompanionSelect );
this.off( 'staticClick', this.onNavStaticClick );
delete this.navCompanion;
};
@@ -5007,7 +5029,7 @@ function makeArray( obj ) {
});
/*!
- * Flickity imagesLoaded v0.1.2
+ * Flickity imagesLoaded v1.0.0
* enables imagesLoaded option for Flickity
*/
@@ -5022,30 +5044,27 @@ function makeArray( obj ) {
// AMD
define( [
'flickity/js/index',
- 'imagesloaded/imagesloaded',
- 'fizzy-ui-utils/utils'
- ], function( Flickity, imagesLoaded, utils ) {
- return factory( window, Flickity, imagesLoaded, utils );
+ 'imagesloaded/imagesloaded'
+ ], function( Flickity, imagesLoaded ) {
+ return factory( window, Flickity, imagesLoaded );
});
} else if ( typeof exports == 'object' ) {
// CommonJS
module.exports = factory(
window,
require('flickity'),
- require('imagesloaded'),
- require('fizzy-ui-utils')
+ require('imagesloaded')
);
} else {
// browser global
window.Flickity = factory(
window,
window.Flickity,
- window.imagesLoaded,
- window.fizzyUIUtils
+ window.imagesLoaded
);
}
-}( window, function factory( window, Flickity, imagesLoaded, utils ) {
+}( window, function factory( window, Flickity, imagesLoaded ) {
Flickity.createMethods.push('_createImagesLoaded');
@@ -5060,12 +5079,8 @@ Flickity.prototype.imagesLoaded = function() {
}
var _this = this;
function onImagesLoadedProgress( instance, image ) {
- // check if image is a cell
- var cell = _this.getCell( image.img );
- // otherwise get its parents
- var cellElem = cell && cell.element ||
- utils.getParent( image.img, '.flickity-slider > *' );
- _this.cellSizeChange( cellElem );
+ var cell = _this.getParentCell( image.img );
+ _this.cellSizeChange( cell && cell.element );
}
this.loader = imagesLoaded( this.slider ).on( 'progress', onImagesLoadedProgress );
};
diff --git a/site/public/assets/javascripts/vendor/loader.js b/site/public/assets/javascripts/vendor/loader.js
index 4c1c8cd..b939941 100644
--- a/site/public/assets/javascripts/vendor/loader.js
+++ b/site/public/assets/javascripts/vendor/loader.js
@@ -1,13 +1,17 @@
var Loader = Loader || (function(){
- function Loader (readyCallback){
+ function Loader (readyCallback, view){
this.assets = {};
this.images = [];
this.readyCallback = readyCallback;
+ this.count = 0
+ this.view = view
+ this.loaded = false
}
// Register an asset as loading
Loader.prototype.register = function(s){
this.assets[s] = false;
+ this.count += 1
}
// Signal that an asset has loaded
@@ -16,10 +20,18 @@ var Loader = Loader || (function(){
this.assets[s] = true;
if (this.loaded) return;
+
+ this.view && this.view.update( this.percentRemaining() )
+
if (! this.isReady()) return;
this.loaded = true;
- this.readyCallback && this.readyCallback();
+ if (this.view) {
+ this.view && this.view.finish(this.readyCallback)
+ }
+ else {
+ this.readyCallback && this.readyCallback();
+ }
}
// (boolean) Is the loader ready?
@@ -31,6 +43,11 @@ var Loader = Loader || (function(){
}
return true;
}
+
+ // (float) Percentage of assets remaining
+ Loader.prototype.percentRemaining = function(){
+ return this.remainingAssets() / this.count
+ }
// (int) Number of assets remaining
Loader.prototype.remainingAssets = function(){
@@ -38,7 +55,7 @@ var Loader = Loader || (function(){
for (var s in this.assets) {
if (this.assets.hasOwnProperty(s) && this.assets[s] != true) {
n++;
- console.log('remaining: ' + s);
+ // console.log('remaining: ' + s);
}
}
return n;
diff --git a/site/public/assets/javascripts/vendor/polyfill.js b/site/public/assets/javascripts/vendor/polyfill.js
index 411d90f..8c26e80 100644
--- a/site/public/assets/javascripts/vendor/polyfill.js
+++ b/site/public/assets/javascripts/vendor/polyfill.js
@@ -97,4 +97,34 @@ function fullscreen (el) {
} else if (el.webkitRequestFullscreen) {
el.webkitRequestFullscreen();
}
-} \ No newline at end of file
+}
+
+/*
+ * Proper fullscreen detection using the HTML5
+ * Full Screen API. Not supported on mobile or
+ * IE10 and under
+ * TODO Need to disable fullscreen button on IE10 and lower
+ */
+function isFullScreen() {
+ return !!getFullScreenElement()
+}
+
+function getFullScreenElement() {
+ return document.fullScreenElement ||
+ document.webkitFullscreenElement ||
+ document.mozFullScreenElement ||
+ document.msFullscreenElement
+}
+
+var raf = window.requestAnimationFrame ||
+ window.webkitRequestAnimationFrame ||
+ window.mozRequestAnimationFrame ||
+ window.oRequestAnimationFrame ||
+ window.msRequestAnimationFrame
+
+var caf = window.cancelAnimationFrame ||
+ window.webkitCancelAnimationFrame ||
+ window.mozCancelAnimationFrame ||
+ window.oCancelAnimationFrame ||
+ window.msCancelAnimationFrame
+
diff --git a/site/public/assets/javascripts/vendor/util.js b/site/public/assets/javascripts/vendor/util.js
index 0f5c6ed..487fe56 100644
--- a/site/public/assets/javascripts/vendor/util.js
+++ b/site/public/assets/javascripts/vendor/util.js
@@ -240,6 +240,27 @@ if (!Function.prototype.bind) {
};
}());
+/*
+ * Throttle a function to be called no more often
+ * than ms milliseconds
+ */
+function throttle(fn, ms) {
+ ms = ms || 100
+ var ready = true
+ var last
+ return function() {
+ var now = Date.now()
+ if (ready) {
+ last = now
+ return fn.apply(this, arguments)
+ ready = false
+ } else {
+ if (now - last > ms) {
+ ready = true
+ }
+ }
+ }
+}
function selectElementContents(el) {
if (window.getSelection && document.createRange) {
diff --git a/site/public/assets/style.css b/site/public/assets/style.css
index 2ca71b4..2cd2d29 100644
--- a/site/public/assets/style.css
+++ b/site/public/assets/style.css
@@ -113,7 +113,7 @@ cursor: grabbing;
transform: translateY(-50%);
}
-.flickity-prev-next-button:hover { background: white; }
+.desktop .flickity-prev-next-button:hover { background: white; }
.flickity-prev-next-button:focus {
outline: none;
@@ -208,6 +208,24 @@ cursor: grabbing;
cursor: -moz-grabbing;
}
+#loader_rapper {
+ -webkit-transition: 0.3s opacity !important;
+ transition: 0.3s opacity !important;
+ opacity: 1.0;
+}
+#loader_rapper.hidden {
+ opacity: 0;
+}
+#loader_svg {
+ position: absolute;
+ left: 2.5%;
+ top: 30%;
+ height: 40%;
+ width: 95%;
+}
+#loader_svg svg {
+ width: 100%; height: 100%;
+}
nav {
-moz-user-select: none;
-webkit-user-select: none;
@@ -238,7 +256,7 @@ nav {
border-top: 1px solid #222;
padding-top: 10px;
}
-.toplogo:hover {
+.desktop .toplogo:hover {
cursor:pointer;
opacity:1;
}
@@ -267,8 +285,9 @@ nav .middle {
}
nav .bottom {
+ height: 22%;
width: 100%;
- background: #44D3D3;
+ background: #ddd;
}
nav a {
text-decoration:none;
@@ -276,14 +295,33 @@ nav a {
width:100%;
color:black;
}
+.contact {
+ line-height: 14px;
+ padding-left: 10px;
+ padding-right: 10px;
+ font-size: 10px;
+ margin-top: 10px;
+ vertical-align: bottom;
+}
+.contact a {
+ display: inline;
+}
-nav .cat:hover {
+
+
+.desktop nav .cat.about,
+.desktop nav .cat.hover,
+.desktop nav .cat:hover {
cursor:pointer;
background:#eee;
}
-
-
-nav a.active:hover {
+nav .cat.no-hover {
+ opacity: 0.3;
+}
+.nav .cat.about {
+ background: #E5E5E7;
+}
+.desktop nav a.active:hover {
cursor:default;
}
nav .cat {
@@ -295,7 +333,7 @@ nav .cat.active {
display: inline-block;
font-family: 'BellGothic-Bold';
}
-nav .top .cat.active:hover {
+.desktop nav .top .cat.active:hover {
background:transparent;
}
@@ -315,7 +353,7 @@ nav .sub {
nav .sub.active {
display: inline-block;
- max-height:180px;
+ max-height: 450px;
}
nav .sub a {
@@ -383,7 +421,7 @@ nav .sub.active a {
height:auto;
position:relative;
width:100%;
- max-height:40px;
+ max-height:70px;
padding: 3px 0 5px 20px;
opacity:1;
-webkit-transform:translateY(0)scale(1)skew(0deg);
@@ -391,7 +429,7 @@ nav .sub.active a {
transform:translateY(0)scale(1)skew(0deg);
}
-nav a.active, nav .sub a:hover {
+.desktop nav a.active, nav .sub a:hover {
text-decoration:none;
background:#eee;
color:black;
@@ -406,7 +444,12 @@ nav a.active, nav .sub a:hover {
display: inline-block;
width: 80%;
width: calc(87% - 80px);
- margin-left: 160px;
+ margin-left: 180px;
+}
+.entry.all {
+/*
+ width: 90%;
+ */
}
.entry h1{
margin-bottom: 1.2em;
@@ -422,13 +465,39 @@ nav a.active, nav .sub a:hover {
.postname {
border-bottom: 1px solid #999;
padding: 20px 0px 0.6em 2px;
- margin-bottom: 1em;
+ margin-bottom: 0.7em;
font-size: 1em;
+ text-transform: uppercase;
+}
+
+
+.galnav {
+ display: inline-block;
+ width: 100%;
+ float: left;
+ clear: both;
}
+.galnav span{
+ width: 50%;
+ background: #999;
+ color: white;
+ padding: 2px;
+ font-size: 11px;
+ transition:0.2s background;
+}
+.galnav .nextbutton{
+ text-align: right;
+ background: #888;
+ cursor:pointer;
+}
+.desktop .galnav span:hover {
+ background:black;
+}
+.singleton .galnav { display: none }
.credit {
- margin: 4em 0px 0px 0px;
+ margin: 1em 0px 0px 0px;
padding: 11px 0px;
border-top: 1px solid;
float: left;
@@ -436,18 +505,16 @@ nav a.active, nav .sub a:hover {
color: #909090;
}
-.credit a {
+.credit img {
display:inline-block;
opacity:0.9;
+ cursor: pointer;
+ width: 18px;
}
-.credit a:hover {
+.desktop .credit img:hover {
opacity:1;
}
-.credit a img {
- width:18px;
-}
-
.mx-object3d .image{
box-shadow:5px -10px 20px rgba(0,0,0,0.1);
}
@@ -467,15 +534,27 @@ nav a.active, nav .sub a:hover {
padding-top:20px;
border-top:1px solid #999;
width:100%;
+/*
-webkit-column-count: 3;
-moz-column-count: 3;
column-count: 3;
+ min-height: 130px;
+ */
+}
+.entry span div.content.noline {
+ border-top: 0;
+ padding-top: 0;
}
.entry span div.content div {
+/*
+ min-height: 130px;
+ */
width:50%;
+/*
-webkit-column-count: 3;
-moz-column-count: 3;
column-count: 3;
+ */
}
@@ -504,23 +583,34 @@ nav a.active, nav .sub a:hover {
.gallery {
width: 100%;
- height: 60vh;
+ height: 70vh;
overflow: hidden;
float:left;
display:inline-block;
cursor: url(images/next.png), auto!important;
- background: url(images/dither.gif);
+ background: white;
+}
+.singleton .gallery,
+.singleton .cell {
+ cursor: pointer !important;
}
.cell {
display:inline-block;
height:100%;
cursor: url(images/next.png), auto!important;
}
+.gallery.prev,
+.gallery.prev .cell {
+ cursor: url(images/prev.png), auto!important;
+}
.cell.video {
width: 80%;
background-size: cover;
background-position: center center;
}
+.singleton .cell.video {
+ width: 100%;
+}
.cell.video.playing {
background: black !important;
}
@@ -542,8 +632,12 @@ nav a.active, nav .sub a:hover {
height: 100px;
opacity: 0.7;
z-index: 4;
+ pointer-events: none;
}
-.cell.video .play:hover {
+.desktop .cell.video.is-selected .play {
+ pointer-events: auto;
+}
+.desktop .cell.video .play:hover {
opacity: 1.0;
}
.cell iframe {
@@ -553,12 +647,26 @@ nav a.active, nav .sub a:hover {
-webkit-transition:0.4s opacity ease-in;
transition:0.4s opacity ease-in;
pointer-events: none;
-}
-.cell iframe {
+/*
height: 200%;
-webkit-transform: translateY(-25%);
transform: translateY(-25%);
+ */
}
+.cell .underlay {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height:100%;
+ opacity:0.2;
+ -webkit-transition:0.4s opacity ease-in;
+ transition:0.4s opacity ease-in;
+ pointer-events: none;
+ background-size: cover;
+ background-position: center center;
+}
+
.fullscreen {
text-align: right;
}
@@ -595,50 +703,63 @@ nav a.active, nav .sub a:hover {
clear: both;
width: 100%;
padding: 2px;
- font-size: 0.67em;
+ font-size: 0.77em;
margin-bottom: 10px;
}
.caption:after {
content:"VIEW IN FULLSCREEN";
- text-align:right;
- float: right;
- opacity:0.5;
+ text-align: left;
+ float: left;
+ opacity: 1.0;
cursor:pointer;
}
-.caption:hover {
+.msie .entry .caption {
+ display: none;
+}
+.desktop .caption:hover {
background:#222;
color:#222;
cursor:pointer;
}
-.caption:hover::after {
+.desktop .caption:hover::after {
color:white;
opacity:1;
}
.cell img {
- max-height:100%;
+ height:100%;
opacity:0.0;
transition:0.4s opacity ease-in;
}
+
+.cell img.loading {
+ opacity: 0.0 !important;
+}
.cell img.loaded {
opacity: 0.2;
}
-.cell.is-selected img, .cell.is-selected iframe {
+.cell.is-selected .underlay,
+.cell.is-selected img.loaded,
+.cell.is-selected iframe {
opacity:1;
pointer-events: auto;
}
-.cell .mask {
+.cell .underlay {
z-index: 2;
width: 100%;
height: 100%;
position: absolute;
top: 0; left: 0;
}
-.cell.playing .mask {
+.cell.loaded .underlay {
+ background-image: none !important;
+}
+.cell.playing .underlay {
pointer-events: none;
+ opacity: 0;
}
.logo {
position: fixed;
- right: 10px;
+ right: 2%;
bottom: 10px;
width: 6%;
max-width:120px;
@@ -647,6 +768,10 @@ nav a.active, nav .sub a:hover {
.logo img {
width:100%;
}
+.loading .logo,
+.loading .toggleRapper {
+ display: none;
+}
.toggleRapper {
width: 50px;
position: fixed;
@@ -702,51 +827,161 @@ nav a.active, nav .sub a:hover {
top:0;
}
+.entry .brady {
+ width: 72vw;
+}
+.brady {
+ display: block;
+}
+.brady > a {
+ width: 18vw; height: 18vw;
+ background-size: cover;
+ background-position: center center;
+ position: relative;
+ display: block;
+ float: left;
+}
+.brady div {
+ width: 100%;
+ position: relative;
+ display: block;
+ float: left;
+ padding: 1em 0.5em 1em 0vw;
+ font-size: 0.8em;
+ line-height: 1.5em;
+ border-bottom: 1px solid black;
+ margin: 1em 0;
+ font-family: 'BellGothic-Bold';
+}
+.brady div.aboutcontent { border: 0; }
+.aboutcontenttext { display: none }
+.brady div.collabscontent {
+ border-top: 1px solid black;
+}
+.brady div.contactcontent {
+ margin-top: 0;
+ padding-top: 0;
+}
+.all .contactcontent {
+ width: 100%;
+ clear: both;
+ position: relative;
+ top: 1em;
+ margin-left: 10px;
+ padding: 1em 0;
+ font-size: 0.8em;
+ line-height: 1.5em;
+ border-bottom: 1px solid black;
+ border-top: 1px solid black;
+}
+.desktop .brady > a:hover:after {
+ content: 'SAY HELLO!';
+ position: absolute;
+ top: 40%;
+ left: 0;
+ text-decoration: underline;
+ text-align: center;
+ font-size: 22px;
+ width: 100%;
+}
+.brady span {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ background: white;
+ opacity: 0;
+ color: black;
+ margin-top: -4px;
+ font-size: 0.8em;
+ line-height: 1.5em;
+ padding: 2px 0 1px 2px;
+
+ transition: 0.1s opacity ease-in;
+ display: block;
+ text-overflow: ellipsis;
+ text-transform: uppercase;
+}
+.desktop .brady > a:hover span {
+ opacity: 1;
+}
+
.project {
float: left;
- width: 33.33333%;
- height: 220px;
- padding: 10px;
+ width: 25%;
+ width: 19vw;
+ height: 200px;
+ height: 12.3vw;
+ padding: 10px 0px 0 10px;
cursor: pointer;
opacity: 0.0;
font-size: 0.8em;
- max-width: 300px;
transition: 0.1s opacity ease-in;
transition-delay:0.4s;
}
-.ready .project:hover {
+.desktop .ready .project:hover {
opacity: 1.0;
}
+.msie .project {
+ opacity: 1.0 !important;
+}
+.entry.hover .project { opacity: 0.5 }
+.entry.hover .project.hover { opacity: 1.0 }
+
.project img {
width: 100%;
}
.ready .project {
opacity: 0.8;
}
-.done.ready .project {
- transition-delay: 0;
-}
-.project:nth-child(1) {
- transition-delay:0.05s;
-}
-.project:nth-child(2) {
- transition-delay:0.1s;
-}
-.project:nth-child(3) {
- transition-delay:0.15s;
-}
-.project:nth-child(4) {
- transition-delay:0.2s;
-}
-.project:nth-child(5) {
- transition-delay:0.25s;
+.ready .project {
+ -webkit-transition-delay: 0s !important;
+ transition-delay: 0s !important;
}
-.project:nth-child(6) {
- transition-delay:0.3s;
+.project span {
+ position: relative;
+ top: -19px;
+ background: white;
+ opacity: 0;
+ transition: 0.1s opacity ease-in;
+ display: block;
+ text-overflow: ellipsis;
+ text-transform: uppercase;
}
-.project:nth-child(7) {
- transition-delay:0.35s;
+.mobile .project span,
+.desktop .project:hover span,
+.msie .project span {
+ opacity: 1;
}
+.undone .project:nth-child(1) { transition-delay:0.05s; }
+.undone .project:nth-child(2) { transition-delay:0.1s; }
+.undone .project:nth-child(3) { transition-delay:0.15s; }
+.undone .project:nth-child(4) { transition-delay:0.2s; }
+.undone .project:nth-child(5) { transition-delay:0.25s; }
+.undone .project:nth-child(6) { transition-delay:0.3s; }
+.undone .project:nth-child(7) { transition-delay:0.35s; }
+.undone .project:nth-child(8) { transition-delay:0.4s; }
+.undone .project:nth-child(9) { transition-delay:0.45s; }
+.undone .project:nth-child(10) { transition-delay:0.5s; }
+.undone .project:nth-child(11) { transition-delay:0.55s; }
+.undone .project:nth-child(12) { transition-delay:0.6s; }
+.undone .project:nth-child(13) { transition-delay:0.65s; }
+.undone .project:nth-child(14) { transition-delay:0.7s; }
+.undone .project:nth-child(15) { transition-delay:0.75s; }
+.undone .project:nth-child(16) { transition-delay:0.8s; }
+.undone .project:nth-child(17) { transition-delay:0.85s; }
+.undone .project:nth-child(18) { transition-delay:0.9s; }
+.undone .project:nth-child(19) { transition-delay:0.95s; }
+.undone .project:nth-child(20) { transition-delay:1.00s; }
+.undone .project:nth-child(21) { transition-delay:1.05s; }
+.undone .project:nth-child(22) { transition-delay:1.1s; }
+.undone .project:nth-child(23) { transition-delay:1.15s; }
+.undone .project:nth-child(24) { transition-delay:1.2s; }
+.undone .project:nth-child(25) { transition-delay:1.25s; }
+.undone .project:nth-child(26) { transition-delay:1.3s; }
+.undone .project:nth-child(27) { transition-delay:1.35s; }
+.undone .project:nth-child(28) { transition-delay:1.4s; }
+.undone .project:nth-child(29) { transition-delay:1.45s; }
+.undone .project:nth-child(30) { transition-delay:1.50s; }
#entry_container.visible {
top: 0%;
@@ -795,26 +1030,42 @@ nav a.active, nav .sub a:hover {
}
-
@media (max-width:1200px) {
- .entry span div.content {
- -webkit-column-count: 2;
- -moz-column-count: 2;
- column-count: 2;
+ .project {
+ width:33.3333%;
+ height: 16.6vw;
+ }
+ .brady > a {
+ width: 24vw; height: 24vw;
+ }
+ .brady > a:nth-child(3) {
+ margin-right: 0vw;
+ }
+}
+
+@media (max-width:900px) {
+ .project {
+ width:50%;
+ height: 23vw;
}
}
@media (max-width:600px) {
.entry span div.content {
+/*
-webkit-column-count: 1;
-moz-column-count: 1;
column-count: 1;
+ */
}
#entry_container .entry {
width:100%;
margin-left:0;
}
+ .flickity-viewport {
+ height: 37vh;
+ }
.logo img {
width:50px;
}
@@ -827,19 +1078,90 @@ nav a.active, nav .sub a:hover {
.project {
width: 100%;
padding: 0 0 0 25px;
- height: 260px;
+ height: 55vw;
}
.menuActive #entry_container {
+ left:120px;
+ }
+ #scene {
+ -webkit-transition: left 0.2s;
+ transition: left 0.2s;
+ }
+ .menuActive #scene {
left:160px;
}
- body{
- font-size: 18px;
+ body {
+ font-size: 18px;
+ }
+ nav {
+ font-size: 0.6em;
+ width: 120px;
+ }
+ nav .bottom {
+ height: 27%;
+ }
+ nav .sub.active a {
+ padding: 2px 0 4px 20px;
+ }
+ nav .cat {
+ padding: 2px 0 2px 10px;
+ }
+ .contact {
+ margin-top: 6px;
+ }
+ .menuActive #entry_container .entry.all {
+ width:65%;
+ }
+ .menuActive .project {
+ height: 36vw;
+ text-transform: uppercase;
+ font-size:0.6em;
}
+ .menuActive .project span {
+ top: -18px;
+ }
+ .brady > a {
+ display: none;
+ width: 35vw; height: 35vw;
+ }
+ .brady {
+ width: 100%;
+ }
+ .brady span {
+ font-size: 13px !important;
+ }
+ .brady div {
+ width: 100%;
+ border: 0;
+ margin: 0.5em;
+ margin-left: 2em;
+ padding: 0;
+ font-size: 13px !important;
+ }
+ .brady > a:nth-child(3) {
+ margin-right: 0vw;
+ }
+ .brady span.aboutcontenttext {
+ position: static; bottom: auto; left: auto;
+ opacity: 1;
+ background: transparent;
+ }
+ .aboutcontent { display: block }
+ .aboutcontenttext { display: inline }
+ .aboutcontent img { display: none }
}
+
+
.mobile .cell iframe {
- position: fixed; /* REALLY WEIRD, vimeo won't play without this! */
- width: 80%;
- opacity:0.2;
+ width: 100%;
+ opacity: 0.0!important;
transition:0.4s opacity ease-in;
- z-index: 2;
+ z-index: 100;
+ height: 100%;
+ -webkit-transform: translateZ(0);
+ transform: translateZ(0);
+}
+.mobile .play {
+ pointer-events: none;
+ opacity: 1;
}
diff --git a/site/templates/about.liquid b/site/templates/about.liquid
new file mode 100644
index 0000000..5858462
--- /dev/null
+++ b/site/templates/about.liquid
@@ -0,0 +1,13 @@
+<div class="entry page">
+ <span>
+ <span class="brady">
+ <img src="http://ltho.s3.amazonaws.com/twohustlers/2H_ABOUT_150616.jpg" style="width:100%">
+ <div class="aboutcontent">
+ <span class="aboutcontenttext">{{page.body | newline_to_br}}</span>
+ </div>
+ {% for image in shape.images %}<a href="mailto:{{image.caption}}?subject=SAY HELLO!" style="background-image:url({{ image.uri }})"><span>{{ image.label }}</span></a>{% endfor %}
+ <div class="collabscontent">{{page.collabs | newline_to_br}}</div>
+ <div class="contactcontent">{{page.contact | newline_to_br}}</div>
+ </span>
+ </span>
+</div>
diff --git a/site/templates/all.liquid b/site/templates/all.liquid
index edb31d2..34db1fc 100644
--- a/site/templates/all.liquid
+++ b/site/templates/all.liquid
@@ -1,6 +1,24 @@
-<div class="entry all">
- <div class="project">
- <img src="http://twohustlers.com/bigimages/ss15_1.jpg">
- <span>DIESEL SS15</span>
+<div class="entry all undone">
+ <img src="http://ltho.s3.amazonaws.com/twohustlers/abouttext.png" style="width:100%;">
+ <div id="project_list">
+ {% for project in advertisings %}
+ <div class="project" data-id="{{ project.id }}" data-type="advertising">
+ <img src="{{ project.thumbnail.uri }}">
+ <span>{{ project.menu }}</span>
+ </div>
+ {% endfor %}
+ {% for project in contents %}
+ <div class="project" data-id="{{ project.id }}" data-type="content">
+ <img src="{{ project.thumbnail.uri }}">
+ <span>{{ project.menu }}</span>
+ </div>
+ {% endfor %}
+ {% for project in experientials %}
+ <div class="project" data-id="{{ project.id }}" data-type="experiential">
+ <img src="{{ project.thumbnail.uri }}">
+ <span>{{ project.menu }}</span>
+ </div>
+ {% endfor %}
</div>
+ <div class="contactcontent">{{page.contact | newline_to_br}}</div>
</div>
diff --git a/site/templates/index.liquid b/site/templates/index.liquid
index 8797f25..572cf0a 100644
--- a/site/templates/index.liquid
+++ b/site/templates/index.liquid
@@ -67,12 +67,12 @@ WEBSITE BY OKFOCUS, http://okfoc.us, Internet Legends.
<meta name="google" content="notranslate">
<meta http-equiv="Content-Language" content="en">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
-<meta name="description" content="OKFocus, Internet Legends">
+<meta name="description" content="Two Hustlers is a creative collective of radical thinkers, designers and storytellers. We build transformative experiences for passionate brands.">
+<meta property="og:url" content="http://twohustlers.com"/>
+<meta property="og:site_name" content="Two Hustlers" />
<meta property="og:title" content="TWOHUSTLERS">
<meta property="og:type" content="website">
-<meta property="og:image" content="http://twohustlers.com/assets/images/2H_LOGOMARK.png">
-<meta property="og:url" content="http://twohustlers.com/">
-<meta property="og:site_name" content="TWOHUSTLERS">
+<meta property="og:image" content="https://ltho.s3.amazonaws.com/twohustlers%2F0fa87125-e5b2-4020-8646-1155aba96250.jpg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
@@ -85,71 +85,113 @@ WEBSITE BY OKFOCUS, http://okfoc.us, Internet Legends.
<nav>
<div class="top">
<img src="assets/images/2H_WORDMARK.png" class="toplogo">
- <div class="cat">RETAIL</div>
- <div class="sub">
- {% for project in retail %}
- <a href="/retail/{{ project.id }}" data-image="{{ project.images[0].uri }}">{{ project.shortname }}</a>
+ <div class="cat" data-type="advertising">advertising</div>
+ <div class="sub" data-type="advertising">
+ {% for project in advertisings %}
+ <a href="#" data-type="advertising" data-id="{{ project.id }}" data-name="{{ project.menu }}" data-image="{{ project.thumbnail.uri }}">{{ project.menu }}</a>
{% endfor %}
</div>
- <div class="cat">advertising</div>
- <div class="sub">
- {% for project in advertising %}
- <a href="/advertising/{{ project.id }}">{{ project.shortname || project.title }}</a>
+ <div class="cat" data-type="content">digital programs</div>
+ <div class="sub" data-type="content">
+ {% for project in contents %}
+ <a href="#" data-type="content" data-id="{{ project.id }}" data-name="{{ project.menu }}" data-image="{{ project.thumbnail.uri }}">{{ project.menu }}</a>
{% endfor %}
</div>
- <div class="cat">experiential</div>
- <div class="sub">
- {% for project in experiential %}
- <a href="/experiential/{{ project.id }}">{{ project.shortname || project.title }}</a>
- {% endfor %}
- </div>
- <div class="cat">content</div>
- <div class="sub">
- {% for project in content %}
- <a href="/content/{{ project.id }}">{{ project.shortname || project.title }}</a>
+ <div class="cat" data-type="experiential">experiential</div>
+ <div class="sub" data-type="experiential">
+ {% for project in experientials %}
+ <a href="#" data-type="experiential" data-id="{{ project.id }}" data-name="{{ project.menu }}" data-image="{{ project.thumbnail.uri }}">{{ project.menu }}</a>
{% endfor %}
</div>
</div>
- <div class="middle">
+ <div class="middle" style="display: none">
<div class="cat index">VIEW ALL PROJECTS</div>
</div>
<div class="bottom">
- <div class="cat about">ABOUT</div>
- <div class="cat contact">CONTACT</div>
+ <div class="cat about">ABOUT/CONTACT</div>
+ <div class="contact">
+ {{ page.body | newline_to_br }}
+ </div>
</div>
</nav>
+
+<div id="loader_rapper">
+ <div id="loader_svg">
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="0 0 2528.9 458.1" xml:space="preserve">
+ <defs>
+ <mask id="rect">
+ <rect x="0" y="1100" width="2528" height="500" fill="#fff" id="loader_svg_status" />
+ </mask>
+ </defs>
+ <g id="rapper">
+ <g fill="transparent" stroke="#000">
+ <path d="M191.1,172.9L246.7 172.9 246.7 330.1 291.2 330.1 291.2 172.9 347.1 172.9 347.1 130.4 191.1 130.4 z"/>
+ <path d="M586.3,258.5L544.9 130.4 499.3 130.4 457.9 258.3 424.9 130.4 377.6 130.4 432 330.1 478.7 330.1 521.5 197.7 564.1 330.1 610 330.1 664.4 130.4 618.7 130.4 z"/>
+ <path d="M780.5,126.1c-56.3,0-104,40.9-104,104.2c0,63.1,47.6,104,104,104c56.1,0,103.7-40.8,103.7-104 C884.2,167,836.6,126.1,780.5,126.1z M780.5,290.4c-27.9,0-57.8-18.6-57.8-60.3c0-41.7,29.9-60.6,57.8-60.6 c27.6,0,57.5,18.9,57.5,60.6C838,271.8,808.1,290.4,780.5,290.4z"/>
+ <path d="M1042.7,208.7L963 208.7 963 130.4 918.4 130.4 918.4 330.1 963 330.1 963 250.6 1042.7 250.6 1042.7 330.1 1087.5 330.1 1087.5 130.4 1042.7 130.4 z"/>
+ <path d="M1245.4,254.3c0,24.2-13.5,36.3-34.6,36.3c-21.1,0-34.7-12.1-34.7-36.3v-124h-44.5V258c0,50.1,35.2,76.6,79.2,76.6 c43.9,0,79.2-26.5,79.2-76.6V130.4h-44.5V254.3z"/>
+ <path d="M1502.6,172.9L1558.2 172.9 1558.2 330.1 1602.7 330.1 1602.7 172.9 1658.6 172.9 1658.6 130.4 1502.6 130.4 z"/>
+ <path d="M1738.6,130.4L1694.1 130.4 1694.1 330.1 1824.8 330.1 1824.8 287.6 1738.6 287.6 z"/>
+ <path d="M1904.3,249.5L1978.7 249.5 1978.7 210.4 1904.3 210.4 1904.3 172.3 1986.3 172.3 1986.3 130.4 1859.8 130.4 1859.8 330.1 1986.6 330.1 1986.6 287.8 1904.3 287.8 z"/>
+ <path d="M2174.7,192.9c0-35.5-25.4-62.5-64.8-62.5h-79.2v199.7h44.5v-74.4h15.8l38,74.4h49l-42.8-80.9 C2159.8,240.5,2174.7,219.9,2174.7,192.9z M2101.5,217.4h-26.2v-48.5h26.2c18.3,0,28.2,9.3,28.2,24.2 C2129.7,207.3,2119.8,217.4,2101.5,217.4z"/>
+ <path d="M1479.3,269.2c-0.7-28.4-21.1-52.5-59.3-58.5l-26.9-4.4c-13.9-2.2-20-9.1-20.2-18.6c-0.3-11,10.2-21.7,26.8-22.1 c23-0.6,31.4,13.4,33.6,22.8h33.8h7.5c0,0,0-1.2-0.2-3.3c-0.2-2.3-0.7-5.8-1.6-9.7c-0.3-1.3-0.6-2.5-1-3.8 c-0.2-0.7-0.4-1.4-0.7-2c-0.5-1.5-1.1-3-1.7-4.4c0-0.1-0.1-0.2-0.1-0.2c-0.1-0.3-0.2-0.5-0.4-0.8c-8.9-19.7-29.4-38.9-70-37.9 c-38.3,1-70.9,28.3-69.9,66.1c0.8,29.6,21.9,51.6,55.9,57.2l27.5,4.4c13.3,2.2,21.7,9.3,21.9,19.4c0.3,12.4-10.2,21.1-27.6,21.6 c-24.8,0.6-37.7-12.3-41.4-28.4h-37.6h-4.3c0,0,0,1.9,0.3,4.5l0.2,1.4c0,0.1,0,0.1,0,0.2c0.1,0.4,0.1,0.8,0.2,1.2c0,0,0,0,0,0.1 c0.1,0.6,0.2,1.3,0.3,1.9c5,27.5,29.7,60,82.8,58.6C1454.7,332.9,1480.1,300.4,1479.3,269.2z"/>
+ <path d="M2355.9,269.2c-0.7-28.4-21.1-52.5-59.3-58.5l-26.9-4.4c-13.9-2.2-20-9.1-20.2-18.6c-0.3-11,10.2-21.7,26.8-22.1 c23-0.6,31.4,13.4,33.6,22.8h33.8h7.5c0,0,0-1.2-0.2-3.3c-0.2-2.3-0.7-5.8-1.6-9.7c-0.3-1.3-0.6-2.5-1-3.8 c-0.2-0.7-0.4-1.4-0.7-2c-0.5-1.5-1.1-3-1.7-4.4c0-0.1-0.1-0.2-0.1-0.2c-0.1-0.3-0.2-0.5-0.4-0.8c-8.9-19.7-29.4-38.9-70-37.9 c-38.3,1-70.9,28.3-69.9,66.1c0.8,29.6,21.9,51.6,55.9,57.2l27.5,4.4c13.3,2.2,21.7,9.3,21.9,19.4c0.3,12.4-10.2,21.1-27.6,21.6 c-24.8,0.6-37.7-12.3-41.4-28.4h-37.6h-4.3c0,0,0,1.9,0.3,4.5l0.2,1.4c0,0.1,0,0.1,0,0.2c0.1,0.4,0.1,0.8,0.2,1.2c0,0,0,0,0,0.1 c0.1,0.6,0.2,1.3,0.3,1.9c5,27.5,29.7,60,82.8,58.6C2331.3,332.9,2356.7,300.4,2355.9,269.2z"/>
+ </g>
+ <g mask="url(#rect)" fill="#000">
+ <path d="M191.1,172.9L246.7 172.9 246.7 330.1 291.2 330.1 291.2 172.9 347.1 172.9 347.1 130.4 191.1 130.4 z"/>
+ <path d="M586.3,258.5L544.9 130.4 499.3 130.4 457.9 258.3 424.9 130.4 377.6 130.4 432 330.1 478.7 330.1 521.5 197.7 564.1 330.1 610 330.1 664.4 130.4 618.7 130.4 z"/>
+ <path d="M780.5,126.1c-56.3,0-104,40.9-104,104.2c0,63.1,47.6,104,104,104c56.1,0,103.7-40.8,103.7-104 C884.2,167,836.6,126.1,780.5,126.1z M780.5,290.4c-27.9,0-57.8-18.6-57.8-60.3c0-41.7,29.9-60.6,57.8-60.6 c27.6,0,57.5,18.9,57.5,60.6C838,271.8,808.1,290.4,780.5,290.4z"/>
+ <path d="M1042.7,208.7L963 208.7 963 130.4 918.4 130.4 918.4 330.1 963 330.1 963 250.6 1042.7 250.6 1042.7 330.1 1087.5 330.1 1087.5 130.4 1042.7 130.4 z"/>
+ <path d="M1245.4,254.3c0,24.2-13.5,36.3-34.6,36.3c-21.1,0-34.7-12.1-34.7-36.3v-124h-44.5V258c0,50.1,35.2,76.6,79.2,76.6 c43.9,0,79.2-26.5,79.2-76.6V130.4h-44.5V254.3z"/>
+ <path d="M1502.6,172.9L1558.2 172.9 1558.2 330.1 1602.7 330.1 1602.7 172.9 1658.6 172.9 1658.6 130.4 1502.6 130.4 z"/>
+ <path d="M1738.6,130.4L1694.1 130.4 1694.1 330.1 1824.8 330.1 1824.8 287.6 1738.6 287.6 z"/>
+ <path d="M1904.3,249.5L1978.7 249.5 1978.7 210.4 1904.3 210.4 1904.3 172.3 1986.3 172.3 1986.3 130.4 1859.8 130.4 1859.8 330.1 1986.6 330.1 1986.6 287.8 1904.3 287.8 z"/>
+ <path d="M2174.7,192.9c0-35.5-25.4-62.5-64.8-62.5h-79.2v199.7h44.5v-74.4h15.8l38,74.4h49l-42.8-80.9 C2159.8,240.5,2174.7,219.9,2174.7,192.9z M2101.5,217.4h-26.2v-48.5h26.2c18.3,0,28.2,9.3,28.2,24.2 C2129.7,207.3,2119.8,217.4,2101.5,217.4z"/>
+ <path d="M1479.3,269.2c-0.7-28.4-21.1-52.5-59.3-58.5l-26.9-4.4c-13.9-2.2-20-9.1-20.2-18.6c-0.3-11,10.2-21.7,26.8-22.1 c23-0.6,31.4,13.4,33.6,22.8h33.8h7.5c0,0,0-1.2-0.2-3.3c-0.2-2.3-0.7-5.8-1.6-9.7c-0.3-1.3-0.6-2.5-1-3.8 c-0.2-0.7-0.4-1.4-0.7-2c-0.5-1.5-1.1-3-1.7-4.4c0-0.1-0.1-0.2-0.1-0.2c-0.1-0.3-0.2-0.5-0.4-0.8c-8.9-19.7-29.4-38.9-70-37.9 c-38.3,1-70.9,28.3-69.9,66.1c0.8,29.6,21.9,51.6,55.9,57.2l27.5,4.4c13.3,2.2,21.7,9.3,21.9,19.4c0.3,12.4-10.2,21.1-27.6,21.6 c-24.8,0.6-37.7-12.3-41.4-28.4h-37.6h-4.3c0,0,0,1.9,0.3,4.5l0.2,1.4c0,0.1,0,0.1,0,0.2c0.1,0.4,0.1,0.8,0.2,1.2c0,0,0,0,0,0.1 c0.1,0.6,0.2,1.3,0.3,1.9c5,27.5,29.7,60,82.8,58.6C1454.7,332.9,1480.1,300.4,1479.3,269.2z"/>
+ <path d="M2355.9,269.2c-0.7-28.4-21.1-52.5-59.3-58.5l-26.9-4.4c-13.9-2.2-20-9.1-20.2-18.6c-0.3-11,10.2-21.7,26.8-22.1 c23-0.6,31.4,13.4,33.6,22.8h33.8h7.5c0,0,0-1.2-0.2-3.3c-0.2-2.3-0.7-5.8-1.6-9.7c-0.3-1.3-0.6-2.5-1-3.8 c-0.2-0.7-0.4-1.4-0.7-2c-0.5-1.5-1.1-3-1.7-4.4c0-0.1-0.1-0.2-0.1-0.2c-0.1-0.3-0.2-0.5-0.4-0.8c-8.9-19.7-29.4-38.9-70-37.9 c-38.3,1-70.9,28.3-69.9,66.1c0.8,29.6,21.9,51.6,55.9,57.2l27.5,4.4c13.3,2.2,21.7,9.3,21.9,19.4c0.3,12.4-10.2,21.1-27.6,21.6 c-24.8,0.6-37.7-12.3-41.4-28.4h-37.6h-4.3c0,0,0,1.9,0.3,4.5l0.2,1.4c0,0.1,0,0.1,0,0.2c0.1,0.4,0.1,0.8,0.2,1.2c0,0,0,0,0,0.1 c0.1,0.6,0.2,1.3,0.3,1.9c5,27.5,29.7,60,82.8,58.6C2331.3,332.9,2356.7,300.4,2355.9,269.2z"/>
+ </g>
+ </g>
+ </svg>
+</div>
+</div>
+
<div id="scene_container">
<div id="scene"></div>
<div id="entry_container">
</div>
</div>
+<script type="text/plain" id="preload-image-list">
+{% for image in about.images %}{{ image.uri }}
+{% endfor %}</script>
+<script type="text/plain" id="box-image-list">
+{% for image in shape.images %}{{ image.uri }}
+{% endfor %}</script>
-<a class="burgWrapper" href="##">
- <div class="burg"></div>
-</a>
<div class="toggleRapper">
<div class="menuToggle"></div>
</div>
-<a href="#" class="logo"><img src="assets/images/2H_LOGOMARK.png"></a>
</body>
-<!-- if production else :-p -->
-<!--
-<script src="assets/app.min.js"></script>
--->
-<script src="assets/javascripts/mx/mx.skew.js"></script>
-<script src="assets/javascripts/mx/extensions/mx.scene.js"></script>
-<script src="assets/javascripts/mx/extensions/mx.unclampedOrbitCamera.js"></script>
-<script src="assets/javascripts/mx/primitives/mx.image.js"></script>
-<script src="assets/javascripts/vendor/jquery.min.js"></script>
-<script src="assets/javascripts/vendor/froogaloop.js"></script>
-<script src="assets/javascripts/vendor/flickity.pkgd.js"></script>
-<script src="assets/javascripts/vendor/loader.js"></script>
-<script src="assets/javascripts/vendor/wheel.js"></script>
-<script src="assets/javascripts/vendor/polyfill.js"></script>
-<script src="assets/javascripts/vendor/util.js"></script>
-<script src="assets/javascripts/_env.js"></script>
-<script src="assets/javascripts/app.js"></script>
+{% if meta.production %}
+ <script src="assets/app.min.js"></script>
+{% else %}
+ <script src="assets/javascripts/mx/mx.skew.js"></script>
+ <script src="assets/javascripts/mx/extensions/mx.scene.js"></script>
+ <script src="assets/javascripts/mx/extensions/mx.unclampedOrbitCamera.js"></script>
+ <script src="assets/javascripts/mx/extensions/mx.unclampedOrbitCameraMobile.js"></script>
+ <script src="assets/javascripts/mx/primitives/mx.image.js"></script>
+ <script src="assets/javascripts/vendor/jquery.min.js"></script>
+ <script src="assets/javascripts/vendor/froogaloop.js"></script>
+ <script src="assets/javascripts/vendor/fastclick.js"></script>
+ <script src="assets/javascripts/vendor/flickity.pkgd.js"></script>
+ <script src="assets/javascripts/vendor/loader.js"></script>
+ <script src="assets/javascripts/vendor/wheel.js"></script>
+ <script src="assets/javascripts/vendor/polyfill.js"></script>
+ <script src="assets/javascripts/vendor/util.js"></script>
+ <script src="assets/javascripts/_env.js"></script>
+ <script src="assets/javascripts/app.js"></script>
+{% endif %}
</html>
diff --git a/site/templates/page.liquid b/site/templates/page.liquid
index f752cb9..63f71f2 100644
--- a/site/templates/page.liquid
+++ b/site/templates/page.liquid
@@ -1,9 +1,15 @@
<div class="entry page">
<span>
- <span class="postname">{{page.title}}</span>
- <img class="mainimg" src="{{page.image}}">
- <div class="content">
- {{page.body}}
- </div>
+ {% if page.image %}
+ <span class="postname">{{page.title}}</span>
+ <img class="mainimg" src="{{page.image}}">
+ <div class="content">
+ {{page.body | newline_to_br}}
+ </div>
+ {% else %}
+ <div class="content noline">
+ {{page.body | newline_to_br}}
+ </div>
+ {% endif %}
</span>
</div>
diff --git a/site/templates/project.liquid b/site/templates/project.liquid
index 5e6bc84..65587d9 100644
--- a/site/templates/project.liquid
+++ b/site/templates/project.liquid
@@ -1,22 +1,26 @@
<div class="entry">
<span>
- <span class="postname">{{post.title}}</span>
-
+ <span class="postname">{{project.title}}</span>
+ <div class="galnav">
+ <span class="prevbutton">PREVIOUS</span>
+ <span class="nextbutton">NEXT</span>
+ </div>
<div class="gallery" id="okgallery">
- {% if post.video %}
- <div class="cell video" style="background-image:url({{ post.video.thumb }}" data-video="https://player.vimeo.com/video/{{ post.video.token }}" data-caption="{{ post.video.title }}"></div>
- {% endif %}
- {% for image in post.images %}
- <div class="cell" data-caption="{{ image.caption }}"><img src="{{ image.uri }}"></div>
+ {% for media in project.media %}
+ {% if media.token %}
+ <div class="cell video" style="background-image:url({{ media.thumb }})" data-video="https://player.vimeo.com/video/{{ media.token }}" data-caption=""></div>
+ {% else %}
+ <div class="cell loading" data-caption="{{ media.caption }}"><img src="{{ media.uri }}"></div>
+ {% endif %}
{% endfor %}
</div>
<div class="caption"></div>
<div class="content">
- {{ post.description }}
+ {{ project.description | newline_to_br }}
</div>
<div class="credit">
- <a href="#"><img src="assets/images/fb2.png"></a>
- <a href="#"><img src="assets/images/tw2.png"></a>
+ <img src="{{static}}/assets/images/fb2.png" class="fb">
+ <img src="{{static}}/assets/images/tw2.png" class="tw">
</div>
- </span>
+ </span>
</div> \ No newline at end of file
diff --git a/themes/okadmin/public/css/main.css b/themes/okadmin/public/css/main.css
index a1e20a0..6a48e94 100644
--- a/themes/okadmin/public/css/main.css
+++ b/themes/okadmin/public/css/main.css
@@ -14,11 +14,12 @@ html, body {
background-attachment: scroll;
}
-ul {
+ul, ol {
padding: 0;
list-style: none;
}
+.main.index .resource-category button,
a {
color: #A200FF;
text-decoration: none;
@@ -26,6 +27,7 @@ a {
text-transform: uppercase;
}
+.main.index .resource-category button:hover,
a:hover {
border-bottom: 1px solid #A200FF;
}
@@ -41,11 +43,14 @@ a:visited {
}
.admin-header .breadcrumb {
- margin-left: 1em;
+ margin-left: 0.5em;
font-size: 2em;
color: rgba(0, 0, 0, 0.25);
line-height: 50px;
}
+.admin-header .breadcrumb b {
+ color: #333;
+}
.admin-header .site-link {
float: right;
@@ -62,7 +67,12 @@ a:visited {
border: 2px solid #ddd;
}
-nav {
+.main.index .resource-category.active li:before {
+ content: "፧";
+ margin-right: 1em;
+}
+
+.resource-nav {
background: white;
width: 10%;
margin: 2.5em 1em;
@@ -86,25 +96,69 @@ h2 {
transform: rotate(-1deg);
}
-.main.index .resource-category a.add-new {
- border-bottom: 3px solid rgba(0, 0, 0, 0);
+.main.index .resource-category nav {
float: right;
- font-size: 1.5em;
+}
+
+.main.index .resource-category.active ol {
+ cursor: -webkit-grab;
+ cursor: grab;
+}
+
+.main.index .resource-category.active li a {
+ pointer-events: none;
+}
+
+/* Makes the button look like a link */
+.main.index .resource-category button {
+ background: none !important;
+ height: 1.5em;
+ border: none;
+ padding: 0 !important;
+ font: inherit;
+ cursor: pointer;
+ font-family: Monaco, monospace;
+ text-transform: uppercase;
+}
+
+.main.index .resource-category .btn {
+ border-bottom: 3px solid rgba(0, 0, 0, 0);
color: rgba(0, 0, 0, 0.25);
+ line-height: 20px;
+}
+
+.main.index .resource-category .btn {
+ display: none;
+}
+
+.main.index .resource-category .btn.active {
+ display: inline;
+}
+
+.main.index .resource-category .btn:hover {
+ border-bottom: 1px solid rgba(0, 0, 0, 0.25);
+}
+
+.main.index .resource-category .btn {
+ margin-right: 1em;
+}
+
+.main.index .resource-category .btn:last-child {
+ margin-right: 0;
+}
+.main.index .resource-category .add-btn {
+ font-size: 20px;
}
.main.index .resource-category li {
margin: 1em 0;
}
-.main.index .resource-category a.add-new:hover {
- border-bottom: 3px solid rgba(0, 0, 0, 0.25);
-}
.main.resource {
float: left;
margin-top: 2em;
- width: 80%;
+ width: 85%;
}
.main.resource > * {
@@ -151,7 +205,18 @@ label {
padding: 0 0.5em;
margin-bottom: 1em;
}
+.main.resource form input[name=id] {
+ width: 15em;
+}
+button, input[type=submit] {
+ cursor: pointer;
+}
+.main.resource .date input {
+ /* date inputs need font family override */
+ font-family: "Helvetica", sans-serif;
+}
.main.resource form .group {
+ position: relative;
display: block;
float: left;
width: 31em;
@@ -168,27 +233,57 @@ label {
border: 0;
display: none;
}
-.main.resource form .group.loaded input:first-child,
+.main.resource form .group.image input,
+.main.resource form .group.video input[type=text]:first-child,
+.main.resource form .group.loaded.video input[type=text],
.main.resource form .group input:first-child {
display: block;
width: 25em;
}
+.main.resource form .group .checkboxes,
+.main.resource form .group.loaded .checkboxes {
+ clear: left;
+ display: block;
+ max-width: 250px;
+ padding-top: 5px;
+}
+.main.resource form .group .checkboxes input.flag,
+.main.resource form .group.loaded .checkboxes input.flag {
+ display: inline-block;
+ max-width: 20px;
+ float: none;
+}
+.main.resource form .group .checkboxes label,
+.main.resource form .group.loaded .checkboxes label {
+ display: inline-block;
+ float: none;
+ width: 70px;
+ margin: 0;
+ text-align: left;
+}
.main.resource form .group.loaded label {
display: block;
}
.main.resource form .group.loaded input {
display: block;
- width: 20.05em;
}
-.main.resource form .group input {
- display: none;
+.main.resource form .group input[type=text] {
+ width: 20.05em;
margin-bottom: 0.1em;
}
+.main.resource form .group.image .image-element,
+.main.resource form .group.video input[type=text],
.main.resource form .group.loaded input[hidden],
+.main.resource form .group.image.loaded .fields,
.main.resource form input[hidden] {
display: none;
}
-
+.main.resource form .group.image.loaded .image-element {
+ display: block;
+}
+.main.resource form .fields {
+ height: 3em;
+}
.main.resource form textarea {
padding: 0.5em;
height: 15em;
@@ -202,6 +297,9 @@ label {
font-size: 1.0em;
margin-top: 1.0em;
}
+.main.resource form#delete_form button {
+ float: right;
+}
.main.resource form ol {
margin: 0;
@@ -211,43 +309,118 @@ label {
list-style-type: none;
display: block;
clear: both;
- height: 10em;
+ height: 7em;
}
.main.resource form img {
- width: 10em;
- max-height: 10em;
+ width: auto;
+ height: auto;
+ max-width: 10em;
+ max-height: 6em;
border: 0;
+}
+.main.resource form .images img {
cursor: -webkit-grab;
cursor: grab;
}
.main.resource form textarea.caption {
width: 15em;
- height: 9em;
+ height: 6em;
+}
+.main.resource form .audio-element input[type=text],
+.main.resource form .video-element input[type=text] {
+ width: 15em;
+}
+.main.resource form .group input[type=text].link-input,
+.main.resource form .group input[type=text].link-input-new {
+ width: 13.05em;
+ padding: 0 0 0 0.5em;
+}
+.handle {
+ display: block;
+ width: 1em;
+ height: 2em;
+ background: #ddd;
+ float: left;
+}
+.main.resource form .links li {
+ height: 2em;
+}
+.main .link-list .add-link-btn,
+.main .link-list .remove-link-btn {
+ margin: 0;
+ height: 2em;
+ line-height: 1em;
}
.add-image-button {
background: #ddd;
clear: left;
text-align: left;
- padding: 10px;
- width: 15em;
+ float: left;
+ margin-right: 1em;
position: relative;
+ overflow: hidden;
+ cursor: pointer;
}
.add-image-button:hover {
background: #def;
}
+.main.resource form .add-image-button button {
+ margin: 0;
+ pointer-events: none;
+ width: 100%; height: 100%;
+}
.add-image-button input[type=file] {
opacity: 0;
position: absolute;
top: 0; left: 0;
width: 100%; height: 100%;
+ margin: 0; padding: 0;
cursor: pointer;
}
-li.image-element:hover .remove-image {
+.audio-element:hover .remove,
+.video-element:hover .remove,
+.image-element:hover .remove {
display: block;
}
-.remove-image {
+.audio-element .remove:hover,
+.video-element .remove:hover,
+.image-element .remove:hover {
+ color: red;
+}
+
+.progress {
+ position: absolute;
+ top: 0; right: -100px;
+ padding: 10px 10px 0 10px;
+ margin: 0px;
+ width: 100px;
+ pointer-events: none;
+ background: #eee;
+ opacity: 0;
+ transition: opacity 0.3s;
+}
+.progress .xhr {
+ height: 10px;
+ background: black;
+ margin-bottom: 10px;
+ transition: all 0.2s;
+}
+.progress .xhr div {
+ background: white;
+ transition: all 0.2s;
+ height: 100%;
+}
+.progress.loading {
+ opacity: 1;
+}
+
+/*
+.remove {
display: none;
}
+ */
+
+#delete_form button:hover { color: red }
.template {
display: none;
@@ -257,16 +430,27 @@ li.image-element:hover .remove-image {
}
-.errors {
+.success, .errors {
background: white;
- padding: 10px;
- width: 100%;
+ padding: 9px 8px 7px;
+ width: 50%;
line-height: 1.4em;
+ border: 1px solid;
+ margin: 1em;
+ border-radius: 2px;
}
-.errors .message {
+
+.success {
+ color: green;
+}
+.errors {
color: red;
}
.clear {
clear: both;
}
+
+.hidden {
+ display: none;
+}
diff --git a/themes/okadmin/public/js/app.js b/themes/okadmin/public/js/app.js
index 4b8d98f..9891298 100644
--- a/themes/okadmin/public/js/app.js
+++ b/themes/okadmin/public/js/app.js
@@ -1,61 +1,333 @@
var OKAdmin = function(){
-
- OKUpload.bind()
- OKUpload.add = function(data){
- var url = data[0].extra.Location
- add_image(url)
- }
- function add_image(url){
- var imageTemplate = $("#captioned-image-template").html()
- var $el = $(imageTemplate)
- $el.find(".uri").val(url)
- $el.find("img").attr("src", url)
- $(".captioned-image-list ol").append($el)
- }
- $(".captioned-image-list ol").sortable()
- $(".captioned-image-list ol").disableSelection()
-
- $("#add-image-url").keydown(pressEnter(function(e){
- var url = $(this).val()
- $(this).val("")
- add_image(url)
- })})
-
- $(document).on("click", ".remove-image", function(){
- if (confirm("Delete this image?")) {
+
+ // initialize our multi-image uploader with an element and a template
+ $(".group.image-list").each(function(){
+ var parent = this
+ var uploader = new OKUpload ()
+ uploader.bind( this )
+ uploader.add = function(media){
+ var url = media.url
+ var imageTemplate = $(".image-template", parent).html()
+ var $el = $(imageTemplate)
+ $el.find(".uri").val(media.url)
+ $el.find(".image-width").val(media.width)
+ $el.find(".image-height").val(media.height)
+ $el.find("img").attr("src", media.url)
+ $("ol", parent).prepend($el)
+ }
+ })
+ // delete image from gallery
+ $(document).on("mousedown", ".image-list .remove", function(){
+ if (confirm("Remove this image?")) {
$(this).parent().remove()
}
})
-
- $(".video .url").keydown(pressEnter(function(){
+
+ // Add default date
+ $('.date input').each(function(i, el){
+ var value = el.getAttribute('value')
+ if (!value) {
+ el.setAttribute('value', toDateInputValue(new Date))
+ }
+
+ function toDateInputValue (date) {
+ var local = new Date(date);
+ local.setMinutes(date.getMinutes() - date.getTimezoneOffset());
+ return local.toJSON().slice(0,10);
+ }
+ })
+
+ // initialize our multimedia uploader with an element and a template
+ $(".group.media-list").each(function(){
+ var parent = this
+ var uploader = new OKUpload ()
+ uploader.bind( this )
+ uploader.add = function(media){
+ var url = media.url
+ var imageTemplate = $(".image-template", parent).html()
+ var $el = $(imageTemplate)
+ $el.find(".uri").val(media.url)
+ $el.find(".image-width").val(media.width)
+ $el.find(".image-height").val(media.height)
+ $el.find("img").attr("src", media.url)
+ $("ol", parent).prepend($el)
+ }
+ uploader.addMedia = function(media){
+ switch (media.type) {
+ case 'youtube':
+ case 'vimeo':
+ case 'video':
+ var videoTemplate = $(".video-template", parent).html()
+ var $el = $(videoTemplate)
+ $el.addClass("loaded")
+ $el.find(".video-type").val( media.type )
+ $el.find(".video-token").val( media.token )
+ $el.find(".video-uri").val( media.uri )
+ $el.find(".video-title").val( media.title )
+ $el.find(".video-thumb").val( media.thumbnail )
+ $el.find(".video-width").val( media.width )
+ $el.find(".video-height").val( media.height )
+ $el.find("img").attr("src", media.thumbnail )
+ $("ol", parent).prepend($el)
+ break
+ case 'audio':
+ var audioTemplate = $(".audio-template", parent).html()
+ var $el = $(audioTemplate)
+ $el.addClass("loaded")
+ $el.find(".audio-type").val( media.type )
+ $el.find(".audio-token").val( media.token )
+ $el.find(".audio-uri").val( media.uri )
+ $el.find(".audio-title").val( media.title )
+ $el.find(".audio-thumb").val( media.thumbnail )
+ $el.find(".audio-duration").val( media.duration )
+ $el.find("img").attr("src", media.thumbnail )
+ $("ol", parent).prepend($el)
+ break
+ case 'link':
+ var linkTemplate = $(".link-template", parent).html()
+ var $el = $(linkTemplate)
+ $el.addClass("loaded")
+ $el.find(".uri").val( media.url )
+ $("ol", parent).prepend($el)
+ break
+ default:
+ alert("Unsupported link type!")
+ }
+ }
+ })
+ // delete image from gallery
+ $(document).on("mousedown", ".media-list .remove", function(){
+ if (confirm("Remove this media?")) {
+ $(this).parent().remove()
+ }
+ })
+
+ // initialize our single image uploader with existing DOM
+ $(".group.image").each(function(){
+ var $el = $(this)
+ var uploader = new OKUpload ()
+ uploader.bind( this )
+ uploader.add = function(media){
+ console.log(media)
+ $el.find(".uri").val(media.url)
+ $el.find(".caption").val("")
+ $el.find(".image-width").val(media.width)
+ $el.find(".image-height").val(media.height)
+ $el.find("img").attr("src", media.url).show()
+ $el.addClass("loaded")
+ }
+ })
+ // delete image from single image entry
+ $(document).on("mousedown", ".image .remove", function(){
+ if (confirm("Remove this image?")) {
+ var $el = $(this).closest(".image")
+ $el.removeClass('loaded')
+ $el.find(".uri").val("")
+ $el.find(".image-width").val("")
+ $el.find(".image-height").val("")
+ $el.find(".caption").val("")
+ $el.find("img").attr("src", "")
+ }
+ })
+
+ // make the region sortable with drag-and-drop
+ $(".media-list ol, .image-list ol, .link-list .links").sortable()
+ $(".media-list ol, .image-list ol").disableSelection()
+
+ // populate a video field with info from our url parser
+ var last_url
+ $(".video .url").on("focus", function(){
+ var $el = $(this)
+ last_url = $el.val()
+ })
+ $(".video .url").on("keydown blur", pressEnter(function(){
var $el = $(this)
var url = $el.val()
+ if (url == last_url) { return }
Parser.parse( url, function(media){
console.log(url,media)
$el.parent().addClass("loaded")
$el.parent().find(".video-type").val( media.type )
$el.parent().find(".video-token").val( media.token )
+ $el.parent().find(".video-uri").val( media.url )
$el.parent().find(".video-title").val( media.title )
$el.parent().find(".video-thumb").val( media.thumbnail )
+ $el.parent().find(".video-width").val( media.width )
+ $el.parent().find(".video-height").val( media.height )
})
- }}))
-
- $("form").submit(function(){
- $(".image-element").each(function(index){
- $(this).find("input,textarea").each(function(){
- var field = $(this).attr("name").replace(/\[\]/, "[" + index + "]")
- $(this).attr("name", field)
+ }))
+
+ // Add a new link to the list
+ $('.link-list').on('click', '.add-link-btn', function addNewLink (e) {
+ e.preventDefault && e.preventDefault()
+ e.stopPropagation && e.stopPropagation()
+ var $delegate = $(e.delegateTarget)
+ var $list = $delegate.find('.links')
+ var linkCount = $list.find("li").length
+
+ var $linkText = $delegate.find(".link-input-new.link-text")
+ var $linkURI = $delegate.find(".link-input-new.link-uri")
+
+ var template = $delegate.find(".link-template").html()
+ template = template.replace(/\[\]/g, "[" + linkCount + "]")
+ var $el = $(template)
+ $el.find(".link-text").val( $linkText.val() )
+ $el.find(".link-uri").val( $linkURI.val() )
+ $list.append($el)
+ $linkText.val("")
+ $linkURI.val("")
+ })
+
+ // Remove a link from the list
+ $('.link-list').on('click', '.remove-link-btn', function(e) {
+ e.preventDefault()
+ e.stopPropagation()
+ var $target = $(e.target)
+ $target.closest("li").remove()
+ })
+
+ // fix post indexing in list-driven inputs
+ $(".main.resource form").submit(function(e){
+ var $id = $("[name=id]"), $title = $("[name=title]"), $menu = $("[name=menu]"), $section = $(".resource.main")
+ var id = $section.data("id"), type = $section.data("type")
+
+ if ($title.length && ! $title.val()) {
+ $title.focus()
+ alert("Please enter a title")
+ e.preventDefault()
+ return
+ }
+
+ if ($menu.length && ! $menu.val()) {
+ $menu.val( $title.val() )
+ }
+
+ // TODO: pass through whether this page is static
+ if (type === "page" && (id == "contact" || id == "about")) {
+ ;
+ }
+ else {
+ var slug = slugify( $title.val() )
+ $id.val( slug )
+ }
+
+ // Parse date input
+ $('.property .date').each(function(i, el) {
+ var name = $(el).parent('.property').data('name')
+ var $input = $(el).find('input')
+ var date = new Date($input.val())
+ // Set to middle of day so it is the same date
+ // for all locales
+ date.setUTCHours(12)
+ var dateString = date.toUTCString()
+ var normalizedInput = document.createElement('input')
+ $(normalizedInput).attr({
+ name: name,
+ type: 'text',
+ value: dateString
+ })
+ $input.remove()
+ $(el).append(normalizedInput)
+ })
+
+ // Modify flags checkboxes such that unchecked ones return "false"
+ // instead of nothing
+ $('.property input[type=checkbox]').each(function(i, el) {
+ var checked = !!el.checked
+ if (!checked) {
+ el.value = 'false'
+ el.setAttribute('checked', true)
+ }
+ })
+
+ $(".link-list").each(function(){
+ var $inputs = $(this).find(".link-input-new")
+ if ($inputs.eq(0).val() && $inputs.eq(1).val()) {
+ $(this).find(".add-link-btn").trigger("click")
+ }
+ })
+
+ $("ol").each(function(){
+ $("li", this).each(function(index){
+ $(this).find("input,textarea").each(function(){
+ var field = $(this).attr("name").replace(/\[[0-9]*\]/, "[" + index + "]")
+ $(this).attr("name", field)
+ })
})
})
})
+
+ // delete individual records
+ $("#delete_form").submit(function(e){
+ if (confirm("Are you sure you want to delete this record?")) {
+ return
+ }
+ else {
+ e.preventDefault()
+ }
+ })
+
+ // reorder items in categories
+ $(".resource-category:not(.grouped)").on("click", ".edit-btn", function(e) {
+ e.preventDefault();
+ var $parent = $(e.delegateTarget)
+ var $editBtn = $parent.find(".edit-btn");
+ var $cancelBtn = $parent.find(".cancel-btn");
+ var $saveBtn = $parent.find(".save-btn");
+ var $ol = $parent.find("ol");
+ var toggles = [$parent, $cancelBtn, $saveBtn, $editBtn];
+
+ $ol.sortable();
+ $ol.disableSelection();
+ toggle();
+
+ $cancelBtn.one("click", function(e) {
+ $ol.sortable("cancel");
+ $ol.enableSelection();
+ toggle();
+ });
+
+ $saveBtn.one("click", function(e) {
+ $ol.sortable();
+ toggle();
+ });
+
+ function toggle() {
+ toggles.forEach(function($el) {
+ $el.toggleClass('active');
+ })
+ }
+ });
+
+ // save new category order
+ $(".resource-category.root").on("submit", "form", function(e) {
+ var $parent = $(e.delegateTarget);
+ var $resources = $parent.find(".resource-input")
+ var isDescending = $parent.hasClass("descending")
+ $resources.each(function(index) {
+ var $input = $(this);
+ var parsed = JSON.parse($input.val());
+ if (isDescending) {
+ parsed.__index = $resources.length - index;
+ }
+ else {
+ parsed.__index = index;
+ }
+ $input.val(JSON.stringify(parsed));
+ })
+ });
- function pressEnter(fn){
- return function(e){
- if (e.keyCode !== 13) return
+ $(window).on('keydown', function(e){
+ if ( (e.ctrlKey || e.altKey || e.metaKey) && e.keyCode == 83 ) {
e.preventDefault()
+ $("#resource_form").submit()
}
- }
+ })
+}
$(function(){
window.app = new OKAdmin ()
})
+
+
+function slugify (s){ return (s || "").toLowerCase().replace(/\s/g,"-").replace(/[^-_a-zA-Z0-9]/g, '-').replace(/-+/g, "-") }
diff --git a/themes/okadmin/public/js/parser.js b/themes/okadmin/public/js/parser.js
index 411f425..81bba2d 100644
--- a/themes/okadmin/public/js/parser.js
+++ b/themes/okadmin/public/js/parser.js
@@ -31,15 +31,17 @@ var Parser = {
regex: /\.(mp4|webm)(\?.*)?$/i,
fetch: function(url, done) {
var video = document.createElement("video")
+ var url_parts = url.replace(/\?.*$/, "").split("/")
+ var filename = url_parts[ url_parts.length-1 ]
video.addEventListener("loadedmetadata", function(){
var width = video.videoWidth, height = video.videoHeight
video = null
done({
url: url,
type: "video",
- token: "",
- thumbnail: "",
- title: "",
+ token: url,
+ thumbnail: "http://okfocus.s3.amazonaws.com/misc/okcms/video.png",
+ title: filename,
width: width,
height: height,
})
@@ -51,6 +53,31 @@ var Parser = {
return '<video src="' + media.url + '">';
}
}, {
+ type: 'audio',
+ regex: /\.(wav|mp3)(\?.*)?$/i,
+ fetch: function(url, done) {
+ var audio = document.createElement("audio")
+ var url_parts = url.replace(/\?.*$/, "").split("/")
+ var filename = url_parts[ url_parts.length-1 ]
+ audio.addEventListener("loadedmetadata", function(){
+ var duration = audio.duration
+ audio = null
+ done({
+ url: url,
+ type: "audio",
+ token: url,
+ thumbnail: "http://okfocus.s3.amazonaws.com/misc/okcms/audio.png",
+ title: filename,
+ duration: duration,
+ })
+ })
+ audio.src = url
+ audio.load()
+ },
+ tag: function (media) {
+ return '<audio src="' + media.url + '">';
+ }
+ }, {
type: 'youtube',
regex: /(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/i,
fetch: function(url, done) {
@@ -73,6 +100,8 @@ var Parser = {
token: id,
thumbnail: thumb,
title: res.snippet.title,
+ autoplay: false,
+ loop: false,
width: 640,
height: 360,
})
@@ -106,6 +135,8 @@ var Parser = {
title: res.title,
width: res.width,
height: res.height,
+ autoplay: false,
+ loop: false,
})
}
})
@@ -114,8 +145,7 @@ var Parser = {
// return '<img class="video" type="vimeo" vid="'+media.token+'" src="'+media.thumbnail+'"><span class="playvid">&#9654;</span>';
return '<div class="video" style="width: ' + media.width + 'px; height: ' + media.height + 'px; overflow: hidden; position: relative;"><iframe frameborder="0" scrolling="no" seamless="seamless" webkitallowfullscreen="webkitAllowFullScreen" mozallowfullscreen="mozallowfullscreen" allowfullscreen="allowfullscreen" id="okplayer" src="http://player.vimeo.com/video/' + media.token + '?api=1&title=0&byline=0&portrait=0&playbar=0&player_id=okplayer&loop=0&autoplay=0" width="' + media.width + '" height="' + media.height + '" style="position: absolute; top: 0px; left: 0px; width: ' + media.width + 'px; height: ' + media.height + 'px;"></iframe></div>'
}
- },
- {
+ }, {
type: 'soundcloud',
regex: /soundcloud.com\/[-a-zA-Z0-9]+\/[-a-zA-Z0-9]+\/?$/i,
fetch: function (url, done) {
@@ -126,13 +156,14 @@ var Parser = {
+ '&client_id='
+ '0673fbe6fc794a7750f680747e863b10',
success: function(result) {
- // console.log(result)
+ console.log(result)
done({
url: url,
type: "soundcloud",
token: result.id,
thumbnail: result.artwork_url || result.user.avatar_url,
title: result.user.username + " - " + result.title,
+ duration: result.duration,
width: 166,
height: 166,
})
@@ -145,7 +176,6 @@ var Parser = {
'&amp;color=ff6600&amp;auto_play=false&amp;show_artwork=true"></iframe>'
}
},
- /*
{
type: 'link',
regex: /^http.+/i,
@@ -163,8 +193,7 @@ var Parser = {
tag: function (media) {
return '<a href="' + media.url + '" target="_blank">' + media.url + '</a>'
}
- }
- */
+ },
],
tumblr: function(url, cb){
@@ -232,6 +261,8 @@ var Parser = {
title: stripHTML(post['video-caption']),
width: 640,
height: 360,
+ autoplay: false,
+ loop: false,
}
media_list.push(media)
}
diff --git a/themes/okadmin/public/js/upload.js b/themes/okadmin/public/js/upload.js
index d9fd5ed..6ff7ac9 100644
--- a/themes/okadmin/public/js/upload.js
+++ b/themes/okadmin/public/js/upload.js
@@ -1,56 +1,191 @@
-var OKUpload = {
- action: "/_services/image",
-
- bind: function(){
- var el = document.getElementById("file")
- if (! el) return
- el.addEventListener("change", OKUpload.handleFileSelect)
- },
+var OKUpload = function(){
+ this.config = $("#uploadConfig").data()
+ this.imageAction = "/_services/s3/image"
+ this.videoAction = "/_services/s3/video"
+ this.audioAction = "/_services/s3/audio"
+}
+OKUpload.prototype.bind = function(rapper){
+ var uploader = this
+ this.rapper = rapper
+ this.$progress = $("<div class='progress'>")
+ this.xhrCount = 0
+ this.loadCount = 0
+
+ $(this.rapper).append(this.$progress)
+ $(".add-image-button input", rapper).change( uploader.handleFileSelect.bind(uploader) )
+ $(".add-url", rapper).on("keydown blur", pressEnter( function(e){
+ var url = $(this).val()
+ $(this).val("")
+ uploader.parse(url)
+ }))
+}
+OKUpload.prototype.parse = function(url){
+ if (! url) return
+ var uploader = this
+ Parser.parse( url, function(media){
+ console.log(url, media)
+ if (! media) {
+ alert("Not a valid link")
+ }
+ else if (media.type == "image") {
+ uploader.add(media)
+ }
+ else {
+ uploader.addMedia(media)
+ }
+ })
+}
+OKUpload.prototype.handleFileSelect = function(e) {
+ e.stopPropagation();
+ e.preventDefault();
- handleFileSelect: function(e) {
- e.stopPropagation();
- e.preventDefault();
+ var files = e.dataTransfer ? e.dataTransfer.files : e.target.files;
- var files = e.dataTransfer ? e.dataTransfer.files : e.target.files;
+ for (var i = 0, f; f = files[i]; i++) {
+ this.upload(f)
+ }
+}
+OKUpload.prototype.largeFileError = function(file, maxSize) {
+ var your_bytes = bytesToString(file.size)
+ var max_bytes = bytesToString(maxSize)
+ alert("Sorry, your file is too big.\n\n" + file.name + "\n\nYour file: " + your_bytes + "\nMax size: " + max_bytes)
+ function bytesToString (n) {
+ if (n < 1024) return n + " bytes"
+ n /= 1024
+ if (n < 1024) return n.toFixed(1) + " kb"
+ n /= 1024
+ if (n < 1024) return n.toFixed(1) + " mb"
+ }
+}
+OKUpload.prototype.upload = function(f){
- for (var i = 0, f; f = files[i]; i++) {
- if ( ! f.type.match('image.*')) {
- continue;
- }
- OKUpload.upload(f)
+ var field, action
+
+ if ( f.type.match('video.*') ) {
+ if (this.config.videoMaxbytes && f.size > this.config.videoMaxbytes) {
+ return this.largeFileError(f, this.config.videoMaxbytes)
+ }
+ field = 'video'
+ action = this.videoAction
+ }
+ else if ( f.type.match('audio.*') ) {
+ if (this.config.audioMaxbytes && f.size > this.config.audioMaxbytes) {
+ return this.largeFileError(f, this.config.audioMaxbytes)
}
- },
+ field = 'audio'
+ action = this.audioAction
+ }
+ else {
+ if (this.config.imageMaxbytes && f.size > this.config.imageMaxbytes) {
+ return this.largeFileError(f, this.config.imageMaxbytes)
+ }
+ field = 'image'
+ action = this.imageAction || this.action
+ }
+
+ this.xhrCount += 1
- upload: function(f){
- var fd = new FormData()
- fd.append('image', f)
+ this.$progress.addClass("loading")
- var request = $.ajax({
- url: OKUpload.action,
- type: "post",
- data: fd,
- dataType: "json",
- processData: false,
- contentType: false,
- })
- request.done(OKUpload.success)
- },
+ var $loader = $("<div class='xhr'>")
+ var $loading_bar = $("<div>")
+ $loading_bar.css("width", "0%")
+ $loader.append( $loading_bar )
+ this.$progress.append($loader)
- success: function(media){
- if (media.error) {
- console.log(media.error)
- return
+ var fd = new FormData()
+ fd.append(field, f)
+
+ var request = new XMLHttpRequest()
+ request.open("POST", action, true)
+
+ request.addEventListener("progress", updateProgress.bind(this));
+ request.addEventListener("load", transferComplete.bind(this));
+ request.addEventListener("error", transferError.bind(this));
+ request.addEventListener("abort", transferAbort.bind(this));
+
+ function updateProgress (e) {
+ if (e.lengthComputable) {
+ var percentComplete = Math.round( 100 * e.loaded / e.total )
+ $loading_bar.css("width", percentComplete + "%")
}
- OKUpload.add(media)
- },
-
- add: function(media){
- console.log(media)
- },
-
- error: function(error){
- throw error
- },
+ }
+ function transferComplete (data) {
+ this.loadCount += 1
+ this.hideUploadBars()
+ if (request.readyState == 4 && request.status == 200) {
+ var responseData
+ try {
+ responseData = JSON.parse( request.responseText )
+ this.success( responseData )
+ }
+ catch (e) {
+ console.log(request.responseText)
+ console.log("ERROR PARSING JSON")
+ }
+ }
+ console.log(arguments, request)
+ }
+ function transferError (data) {
+ console.log("Transfer error")
+ this.loadCount += 1
+ this.hideUploadBars()
+ console.log(arguments)
+ }
+ function transferAbort (data) {
+ console.log("Transfer aborted")
+ this.loadCount += 1
+ this.hideUploadBars()
+ console.log(arguments)
+ }
+ request.send(fd)
+
+/*
+ var request = $.ajax({
+ url: this.action,
+ type: "post",
+ data: fd,
+ dataType: "json",
+ processData: false,
+ contentType: false,
+ })
+ request.done(this.success.bind(this))
+*/
}
+OKUpload.prototype.hideUploadBars = function () {
+ if (this.xhrCount == this.loadCount) {
+ this.$progress.removeClass("loading")
+ setTimeout(function(){
+ this.$progress.empty()
+ }.bind(this), 300)
+ }
+}
+OKUpload.prototype.success = function(data){
+ if (data.error) {
+ console.log(data.error)
+ return
+ }
+ var url = data.url
+ console.log(url)
+ this.parse(url)
+}
+OKUpload.prototype.add = function(media){
+ console.log(media)
+}
+OKUpload.prototype.addMedia = function(media){
+ console.log(media)
+}
+OKUpload.prototype.error = function(error){
+ throw error
+}
+
+
+function pressEnter(fn){
+ return function(e){
+ if (e.keyCode && e.keyCode !== 13) return
+ e.preventDefault()
+ fn.apply(this)
+ }
+} \ No newline at end of file
diff --git a/themes/okadmin/templates/404.liquid b/themes/okadmin/templates/404.liquid
new file mode 100644
index 0000000..87f5342
--- /dev/null
+++ b/themes/okadmin/templates/404.liquid
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>404</title>
+ <style type="text/css">
+ html, body {
+ margin: 0;
+ padding: 0;
+ font-family: "Helvetica", sans-serif;
+ background-image: url('http://okfoc.us/assets/images/photocopy.png');
+ background-position: bottom center;
+ background-repeat: repeat;
+ background-attachment: scroll;
+ height: 100%;
+ font-size: 1.75em;
+ font-weight: bold;
+ color: #FFFFFF;
+ }
+
+ a {
+ color: #8888FF;
+ text-decoration: none;
+ }
+
+ a:hover {
+ border-bottom: 3px solid #8888FF;
+ }
+
+ a:visited {
+ color: #8888FF;
+ }
+
+ .message {
+ width: 700px;
+ padding: 1em 1em 1em 1em;
+ background-color: #0000FF;
+ margin: 0 auto;
+ margin-top: 1em;
+ }
+
+ .message p:first-child {
+ margin-top: 0;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="message">
+ <p>¯\_(ツ)_/¯</p>
+ <p>We couldn't find that page.</p>
+ <p>Sure you have the right URL?</p>
+ <a href="javascript:history.back()">Back</a>
+ </div>
+ </body>
+</html>
diff --git a/themes/okadmin/templates/5xx.liquid b/themes/okadmin/templates/5xx.liquid
new file mode 100644
index 0000000..f245545
--- /dev/null
+++ b/themes/okadmin/templates/5xx.liquid
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>404</title>
+ <style type="text/css">
+ html, body {
+ margin: 0;
+ padding: 0;
+ font-family: "Helvetica", sans-serif;
+ background-image: url('http://okfoc.us/assets/images/photocopy.png');
+ background-position: bottom center;
+ background-repeat: repeat;
+ background-attachment: scroll;
+ height: 100%;
+ font-size: 1.75em;
+ font-weight: bold;
+ color: #FFFFFF;
+ }
+
+ a {
+ color: #8888FF;
+ text-decoration: none;
+ }
+
+ a:hover {
+ border-bottom: 3px solid #8888FF;
+ }
+
+ a:visited {
+ color: #8888FF;
+ }
+
+ .message {
+ width: 700px;
+ padding: 0 1em 1em 1em;
+ background-color: #0000FF;
+ margin: 0 auto;
+ margin-top: 1em;
+ }
+
+ .message p:first-child {
+ margin-top: 0;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="message">
+ <p>(;一_一)</p>
+ <p>Looks like we experienced an error.</p>
+ <p>Sorry about that. Maybe try again later.</p>
+ <a href="javascript:history.back()">Back</a>
+ </div>
+ </body>
+</html>
diff --git a/themes/okadmin/templates/index.liquid b/themes/okadmin/templates/index.liquid
index 95c64dd..ebb1bde 100644
--- a/themes/okadmin/templates/index.liquid
+++ b/themes/okadmin/templates/index.liquid
@@ -1,25 +1,79 @@
{% include 'partials/head' %}
+{% include 'partials/flash' %}
+
<section class="index main">
{% for pair in resources %}
{% assign name = pair[0] %}
{% assign resource = pair[1] %}
- {% assign spec = resource.spec %}
- <section class="resource-category {{name}}">
- <header>
- <h2>{{name | capitalize}}</h2>
- </header>
- <ul class="resource-list">
- {% for data in resource.data %}
- <li><a href="{{resource.type}}/{{data.id}}/">{{data.id}}</a></li>
- {% endfor %}
- </ul>
- <footer>
- <a class="add-new" href="{{resource.type}}/new/">+</a>
- </footer>
+ <section class="resource-category root
+ {% if resource.groupBy %} grouped {% endif %}
+ {% if resource.descending %} descending {% endif %}
+ {{name}}">
+ <form action="{{resource.type}}/__batch__/" method="POST">
+ <header>
+ <h2>{{name | capitalize}}</h2>
+ </header>
+ <input type="hidden" name="_method" value="PUT">
+ {% assign resourceJSON = resource.data[0][resource.groupBy] | stringify %}
+ {% if resource.groupBy and resourceJSON != "{}" %}
+ {% assign i = 0 %}
+ {% for item in resource.data %}
+ {% for pair in item[resource.groupBy] %}
+ {% assign group = pair[0] %}
+ {% assign members = pair[1] %}
+ <section class="resource-category {{group}}">
+ <header>
+ <h2>{{group | capitalize}}</h2>
+ </header>
+ <ol class="resource-list">
+ {% for data in members %}
+ <li>
+ {% if data.disabled %} <del> {% endif %}
+ <a href="{{resource.type}}/{{data.id}}/">{{data.title}}</a>
+ {% if data.disabled %} </del> {% endif %}
+ <input class="resource-input" type="hidden" name="{{resource.type}}[{{increment i}}]"
+ value='{{data | stringify | escape_once}}'>
+ </li>
+ {% endfor %}
+ </ol>
+ <footer>
+ <nav>
+ <a class="btn cancel-btn" href="#">cancel</a>
+ <button type="submit"
+ class="btn save-btn" href="#">save</button>
+ <a class="btn edit-btn active" href="#">sort</a>
+ <a class="btn add-btn active" href="{{resource.type}}/__new__/">+</a>
+ </nav>
+ </footer>
+ </section>
+ {% endfor %}
+ {% endfor %}
+ {% else %}
+ <ol class="resource-list">
+ {% for data in resource.data %}
+ <li>
+ {% if data.disabled %} <del> {% endif %}
+ <a href="{{resource.type}}/{{data.id}}/">{{data.title}}</a>
+ {% if data.disabled %} </del> {% endif %}
+ <input class="resource-input" type="hidden" name="{{resource.type}}[{{forloop.index0}}]"
+ value='{{data | stringify | escape_once}}'>
+ </li>
+ {% endfor %}
+ </ol>
+ <footer>
+ <nav>
+ <a class="btn cancel-btn" href="#">cancel</a>
+ <button type="submit"
+ class="btn save-btn" href="#">save</button>
+ <a class="btn edit-btn active" href="#">sort</a>
+ <a class="btn add-btn active" href="{{resource.type}}/__new__/">+</a>
+ </nav>
+ </footer>
+ {% endif %}
+ </form>
</section>
-
{% endfor %}
</section>
diff --git a/themes/okadmin/templates/partials/errors.liquid b/themes/okadmin/templates/partials/errors.liquid
deleted file mode 100644
index cdb0b25..0000000
--- a/themes/okadmin/templates/partials/errors.liquid
+++ /dev/null
@@ -1,10 +0,0 @@
-<div class="errors">
- {% for error in errors %}
- <div class="error">
- <div class="message">{{error.message}}</div>
- <div class="assertion">
- Expected {{error.expected}} but got {{error.actual}}
- </div>
- </div>
- {% endfor %}
-</div>
diff --git a/themes/okadmin/templates/partials/flash.liquid b/themes/okadmin/templates/partials/flash.liquid
new file mode 100644
index 0000000..e51a86b
--- /dev/null
+++ b/themes/okadmin/templates/partials/flash.liquid
@@ -0,0 +1,20 @@
+{% if success.length > 0 %}
+<div class="success">
+ <div class="message">Changes saved.</div>
+ <!--
+ {% for info in success %}
+ <div class="message">{{info.action}}</div>
+ {% endfor %}
+ -->
+</div>
+{% endif %}
+
+{% if errors.length > 0 %}
+<div class="errors">
+ {% for error in errors %}
+ <div class="error">
+ <div class="message">{{error.message}}</div>
+ </div>
+ {% endfor %}
+</div>
+{% endif %} \ No newline at end of file
diff --git a/themes/okadmin/templates/partials/head.liquid b/themes/okadmin/templates/partials/head.liquid
index 3af59fd..e9c27dc 100644
--- a/themes/okadmin/templates/partials/head.liquid
+++ b/themes/okadmin/templates/partials/head.liquid
@@ -2,12 +2,12 @@
<html>
<head>
<meta charset="utf8">
- <title>{{meta.title}}</title>
+ <title>{{meta.project}} Admin</title>
<link rel="stylesheet" href="{{meta.static}}/css/main.css">
</head>
<body>
<header class="admin-header">
- <span class="breadcrumb"><b>{{meta.title}}</b> Admin</span>
+ <span class="breadcrumb"><b>{{meta.project}}</b> Admin</span>
<a class="site-link" href="/">View Site</a>
</header>
- <div class="container">
+ <div class="container"> \ No newline at end of file
diff --git a/themes/okadmin/templates/partials/inputs.liquid b/themes/okadmin/templates/partials/inputs.liquid
index 7d23c9e..0fee61e 100644
--- a/themes/okadmin/templates/partials/inputs.liquid
+++ b/themes/okadmin/templates/partials/inputs.liquid
@@ -3,67 +3,349 @@
{% assign spec = pair[1] %}
{% assign type = spec.type %}
- <div class="property {{type}}">
+ <div class="property {{type}} {% if spec.hidden %}hidden{% endif %}"
+ data-name="{{name}}">
<label for="{{name}}">{{name | capitalize}}</label>
{% if type == 'string' %}
<input
- {% if spec.disabled %}
- disabled="true"
- {% endif %}
- name="{{name}}" type="text" value="{{spec.value}}">
+ name="{{name}}" type="text" value="{{spec.value | escape}}">
{% elsif type == 'text' %}
<textarea
- {% if spec.disabled %}
- disabled="true"
- {% endif %}
- name="{{name}}">{{spec.value}}</textarea>
- {% elsif type == 'enum' %}
+ name="{{name}}">{{spec.value | escape}}</textarea>
+ {% elsif type == 'number' %}
+ <input
+ type="number"
+ name="{{name}}" value="{{spec.value | escape}}">
+ {% elsif type == 'enum' or type == 'foreign-key' %}
<select
- {% if spec.disabled %}
- disabled="true"
- {% endif %}
name="{{name}}">
{% for option in spec.options %}
- <option value="{{option}}" {% if option == spec.value %}selected{% endif %}>{{option}}</option>
+ <option value="{{option}}" {% if option == spec.value %}selected{% endif %}>{{option | capitalize}}</option>
{% endfor %}
</select>
{% elsif type == 'video' %}
<div class="video group {% if spec.value.url %}loaded{% endif %}">
<input name="{{name}}[url]" type="text" value="{{spec.value.url}}" class="url" placeholder="Enter a video URL">
- <input name="{{name}}[type]" type="text" value="{{spec.value.type}}" class="video-type" hidden>
- <input name="{{name}}[token]" type="text" value="{{spec.value.token}}" class="video-token" hidden>
+ <input name="{{name}}[type]" type="hidden" value="{{spec.value.type}}" class="video-type" hidden>
+ <input name="{{name}}[token]" type="hidden" value="{{spec.value.token}}" class="video-token" hidden>
+ <input name="{{name}}[width]" value="{{spec.value.width}}" type="hidden" class="video-width" hidden>
+ <input name="{{name}}[height]" value="{{spec.value.height}}" type="hidden" class="video-height" hidden>
<label>Title</label>
- <input name="{{name}}[title]" type="text" value="{{spec.value.title}}" class="video-title">
+ <input name="{{name}}[title]" type="text" value="{{spec.value.title | escape}}" class="video-title">
<label>Thumbnail</label>
- <input name="{{name}}[thumb]" type="text" value="{{spec.value.thumb}}" class="video-thumb">
+ <input name="{{name}}[thumb]" type="text" value="{{spec.value.thumb | escape}}" class="video-thumb">
+ </div>
+ {% elsif type == 'image' %}
+ <div class="image group {% if spec.value.uri %}loaded{% endif %}">
+ <div class="fields">
+ <div class="add-image-button">
+ <input type="file" accept="image/*">
+ <button>+ Add image</button>
+ </div>
+ <input class="add-url" type="text" placeholder="+ Add URL">
+ </div>
+ <div class="image-element">
+ <input class="uri" type="hidden" name="{{name}}[uri]" value="{{spec.value.uri}}">
+ <textarea class="caption" name="{{name}}[caption]">{{spec.value.caption | escape}}</textarea>
+ <input type="hidden" name="{{name}}[width]" value="{{spec.value.width}}" class="image-width">
+ <input type="hidden" name="{{name}}[height]" value="{{spec.value.height}}" class="image-height">
+ <img src="{{spec.value.uri}}" alt="{{spec.value.caption | escape}}">
+ <button class="remove">x</button>
+ </div>
+ </div>
+
+ {% elsif type == 'date' %}
+
+ <div class="date">
+ <input name="{{name}}"
+ type="date"
+ {% if spec.value %}
+ value="{{spec.value | date: '%Y-%m-%d'}}"
+ {% endif %}
+ >
+ </div>
+
+ {% elsif type == 'flag' %}
+
+ <div class="flag">
+ <input name="{{name}}"
+ type="checkbox"
+ {% if spec.value %}
+ checked="true"
+ {% endif %}
+ value="true">
+ </div>
+
+ {% elsif type == 'tag-list' %}
+ <div class="tag-list">
+ <input name="{{name}}"
+ value="{{spec.value | escape}}"
+ placeholder="Enter a comma separated list of tags.">
</div>
- {% elsif type == 'captioned-image-list' %}
- <div class="image group loaded">
+
+ {% elsif type == 'link-list' %}
+ <div class="link-list group">
+ <ol class="links">
+ {% for link in spec.value %}
+ <li>
+ <div class="handle"></div>
+ <input
+ name="{{name}}[{{forloop.index0}}][text]"
+ value="{{link.text | escape}}"
+ type="text"
+ placeholder="Link text"
+ class="link-input link-text">
+ <input
+ name="{{name}}[{{forloop.index0}}][uri]"
+ value="{{link.uri | escape}}"
+ type="text"
+ placeholder="URL"
+ class="link-input link-uri">
+ <button class="remove-link-btn">
+ -
+ </button>
+ </li>
+ {% endfor %}
+ </ol>
+
+ <input type="text"
+ class="link-input-new link-text"
+ placeholder="Link text">
+ <input type="text"
+ class="link-input-new link-uri"
+ placeholder="http://www.example.com">
+ <button class="add-link-btn">+</button>
+
+ <script type="text/html" class="link-template">
+ <li>
+ <div class="handle"></div>
+ <input
+ name="{{name}}[][text]"
+ value=""
+ type="text"
+ placeholder="Link text"
+ class="link-input link-text">
+ <input
+ name="{{name}}[][uri]"
+ value=""
+ type="text"
+ placeholder="URL"
+ class="link-input link-uri">
+ <button class="remove-link-btn">
+ -
+ </button>
+ </li>
+ </script>
+
+ </div>
+
+ {% elsif type == 'media-list' or type == 'media' %}
+ <div class="media-list group loaded">
+ <div class="fields">
+ <div class="add-image-button">
+ <input type="file" accept="image/*,video/*,audio/*" multiple>
+ <button>+ Add media</button>
+ </div>
+ <input class="add-url" type="text" placeholder="+ Add Image/Video/Link URL">
+ </div>
+
+ <script type="text/html" class="image-template">
+ <li class="image-element">
+ <label>Caption</label>
+ <input class="uri" type="hidden" name="{{name}}[][uri]" value="">
+ <textarea class="caption" name="{{name}}[][caption]"></textarea>
+ <input type="hidden" name="{{name}}[][type]" value="image">
+ <input type="hidden" name="{{name}}[][width]" class="image-width" hidden>
+ <input type="hidden" name="{{name}}[][height]" class="image-height" hidden>
+ <img>
+ <button class="remove">x</button>
+ </li>
+ </script>
+
+ <script type="text/html" class="video-template">
+ <li class="video-element">
+ <div style="float: left">
+ <input name="{{name}}[][type]" type="hidden" class="video-type" hidden>
+ <input name="{{name}}[][token]" type="hidden" class="video-token" hidden>
+ <input name="{{name}}[][uri]" type="hidden" class="video-uri" hidden>
+ <input name="{{name}}[][width]" type="hidden" class="video-width" hidden>
+ <input name="{{name}}[][height]" type="hidden" class="video-height" hidden>
+ <label>Caption</label>
+ <input name="{{name}}[][title]" type="text" class="video-title">
+ <label>Thumbnail</label>
+ <input name="{{name}}[][thumb]" type="text" class="video-thumb">
+ <span class="checkboxes">
+ <input name="{{name}}[][autoplay]" value="{{image.autoplay}}" type="checkbox" class="video-autoplay flag">
+ <label>Autoplay</label>
+ <input name="{{name}}[][loop]" value="{{image.loop}}" type="checkbox" class="video-loop flag">
+ <label>Loop</label>
+ </span>
+ </div>
+ <img>
+ <button class="remove">x</button>
+ </li>
+ </script>
+
+ <script type="text/html" class="audio-template">
+ <li class="audio-element">
+ <div style="float: left">
+ <input name="{{name}}[][type]" type="hidden" class="audio-type" hidden>
+ <input name="{{name}}[][token]" type="hidden" class="audio-token" hidden>
+ <input name="{{name}}[][uri]" type="hidden" class="audio-uri" hidden>
+ <input name="{{name}}[][duration]" value="{{image.duration}}" type="hidden" class="audio-duration" hidden>
+ <label>Caption</label>
+ <input name="{{name}}[][title]" type="text" class="audio-title">
+ <label>Thumbnail</label>
+ <input name="{{name}}[][thumb]" type="text" class="audio-thumb">
+ </div>
+ <img>
+ <button class="remove">x</button>
+ </li>
+ </script>
+
+ <script type="text/html" class="link-template">
+ <li class="link-element">
+ <input class="uri" type="text" name="{{name}}[][uri]" value="">
+ <textarea class="caption" name="{{name}}[][caption]" placeholder="Caption"></textarea>
+ <input type="hidden" name="{{name}}[][type]" value="link">
+ <button class="remove">x</button>
+ </li>
+ </script>
+
+ <ol>
+ {% for image in spec.value %}
+ {% if image.type and (image.type == "vimeo" or image.type == "youtube" or image.type == "video") %}
+ <li class="video-element">
+ <div style="float: left">
+ <input name="{{name}}[{{forloop.index0}}][type]" value="{{image.type}}" type="hidden" class="video-type" hidden>
+ <input name="{{name}}[{{forloop.index0}}][token]" value="{{image.token}}" type="hidden" class="video-token" hidden>
+ <input name="{{name}}[{{forloop.index0}}][uri]" value="{{image.uri}}" type="hidden" class="video-uri" hidden>
+ <input name="{{name}}[{{forloop.index0}}][width]" value="{{image.width}}" type="hidden" class="video-width" hidden>
+ <input name="{{name}}[{{forloop.index0}}][height]" value="{{image.height}}" type="hidden" class="video-height" hidden>
+ <label>Caption</label>
+ <input name="{{name}}[{{forloop.index0}}][title]" value="{{image.title | escape}}" type="text" class="video-title">
+ <label>Thumbnail</label>
+ <input name="{{name}}[{{forloop.index0}}][thumb]" value="{{image.thumb}}" type="text" class="video-thumb">
+ <span class="checkboxes">
+ <input name="{{name}}[{{forloop.index0}}][autoplay]" value="true" {% if image.autoplay == "true" %}checked="true"{% endif %} type="checkbox" class="flag video-autoplay">
+ <label>Autoplay</label>
+ <input name="{{name}}[{{forloop.index0}}][loop]" value="true" {% if image.loop == "true" %}checked="true"{% endif %} type="checkbox" class="flag video-loop">
+ <label>Loop</label>
+ </span>
+ </div>
+ <img src="{{image.thumb}}">
+ <button class="remove">x</button>
+ </li>
+ {% elsif image.type and (image.type == "audio" or image.type == "soundcloud") %}
+ <li class="audio-element">
+ <div style="float: left">
+ <input name="{{name}}[{{forloop.index0}}][type]" value="{{image.type}}" type="hidden" class="audio-type" hidden>
+ <input name="{{name}}[{{forloop.index0}}][token]" value="{{image.token}}" type="hidden" class="audio-token" hidden>
+ <input name="{{name}}[{{forloop.index0}}][uri]" value="{{image.uri}}" type="hidden" class="audio-uri" hidden>
+ <input name="{{name}}[{{forloop.index0}}][duration]" value="{{image.duration}}" type="hidden" class="audio-duration" hidden>
+ <label>Caption</label>
+ <input name="{{name}}[{{forloop.index0}}][title]" value="{{image.title | escape}}" type="text" class="audio-title">
+ <label>Thumbnail</label>
+ <input name="{{name}}[{{forloop.index0}}][thumb]" value="{{image.thumb}}" type="text" class="audio-thumb">
+ </div>
+ <img src="{{image.thumb}}">
+ <button class="remove">x</button>
+ </li>
+ {% elsif image.type and image.type == "link" %}
+ <li class="link-element">
+ <input class="uri" type="text" name="{{name}}[{{forloop.index0}}][uri]" value="{{image.uri}}">
+ <textarea class="caption" name="{{name}}[{{forloop.index0}}][caption]" placeholder="Caption">{{image.caption | escape}}</textarea>
+ <input type="hidden" name="{{name}}[{{forloop.index0}}][type]" value="link">
+ <button class="remove">x</button>
+ </li>
+ {% else %}
+ <li class="image-element">
+ <label>Caption</label>
+ <input type="hidden" name="{{name}}[{{forloop.index0}}][uri]" value="{{image.uri}}">
+ <input name="{{name}}[{{forloop.index0}}][width]" value="{{image.width}}" type="hidden" class="image-width" hidden>
+ <input name="{{name}}[{{forloop.index0}}][height]" value="{{image.height}}" type="hidden" class="image-height" hidden>
+ <textarea class="caption" name="{{name}}[{{forloop.index0}}][caption]">{{image.caption | escape}}</textarea>
+ <input type="hidden" name="{{name}}[{{forloop.index0}}][type]" value="image">
+ <img src="{{image.uri}}" alt="{{image.caption | strip_html}}">
+ <button class="remove">x</button>
+ </li>
+ {% endif %}
+ {% endfor %}
+ </ol>
+ </div>
+ {% elsif type == 'captioned-image-list' or type == 'gallery' %}
+ <div class="image-list group loaded">
+ <div class="fields">
+ <div class="add-image-button">
+ <input type="file" accept="image/*" multiple>
+ <button>+ Add images</button>
+ </div>
+ <input class="add-url" type="text" placeholder="+ Add URL">
+ </div>
+
+ <script type="text/html" class="image-template">
+ <li class="image-element">
+ <input class="uri" type="hidden" name="{{name}}[][uri]" value="">
+ <input type="hidden" name="{{name}}[][width]" class="image-width" hidden>
+ <input type="hidden" name="{{name}}[][height]" class="image-height" hidden>
+ <textarea class="caption" name="{{name}}[][caption]"></textarea>
+ <img>
+ <button class="remove">x</button>
+ </li>
+ </script>
+
<ol>
{% for image in spec.value %}
<li class="image-element">
- <input type="hidden" name="{{name}}[][uri]" value="{{image.uri}}">
- <textarea class="caption" name="{{name}}[][caption]">{{image.caption}}</textarea>
- <img src="{{image.uri}}" alt="{{image.caption}}">
- <button class="remove-image">♲</button>
+ <input type="hidden" name="{{name}}[{{forloop.index0}}][uri]" value="{{image.uri}}">
+ <input type="hidden" name="{{name}}[{{forloop.index0}}][width]" value="{{image.width}}" class="image-width">
+ <input type="hidden" name="{{name}}[{{forloop.index0}}][height]" value="{{image.height}}" class="image-height">
+ <textarea class="caption" name="{{name}}[{{forloop.index0}}][caption]">{{image.caption | escape}}</textarea>
+ <img src="{{image.uri}}" alt="{{image.caption | strip_html}}">
+ <button class="remove">x</button>
</li>
{% endfor %}
</ol>
- <div class="add-image-button">
- <input id="file" type="file" accept="image/*" multiple>
- <span>+ Add images</span>
+ </div>
+ {% elsif type == 'double-captioned-image-list' %}
+ <div class="image-list group loaded">
+ <div class="fields">
+ <div class="add-image-button">
+ <input type="file" accept="image/*" multiple>
+ <button>+ Add images</button>
+ </div>
+ <input class="add-url" type="text" placeholder="+ Add URL">
</div>
- <input id="add-image-url" type="text" placeholder="+ Add URL">
- <script type="text/html" id="captioned-image-template">
+
+ <script type="text/html" class="image-template">
<li class="image-element">
+ <img>
+ <button class="remove">x</button>
<input class="uri" type="hidden" name="{{name}}[][uri]" value="">
- <textarea class="caption" name="{{name}}[][caption]"></textarea>
- <img alt="{{image.caption}}">
- <button class="remove-image">♲</button>
+ <input type="hidden" name="{{name}}[][width]" class="image-width">
+ <input type="hidden" name="{{name}}[][height]" class="image-height">
+ <input class="caption" name="{{name}}[][label]" placeholder="Name">
+ <input class="caption" name="{{name}}[][caption]" placeholder="Email">
</li>
</script>
+
+ <ol>
+ {% for image in spec.value %}
+ <li class="image-element">
+ <img src="{{image.uri}}" alt="{{image.caption | strip_html}}">
+ <button class="remove">x</button>
+ <input type="hidden" name="{{name}}[{{forloop.index0}}][uri]" value="{{image.uri}}">
+ <input type="hidden" name="{{name}}[{{forloop.index0}}][width]" value="{{image.width}}" class="image-width">
+ <input type="hidden" name="{{name}}[{{forloop.index0}}][height]" value="{{image.height}}" class="image-height">
+ <input class="caption" name="{{name}}[{{forloop.index0}}][label]" value="{{image.label | escape}}" placeholder="Name">
+ <input class="caption" name="{{name}}[{{forloop.index0}}][caption]" value="{{image.caption | escape}}" placeholder="Email">
+ </li>
+ {% endfor %}
+ </ol>
</div>
+ {% elsif type == 'meta' %}
+ <input class="hidden" type="hidden" name="{{name}}" value="{{spec.value}}">
{% else %}
<p><pre style="color: red">Admin template doesn't support '{{type}}' properties!</pre></p>
{% endif %}
diff --git a/themes/okadmin/templates/partials/tail.liquid b/themes/okadmin/templates/partials/tail.liquid
index 88764a6..522023b 100644
--- a/themes/okadmin/templates/partials/tail.liquid
+++ b/themes/okadmin/templates/partials/tail.liquid
@@ -1,9 +1,14 @@
</div> {% comment %} closes container tag {% endcomment %}
+ <div id="progress"></div>
+ <div id="uploadConfig"
+ data-image-maxbytes="{{meta.services.s3.image.maxbytes}}"
+ data-audio-maxbytes="{{meta.services.s3.audio.maxbytes}}"
+ data-video-maxbytes="{{meta.services.s3.video.maxbytes}}"></div>
</body>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.6.0/lodash.min.js"></script>
- <script src="/_admin/js/jqueryui-draggable.js"></script>
- <script src="/_admin/js/upload.js"></script>
- <script src="/_admin/js/parser.js"></script>
- <script src="/_admin/js/app.js"></script>
+ <script src="/admin/js/jqueryui-draggable.js"></script>
+ <script src="/admin/js/upload.js"></script>
+ <script src="/admin/js/parser.js"></script>
+ <script src="/admin/js/app.js"></script>
</html>
diff --git a/themes/okadmin/templates/resource.liquid b/themes/okadmin/templates/resource.liquid
index c0d348d..88f93bd 100644
--- a/themes/okadmin/templates/resource.liquid
+++ b/themes/okadmin/templates/resource.liquid
@@ -1,19 +1,25 @@
{% include 'partials/head' %}
-{% include 'partials/errors' %}
+{% include 'partials/flash' %}
-<nav>
- <a href="../..">Back</a>
+<nav class="resource-nav">
+ <a href="../..">Back</a><br>
+ <br>
+ <a href="/admin/{{ resource.type }}/__new__/">ADD ANOTHER</a>
</nav>
-<section class="resource main">
- <h2>EDIT {{ resource.type }} '{{ resource.id }}'</h2>
- <form action="." method="POST">
+<section class="resource main" data-type="{{ resource.type }}" data-id="{{ resource.id }}">
+ <h2>EDIT {{ resource.type }} '{{ resource.spec.title.value }}'</h2>
+ <form action="." method="POST" id="resource_form">
<input type="hidden" name="_method" value="PUT">
{% include 'partials/inputs' %}
<label>&nbsp;</label><button type="submit">Save</button>
<div class="clear"></div>
</form>
+ <form action="." method="POST" id="delete_form">
+ <input type="hidden" name="_method" value="DELETE">
+ <button type="submit">Delete Record</button>
+ </form>
</section>
{% include 'partials/tail' %}
diff --git a/themes/okadmin/templates/resource_new.liquid b/themes/okadmin/templates/resource_new.liquid
index c57dd83..15d13ba 100644
--- a/themes/okadmin/templates/resource_new.liquid
+++ b/themes/okadmin/templates/resource_new.liquid
@@ -1,14 +1,14 @@
{% include 'partials/head' %}
-{% include 'partials/errors' %}
+{% include 'partials/flash' %}
-<nav>
+<nav class="resource-nav">
<a href="../..">Back</a>
</nav>
<section class="main resource resource-new">
<h2>NEW {{ resource.type }}</h2>
- <form action=".." method="POST">
+ <form action=".." method="POST" id="resource_form">
<input type="hidden" name="_method" value="POST">
{% include 'partials/inputs' %}
<label>&nbsp;</label><button type="submit">Create</button>