mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-11 10:22:53 +00:00
added blogpost and switched to ejs
This commit is contained in:
@@ -10,8 +10,7 @@ block content
|
||||
h1.blog-title mitchellG.me
|
||||
p.lead.blog-description A "blog" about computer related projects that I find interesting.
|
||||
div.row
|
||||
div.col-lg-8.blog-main
|
||||
include ./blogposts/7-21-15.jade
|
||||
div.col-sm-8.blog-main
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +21,7 @@ block content
|
||||
br
|
||||
div.sidebar-module.sidebar-module-inset
|
||||
p.
|
||||
I'm 22 years old and I'm currently attending Winona State University as a Computer Science major.
|
||||
I'm 22 years old and currently attending Winona State University as a Computer Science major.
|
||||
I am graduating in Spring of 2016 and plan to pursue a career in the field of software development.
|
||||
a(href="https://www.linkedin.com/pub/mitchell-gerber/b3/391/125" target="_blank")
|
||||
i.icon-large.icon-linked-in
|
||||
6
app.js
6
app.js
@@ -7,6 +7,7 @@ var bodyParser = require('body-parser');
|
||||
|
||||
var index = require('./routes/index');
|
||||
var success = require('./routes/success');
|
||||
|
||||
var mongoose = require('mongoose');
|
||||
var mainLoop = require('./main');
|
||||
|
||||
@@ -22,7 +23,7 @@ db.once('open', function (callback) {
|
||||
|
||||
// view engine setup
|
||||
app.set('views', path.join(__dirname, 'views'));
|
||||
app.set('view engine', 'jade');
|
||||
app.set('view engine', 'ejs');
|
||||
|
||||
// uncomment after placing your favicon in /public
|
||||
app.use(favicon(__dirname + '/public/favicon.ico'));
|
||||
@@ -33,7 +34,8 @@ app.use(cookieParser());
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
|
||||
app.use('/', index);
|
||||
app.use('/success', success)
|
||||
app.use('/success', success);
|
||||
|
||||
// catch 404 and forward to error handler
|
||||
app.use(function(req, res, next) {
|
||||
var err = new Error('Not Found');
|
||||
|
||||
45
node_modules/ejs/Jakefile
generated
vendored
Normal file
45
node_modules/ejs/Jakefile
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
var fs = require('fs')
|
||||
, buildOpts = {
|
||||
printStdout: true
|
||||
, printStderr: true
|
||||
};
|
||||
|
||||
task('build', ['browserify', 'minify'], function () {
|
||||
console.log('Build completed.');
|
||||
});
|
||||
|
||||
desc('Cleans browerified/minified files and package files');
|
||||
task('clean', ['clobber'], function () {
|
||||
jake.rmRf('./ejs.js');
|
||||
jake.rmRf('./ejs.min.js');
|
||||
});
|
||||
|
||||
task('browserify', {async: true}, function () {
|
||||
jake.exec('./node_modules/browserify/bin/cmd.js lib/ejs.js > ejs.js',
|
||||
buildOpts, function () {
|
||||
console.log('Browserification completed.');
|
||||
setTimeout(complete, 0);
|
||||
});
|
||||
});
|
||||
|
||||
task('minify', {async: true}, function () {
|
||||
jake.exec('./node_modules/uglify-js/bin/uglifyjs ejs.js > ejs.min.js',
|
||||
buildOpts, function () {
|
||||
console.log('Minification completed.');
|
||||
setTimeout(complete, 0);
|
||||
});
|
||||
});
|
||||
|
||||
publishTask('ejs', ['build'], function () {
|
||||
this.packageFiles.include([
|
||||
'Jakefile'
|
||||
, 'README.md'
|
||||
, 'package.json'
|
||||
, 'ejs.js'
|
||||
, 'ejs.min.js'
|
||||
, 'lib/**'
|
||||
, 'test/**'
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
178
node_modules/ejs/README.md
generated
vendored
Normal file
178
node_modules/ejs/README.md
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
# EJS
|
||||
|
||||
Embedded JavaScript templates
|
||||
|
||||
[](https://travis-ci.org/mde/ejs)
|
||||
[](https://david-dm.org/mde/ejs#info=devDependencies)
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install ejs
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
* Control flow with `<% %>`
|
||||
* Escaped output with `<%= %>`
|
||||
* Unescaped raw output with `<%- %>`
|
||||
* Trim-mode ('newline slurping') with `-%>` ending tag
|
||||
* Custom delimiters (e.g., use '<? ?>' instead of '<% %>')
|
||||
* Includes
|
||||
* Client-side support
|
||||
* Static caching of intermediate JavaScript
|
||||
* Static caching of templates
|
||||
* Complies with the [Express](http://expressjs.com) view system
|
||||
|
||||
## Example
|
||||
|
||||
```html
|
||||
<% if (user) { %>
|
||||
<h2><%= user.name %></h2>
|
||||
<% } %>
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
var template = ejs.compile(str, options);
|
||||
template(data);
|
||||
// => Rendered HTML string
|
||||
|
||||
ejs.render(str, data, options);
|
||||
// => Rendered HTML string
|
||||
```
|
||||
|
||||
You can also use the shortcut `ejs.render(dataAndOptions);` where you pass
|
||||
everything in a single object. In that case, you'll end up with local variables
|
||||
for all the passed options.
|
||||
|
||||
## Options
|
||||
|
||||
- `cache` Compiled functions are cached, requires `filename`
|
||||
- `filename` Used by `cache` to key caches, and for includes
|
||||
- `context` Function execution context
|
||||
- `compileDebug` When `false` no debug instrumentation is compiled
|
||||
- `client` Returns standalone compiled function
|
||||
- `delimiter` Character to use with angle brackets for open/close
|
||||
- `debug` Output generated function body
|
||||
- `_with` Whether or not to use `with() {}` constructs. If `false` then the locals will be stored in the `locals` object.
|
||||
- `rmWhitespace` Remove all safe-to-remove whitespace, including leading
|
||||
and trailing whitespace. It also enables a safer version of `-%>` line
|
||||
slurping for all scriptlet tags (it does not strip new lines of tags in
|
||||
the middle of a line).
|
||||
|
||||
## Tags
|
||||
|
||||
- `<%` 'Scriptlet' tag, for control-flow, no output
|
||||
- `<%=` Outputs the value into the template (HTML escaped)
|
||||
- `<%-` Outputs the unescaped value into the template
|
||||
- `<%#` Comment tag, no execution, no output
|
||||
- `<%%` Outputs a literal '<%'
|
||||
- `%>` Plain ending tag
|
||||
- `-%>` Trim-mode ('newline slurp') tag, trims following newline
|
||||
|
||||
## Includes
|
||||
|
||||
Includes either have to be an absolute path, or, if not, are assumed as
|
||||
relative to the template with the `include` call. (This requires the
|
||||
`filename` option.) For example if you are including `./views/user/show.ejs`
|
||||
from `./views/users.ejs` you would use `<%- include('user/show') %>`.
|
||||
|
||||
You'll likely want to use the raw output tag (`<%-`) with your include to avoid
|
||||
double-escaping the HTML output.
|
||||
|
||||
```html
|
||||
<ul>
|
||||
<% users.forEach(function(user){ %>
|
||||
<%- include('user/show', {user: user}) %>
|
||||
<% }); %>
|
||||
</ul>
|
||||
```
|
||||
|
||||
Includes are inserted at runtime, so you can use variables for the path in the
|
||||
`include` call (for example `<%- include(somePath) %>`). Variables in your
|
||||
top-level data object are available to all your includes, but local variables
|
||||
need to be passed down.
|
||||
|
||||
NOTE: Include preprocessor directives (`<% include user/show %>`) are
|
||||
still supported.
|
||||
|
||||
## Custom delimiters
|
||||
|
||||
Custom delimiters can be applied on a per-template basis, or globally:
|
||||
|
||||
```javascript
|
||||
var ejs = require('ejs'),
|
||||
users = ['geddy', 'neil', 'alex'];
|
||||
|
||||
// Just one template
|
||||
ejs.render('<?= users.join(" | "); ?>', {users: users}, {delimiter: '?'});
|
||||
// => 'geddy | neil | alex'
|
||||
|
||||
// Or globally
|
||||
ejs.delimiter = '$';
|
||||
ejs.render('<$= users.join(" | "); $>', {users: users});
|
||||
// => 'geddy | neil | alex'
|
||||
```
|
||||
|
||||
## Caching
|
||||
|
||||
EJS ships with a basic in-process cache for caching the intermediate JavaScript
|
||||
functions used to render templates. It's easy to plug in LRU caching using
|
||||
Node's `lru-cache` library:
|
||||
|
||||
```javascript
|
||||
var ejs = require('ejs')
|
||||
, LRU = require('lru-cache');
|
||||
ejs.cache = LRU(100); // LRU cache with 100-item limit
|
||||
```
|
||||
|
||||
If you want to clear the EJS cache, call `ejs.clearCache`. If you're using the
|
||||
LRU cache and need a different limit, simple reset `ejs.cache` to a new instance
|
||||
of the LRU.
|
||||
|
||||
## Layouts
|
||||
|
||||
EJS does not specifically support blocks, but layouts can be implemented by
|
||||
including headers and footers, like so:
|
||||
|
||||
|
||||
```html
|
||||
<%- include('header') -%>
|
||||
<h1>
|
||||
Title
|
||||
</h1>
|
||||
<p>
|
||||
My page
|
||||
</p>
|
||||
<%- include('footer') -%>
|
||||
```
|
||||
|
||||
## Client-side support
|
||||
|
||||
Go to the [Latest Release](https://github.com/mde/ejs/releases/latest), download
|
||||
`./ejs.js` or `./ejs.min.js`.
|
||||
|
||||
Include one of these on your page, and `ejs.render(str)`.
|
||||
|
||||
## Related projects
|
||||
|
||||
There are a number of implementations of EJS:
|
||||
|
||||
* TJ's implementation, the v1 of this library: https://github.com/tj/ejs
|
||||
* Jupiter Consulting's EJS: http://www.embeddedjs.com/
|
||||
* EJS Embedded JavaScript Framework on Google Code: https://code.google.com/p/embeddedjavascript/
|
||||
* Sam Stephenson's Ruby implementation: https://rubygems.org/gems/ejs
|
||||
* Erubis, an ERB implementation which also runs JavaScript: http://www.kuwata-lab.com/erubis/users-guide.04.html#lang-javascript
|
||||
|
||||
## License
|
||||
|
||||
Licensed under the Apache License, Version 2.0
|
||||
(<http://www.apache.org/licenses/LICENSE-2.0>)
|
||||
|
||||
- - -
|
||||
EJS Embedded JavaScript templates copyright 2112
|
||||
mde@fleegix.org.
|
||||
|
||||
|
||||
1224
node_modules/ejs/ejs.js
generated
vendored
Normal file
1224
node_modules/ejs/ejs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/ejs/ejs.min.js
generated
vendored
Normal file
1
node_modules/ejs/ejs.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
717
node_modules/ejs/lib/ejs.js
generated
vendored
Normal file
717
node_modules/ejs/lib/ejs.js
generated
vendored
Normal file
@@ -0,0 +1,717 @@
|
||||
/*
|
||||
* EJS Embedded JavaScript templates
|
||||
* Copyright 2112 Matthew Eernisse (mde@fleegix.org)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @file Embedded JavaScript templating engine.
|
||||
* @author Matthew Eernisse <mde@fleegix.org>
|
||||
* @author Tiancheng "Timothy" Gu <timothygu99@gmail.com>
|
||||
* @project EJS
|
||||
* @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0}
|
||||
*/
|
||||
|
||||
/**
|
||||
* EJS internal functions.
|
||||
*
|
||||
* Technically this "module" lies in the same file as {@link module:ejs}, for
|
||||
* the sake of organization all the private functions re grouped into this
|
||||
* module.
|
||||
*
|
||||
* @module ejs-internal
|
||||
* @private
|
||||
*/
|
||||
|
||||
/**
|
||||
* Embedded JavaScript templating engine.
|
||||
*
|
||||
* @module ejs
|
||||
* @public
|
||||
*/
|
||||
|
||||
var fs = require('fs')
|
||||
, utils = require('./utils')
|
||||
, scopeOptionWarned = false
|
||||
, _VERSION_STRING = require('../package.json').version
|
||||
, _DEFAULT_DELIMITER = '%'
|
||||
, _DEFAULT_LOCALS_NAME = 'locals'
|
||||
, _REGEX_STRING = '(<%%|<%=|<%-|<%#|<%|%>|-%>)'
|
||||
, _OPTS = [ 'cache', 'filename', 'delimiter', 'scope', 'context'
|
||||
, 'debug', 'compileDebug', 'client', '_with'
|
||||
]
|
||||
, _TRAILING_SEMCOL = /;\s*$/
|
||||
, _BOM = /^\uFEFF/;
|
||||
|
||||
/**
|
||||
* EJS template function cache. This can be a LRU object from lru-cache NPM
|
||||
* module. By default, it is {@link module:utils.cache}, a simple in-process
|
||||
* cache that grows continuously.
|
||||
*
|
||||
* @type {Cache}
|
||||
*/
|
||||
|
||||
exports.cache = utils.cache;
|
||||
|
||||
/**
|
||||
* Name of the object containing the locals.
|
||||
*
|
||||
* This variable is overriden by {@link Options}`.localsName` if it is not
|
||||
* `undefined`.
|
||||
*
|
||||
* @type {String}
|
||||
* @public
|
||||
*/
|
||||
|
||||
exports.localsName = _DEFAULT_LOCALS_NAME;
|
||||
|
||||
/**
|
||||
* Get the path to the included file from the parent file path and the
|
||||
* specified path.
|
||||
*
|
||||
* @param {String} name specified path
|
||||
* @param {String} filename parent file path
|
||||
* @return {String}
|
||||
*/
|
||||
|
||||
exports.resolveInclude = function(name, filename) {
|
||||
var path = require('path')
|
||||
, dirname = path.dirname
|
||||
, extname = path.extname
|
||||
, resolve = path.resolve
|
||||
, includePath = resolve(dirname(filename), name)
|
||||
, ext = extname(name);
|
||||
if (!ext) {
|
||||
includePath += '.ejs';
|
||||
}
|
||||
return includePath;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the template from a string or a file, either compiled on-the-fly or
|
||||
* read from cache (if enabled), and cache the template if needed.
|
||||
*
|
||||
* If `template` is not set, the file specified in `options.filename` will be
|
||||
* read.
|
||||
*
|
||||
* If `options.cache` is true, this function reads the file from
|
||||
* `options.filename` so it must be set prior to calling this function.
|
||||
*
|
||||
* @memberof module:ejs-internal
|
||||
* @param {Options} options compilation options
|
||||
* @param {String} [template] template source
|
||||
* @return {(TemplateFunction|ClientFunction)}
|
||||
* Depending on the value of `options.client`, either type might be returned.
|
||||
* @static
|
||||
*/
|
||||
|
||||
function handleCache(options, template) {
|
||||
var fn
|
||||
, path = options.filename
|
||||
, hasTemplate = arguments.length > 1;
|
||||
|
||||
if (options.cache) {
|
||||
if (!path) {
|
||||
throw new Error('cache option requires a filename');
|
||||
}
|
||||
fn = exports.cache.get(path);
|
||||
if (fn) {
|
||||
return fn;
|
||||
}
|
||||
if (!hasTemplate) {
|
||||
template = fs.readFileSync(path).toString().replace(_BOM, '');
|
||||
}
|
||||
}
|
||||
else if (!hasTemplate) {
|
||||
// istanbul ignore if: should not happen at all
|
||||
if (!path) {
|
||||
throw new Error('Internal EJS error: no file name or template '
|
||||
+ 'provided');
|
||||
}
|
||||
template = fs.readFileSync(path).toString().replace(_BOM, '');
|
||||
}
|
||||
fn = exports.compile(template, options);
|
||||
if (options.cache) {
|
||||
exports.cache.set(path, fn);
|
||||
}
|
||||
return fn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the template function.
|
||||
*
|
||||
* If `options.cache` is `true`, then the template is cached.
|
||||
*
|
||||
* @memberof module:ejs-internal
|
||||
* @param {String} path path for the specified file
|
||||
* @param {Options} options compilation options
|
||||
* @return {(TemplateFunction|ClientFunction)}
|
||||
* Depending on the value of `options.client`, either type might be returned
|
||||
* @static
|
||||
*/
|
||||
|
||||
function includeFile(path, options) {
|
||||
var opts = utils.shallowCopy({}, options);
|
||||
if (!opts.filename) {
|
||||
throw new Error('`include` requires the \'filename\' option.');
|
||||
}
|
||||
opts.filename = exports.resolveInclude(path, opts.filename);
|
||||
return handleCache(opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the JavaScript source of an included file.
|
||||
*
|
||||
* @memberof module:ejs-internal
|
||||
* @param {String} path path for the specified file
|
||||
* @param {Options} options compilation options
|
||||
* @return {String}
|
||||
* @static
|
||||
*/
|
||||
|
||||
function includeSource(path, options) {
|
||||
var opts = utils.shallowCopy({}, options)
|
||||
, includePath
|
||||
, template;
|
||||
if (!opts.filename) {
|
||||
throw new Error('`include` requires the \'filename\' option.');
|
||||
}
|
||||
includePath = exports.resolveInclude(path, opts.filename);
|
||||
template = fs.readFileSync(includePath).toString().replace(_BOM, '');
|
||||
|
||||
opts.filename = includePath;
|
||||
var templ = new Template(template, opts);
|
||||
templ.generateSource();
|
||||
return templ.source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-throw the given `err` in context to the `str` of ejs, `filename`, and
|
||||
* `lineno`.
|
||||
*
|
||||
* @implements RethrowCallback
|
||||
* @memberof module:ejs-internal
|
||||
* @param {Error} err Error object
|
||||
* @param {String} str EJS source
|
||||
* @param {String} filename file name of the EJS file
|
||||
* @param {String} lineno line number of the error
|
||||
* @static
|
||||
*/
|
||||
|
||||
function rethrow(err, str, filename, lineno){
|
||||
var lines = str.split('\n')
|
||||
, start = Math.max(lineno - 3, 0)
|
||||
, end = Math.min(lines.length, lineno + 3);
|
||||
|
||||
// Error context
|
||||
var context = lines.slice(start, end).map(function (line, i){
|
||||
var curr = i + start + 1;
|
||||
return (curr == lineno ? ' >> ' : ' ')
|
||||
+ curr
|
||||
+ '| '
|
||||
+ line;
|
||||
}).join('\n');
|
||||
|
||||
// Alter exception message
|
||||
err.path = filename;
|
||||
err.message = (filename || 'ejs') + ':'
|
||||
+ lineno + '\n'
|
||||
+ context + '\n\n'
|
||||
+ err.message;
|
||||
|
||||
throw err;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy properties in data object that are recognized as options to an
|
||||
* options object.
|
||||
*
|
||||
* This is used for compatibility with earlier versions of EJS and Express.js.
|
||||
*
|
||||
* @memberof module:ejs-internal
|
||||
* @param {Object} data data object
|
||||
* @param {Options} opts options object
|
||||
* @static
|
||||
*/
|
||||
|
||||
function cpOptsInData(data, opts) {
|
||||
_OPTS.forEach(function (p) {
|
||||
if (typeof data[p] != 'undefined') {
|
||||
opts[p] = data[p];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile the given `str` of ejs into a template function.
|
||||
*
|
||||
* @param {String} template EJS template
|
||||
*
|
||||
* @param {Options} opts compilation options
|
||||
*
|
||||
* @return {(TemplateFunction|ClientFunction)}
|
||||
* Depending on the value of `opts.client`, either type might be returned.
|
||||
* @public
|
||||
*/
|
||||
|
||||
exports.compile = function compile(template, opts) {
|
||||
var templ;
|
||||
|
||||
// v1 compat
|
||||
// 'scope' is 'context'
|
||||
// FIXME: Remove this in a future version
|
||||
if (opts && opts.scope) {
|
||||
if (!scopeOptionWarned){
|
||||
console.warn('`scope` option is deprecated and will be removed in EJS 3');
|
||||
scopeOptionWarned = true;
|
||||
}
|
||||
if (!opts.context) {
|
||||
opts.context = opts.scope;
|
||||
}
|
||||
delete opts.scope;
|
||||
}
|
||||
templ = new Template(template, opts);
|
||||
return templ.compile();
|
||||
};
|
||||
|
||||
/**
|
||||
* Render the given `template` of ejs.
|
||||
*
|
||||
* If you would like to include options but not data, you need to explicitly
|
||||
* call this function with `data` being an empty object or `null`.
|
||||
*
|
||||
* @param {String} template EJS template
|
||||
* @param {Object} [data={}] template data
|
||||
* @param {Options} [opts={}] compilation and rendering options
|
||||
* @return {String}
|
||||
* @public
|
||||
*/
|
||||
|
||||
exports.render = function (template, data, opts) {
|
||||
data = data || {};
|
||||
opts = opts || {};
|
||||
var fn;
|
||||
|
||||
// No options object -- if there are optiony names
|
||||
// in the data, copy them to options
|
||||
if (arguments.length == 2) {
|
||||
cpOptsInData(data, opts);
|
||||
}
|
||||
|
||||
return handleCache(opts, template)(data);
|
||||
};
|
||||
|
||||
/**
|
||||
* Render an EJS file at the given `path` and callback `cb(err, str)`.
|
||||
*
|
||||
* If you would like to include options but not data, you need to explicitly
|
||||
* call this function with `data` being an empty object or `null`.
|
||||
*
|
||||
* @param {String} path path to the EJS file
|
||||
* @param {Object} [data={}] template data
|
||||
* @param {Options} [opts={}] compilation and rendering options
|
||||
* @param {RenderFileCallback} cb callback
|
||||
* @public
|
||||
*/
|
||||
|
||||
exports.renderFile = function () {
|
||||
var args = Array.prototype.slice.call(arguments)
|
||||
, path = args.shift()
|
||||
, cb = args.pop()
|
||||
, data = args.shift() || {}
|
||||
, opts = args.pop() || {}
|
||||
, result;
|
||||
|
||||
// Don't pollute passed in opts obj with new vals
|
||||
opts = utils.shallowCopy({}, opts);
|
||||
|
||||
// No options object -- if there are optiony names
|
||||
// in the data, copy them to options
|
||||
if (arguments.length == 3) {
|
||||
cpOptsInData(data, opts);
|
||||
}
|
||||
opts.filename = path;
|
||||
|
||||
try {
|
||||
result = handleCache(opts)(data);
|
||||
}
|
||||
catch(err) {
|
||||
return cb(err);
|
||||
}
|
||||
return cb(null, result);
|
||||
};
|
||||
|
||||
/**
|
||||
* Clear intermediate JavaScript cache. Calls {@link Cache#reset}.
|
||||
* @public
|
||||
*/
|
||||
|
||||
exports.clearCache = function () {
|
||||
exports.cache.reset();
|
||||
};
|
||||
|
||||
function Template(text, opts) {
|
||||
opts = opts || {};
|
||||
var options = {};
|
||||
this.templateText = text;
|
||||
this.mode = null;
|
||||
this.truncate = false;
|
||||
this.currentLine = 1;
|
||||
this.source = '';
|
||||
this.dependencies = [];
|
||||
options.client = opts.client || false;
|
||||
options.escapeFunction = opts.escape || utils.escapeXML;
|
||||
options.compileDebug = opts.compileDebug !== false;
|
||||
options.debug = !!opts.debug;
|
||||
options.filename = opts.filename;
|
||||
options.delimiter = opts.delimiter || exports.delimiter || _DEFAULT_DELIMITER;
|
||||
options._with = typeof opts._with != 'undefined' ? opts._with : true;
|
||||
options.context = opts.context;
|
||||
options.cache = opts.cache || false;
|
||||
options.rmWhitespace = opts.rmWhitespace;
|
||||
this.opts = options;
|
||||
|
||||
this.regex = this.createRegex();
|
||||
}
|
||||
|
||||
Template.modes = {
|
||||
EVAL: 'eval'
|
||||
, ESCAPED: 'escaped'
|
||||
, RAW: 'raw'
|
||||
, COMMENT: 'comment'
|
||||
, LITERAL: 'literal'
|
||||
};
|
||||
|
||||
Template.prototype = {
|
||||
createRegex: function () {
|
||||
var str = _REGEX_STRING
|
||||
, delim = utils.escapeRegExpChars(this.opts.delimiter);
|
||||
str = str.replace(/%/g, delim);
|
||||
return new RegExp(str);
|
||||
}
|
||||
|
||||
, compile: function () {
|
||||
var src
|
||||
, fn
|
||||
, opts = this.opts
|
||||
, prepended = ''
|
||||
, appended = ''
|
||||
, escape = opts.escapeFunction;
|
||||
|
||||
if (opts.rmWhitespace) {
|
||||
// Have to use two separate replace here as `^` and `$` operators don't
|
||||
// work well with `\r`.
|
||||
this.templateText =
|
||||
this.templateText.replace(/\r/g, '').replace(/^\s+|\s+$/gm, '');
|
||||
}
|
||||
|
||||
if (!this.source) {
|
||||
this.generateSource();
|
||||
prepended += ' var __output = [], __append = __output.push.bind(__output);' + '\n';
|
||||
if (opts._with !== false) {
|
||||
prepended += ' with (' + exports.localsName + ' || {}) {' + '\n';
|
||||
appended += ' }' + '\n';
|
||||
}
|
||||
appended += ' return __output.join("");' + '\n';
|
||||
this.source = prepended + this.source + appended;
|
||||
}
|
||||
|
||||
if (opts.compileDebug) {
|
||||
src = 'var __line = 1' + '\n'
|
||||
+ ' , __lines = ' + JSON.stringify(this.templateText) + '\n'
|
||||
+ ' , __filename = ' + (opts.filename ?
|
||||
JSON.stringify(opts.filename) : 'undefined') + ';' + '\n'
|
||||
+ 'try {' + '\n'
|
||||
+ this.source
|
||||
+ '} catch (e) {' + '\n'
|
||||
+ ' rethrow(e, __lines, __filename, __line);' + '\n'
|
||||
+ '}' + '\n';
|
||||
}
|
||||
else {
|
||||
src = this.source;
|
||||
}
|
||||
|
||||
if (opts.debug) {
|
||||
console.log(src);
|
||||
}
|
||||
|
||||
if (opts.client) {
|
||||
src = 'escape = escape || ' + escape.toString() + ';' + '\n' + src;
|
||||
if (opts.compileDebug) {
|
||||
src = 'rethrow = rethrow || ' + rethrow.toString() + ';' + '\n' + src;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
fn = new Function(exports.localsName + ', escape, include, rethrow', src);
|
||||
}
|
||||
catch(e) {
|
||||
// istanbul ignore else
|
||||
if (e instanceof SyntaxError) {
|
||||
if (opts.filename) {
|
||||
e.message += ' in ' + opts.filename;
|
||||
}
|
||||
e.message += ' while compiling ejs';
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
if (opts.client) {
|
||||
fn.dependencies = this.dependencies;
|
||||
return fn;
|
||||
}
|
||||
|
||||
// Return a callable function which will execute the function
|
||||
// created by the source-code, with the passed data as locals
|
||||
// Adds a local `include` function which allows full recursive include
|
||||
var returnedFn = function (data) {
|
||||
var include = function (path, includeData) {
|
||||
var d = utils.shallowCopy({}, data);
|
||||
if (includeData) {
|
||||
d = utils.shallowCopy(d, includeData);
|
||||
}
|
||||
return includeFile(path, opts)(d);
|
||||
};
|
||||
return fn.apply(opts.context, [data || {}, escape, include, rethrow]);
|
||||
};
|
||||
returnedFn.dependencies = this.dependencies;
|
||||
return returnedFn;
|
||||
}
|
||||
|
||||
, generateSource: function () {
|
||||
var self = this
|
||||
, matches = this.parseTemplateText()
|
||||
, d = this.opts.delimiter;
|
||||
|
||||
if (matches && matches.length) {
|
||||
matches.forEach(function (line, index) {
|
||||
var opening
|
||||
, closing
|
||||
, include
|
||||
, includeOpts
|
||||
, includeSrc;
|
||||
// If this is an opening tag, check for closing tags
|
||||
// FIXME: May end up with some false positives here
|
||||
// Better to store modes as k/v with '<' + delimiter as key
|
||||
// Then this can simply check against the map
|
||||
if ( line.indexOf('<' + d) === 0 // If it is a tag
|
||||
&& line.indexOf('<' + d + d) !== 0) { // and is not escaped
|
||||
closing = matches[index + 2];
|
||||
if (!(closing == d + '>' || closing == '-' + d + '>')) {
|
||||
throw new Error('Could not find matching close tag for "' + line + '".');
|
||||
}
|
||||
}
|
||||
// HACK: backward-compat `include` preprocessor directives
|
||||
if ((include = line.match(/^\s*include\s+(\S+)/))) {
|
||||
opening = matches[index - 1];
|
||||
// Must be in EVAL or RAW mode
|
||||
if (opening && (opening == '<' + d || opening == '<' + d + '-')) {
|
||||
includeOpts = utils.shallowCopy({}, self.opts);
|
||||
includeSrc = includeSource(include[1], includeOpts);
|
||||
includeSrc = ' ; (function(){' + '\n' + includeSrc +
|
||||
' ; })()' + '\n';
|
||||
self.source += includeSrc;
|
||||
self.dependencies.push(exports.resolveInclude(include[1],
|
||||
includeOpts.filename));
|
||||
return;
|
||||
}
|
||||
}
|
||||
self.scanLine(line);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
, parseTemplateText: function () {
|
||||
var str = this.templateText
|
||||
, pat = this.regex
|
||||
, result = pat.exec(str)
|
||||
, arr = []
|
||||
, firstPos
|
||||
, lastPos;
|
||||
|
||||
while (result) {
|
||||
firstPos = result.index;
|
||||
lastPos = pat.lastIndex;
|
||||
|
||||
if (firstPos !== 0) {
|
||||
arr.push(str.substring(0, firstPos));
|
||||
str = str.slice(firstPos);
|
||||
}
|
||||
|
||||
arr.push(result[0]);
|
||||
str = str.slice(result[0].length);
|
||||
result = pat.exec(str);
|
||||
}
|
||||
|
||||
if (str) {
|
||||
arr.push(str);
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
, scanLine: function (line) {
|
||||
var self = this
|
||||
, d = this.opts.delimiter
|
||||
, newLineCount = 0;
|
||||
|
||||
function _addOutput() {
|
||||
if (self.truncate) {
|
||||
line = line.replace('\n', '');
|
||||
self.truncate = false;
|
||||
}
|
||||
else if (self.opts.rmWhitespace) {
|
||||
// Gotta me more careful here.
|
||||
// .replace(/^(\s*)\n/, '$1') might be more appropriate here but as
|
||||
// rmWhitespace already removes trailing spaces anyway so meh.
|
||||
line = line.replace(/^\n/, '');
|
||||
}
|
||||
if (!line) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Preserve literal slashes
|
||||
line = line.replace(/\\/g, '\\\\');
|
||||
|
||||
// Convert linebreaks
|
||||
line = line.replace(/\n/g, '\\n');
|
||||
line = line.replace(/\r/g, '\\r');
|
||||
|
||||
// Escape double-quotes
|
||||
// - this will be the delimiter during execution
|
||||
line = line.replace(/"/g, '\\"');
|
||||
self.source += ' ; __append("' + line + '")' + '\n';
|
||||
}
|
||||
|
||||
newLineCount = (line.split('\n').length - 1);
|
||||
|
||||
switch (line) {
|
||||
case '<' + d:
|
||||
this.mode = Template.modes.EVAL;
|
||||
break;
|
||||
case '<' + d + '=':
|
||||
this.mode = Template.modes.ESCAPED;
|
||||
break;
|
||||
case '<' + d + '-':
|
||||
this.mode = Template.modes.RAW;
|
||||
break;
|
||||
case '<' + d + '#':
|
||||
this.mode = Template.modes.COMMENT;
|
||||
break;
|
||||
case '<' + d + d:
|
||||
this.mode = Template.modes.LITERAL;
|
||||
this.source += ' ; __append("' + line.replace('<' + d + d, '<' + d) + '")' + '\n';
|
||||
break;
|
||||
case d + '>':
|
||||
case '-' + d + '>':
|
||||
if (this.mode == Template.modes.LITERAL) {
|
||||
_addOutput();
|
||||
}
|
||||
|
||||
this.mode = null;
|
||||
this.truncate = line.indexOf('-') === 0;
|
||||
break;
|
||||
default:
|
||||
// In script mode, depends on type of tag
|
||||
if (this.mode) {
|
||||
// If '//' is found without a line break, add a line break.
|
||||
switch (this.mode) {
|
||||
case Template.modes.EVAL:
|
||||
case Template.modes.ESCAPED:
|
||||
case Template.modes.RAW:
|
||||
if (line.lastIndexOf('//') > line.lastIndexOf('\n')) {
|
||||
line += '\n';
|
||||
}
|
||||
}
|
||||
switch (this.mode) {
|
||||
// Just executing code
|
||||
case Template.modes.EVAL:
|
||||
this.source += ' ; ' + line + '\n';
|
||||
break;
|
||||
// Exec, esc, and output
|
||||
case Template.modes.ESCAPED:
|
||||
this.source += ' ; __append(escape(' +
|
||||
line.replace(_TRAILING_SEMCOL, '').trim() + '))' + '\n';
|
||||
break;
|
||||
// Exec and output
|
||||
case Template.modes.RAW:
|
||||
this.source += ' ; __append(' +
|
||||
line.replace(_TRAILING_SEMCOL, '').trim() + ')' + '\n';
|
||||
break;
|
||||
case Template.modes.COMMENT:
|
||||
// Do nothing
|
||||
break;
|
||||
// Literal <%% mode, append as raw output
|
||||
case Template.modes.LITERAL:
|
||||
_addOutput();
|
||||
break;
|
||||
}
|
||||
}
|
||||
// In string mode, just add the output
|
||||
else {
|
||||
_addOutput();
|
||||
}
|
||||
}
|
||||
|
||||
if (self.opts.compileDebug && newLineCount) {
|
||||
this.currentLine += newLineCount;
|
||||
this.source += ' ; __line = ' + this.currentLine + '\n';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Express.js support.
|
||||
*
|
||||
* This is an alias for {@link module:ejs.renderFile}, in order to support
|
||||
* Express.js out-of-the-box.
|
||||
*
|
||||
* @func
|
||||
*/
|
||||
|
||||
exports.__express = exports.renderFile;
|
||||
|
||||
// Add require support
|
||||
/* istanbul ignore else */
|
||||
if (require.extensions) {
|
||||
require.extensions['.ejs'] = function (module, filename) {
|
||||
filename = filename || /* istanbul ignore next */ module.filename;
|
||||
var options = {
|
||||
filename: filename
|
||||
, client: true
|
||||
}
|
||||
, template = fs.readFileSync(filename).toString()
|
||||
, fn = exports.compile(template, options);
|
||||
module._compile('module.exports = ' + fn.toString() + ';', filename);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Version of EJS.
|
||||
*
|
||||
* @readonly
|
||||
* @type {String}
|
||||
* @public
|
||||
*/
|
||||
|
||||
exports.VERSION = _VERSION_STRING;
|
||||
|
||||
/* istanbul ignore if */
|
||||
if (typeof window != 'undefined') {
|
||||
window.ejs = exports;
|
||||
}
|
||||
141
node_modules/ejs/lib/utils.js
generated
vendored
Normal file
141
node_modules/ejs/lib/utils.js
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* EJS Embedded JavaScript templates
|
||||
* Copyright 2112 Matthew Eernisse (mde@fleegix.org)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Private utility functions
|
||||
* @module utils
|
||||
* @private
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var regExpChars = /[|\\{}()[\]^$+*?.]/g;
|
||||
|
||||
/**
|
||||
* Escape characters reserved in regular expressions.
|
||||
*
|
||||
* If `string` is `undefined` or `null`, the empty string is returned.
|
||||
*
|
||||
* @param {String} string Input string
|
||||
* @return {String} Escaped string
|
||||
* @static
|
||||
* @private
|
||||
*/
|
||||
exports.escapeRegExpChars = function (string) {
|
||||
// istanbul ignore if
|
||||
if (!string) {
|
||||
return '';
|
||||
}
|
||||
return String(string).replace(regExpChars, '\\$&');
|
||||
};
|
||||
|
||||
var _ENCODE_HTML_RULES = {
|
||||
'&': '&'
|
||||
, '<': '<'
|
||||
, '>': '>'
|
||||
, '"': '"'
|
||||
, "'": '''
|
||||
}
|
||||
, _MATCH_HTML = /[&<>\'"]/g;
|
||||
|
||||
function encode_char(c) {
|
||||
return _ENCODE_HTML_RULES[c] || c;
|
||||
};
|
||||
|
||||
/**
|
||||
* Stringified version of constants used by {@link module:utils.escapeXML}.
|
||||
*
|
||||
* It is used in the process of generating {@link ClientFunction}s.
|
||||
*
|
||||
* @readonly
|
||||
* @type {String}
|
||||
*/
|
||||
|
||||
var escapeFuncStr =
|
||||
'var _ENCODE_HTML_RULES = {\n'
|
||||
+ ' "&": "&"\n'
|
||||
+ ' , "<": "<"\n'
|
||||
+ ' , ">": ">"\n'
|
||||
+ ' , \'"\': """\n'
|
||||
+ ' , "\'": "'"\n'
|
||||
+ ' }\n'
|
||||
+ ' , _MATCH_HTML = /[&<>\'"]/g;\n'
|
||||
+ 'function encode_char(c) {\n'
|
||||
+ ' return _ENCODE_HTML_RULES[c] || c;\n'
|
||||
+ '};\n';
|
||||
|
||||
/**
|
||||
* Escape characters reserved in XML.
|
||||
*
|
||||
* If `markup` is `undefined` or `null`, the empty string is returned.
|
||||
*
|
||||
* @implements {EscapeCallback}
|
||||
* @param {String} markup Input string
|
||||
* @return {String} Escaped string
|
||||
* @static
|
||||
* @private
|
||||
*/
|
||||
|
||||
exports.escapeXML = function (markup) {
|
||||
return markup == undefined
|
||||
? ''
|
||||
: String(markup)
|
||||
.replace(_MATCH_HTML, encode_char);
|
||||
};
|
||||
exports.escapeXML.toString = function () {
|
||||
return Function.prototype.toString.call(this) + ';\n' + escapeFuncStr
|
||||
};
|
||||
|
||||
/**
|
||||
* Copy all properties from one object to another, in a shallow fashion.
|
||||
*
|
||||
* @param {Object} to Destination object
|
||||
* @param {Object} from Source object
|
||||
* @return {Object} Destination object
|
||||
* @static
|
||||
* @private
|
||||
*/
|
||||
exports.shallowCopy = function (to, from) {
|
||||
from = from || {};
|
||||
for (var p in from) {
|
||||
to[p] = from[p];
|
||||
}
|
||||
return to;
|
||||
};
|
||||
|
||||
/**
|
||||
* Simple in-process cache implementation. Does not implement limits of any
|
||||
* sort.
|
||||
*
|
||||
* @implements Cache
|
||||
* @static
|
||||
* @private
|
||||
*/
|
||||
exports.cache = {
|
||||
_data: {},
|
||||
set: function (key, val) {
|
||||
this._data[key] = val;
|
||||
},
|
||||
get: function (key) {
|
||||
return this._data[key];
|
||||
},
|
||||
reset: function () {
|
||||
this._data = {};
|
||||
}
|
||||
};
|
||||
|
||||
77
node_modules/ejs/package.json
generated
vendored
Normal file
77
node_modules/ejs/package.json
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"name": "ejs",
|
||||
"description": "Embedded JavaScript templates",
|
||||
"keywords": [
|
||||
"template",
|
||||
"engine",
|
||||
"ejs"
|
||||
],
|
||||
"version": "2.3.3",
|
||||
"author": {
|
||||
"name": "Matthew Eernisse",
|
||||
"email": "mde@fleegix.org",
|
||||
"url": "http://fleegix.org"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Timothy Gu",
|
||||
"email": "timothygu99@gmail.com",
|
||||
"url": "https://timothygu.github.io"
|
||||
}
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"main": "./lib/ejs.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/mde/ejs.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/mde/ejs/issues"
|
||||
},
|
||||
"homepage": "https://github.com/mde/ejs",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"browserify": "^8.0.3",
|
||||
"istanbul": "~0.3.5",
|
||||
"jake": "^8.0.0",
|
||||
"jsdoc": "^3.3.0-beta1",
|
||||
"lru-cache": "^2.5.0",
|
||||
"mocha": "^2.1.0",
|
||||
"rimraf": "^2.2.8",
|
||||
"uglify-js": "^2.4.16"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha",
|
||||
"coverage": "istanbul cover node_modules/mocha/bin/_mocha",
|
||||
"doc": "rimraf out && jsdoc -c jsdoc.json lib/* docs/jsdoc/*",
|
||||
"devdoc": "rimraf out && jsdoc -p -c jsdoc.json lib/* docs/jsdoc/*"
|
||||
},
|
||||
"_id": "ejs@2.3.3",
|
||||
"_shasum": "a6babb67815d7190694af4ba82fe065e56d5f0e7",
|
||||
"_resolved": "https://registry.npmjs.org/ejs/-/ejs-2.3.3.tgz",
|
||||
"_from": "ejs@*",
|
||||
"_npmVersion": "2.1.11",
|
||||
"_nodeVersion": "0.10.33",
|
||||
"_npmUser": {
|
||||
"name": "mde",
|
||||
"email": "mde@fleegix.org"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "tjholowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
{
|
||||
"name": "mde",
|
||||
"email": "mde@fleegix.org"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "a6babb67815d7190694af4ba82fe065e56d5f0e7",
|
||||
"tarball": "http://registry.npmjs.org/ejs/-/ejs-2.3.3.tgz"
|
||||
},
|
||||
"directories": {}
|
||||
}
|
||||
859
node_modules/ejs/test/ejs.js
generated
vendored
Normal file
859
node_modules/ejs/test/ejs.js
generated
vendored
Normal file
@@ -0,0 +1,859 @@
|
||||
/* jshint mocha: true */
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var ejs = require('..')
|
||||
, fs = require('fs')
|
||||
, read = fs.readFileSync
|
||||
, assert = require('assert')
|
||||
, path = require('path')
|
||||
, LRU = require('lru-cache');
|
||||
|
||||
try {
|
||||
fs.mkdirSync(__dirname + '/tmp');
|
||||
} catch (ex) {
|
||||
if (ex.code !== 'EEXIST') {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
// From https://gist.github.com/pguillory/729616
|
||||
function hook_stdio(stream, callback) {
|
||||
var old_write = stream.write;
|
||||
|
||||
stream.write = (function() {
|
||||
return function(string, encoding, fd) {
|
||||
callback(string, encoding, fd);
|
||||
};
|
||||
})(stream.write);
|
||||
|
||||
return function() {
|
||||
stream.write = old_write;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Load fixture `name`.
|
||||
*/
|
||||
|
||||
function fixture(name) {
|
||||
return read('test/fixtures/' + name, 'utf8');
|
||||
}
|
||||
|
||||
/**
|
||||
* User fixtures.
|
||||
*/
|
||||
|
||||
var users = [];
|
||||
users.push({name: 'geddy'});
|
||||
users.push({name: 'neil'});
|
||||
users.push({name: 'alex'});
|
||||
|
||||
suite('ejs.compile(str, options)', function () {
|
||||
test('compile to a function', function () {
|
||||
var fn = ejs.compile('<p>yay</p>');
|
||||
assert.equal(fn(), '<p>yay</p>');
|
||||
});
|
||||
|
||||
test('empty input works', function () {
|
||||
var fn = ejs.compile('');
|
||||
assert.equal(fn(), '');
|
||||
});
|
||||
|
||||
test('throw if there are syntax errors', function () {
|
||||
try {
|
||||
ejs.compile(fixture('fail.ejs'));
|
||||
}
|
||||
catch (err) {
|
||||
assert.ok(err.message.indexOf('compiling ejs') > -1);
|
||||
|
||||
try {
|
||||
ejs.compile(fixture('fail.ejs'), {filename: 'fail.ejs'});
|
||||
}
|
||||
catch (err) {
|
||||
assert.ok(err.message.indexOf('fail.ejs') > -1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new Error('no error reported when there should be');
|
||||
});
|
||||
|
||||
test('allow customizing delimiter local var', function () {
|
||||
var fn;
|
||||
fn = ejs.compile('<p><?= name ?></p>', {delimiter: '?'});
|
||||
assert.equal(fn({name: 'geddy'}), '<p>geddy</p>');
|
||||
|
||||
fn = ejs.compile('<p><:= name :></p>', {delimiter: ':'});
|
||||
assert.equal(fn({name: 'geddy'}), '<p>geddy</p>');
|
||||
|
||||
fn = ejs.compile('<p><$= name $></p>', {delimiter: '$'});
|
||||
assert.equal(fn({name: 'geddy'}), '<p>geddy</p>');
|
||||
});
|
||||
|
||||
test('default to using ejs.delimiter', function () {
|
||||
var fn;
|
||||
ejs.delimiter = '&';
|
||||
fn = ejs.compile('<p><&= name &></p>');
|
||||
assert.equal(fn({name: 'geddy'}), '<p>geddy</p>');
|
||||
|
||||
fn = ejs.compile('<p><|= name |></p>', {delimiter: '|'});
|
||||
assert.equal(fn({name: 'geddy'}), '<p>geddy</p>');
|
||||
delete ejs.delimiter;
|
||||
});
|
||||
|
||||
test('have a working client option', function () {
|
||||
var fn
|
||||
, str
|
||||
, preFn;
|
||||
fn = ejs.compile('<p><%= foo %></p>', {client: true});
|
||||
str = fn.toString();
|
||||
if (!process.env.running_under_istanbul) {
|
||||
eval('var preFn = ' + str);
|
||||
assert.equal(preFn({foo: 'bar'}), '<p>bar</p>');
|
||||
}
|
||||
});
|
||||
|
||||
test('support client mode without locals', function () {
|
||||
var fn
|
||||
, str
|
||||
, preFn;
|
||||
fn = ejs.compile('<p><%= "foo" %></p>', {client: true});
|
||||
str = fn.toString();
|
||||
if (!process.env.running_under_istanbul) {
|
||||
eval('var preFn = ' + str);
|
||||
assert.equal(preFn(), '<p>foo</p>');
|
||||
}
|
||||
});
|
||||
|
||||
test('not include rethrow() in client mode if compileDebug is false', function () {
|
||||
var fn = ejs.compile('<p><%= "foo" %></p>', {
|
||||
client: true
|
||||
, compileDebug: false
|
||||
});
|
||||
// There could be a `rethrow` in the function declaration
|
||||
assert((fn.toString().match(/rethrow/g) || []).length <= 1);
|
||||
});
|
||||
});
|
||||
|
||||
suite('ejs.render(str, data, opts)', function () {
|
||||
test('render the template', function () {
|
||||
assert.equal(ejs.render('<p>yay</p>'), '<p>yay</p>');
|
||||
});
|
||||
|
||||
test('empty input works', function () {
|
||||
assert.equal(ejs.render(''), '');
|
||||
});
|
||||
|
||||
test('undefined renders nothing escaped', function () {
|
||||
assert.equal(ejs.render('<%= undefined %>'), '');
|
||||
});
|
||||
|
||||
test('undefined renders nothing raw', function () {
|
||||
assert.equal(ejs.render('<%- undefined %>'), '');
|
||||
});
|
||||
|
||||
test('null renders nothing escaped', function () {
|
||||
assert.equal(ejs.render('<%= null %>'), '');
|
||||
});
|
||||
|
||||
test('null renders nothing raw', function () {
|
||||
assert.equal(ejs.render('<%- null %>'), '');
|
||||
});
|
||||
|
||||
test('zero-value data item renders something escaped', function () {
|
||||
assert.equal(ejs.render('<%= 0 %>'), '0');
|
||||
});
|
||||
|
||||
test('zero-value data object renders something raw', function () {
|
||||
assert.equal(ejs.render('<%- 0 %>'), '0');
|
||||
});
|
||||
|
||||
test('accept locals', function () {
|
||||
assert.equal(ejs.render('<p><%= name %></p>', {name: 'geddy'}),
|
||||
'<p>geddy</p>');
|
||||
});
|
||||
|
||||
test('accept locals without using with() {}', function () {
|
||||
assert.equal(ejs.render('<p><%= locals.name %></p>', {name: 'geddy'},
|
||||
{_with: false}),
|
||||
'<p>geddy</p>');
|
||||
assert.throws(function() {
|
||||
ejs.render('<p><%= name %></p>', {name: 'geddy'},
|
||||
{_with: false});
|
||||
}, /name is not defined/);
|
||||
});
|
||||
|
||||
test('accept custom name for locals', function () {
|
||||
ejs.localsName = 'it';
|
||||
assert.equal(ejs.render('<p><%= it.name %></p>', {name: 'geddy'},
|
||||
{_with: false}),
|
||||
'<p>geddy</p>');
|
||||
assert.throws(function() {
|
||||
ejs.render('<p><%= name %></p>', {name: 'geddy'},
|
||||
{_with: false});
|
||||
}, /name is not defined/);
|
||||
ejs.localsName = 'locals';
|
||||
});
|
||||
|
||||
test('support caching', function () {
|
||||
var file = __dirname + '/tmp/render.ejs'
|
||||
, options = {cache: true, filename: file}
|
||||
, out = ejs.render('<p>Old</p>', {}, options)
|
||||
, expected = '<p>Old</p>';
|
||||
assert.equal(out, expected);
|
||||
// Assert no change, still in cache
|
||||
out = ejs.render('<p>New</p>', {}, options);
|
||||
assert.equal(out, expected);
|
||||
});
|
||||
|
||||
test('support LRU caching', function () {
|
||||
var oldCache = ejs.cache
|
||||
, file = __dirname + '/tmp/render.ejs'
|
||||
, options = {cache: true, filename: file}
|
||||
, out
|
||||
, expected = '<p>Old</p>';
|
||||
|
||||
// Switch to LRU
|
||||
ejs.cache = LRU();
|
||||
|
||||
out = ejs.render('<p>Old</p>', {}, options);
|
||||
assert.equal(out, expected);
|
||||
// Assert no change, still in cache
|
||||
out = ejs.render('<p>New</p>', {}, options);
|
||||
assert.equal(out, expected);
|
||||
|
||||
// Restore system cache
|
||||
ejs.cache = oldCache;
|
||||
});
|
||||
|
||||
test('opts.context', function () {
|
||||
var ctxt = {foo: 'FOO'}
|
||||
, out = ejs.render('<%= this.foo %>', {}, {context: ctxt});
|
||||
assert.equal(out, ctxt.foo);
|
||||
});
|
||||
});
|
||||
|
||||
suite('ejs.renderFile(path, [data], [options], fn)', function () {
|
||||
test('render a file', function(done) {
|
||||
ejs.renderFile('test/fixtures/para.ejs', function(err, html) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
assert.equal(html, '<p>hey</p>\n');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('accept locals', function(done) {
|
||||
var data = {name: 'fonebone'}
|
||||
, options = {delimiter: '$'};
|
||||
ejs.renderFile('test/fixtures/user.ejs', data, options, function(err, html) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
assert.equal(html, '<h1>fonebone</h1>\n');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('accept locals without using with() {}', function(done) {
|
||||
var data = {name: 'fonebone'}
|
||||
, options = {delimiter: '$', _with: false}
|
||||
, doneCount = 0;
|
||||
ejs.renderFile('test/fixtures/user-no-with.ejs', data, options,
|
||||
function(err, html) {
|
||||
if (err) {
|
||||
if (doneCount === 2) {
|
||||
return;
|
||||
}
|
||||
doneCount = 2;
|
||||
return done(err);
|
||||
}
|
||||
assert.equal(html, '<h1>fonebone</h1>\n');
|
||||
doneCount++;
|
||||
if (doneCount === 2) {
|
||||
done();
|
||||
}
|
||||
});
|
||||
ejs.renderFile('test/fixtures/user.ejs', data, options, function(err) {
|
||||
if (!err) {
|
||||
if (doneCount === 2) {
|
||||
return;
|
||||
}
|
||||
doneCount = 2;
|
||||
return done(new Error('error not thrown'));
|
||||
}
|
||||
doneCount++;
|
||||
if (doneCount === 2) {
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test('not catch err thrown by callback', function(done) {
|
||||
var data = {name: 'fonebone'}
|
||||
, options = {delimiter: '$'}
|
||||
, counter = 0;
|
||||
|
||||
var d = require('domain').create();
|
||||
d.on('error', function (err) {
|
||||
assert.equal(counter, 1);
|
||||
assert.equal(err.message, 'Exception in callback');
|
||||
done();
|
||||
});
|
||||
d.run(function () {
|
||||
// process.nextTick() needed to work around mochajs/mocha#513
|
||||
//
|
||||
// tl;dr: mocha doesn't support synchronous exception throwing in
|
||||
// domains. Have to make it async. Ticket closed because: "domains are
|
||||
// deprecated :D"
|
||||
process.nextTick(function () {
|
||||
ejs.renderFile('test/fixtures/user.ejs', data, options,
|
||||
function(err) {
|
||||
counter++;
|
||||
if (err) {
|
||||
assert.notEqual(err.message, 'Exception in callback');
|
||||
return done(err);
|
||||
}
|
||||
throw new Error('Exception in callback');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('support caching', function (done) {
|
||||
var expected = '<p>Old</p>'
|
||||
, file = __dirname + '/tmp/renderFile.ejs'
|
||||
, options = {cache: true};
|
||||
fs.writeFileSync(file, '<p>Old</p>');
|
||||
|
||||
ejs.renderFile(file, {}, options, function (err, out) {
|
||||
if (err) {
|
||||
done(err);
|
||||
}
|
||||
fs.writeFileSync(file, '<p>New</p>');
|
||||
assert.equal(out, expected);
|
||||
|
||||
ejs.renderFile(file, {}, options, function (err, out) {
|
||||
if (err) {
|
||||
done(err);
|
||||
}
|
||||
// Assert no change, still in cache
|
||||
assert.equal(out, expected);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('opts.context', function (done) {
|
||||
var ctxt = {foo: 'FOO'};
|
||||
ejs.renderFile('test/fixtures/with-context.ejs', {},
|
||||
{context: ctxt}, function(err, html) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
assert.equal(html, ctxt.foo + '\n');
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
suite('cache specific', function () {
|
||||
test('`clearCache` work properly', function () {
|
||||
var expected = '<p>Old</p>'
|
||||
, file = __dirname + '/tmp/clearCache.ejs'
|
||||
, options = {cache: true, filename: file}
|
||||
, out = ejs.render('<p>Old</p>', {}, options);
|
||||
assert.equal(out, expected);
|
||||
|
||||
ejs.clearCache();
|
||||
|
||||
expected = '<p>New</p>';
|
||||
out = ejs.render('<p>New</p>', {}, options);
|
||||
assert.equal(out, expected);
|
||||
});
|
||||
|
||||
test('`clearCache` work properly, LRU', function () {
|
||||
var expected = '<p>Old</p>'
|
||||
, oldCache = ejs.cache
|
||||
, file = __dirname + '/tmp/clearCache.ejs'
|
||||
, options = {cache: true, filename: file}
|
||||
, out;
|
||||
|
||||
ejs.cache = LRU();
|
||||
|
||||
out = ejs.render('<p>Old</p>', {}, options);
|
||||
assert.equal(out, expected);
|
||||
ejs.clearCache();
|
||||
expected = '<p>New</p>';
|
||||
out = ejs.render('<p>New</p>', {}, options);
|
||||
assert.equal(out, expected);
|
||||
|
||||
ejs.cache = oldCache;
|
||||
});
|
||||
|
||||
test('LRU with cache-size 1', function () {
|
||||
var oldCache = ejs.cache
|
||||
, options
|
||||
, out
|
||||
, expected
|
||||
, file;
|
||||
|
||||
ejs.cache = LRU(1);
|
||||
|
||||
file = __dirname + '/tmp/render1.ejs';
|
||||
options = {cache: true, filename: file};
|
||||
out = ejs.render('<p>File1</p>', {}, options);
|
||||
expected = '<p>File1</p>';
|
||||
assert.equal(out, expected);
|
||||
|
||||
// Same filename, different template, but output
|
||||
// should be the same because cache
|
||||
file = __dirname + '/tmp/render1.ejs';
|
||||
options = {cache: true, filename: file};
|
||||
out = ejs.render('<p>ChangedFile1</p>', {}, options);
|
||||
expected = '<p>File1</p>';
|
||||
assert.equal(out, expected);
|
||||
|
||||
// Different filiename -- output should be different,
|
||||
// and previous cache-entry should be evicted
|
||||
file = __dirname + '/tmp/render2.ejs';
|
||||
options = {cache: true, filename: file};
|
||||
out = ejs.render('<p>File2</p>', {}, options);
|
||||
expected = '<p>File2</p>';
|
||||
assert.equal(out, expected);
|
||||
|
||||
// Entry with first filename should now be out of cache,
|
||||
// results should be different
|
||||
file = __dirname + '/tmp/render1.ejs';
|
||||
options = {cache: true, filename: file};
|
||||
out = ejs.render('<p>ChangedFile1</p>', {}, options);
|
||||
expected = '<p>ChangedFile1</p>';
|
||||
assert.equal(out, expected);
|
||||
|
||||
ejs.cache = oldCache;
|
||||
});
|
||||
});
|
||||
|
||||
suite('<%', function () {
|
||||
test('without semicolons', function () {
|
||||
assert.equal(ejs.render(fixture('no.semicolons.ejs')),
|
||||
fixture('no.semicolons.html'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('<%=', function () {
|
||||
test('escape &<script>', function () {
|
||||
assert.equal(ejs.render('<%= name %>', {name: ' <script>'}),
|
||||
'&nbsp;<script>');
|
||||
});
|
||||
|
||||
test('should escape \'', function () {
|
||||
assert.equal(ejs.render('<%= name %>', {name: 'The Jones\'s'}),
|
||||
'The Jones's');
|
||||
});
|
||||
|
||||
test('should escape &foo_bar;', function () {
|
||||
assert.equal(ejs.render('<%= name %>', {name: '&foo_bar;'}),
|
||||
'&foo_bar;');
|
||||
});
|
||||
});
|
||||
|
||||
suite('<%-', function () {
|
||||
test('not escape', function () {
|
||||
assert.equal(ejs.render('<%- name %>', {name: '<script>'}),
|
||||
'<script>');
|
||||
});
|
||||
|
||||
test('terminate gracefully if no close tag is found', function () {
|
||||
try {
|
||||
ejs.compile('<h1>oops</h1><%- name ->');
|
||||
throw new Error('Expected parse failure');
|
||||
}
|
||||
catch (err) {
|
||||
assert.ok(err.message.indexOf('Could not find matching close tag for') > -1);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
suite('%>', function () {
|
||||
test('produce newlines', function () {
|
||||
assert.equal(ejs.render(fixture('newlines.ejs'), {users: users}),
|
||||
fixture('newlines.html'));
|
||||
});
|
||||
test('works with `-%>` interspersed', function () {
|
||||
assert.equal(ejs.render(fixture('newlines.mixed.ejs'), {users: users}),
|
||||
fixture('newlines.mixed.html'));
|
||||
});
|
||||
test('consecutive tags work', function () {
|
||||
assert.equal(ejs.render(fixture('consecutive-tags.ejs')),
|
||||
fixture('consecutive-tags.html'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('-%>', function () {
|
||||
test('not produce newlines', function () {
|
||||
assert.equal(ejs.render(fixture('no.newlines.ejs'), {users: users}),
|
||||
fixture('no.newlines.html'));
|
||||
});
|
||||
test('stack traces work', function () {
|
||||
try {
|
||||
ejs.render(fixture('no.newlines.error.ejs'));
|
||||
}
|
||||
catch (e) {
|
||||
if (e.message.indexOf('>> 4| <%= qdata %>') > -1) {
|
||||
return;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
throw new Error('Expected ReferenceError');
|
||||
});
|
||||
});
|
||||
|
||||
suite('<%%', function () {
|
||||
test('produce literals', function () {
|
||||
assert.equal(ejs.render('<%%- "foo" %>'),
|
||||
'<%- "foo" %>');
|
||||
});
|
||||
test('work without an end tag', function () {
|
||||
assert.equal(ejs.render('<%%'), '<%');
|
||||
assert.equal(ejs.render(fixture('literal.ejs'), {}, {delimiter: ' '}),
|
||||
fixture('literal.html'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('single quotes', function () {
|
||||
test('not mess up the constructed function', function () {
|
||||
assert.equal(ejs.render(fixture('single-quote.ejs')),
|
||||
fixture('single-quote.html'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('double quotes', function () {
|
||||
test('not mess up the constructed function', function () {
|
||||
assert.equal(ejs.render(fixture('double-quote.ejs')),
|
||||
fixture('double-quote.html'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('backslashes', function () {
|
||||
test('escape', function () {
|
||||
assert.equal(ejs.render(fixture('backslash.ejs')),
|
||||
fixture('backslash.html'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('messed up whitespace', function () {
|
||||
test('work', function () {
|
||||
assert.equal(ejs.render(fixture('messed.ejs'), {users: users}),
|
||||
fixture('messed.html'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('exceptions', function () {
|
||||
test('produce useful stack traces', function () {
|
||||
try {
|
||||
ejs.render(fixture('error.ejs'), {}, {filename: 'error.ejs'});
|
||||
}
|
||||
catch (err) {
|
||||
assert.equal(err.path, 'error.ejs');
|
||||
assert.equal(err.stack.split('\n').slice(0, 8).join('\n'), fixture('error.out'));
|
||||
return;
|
||||
}
|
||||
throw new Error('no error reported when there should be');
|
||||
});
|
||||
|
||||
test('not include fancy stack info if compileDebug is false', function () {
|
||||
try {
|
||||
ejs.render(fixture('error.ejs'), {}, {
|
||||
filename: 'error.ejs',
|
||||
compileDebug: false
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
assert.ok(!err.path);
|
||||
assert.notEqual(err.stack.split('\n').slice(0, 8).join('\n'), fixture('error.out'));
|
||||
return;
|
||||
}
|
||||
throw new Error('no error reported when there should be');
|
||||
});
|
||||
|
||||
var unhook = null;
|
||||
test('log JS source when debug is set', function (done) {
|
||||
var out = ''
|
||||
, needToExit = false;
|
||||
unhook = hook_stdio(process.stdout, function (str) {
|
||||
out += str;
|
||||
if (needToExit) {
|
||||
return;
|
||||
}
|
||||
if (out.indexOf('__output')) {
|
||||
needToExit = true;
|
||||
unhook();
|
||||
unhook = null;
|
||||
return done();
|
||||
}
|
||||
});
|
||||
ejs.render(fixture('hello-world.ejs'), {}, {debug: true});
|
||||
});
|
||||
teardown(function() {
|
||||
if (!unhook) {
|
||||
return;
|
||||
}
|
||||
unhook();
|
||||
unhook = null;
|
||||
});
|
||||
});
|
||||
|
||||
suite('rmWhitespace', function () {
|
||||
test('works', function () {
|
||||
assert.equal(ejs.render(fixture('rmWhitespace.ejs'), {}, {rmWhitespace: true}),
|
||||
fixture('rmWhitespace.html'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('include()', function () {
|
||||
test('include ejs', function () {
|
||||
var file = 'test/fixtures/include-simple.ejs';
|
||||
assert.equal(ejs.render(fixture('include-simple.ejs'), {}, {filename: file}),
|
||||
fixture('include-simple.html'));
|
||||
});
|
||||
|
||||
test('include ejs fails without `filename`', function () {
|
||||
try {
|
||||
ejs.render(fixture('include-simple.ejs'));
|
||||
}
|
||||
catch (err) {
|
||||
assert.ok(err.message.indexOf('requires the \'filename\' option') > -1);
|
||||
return;
|
||||
}
|
||||
throw new Error('expected inclusion error');
|
||||
});
|
||||
|
||||
test('strips BOM', function () {
|
||||
assert.equal(
|
||||
ejs.render('<%- include("fixtures/includes/bom.ejs") %>',
|
||||
{}, {filename: path.join(__dirname, 'f.ejs')}),
|
||||
'<p>This is a file with BOM.</p>\n');
|
||||
});
|
||||
|
||||
test('include ejs with locals', function () {
|
||||
var file = 'test/fixtures/include.ejs';
|
||||
assert.equal(ejs.render(fixture('include.ejs'), {pets: users}, {filename: file, delimiter: '@'}),
|
||||
fixture('include.html'));
|
||||
});
|
||||
|
||||
test('include ejs with absolute path and locals', function () {
|
||||
var file = 'test/fixtures/include-abspath.ejs';
|
||||
assert.equal(ejs.render(fixture('include-abspath.ejs'),
|
||||
{dir: path.join(__dirname, 'fixtures'), pets: users, path: path},
|
||||
{filename: file, delimiter: '@'}),
|
||||
fixture('include.html'));
|
||||
});
|
||||
|
||||
test('work when nested', function () {
|
||||
var file = 'test/fixtures/menu.ejs';
|
||||
assert.equal(ejs.render(fixture('menu.ejs'), {pets: users}, {filename: file}),
|
||||
fixture('menu.html'));
|
||||
});
|
||||
|
||||
test('work with a variable path', function () {
|
||||
var file = 'test/fixtures/menu_var.ejs',
|
||||
includePath = 'includes/menu-item';
|
||||
assert.equal(ejs.render(fixture('menu.ejs'), {pets: users, varPath: includePath}, {filename: file}),
|
||||
fixture('menu.html'));
|
||||
});
|
||||
|
||||
test('include arbitrary files as-is', function () {
|
||||
var file = 'test/fixtures/include.css.ejs';
|
||||
assert.equal(ejs.render(fixture('include.css.ejs'), {pets: users}, {filename: file}),
|
||||
fixture('include.css.html'));
|
||||
});
|
||||
|
||||
test('pass compileDebug to include', function () {
|
||||
var file = 'test/fixtures/include.ejs'
|
||||
, fn;
|
||||
fn = ejs.compile(fixture('include.ejs'), {
|
||||
filename: file
|
||||
, delimiter: '@'
|
||||
, compileDebug: false
|
||||
});
|
||||
try {
|
||||
// Render without a required variable reference
|
||||
fn({foo: 'asdf'});
|
||||
}
|
||||
catch(e) {
|
||||
assert.equal(e.message, 'pets is not defined');
|
||||
assert.ok(!e.path);
|
||||
return;
|
||||
}
|
||||
throw new Error('no error reported when there should be');
|
||||
});
|
||||
|
||||
test('is dynamic', function () {
|
||||
fs.writeFileSync(__dirname + '/tmp/include.ejs', '<p>Old</p>');
|
||||
var file = 'test/fixtures/include_cache.ejs'
|
||||
, options = {filename: file}
|
||||
, out = ejs.compile(fixture('include_cache.ejs'), options);
|
||||
assert.equal(out(), '<p>Old</p>\n');
|
||||
|
||||
fs.writeFileSync(__dirname + '/tmp/include.ejs', '<p>New</p>');
|
||||
assert.equal(out(), '<p>New</p>\n');
|
||||
});
|
||||
|
||||
test('support caching', function () {
|
||||
fs.writeFileSync(__dirname + '/tmp/include.ejs', '<p>Old</p>');
|
||||
var file = 'test/fixtures/include_cache.ejs'
|
||||
, options = {cache: true, filename: file}
|
||||
, out = ejs.render(fixture('include_cache.ejs'), {}, options)
|
||||
, expected = fixture('include_cache.html');
|
||||
assert.equal(out, expected);
|
||||
out = ejs.render(fixture('include_cache.ejs'), {}, options);
|
||||
// No change, still in cache
|
||||
assert.equal(out, expected);
|
||||
fs.writeFileSync(__dirname + '/tmp/include.ejs', '<p>New</p>');
|
||||
out = ejs.render(fixture('include_cache.ejs'), {}, options);
|
||||
assert.equal(out, expected);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
suite('preprocessor include', function () {
|
||||
test('work', function () {
|
||||
var file = 'test/fixtures/include_preprocessor.ejs';
|
||||
assert.equal(ejs.render(fixture('include_preprocessor.ejs'), {pets: users}, {filename: file, delimiter: '@'}),
|
||||
fixture('include_preprocessor.html'));
|
||||
});
|
||||
|
||||
test('no false positives', function () {
|
||||
assert.equal(ejs.render('<% %> include foo <% %>'), ' include foo ');
|
||||
});
|
||||
|
||||
test('fails without `filename`', function () {
|
||||
try {
|
||||
ejs.render(fixture('include_preprocessor.ejs'), {pets: users}, {delimiter: '@'});
|
||||
}
|
||||
catch (err) {
|
||||
assert.ok(err.message.indexOf('requires the \'filename\' option') > -1);
|
||||
return;
|
||||
}
|
||||
throw new Error('expected inclusion error');
|
||||
});
|
||||
|
||||
test('strips BOM', function () {
|
||||
assert.equal(
|
||||
ejs.render('<% include fixtures/includes/bom.ejs %>',
|
||||
{}, {filename: path.join(__dirname, 'f.ejs')}),
|
||||
'<p>This is a file with BOM.</p>\n');
|
||||
});
|
||||
|
||||
test('work when nested', function () {
|
||||
var file = 'test/fixtures/menu_preprocessor.ejs';
|
||||
assert.equal(ejs.render(fixture('menu_preprocessor.ejs'), {pets: users}, {filename: file}),
|
||||
fixture('menu_preprocessor.html'));
|
||||
});
|
||||
|
||||
test('tracks dependency correctly', function () {
|
||||
var file = 'test/fixtures/menu_preprocessor.ejs'
|
||||
, fn = ejs.compile(fixture('menu_preprocessor.ejs'), {filename: file});
|
||||
assert(fn.dependencies.length);
|
||||
});
|
||||
|
||||
test('include arbitrary files as-is', function () {
|
||||
var file = 'test/fixtures/include_preprocessor.css.ejs';
|
||||
assert.equal(ejs.render(fixture('include_preprocessor.css.ejs'), {pets: users}, {filename: file}),
|
||||
fixture('include_preprocessor.css.html'));
|
||||
});
|
||||
|
||||
test('pass compileDebug to include', function () {
|
||||
var file = 'test/fixtures/include_preprocessor.ejs'
|
||||
, fn;
|
||||
fn = ejs.compile(fixture('include_preprocessor.ejs'), {
|
||||
filename: file
|
||||
, delimiter: '@'
|
||||
, compileDebug: false
|
||||
});
|
||||
try {
|
||||
// Render without a required variable reference
|
||||
fn({foo: 'asdf'});
|
||||
}
|
||||
catch(e) {
|
||||
assert.equal(e.message, 'pets is not defined');
|
||||
assert.ok(!e.path);
|
||||
return;
|
||||
}
|
||||
throw new Error('no error reported when there should be');
|
||||
});
|
||||
|
||||
test('is static', function () {
|
||||
fs.writeFileSync(__dirname + '/tmp/include_preprocessor.ejs', '<p>Old</p>');
|
||||
var file = 'test/fixtures/include_preprocessor_cache.ejs'
|
||||
, options = {filename: file}
|
||||
, out = ejs.compile(fixture('include_preprocessor_cache.ejs'), options);
|
||||
assert.equal(out(), '<p>Old</p>\n');
|
||||
|
||||
fs.writeFileSync(__dirname + '/tmp/include_preprocessor.ejs', '<p>New</p>');
|
||||
assert.equal(out(), '<p>Old</p>\n');
|
||||
});
|
||||
|
||||
test('support caching', function () {
|
||||
fs.writeFileSync(__dirname + '/tmp/include_preprocessor.ejs', '<p>Old</p>');
|
||||
var file = 'test/fixtures/include_preprocessor_cache.ejs'
|
||||
, options = {cache: true, filename: file}
|
||||
, out = ejs.render(fixture('include_preprocessor_cache.ejs'), {}, options)
|
||||
, expected = fixture('include_preprocessor_cache.html');
|
||||
assert.equal(out, expected);
|
||||
fs.writeFileSync(__dirname + '/tmp/include_preprocessor.ejs', '<p>New</p>');
|
||||
out = ejs.render(fixture('include_preprocessor_cache.ejs'), {}, options);
|
||||
assert.equal(out, expected);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
suite('comments', function () {
|
||||
test('fully render with comments removed', function () {
|
||||
assert.equal(ejs.render(fixture('comments.ejs')),
|
||||
fixture('comments.html'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('require', function () {
|
||||
|
||||
// Only works with inline/preprocessor includes
|
||||
test('allow ejs templates to be required as node modules', function () {
|
||||
var file = 'test/fixtures/include_preprocessor.ejs'
|
||||
, template = require(__dirname + '/fixtures/menu_preprocessor.ejs');
|
||||
if (!process.env.running_under_istanbul) {
|
||||
assert.equal(template({filename: file, pets: users}),
|
||||
fixture('menu_preprocessor.html'));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
suite('examples', function () {
|
||||
function noop () {}
|
||||
fs.readdirSync('examples').forEach(function (f) {
|
||||
if (!/\.js$/.test(f)) {
|
||||
return;
|
||||
}
|
||||
suite(f, function () {
|
||||
test('doesn\'t throw any errors', function () {
|
||||
var stderr = hook_stdio(process.stderr, noop)
|
||||
, stdout = hook_stdio(process.stdout, noop);
|
||||
try {
|
||||
require('../examples/' + f);
|
||||
}
|
||||
catch (ex) {
|
||||
stdout();
|
||||
stderr();
|
||||
throw ex;
|
||||
}
|
||||
stdout();
|
||||
stderr();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
1
node_modules/ejs/test/fixtures/backslash.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/backslash.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
\foo
|
||||
1
node_modules/ejs/test/fixtures/backslash.html
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/backslash.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
\foo
|
||||
7
node_modules/ejs/test/fixtures/comments.ejs
generated
vendored
Normal file
7
node_modules/ejs/test/fixtures/comments.ejs
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<li><a href="foo"><% // double-slash comment %>foo</li>
|
||||
<li><a href="bar"><% /* C-style comment */ %>bar</li>
|
||||
<li><a href="baz"><% // double-slash comment with newline
|
||||
%>baz</li>
|
||||
<li><a href="qux"><% var x = 'qux'; // double-slash comment @ end of line %><%= x %></li>
|
||||
<li><a href="fee"><%# ERB style comment %>fee</li>
|
||||
<li><a href="bah"><%= 'not a ' + '//' + ' comment' %></a></li>
|
||||
6
node_modules/ejs/test/fixtures/comments.html
generated
vendored
Normal file
6
node_modules/ejs/test/fixtures/comments.html
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<li><a href="foo">foo</li>
|
||||
<li><a href="bar">bar</li>
|
||||
<li><a href="baz">baz</li>
|
||||
<li><a href="qux">qux</li>
|
||||
<li><a href="fee">fee</li>
|
||||
<li><a href="bah">not a // comment</a></li>
|
||||
1
node_modules/ejs/test/fixtures/consecutive-tags.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/consecutive-tags.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<% var a = 'foo' %><% var b = 'bar' %><%= a %>
|
||||
1
node_modules/ejs/test/fixtures/consecutive-tags.html
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/consecutive-tags.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foo
|
||||
1
node_modules/ejs/test/fixtures/double-quote.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/double-quote.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p><%= "lo" + 'ki' %>'s "wheelchair"</p>
|
||||
1
node_modules/ejs/test/fixtures/double-quote.html
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/double-quote.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p>loki's "wheelchair"</p>
|
||||
5
node_modules/ejs/test/fixtures/error.ejs
generated
vendored
Normal file
5
node_modules/ejs/test/fixtures/error.ejs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<ul>
|
||||
<% if (users) { %>
|
||||
<p>Has users</p>
|
||||
<% } %>
|
||||
</ul>
|
||||
8
node_modules/ejs/test/fixtures/error.out
generated
vendored
Normal file
8
node_modules/ejs/test/fixtures/error.out
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
ReferenceError: error.ejs:2
|
||||
1| <ul>
|
||||
>> 2| <% if (users) { %>
|
||||
3| <p>Has users</p>
|
||||
4| <% } %>
|
||||
5| </ul>
|
||||
|
||||
users is not defined
|
||||
1
node_modules/ejs/test/fixtures/fail.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/fail.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<% function foo() return 'foo'; %>
|
||||
1
node_modules/ejs/test/fixtures/hello-world.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/hello-world.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p>Hello world!</p>
|
||||
5
node_modules/ejs/test/fixtures/include-abspath.ejs
generated
vendored
Normal file
5
node_modules/ejs/test/fixtures/include-abspath.ejs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<ul>
|
||||
<@ pets.forEach(function(pet){ @>
|
||||
<@- include(path.join(dir, 'pet'), {pet: pet}); @>
|
||||
<@ }); @>
|
||||
</ul>
|
||||
3
node_modules/ejs/test/fixtures/include-simple.ejs
generated
vendored
Normal file
3
node_modules/ejs/test/fixtures/include-simple.ejs
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<ul>
|
||||
<%- include('hello-world'); %>
|
||||
</ul>
|
||||
4
node_modules/ejs/test/fixtures/include-simple.html
generated
vendored
Normal file
4
node_modules/ejs/test/fixtures/include-simple.html
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<ul>
|
||||
<p>Hello world!</p>
|
||||
|
||||
</ul>
|
||||
1
node_modules/ejs/test/fixtures/include.css.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/include.css.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<style><%- include('style.css', {value: 'bar'}); %></style>
|
||||
4
node_modules/ejs/test/fixtures/include.css.html
generated
vendored
Normal file
4
node_modules/ejs/test/fixtures/include.css.html
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<style>body {
|
||||
foo: 'bar';
|
||||
}
|
||||
</style>
|
||||
5
node_modules/ejs/test/fixtures/include.ejs
generated
vendored
Normal file
5
node_modules/ejs/test/fixtures/include.ejs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<ul>
|
||||
<@ pets.forEach(function(pet){ @>
|
||||
<@- include('pet', {pet: pet}); @>
|
||||
<@ }); @>
|
||||
</ul>
|
||||
12
node_modules/ejs/test/fixtures/include.html
generated
vendored
Normal file
12
node_modules/ejs/test/fixtures/include.html
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<ul>
|
||||
|
||||
<li>geddy</li>
|
||||
|
||||
|
||||
<li>neil</li>
|
||||
|
||||
|
||||
<li>alex</li>
|
||||
|
||||
|
||||
</ul>
|
||||
1
node_modules/ejs/test/fixtures/include_cache.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/include_cache.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<%- include('../tmp/include') %>
|
||||
1
node_modules/ejs/test/fixtures/include_cache.html
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/include_cache.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p>Old</p>
|
||||
1
node_modules/ejs/test/fixtures/include_preprocessor.css.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/include_preprocessor.css.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<style><% var value = 'bar' %><% include style.css %></style>
|
||||
4
node_modules/ejs/test/fixtures/include_preprocessor.css.html
generated
vendored
Normal file
4
node_modules/ejs/test/fixtures/include_preprocessor.css.html
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<style>body {
|
||||
foo: 'bar';
|
||||
}
|
||||
</style>
|
||||
5
node_modules/ejs/test/fixtures/include_preprocessor.ejs
generated
vendored
Normal file
5
node_modules/ejs/test/fixtures/include_preprocessor.ejs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<ul>
|
||||
<@ pets.forEach(function(pet){ @>
|
||||
<@ include pet @>
|
||||
<@ }) @>
|
||||
</ul>
|
||||
12
node_modules/ejs/test/fixtures/include_preprocessor.html
generated
vendored
Normal file
12
node_modules/ejs/test/fixtures/include_preprocessor.html
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<ul>
|
||||
|
||||
<li>geddy</li>
|
||||
|
||||
|
||||
<li>neil</li>
|
||||
|
||||
|
||||
<li>alex</li>
|
||||
|
||||
|
||||
</ul>
|
||||
1
node_modules/ejs/test/fixtures/include_preprocessor_cache.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/include_preprocessor_cache.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<%- include ../tmp/include_preprocessor %>
|
||||
1
node_modules/ejs/test/fixtures/include_preprocessor_cache.html
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/include_preprocessor_cache.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p>Old</p>
|
||||
1
node_modules/ejs/test/fixtures/includes/bom.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/includes/bom.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p>This is a file with BOM.</p>
|
||||
1
node_modules/ejs/test/fixtures/includes/menu-item.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/includes/menu-item.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<li><% include menu/item %></li>
|
||||
1
node_modules/ejs/test/fixtures/includes/menu/item.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/includes/menu/item.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<a href="/<%= url %>"><%= title %></a>
|
||||
3
node_modules/ejs/test/fixtures/literal.ejs
generated
vendored
Normal file
3
node_modules/ejs/test/fixtures/literal.ejs
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<pre>There should be a space followed by a less-than sign and then two more
|
||||
spaces in the next line:
|
||||
< .</pre>
|
||||
3
node_modules/ejs/test/fixtures/literal.html
generated
vendored
Normal file
3
node_modules/ejs/test/fixtures/literal.html
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<pre>There should be a space followed by a less-than sign and then two more
|
||||
spaces in the next line:
|
||||
< .</pre>
|
||||
15
node_modules/ejs/test/fixtures/menu.ejs
generated
vendored
Normal file
15
node_modules/ejs/test/fixtures/menu.ejs
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<%- include('includes/menu-item', {
|
||||
url: '/foo'
|
||||
, title: 'Foo'
|
||||
}); -%>
|
||||
|
||||
<%- include('includes/menu-item', {
|
||||
url: '/bar'
|
||||
, title: 'Bar'
|
||||
}); -%>
|
||||
|
||||
<%- include('includes/menu-item', {
|
||||
url: '/baz'
|
||||
, title: 'Baz'
|
||||
}); -%>
|
||||
|
||||
9
node_modules/ejs/test/fixtures/menu.html
generated
vendored
Normal file
9
node_modules/ejs/test/fixtures/menu.html
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<li><a href="//foo">Foo</a>
|
||||
</li>
|
||||
|
||||
<li><a href="//bar">Bar</a>
|
||||
</li>
|
||||
|
||||
<li><a href="//baz">Baz</a>
|
||||
</li>
|
||||
|
||||
11
node_modules/ejs/test/fixtures/menu_preprocessor.ejs
generated
vendored
Normal file
11
node_modules/ejs/test/fixtures/menu_preprocessor.ejs
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<% var url = '/foo' -%>
|
||||
<% var title = 'Foo' -%>
|
||||
<% include includes/menu-item -%>
|
||||
|
||||
<% var url = '/bar' -%>
|
||||
<% var title = 'Bar' -%>
|
||||
<% include includes/menu-item -%>
|
||||
|
||||
<% var url = '/baz' -%>
|
||||
<% var title = 'Baz' -%>
|
||||
<% include includes/menu-item -%>
|
||||
8
node_modules/ejs/test/fixtures/menu_preprocessor.html
generated
vendored
Normal file
8
node_modules/ejs/test/fixtures/menu_preprocessor.html
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<li><a href="//foo">Foo</a>
|
||||
</li>
|
||||
|
||||
<li><a href="//bar">Bar</a>
|
||||
</li>
|
||||
|
||||
<li><a href="//baz">Baz</a>
|
||||
</li>
|
||||
15
node_modules/ejs/test/fixtures/menu_var.ejs
generated
vendored
Normal file
15
node_modules/ejs/test/fixtures/menu_var.ejs
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<%- include(varPath, {
|
||||
url: '/foo'
|
||||
, title: 'Foo'
|
||||
}); -%>
|
||||
|
||||
<%- include(varPath, {
|
||||
url: '/bar'
|
||||
, title: 'Bar'
|
||||
}); -%>
|
||||
|
||||
<%- include(varPath, {
|
||||
url: '/baz'
|
||||
, title: 'Baz'
|
||||
}); -%>
|
||||
|
||||
1
node_modules/ejs/test/fixtures/messed.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/messed.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<ul><%users.forEach(function(user){%><li><%=user.name%></li><%})%></ul>
|
||||
1
node_modules/ejs/test/fixtures/messed.html
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/messed.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<ul><li>geddy</li><li>neil</li><li>alex</li></ul>
|
||||
5
node_modules/ejs/test/fixtures/newlines.ejs
generated
vendored
Normal file
5
node_modules/ejs/test/fixtures/newlines.ejs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<ul>
|
||||
<% users.forEach(function(user){ %>
|
||||
<li><%= user.name %></li>
|
||||
<% }) %>
|
||||
</ul>
|
||||
9
node_modules/ejs/test/fixtures/newlines.html
generated
vendored
Normal file
9
node_modules/ejs/test/fixtures/newlines.html
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<ul>
|
||||
|
||||
<li>geddy</li>
|
||||
|
||||
<li>neil</li>
|
||||
|
||||
<li>alex</li>
|
||||
|
||||
</ul>
|
||||
6
node_modules/ejs/test/fixtures/newlines.mixed.ejs
generated
vendored
Normal file
6
node_modules/ejs/test/fixtures/newlines.mixed.ejs
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<ul>
|
||||
<% var unused1 = 'blah' -%>
|
||||
<% var unused2 = 'bleh' %>
|
||||
<% var unused3 = 'bloh' -%>
|
||||
<% var unused4 = 'bluh' %>
|
||||
</ul>
|
||||
4
node_modules/ejs/test/fixtures/newlines.mixed.html
generated
vendored
Normal file
4
node_modules/ejs/test/fixtures/newlines.mixed.html
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<ul>
|
||||
|
||||
|
||||
</ul>
|
||||
5
node_modules/ejs/test/fixtures/no.newlines.ejs
generated
vendored
Normal file
5
node_modules/ejs/test/fixtures/no.newlines.ejs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<ul>
|
||||
<% users.forEach(function(user){ -%>
|
||||
<li><%= user.name %></li>
|
||||
<% }) -%>
|
||||
</ul>
|
||||
5
node_modules/ejs/test/fixtures/no.newlines.error.ejs
generated
vendored
Normal file
5
node_modules/ejs/test/fixtures/no.newlines.error.ejs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
AAA
|
||||
<% data = "test"; -%>
|
||||
BBB
|
||||
<%= qdata %>
|
||||
CCC
|
||||
5
node_modules/ejs/test/fixtures/no.newlines.html
generated
vendored
Normal file
5
node_modules/ejs/test/fixtures/no.newlines.html
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<ul>
|
||||
<li>geddy</li>
|
||||
<li>neil</li>
|
||||
<li>alex</li>
|
||||
</ul>
|
||||
8
node_modules/ejs/test/fixtures/no.semicolons.ejs
generated
vendored
Normal file
8
node_modules/ejs/test/fixtures/no.semicolons.ejs
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
This document does not use semicolons in scriptlets.
|
||||
<%
|
||||
var a = 'b'
|
||||
var b = 'c'
|
||||
var c
|
||||
c = b
|
||||
%>
|
||||
The value of c is: <%= c %>
|
||||
3
node_modules/ejs/test/fixtures/no.semicolons.html
generated
vendored
Normal file
3
node_modules/ejs/test/fixtures/no.semicolons.html
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
This document does not use semicolons in scriptlets.
|
||||
|
||||
The value of c is: c
|
||||
1
node_modules/ejs/test/fixtures/para.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/para.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p>hey</p>
|
||||
1
node_modules/ejs/test/fixtures/pet.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/pet.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<li><@= pet.name @></li>
|
||||
14
node_modules/ejs/test/fixtures/rmWhitespace.ejs
generated
vendored
Normal file
14
node_modules/ejs/test/fixtures/rmWhitespace.ejs
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<tag1>
|
||||
<tag2>
|
||||
A very long piece of text very long piece of text very long piece of
|
||||
text very long piece <% var f = 'f' %>of text very long piece of
|
||||
tex
|
||||
t very long piece of<% %>text very long
|
||||
adsffadsfadsfad<%= f %>
|
||||
|
||||
piece of text.
|
||||
<% var a = 'a' %>
|
||||
Text again.
|
||||
<% var b = 'b' %>
|
||||
<% var c = 'c'
|
||||
var d = 'd' %>
|
||||
8
node_modules/ejs/test/fixtures/rmWhitespace.html
generated
vendored
Normal file
8
node_modules/ejs/test/fixtures/rmWhitespace.html
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<tag1>
|
||||
<tag2>
|
||||
A very long piece of text very long piece of text very long piece of
|
||||
text very long piece of text very long piece of
|
||||
text very long piece oftext very long
|
||||
adsffadsfadsfadfpiece of text.
|
||||
Text again.
|
||||
Another text. c
|
||||
1
node_modules/ejs/test/fixtures/single-quote.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/single-quote.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p><%= 'loki' %>'s wheelchair</p>
|
||||
1
node_modules/ejs/test/fixtures/single-quote.html
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/single-quote.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p>loki's wheelchair</p>
|
||||
3
node_modules/ejs/test/fixtures/style.css
generated
vendored
Normal file
3
node_modules/ejs/test/fixtures/style.css
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
body {
|
||||
foo: '<%= value %>';
|
||||
}
|
||||
1
node_modules/ejs/test/fixtures/user-no-with.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/user-no-with.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<h1><$= locals.name $></h1>
|
||||
1
node_modules/ejs/test/fixtures/user.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/user.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<h1><$= name $></h1>
|
||||
1
node_modules/ejs/test/fixtures/with-context.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/fixtures/with-context.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<%= this.foo %>
|
||||
3
node_modules/ejs/test/mocha.opts
generated
vendored
Normal file
3
node_modules/ejs/test/mocha.opts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
--ui tdd
|
||||
--reporter spec
|
||||
--check-leaks
|
||||
1
node_modules/ejs/test/tmp/include.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/tmp/include.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p>New</p>
|
||||
1
node_modules/ejs/test/tmp/include_preprocessor.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/tmp/include_preprocessor.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p>New</p>
|
||||
1
node_modules/ejs/test/tmp/renderFile.ejs
generated
vendored
Normal file
1
node_modules/ejs/test/tmp/renderFile.ejs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<p>New</p>
|
||||
@@ -1,37 +0,0 @@
|
||||
0 info it worked if it ends with ok
|
||||
1 verbose cli [ 'C:\\Program Files (x86)\\nodejs\\\\node.exe',
|
||||
1 verbose cli 'C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
|
||||
1 verbose cli 'start' ]
|
||||
2 info using npm@2.11.2
|
||||
3 info using node@v0.12.5
|
||||
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
|
||||
5 info prestart myapp@0.0.0
|
||||
6 info start myapp@0.0.0
|
||||
7 verbose unsafe-perm in lifecycle true
|
||||
8 info myapp@0.0.0 Failed to exec start script
|
||||
9 verbose stack Error: myapp@0.0.0 start: `node ./bin/www`
|
||||
9 verbose stack Exit status 1
|
||||
9 verbose stack at EventEmitter.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\npm\lib\utils\lifecycle.js:213:16)
|
||||
9 verbose stack at EventEmitter.emit (events.js:110:17)
|
||||
9 verbose stack at ChildProcess.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
|
||||
9 verbose stack at ChildProcess.emit (events.js:110:17)
|
||||
9 verbose stack at maybeClose (child_process.js:1015:16)
|
||||
9 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
|
||||
10 verbose pkgid myapp@0.0.0
|
||||
11 verbose cwd C:\Users\Mitchell\Desktop\mywebsite
|
||||
12 error Windows_NT 6.1.7601
|
||||
13 error argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
|
||||
14 error node v0.12.5
|
||||
15 error npm v2.11.2
|
||||
16 error code ELIFECYCLE
|
||||
17 error myapp@0.0.0 start: `node ./bin/www`
|
||||
17 error Exit status 1
|
||||
18 error Failed at the myapp@0.0.0 start script 'node ./bin/www'.
|
||||
18 error This is most likely a problem with the myapp package,
|
||||
18 error not with npm itself.
|
||||
18 error Tell the author that this fails on your system:
|
||||
18 error node ./bin/www
|
||||
18 error You can get their info via:
|
||||
18 error npm owner ls myapp
|
||||
18 error There is likely additional logging output above.
|
||||
19 verbose exit [ 1, true ]
|
||||
@@ -5,12 +5,13 @@ $(document).ready(function(){
|
||||
$("#timeZone").val(offset);
|
||||
|
||||
console.log("offset - " + offset);
|
||||
|
||||
$(function() {
|
||||
$( "#dpicker" ).datepicker();
|
||||
});
|
||||
|
||||
$(function() {
|
||||
$( "#datepicker" ).datepicker();
|
||||
});
|
||||
|
||||
$(function() {
|
||||
$("#timepicker").timepicker();
|
||||
});
|
||||
|
||||
});
|
||||
5
public/jquery-1.11.3.min.js
vendored
Normal file
5
public/jquery-1.11.3.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
public/jquery-timepicker/.gitignore
vendored
4
public/jquery-timepicker/.gitignore
vendored
@@ -1,4 +0,0 @@
|
||||
.DS_store
|
||||
*.sw*
|
||||
node_modules
|
||||
.idea
|
||||
29
public/jquery-timepicker/GruntFile.js
vendored
29
public/jquery-timepicker/GruntFile.js
vendored
@@ -1,29 +0,0 @@
|
||||
module.exports = function(grunt) {
|
||||
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
meta: {
|
||||
banner : '/*!\n' +
|
||||
' * <%= pkg.title %> v<%= pkg.version %> - <%= pkg.description %>\n' +
|
||||
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> - <%= pkg.homepage %>\n' +
|
||||
' * License: <%= pkg.license %>\n' +
|
||||
' */\n\n'
|
||||
},
|
||||
uglify: {
|
||||
options : {
|
||||
banner : '<%= meta.banner %>',
|
||||
report: 'gzip'
|
||||
},
|
||||
dist: {
|
||||
files: {
|
||||
'jquery.timepicker.min.js': ['jquery.timepicker.js']
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
|
||||
grunt.registerTask('default', ['uglify']);
|
||||
|
||||
};
|
||||
@@ -1,279 +0,0 @@
|
||||
Timepicker Plugin for jQuery
|
||||
========================
|
||||
|
||||
[<img src="http://jonthornton.github.com/jquery-timepicker/lib/screenshot.png" alt="timepicker screenshot" />](http://jonthornton.github.com/jquery-timepicker)
|
||||
|
||||
[See a demo and examples here](http://jonthornton.github.com/jquery-timepicker)
|
||||
|
||||
jquery.timepicker is a lightweight timepicker plugin for jQuery inspired by Google Calendar. It supports both mouse and keyboard navigation, and weighs in at 2.7kb minified and gzipped.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
* [jQuery](http://jquery.com/) (>= 1.7)
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
```javascript
|
||||
$('.some-time-inputs').timepicker(options);
|
||||
```
|
||||
|
||||
Include `jquery.timepicker.css` and `jquery.timepicker.min.js` in your page.
|
||||
|
||||
```options``` is an optional javascript object with parameters explained below.
|
||||
|
||||
You can also set options as [data attributes](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes) on the intput elements, like ```<input type="text" data-time-format="H:i:s" />```. Timepicker still needs to be initialized by calling ```$('#someElement').timepicker();```.
|
||||
|
||||
The defaults for all options are exposed through the ```$.fn.timepicker.defaults``` object. Properties changed in this object (same properties configurable through the constructor) will take effect for every instance created after the change.
|
||||
|
||||
Options
|
||||
-------
|
||||
|
||||
- **appendTo**
|
||||
Override where the dropdown is appended.
|
||||
Takes either a `string` to use as a selector, a `function` that gets passed the clicked input element as argument or a jquery `object` to use directly.
|
||||
*default: "body"*
|
||||
|
||||
- **className**
|
||||
A class name to apply to the HTML element that contains the timepicker dropdown.
|
||||
*default: null*
|
||||
|
||||
- **closeOnWindowScroll**
|
||||
Close the timepicker when the window is scrolled. (Replicates ```<select>``` behavior.)
|
||||
*default: false*
|
||||
|
||||
- **disableTimeRanges**
|
||||
Disable selection of certain time ranges. Input is an array of time pairs, like ```[['3:00am', '4:30am'], ['5:00pm', '8:00pm']]``. The start of the interval will be disabled but the end won't.
|
||||
*default: []*
|
||||
|
||||
- **disableTextInput**
|
||||
Disable typing in the timepicker input box; for users to select from list.
|
||||
*default: false*
|
||||
|
||||
- **disableTouchKeyboard**
|
||||
Disable the onscreen keyboard for touch devices.
|
||||
*default: false*
|
||||
|
||||
- **durationTime**
|
||||
The time against which ```showDuration``` will compute relative times. If this is a function, its result will be used.
|
||||
*default: minTime*
|
||||
|
||||
- **forceRoundTime**
|
||||
Force update the time to ```step``` settings as soon as it loses focus.
|
||||
*default: false*
|
||||
|
||||
- **lang**
|
||||
Language constants used in the timepicker. Can override the defaults by passing an object with one or more of the following properties: decimal, mins, hr, hrs.
|
||||
*default:* ```{
|
||||
am: 'am',
|
||||
pm: 'pm',
|
||||
AM: 'AM',
|
||||
PM: 'PM',
|
||||
decimal: '.',
|
||||
mins: 'mins',
|
||||
hr: 'hr',
|
||||
hrs: 'hrs'
|
||||
}```
|
||||
|
||||
- **maxTime**
|
||||
The time that should appear last in the dropdown list. Can be used to limit the range of time options.
|
||||
*default: 24 hours after minTime*
|
||||
|
||||
- **minTime**
|
||||
The time that should appear first in the dropdown list.
|
||||
*default: 12:00am*
|
||||
|
||||
- **noneOption**
|
||||
Adds one or more custom options to the top of the dropdown. Can accept several different value types:
|
||||
Boolean (```true```): Adds a "None" option that results in an empty input value
|
||||
String: Adds an option with a custom label that results in an empty input value
|
||||
Object: Similar to string, but allows customizing the element's class name and the resulting input value. Can contain ```label```, ```value```, and ```className``` properties. ```value``` must be a string type.
|
||||
Array: An array of strings or objects to add multiple non-time options
|
||||
*default: false*
|
||||
|
||||
- **orientation**
|
||||
By default the timepicker dropdown will be aligned to the bottom right of the input element, or aligned to the top left if there isn't enough room below the input. Force alignment with `l` (left), `r` (right), `t` (top), and `b` (bottom). Examples: `tl`, `rb`.
|
||||
*default: 'l'*
|
||||
|
||||
- **roundingFunction**
|
||||
Function used to compute rounded times. The function will receive time in seconds and a settings object as arguments. The functino should handle a null value for seconds.
|
||||
*default: round to nearest step*
|
||||
|
||||
- **scrollDefault**
|
||||
If no time value is selected, set the dropdown scroll position to show the time provided, e.g. "09:00". A time string, Date object, or integer (seconds past midnight) is acceptible, as well as the string `'now'`.
|
||||
*default: null*
|
||||
|
||||
- **selectOnBlur**
|
||||
Update the input with the currently highlighted time value when the timepicker loses focus.
|
||||
*default: false*
|
||||
|
||||
- **show2400**
|
||||
Show "24:00" as an option when using 24-hour time format.
|
||||
*default: false*
|
||||
|
||||
- **showDuration**
|
||||
Shows the relative time for each item in the dropdown. ```minTime``` or ```durationTime``` must be set.
|
||||
*default: false*
|
||||
|
||||
- **showOn**
|
||||
Display a timepicker dropdown when the input fires a particular event. Set to false to disable automatic display.
|
||||
*default: 'focus'*
|
||||
|
||||
- **showOnFocus**
|
||||
Display a timepicker dropdown when the input gains focus.
|
||||
*default: true*
|
||||
|
||||
- **step**
|
||||
The amount of time, in minutes, between each item in the dropdown. Alternately, you can specify a function to generate steps dynamically. The function will receive a count integer (0, 1, 2...) and is expected to return a step integer.
|
||||
*default: 30*
|
||||
|
||||
- **stopScrollPropagation**
|
||||
When scrolling on the edge of the picker, it prevent parent containers (<body>) to scroll.
|
||||
*default: false*
|
||||
|
||||
- **timeFormat**
|
||||
How times should be displayed in the list and input element. Uses [PHP's date() formatting syntax](http://php.net/manual/en/function.date.php). Characters can be escaped with a preceeding double slash (e.g. `H\\hi`). Alternatively, you can specify a function instead of a string, to use completely custom time formatting. In this case, the format function receives a Date object and is expected to return a string.
|
||||
*default: 'g:ia'*
|
||||
|
||||
- **typeaheadHighlight**
|
||||
Highlight the nearest corresponding time option as a value is typed into the form input.
|
||||
*default: true*
|
||||
|
||||
- **useSelect**
|
||||
Convert the input to an HTML `<SELECT>` control. This is ideal for small screen devices, or if you want to prevent the user from entering arbitrary values. This option is not compatible with the following options: ```appendTo```, ```closeOnWindowScroll```, ```disableTouchKeyboard```, ```forceRoundTime```, ```scrollDefaultNow```, ```selectOnBlur```, ```typeAheadHighlight```.
|
||||
*default: false*
|
||||
|
||||
Methods
|
||||
-------
|
||||
|
||||
- **getSecondsFromMidnight**
|
||||
Get the time as an integer, expressed as seconds from 12am.
|
||||
|
||||
```javascript
|
||||
$('#getTimeExample').timepicker('getSecondsFromMidnight');
|
||||
```
|
||||
|
||||
- **getTime**
|
||||
Get the time using a Javascript Date object, relative to a Date object (default: today).
|
||||
|
||||
```javascript
|
||||
$('#getTimeExample').timepicker('getTime');
|
||||
$('#getTimeExample').timepicker('getTime', new Date());
|
||||
```
|
||||
|
||||
You can get the time as a string using jQuery's built-in ```val()``` function:
|
||||
|
||||
```javascript
|
||||
$('#getTimeExample').val();
|
||||
```
|
||||
|
||||
- **hide**
|
||||
Close the timepicker dropdown.
|
||||
|
||||
```javascript
|
||||
$('#hideExample').timepicker('hide');
|
||||
```
|
||||
|
||||
- **option**
|
||||
Change the settings of an existing timepicker. Calling ```option``` on a visible timepicker will cause the picker to be hidden.
|
||||
|
||||
```javascript
|
||||
$('#optionExample').timepicker({ 'timeFormat': 'g:ia' }); // initialize the timepicker sometime earlier in your code
|
||||
...
|
||||
$('#optionExample').timepicker('option', 'minTime', '2:00am');
|
||||
$('#optionExample').timepicker('option', { 'minTime': '4:00am', 'timeFormat': 'H:i' });
|
||||
```
|
||||
|
||||
- **remove**
|
||||
Unbind an existing timepicker element.
|
||||
|
||||
```javascript
|
||||
$('#removeExample').timepicker('remove');
|
||||
```
|
||||
|
||||
- **setTime**
|
||||
Set the time using a Javascript Date object.
|
||||
|
||||
```javascript
|
||||
$('#setTimeExample').timepicker('setTime', new Date());
|
||||
```
|
||||
|
||||
- **show**
|
||||
Display the timepicker dropdown.
|
||||
|
||||
```javascript
|
||||
$('#showExample').timepicker('show');
|
||||
```
|
||||
|
||||
Events
|
||||
------
|
||||
|
||||
- **change**
|
||||
The native ```onChange``` event will fire any time the input value is updated, whether by selection from the timepicker list or manual entry into the text input. Your code should bind to ```change``` after initializing timepicker, or use [event delegation](http://api.jquery.com/on/).
|
||||
|
||||
- **changeTime**
|
||||
Called after a valid time value is entered or selected. See ```timeFormatError``` and ```timeRangeError``` for error events. Fires before ```change``` event.
|
||||
|
||||
- **hideTimepicker**
|
||||
Called after the timepicker is closed.
|
||||
|
||||
- **selectTime**
|
||||
Called after a time value is selected from the timepicker list. Fires before ```change``` event.
|
||||
|
||||
- **showTimepicker**
|
||||
Called after the timepicker is shown.
|
||||
|
||||
- **timeFormatError**
|
||||
Called if an unparseable time string is manually entered into the timepicker input. Fires before ```change``` event.
|
||||
|
||||
- **timeRangeError**
|
||||
Called if a maxTime, minTime, or disableTimeRanges is set and an invalid time is manually entered into the timepicker input. Fires before ```change``` event.
|
||||
|
||||
Theming
|
||||
-------
|
||||
|
||||
Sample markup with class names:
|
||||
|
||||
```html
|
||||
<input value="5:00pm" class="ui-timepicker-input" type="text">
|
||||
...
|
||||
<div class="ui-timepicker-wrapper ui-timepicker-positioned-top optional-custom-classname" tabindex="-1">
|
||||
<ul class="ui-timepicker-list">
|
||||
<li>12:00am</li>
|
||||
<li>12:30am</li>
|
||||
...
|
||||
<li>4:30pm</li>
|
||||
<li class="ui-timepicker-selected">5:00pm</li>
|
||||
<li class="ui-timepicker-disabled">5:30pm</li>
|
||||
<li>6:00pm <span class="ui-timepicker-duration">(1 hour)</span></li>
|
||||
<li>6:30pm</li>
|
||||
...
|
||||
<li>11:30pm</li>
|
||||
</ul>
|
||||
</div>
|
||||
```
|
||||
|
||||
The `ui-timepicker-positioned-top` class will be applied only when the dropdown is positioned above the input.
|
||||
|
||||
## Packaging
|
||||
|
||||
Install from [Bower](http://bower.io/) as ```jquery-timepicker-jt```.
|
||||
|
||||
An AngularJS directive is available at https://github.com/Recras/angular-jquery-timepicker
|
||||
|
||||
Available via CDN at [https://cdnjs.com/libraries/jquery-timepicker](https://cdnjs.com/libraries/jquery-timepicker).
|
||||
|
||||
Help
|
||||
----
|
||||
|
||||
Submit a [GitHub Issues request](https://github.com/jonthornton/jquery-timepicker/issues/new). Please try provide code that demonstrates the problem; you can use [this jsFiddle](http://jsfiddle.net/jonthornton/28uvg/) as a starting point.
|
||||
|
||||
Development guidelines
|
||||
----------------------
|
||||
|
||||
1. Install dependencies (jquery + grunt) `npm install`
|
||||
2. For sanity checks and minification run `grunt`, or just `grunt lint` to have the code linted
|
||||
|
||||
- - -
|
||||
|
||||
This software is made available under the open source MIT License. © 2014 [Jon Thornton](http://www.jonthornton.com) and [contributors](https://github.com/jonthornton/jquery-timepicker/graphs/contributors)
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"name" : "jt.timepicker",
|
||||
"version" : "1.8.0",
|
||||
"description" : "A jQuery timepicker plugin inspired by Google Calendar.",
|
||||
"homepage" : "http://jonthornton.github.com/jquery-timepicker",
|
||||
"main" : [ "./jquery.timepicker.js", "./jquery.timepicker.css" ],
|
||||
"dependencies" : {
|
||||
"jquery" : ">= 1.7"
|
||||
},
|
||||
"keywords" : [ "time", "picker", "google calendar" ],
|
||||
"author" : {
|
||||
"name" : "Jon Thornton",
|
||||
"web" : "https://github.com/jonthornton"
|
||||
},
|
||||
"license": "http://opensource.org/licenses/MIT"
|
||||
}
|
||||
@@ -1,392 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
|
||||
<title>Timepicker for jQuery – Demos and Documentation</title>
|
||||
<meta name="description" content="A lightweight, customizable jQuery timepicker plugin inspired by Google Calendar. Add a user-friendly javascript timepicker dropdown to your app in minutes." />
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
|
||||
<script type="text/javascript" src="jquery.timepicker.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="jquery.timepicker.css" />
|
||||
|
||||
<script type="text/javascript" src="lib/bootstrap-datepicker.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="lib/bootstrap-datepicker.css" />
|
||||
|
||||
<script type="text/javascript" src="lib/site.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="lib/site.css" />
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
|
||||
<h1><a href="https://github.com/jonthornton/jquery-timepicker">jquery.timepicker</a></h1>
|
||||
<p class="body-text">
|
||||
A lightweight, customizable javascript timepicker plugin for jQuery inspired by Google Calendar.
|
||||
</p>
|
||||
|
||||
<ul id="header-links">
|
||||
<li><a href="https://github.com/jonthornton/jquery-timepicker#timepicker-plugin-for-jquery">Documentation</a></li>
|
||||
<li><a href="https://github.com/jonthornton/jquery-timepicker">Source code on GitHub</a></li>
|
||||
<li><a href="https://github.com/jonthornton/jquery-timepicker/zipball/master">Download (zip)</a></li>
|
||||
<li><a href="https://github.com/jonthornton/jquery-timepicker/issues?state=open">Help</a></li>
|
||||
</ul>
|
||||
</header>
|
||||
|
||||
<section>
|
||||
<p class="body-text">Use this plugin to unobtrusively add a timepicker dropdown to your forms. It's lightweight (2.7kb minified and gzipped) and easy to customize.</p>
|
||||
</section>
|
||||
|
||||
<section id="examples">
|
||||
<article>
|
||||
<div class="demo">
|
||||
<h2>Basic Example</h2>
|
||||
<p><input id="basicExample" type="text" class="time" data-scroll-default="6:00am" /></p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('#basicExample').timepicker();
|
||||
});
|
||||
</script>
|
||||
|
||||
<pre class="code" data-language="javascript">$('#basicExample').timepicker();</pre>
|
||||
</article>
|
||||
|
||||
|
||||
<article>
|
||||
<div class="demo">
|
||||
<h2>Scroll Default Example</h2>
|
||||
<p>Set the scroll position to local time if no value selected.</p>
|
||||
<p><input id="scrollDefaultExample" type="text" class="time" /></p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('#scrollDefaultExample').timepicker({ 'scrollDefault': 'now' });
|
||||
});
|
||||
</script>
|
||||
|
||||
<pre class="code" data-language="javascript">$('#scrollDefaultExample').timepicker({ 'scrollDefault': 'now' });</pre>
|
||||
</article>
|
||||
|
||||
<article>
|
||||
<div class="demo">
|
||||
<h2>Set Time Example</h2>
|
||||
<p>Dynamically set the time using a Javascript Date object.</p>
|
||||
<p>
|
||||
<input id="setTimeExample" type="text" class="time" />
|
||||
<button id="setTimeButton">Set current time</button>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('#setTimeExample').timepicker();
|
||||
$('#setTimeButton').on('click', function (){
|
||||
$('#setTimeExample').timepicker('setTime', new Date());
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<pre class="code" data-language="javascript">$('#setTimeExample').timepicker();
|
||||
$('#setTimeButton').on('click', function (){
|
||||
$('#setTimeExample').timepicker('setTime', new Date());
|
||||
});</pre>
|
||||
</article>
|
||||
|
||||
<article>
|
||||
<div class="demo">
|
||||
<h2>Duration Example</h2>
|
||||
<p>Set a starting time and see duration from that starting time. You can optionally set an maxTime as well.</p>
|
||||
<p><input id="durationExample" type="text" class="time" /></p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('#durationExample').timepicker({
|
||||
'minTime': '2:00pm',
|
||||
'maxTime': '11:30pm',
|
||||
'showDuration': true
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<pre class="code" data-language="javascript">$('#durationExample').timepicker({
|
||||
'minTime': '2:00pm',
|
||||
'maxTime': '11:30pm',
|
||||
'showDuration': true
|
||||
});</pre>
|
||||
</article>
|
||||
|
||||
<article>
|
||||
<div class="demo">
|
||||
<h2>Event Example</h2>
|
||||
<p>Trigger an event after selecting a value. Fires before the input onchange event.</p>
|
||||
<p>
|
||||
<input id="onselectExample" type="text" class="time" />
|
||||
<span id="onselectTarget" style="margin-left: 30px;"></span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('#onselectExample').timepicker();
|
||||
$('#onselectExample').on('changeTime', function() {
|
||||
$('#onselectTarget').text($(this).val());
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<pre class="code" data-language="javascript">$('#onselectExample').timepicker();
|
||||
$('#onselectExample').on('changeTime', function() {
|
||||
$('#onselectTarget').text($(this).val());
|
||||
});</pre>
|
||||
</article>
|
||||
|
||||
<article>
|
||||
<div class="demo">
|
||||
<h2>DisableTimeRanges Example</h2>
|
||||
<p>Prevent selection of certain time values.</p>
|
||||
<p><input id="disableTimeRangesExample" type="text" class="time" /></p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('#disableTimeRangesExample').timepicker({ 'disableTimeRanges': [['1am', '2am'], ['3am', '4:01am']] });
|
||||
});
|
||||
</script>
|
||||
|
||||
<pre class="code" data-language="javascript">$('#disableTimeRangesExample').timepicker({
|
||||
'disableTimeRanges': [
|
||||
['1am', '2am'],
|
||||
['3am', '4:01am']
|
||||
]
|
||||
});</pre>
|
||||
</article>
|
||||
|
||||
<article>
|
||||
<div class="demo">
|
||||
<h2>noneOption Example</h2>
|
||||
<p>Custom options can be added to the dropdown menu.</p>
|
||||
<p><input id="noneOptionExample" type="text" class="time" /></p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('#noneOptionExample').timepicker({
|
||||
'noneOption': [
|
||||
{
|
||||
'label': 'Foobar',
|
||||
'className': 'shibby',
|
||||
'value': '42'
|
||||
},
|
||||
'Foobar2'
|
||||
]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<pre class="code" data-language="javascript">
|
||||
$('#noneOptionExample').timepicker({
|
||||
'noneOption': [
|
||||
{
|
||||
'label': 'Foobar',
|
||||
'className': 'shibby',
|
||||
'value': '42'
|
||||
},
|
||||
'Foobar2'
|
||||
]
|
||||
});
|
||||
</pre>
|
||||
</article>
|
||||
|
||||
<article>
|
||||
<div class="demo">
|
||||
<h2>timeFormat Example</h2>
|
||||
<p>timepicker.jquery uses the time portion of <a href="http://php.net/manual/en/function.date.php">PHP's date formatting commands</a>.</p>
|
||||
<p><input id="timeformatExample1" type="text" class="time" /> <input id="timeformatExample2" type="text" class="time" /></p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('#timeformatExample1').timepicker({ 'timeFormat': 'H:i:s' });
|
||||
$('#timeformatExample2').timepicker({ 'timeFormat': 'h:i A' });
|
||||
});
|
||||
</script>
|
||||
|
||||
<pre class="code" data-language="javascript">$('#timeformatExample1').timepicker({ 'timeFormat': 'H:i:s' });
|
||||
$('#timeformatExample2').timepicker({ 'timeFormat': 'h:i A' });</pre>
|
||||
</article>
|
||||
|
||||
<article>
|
||||
<div class="demo">
|
||||
<h2>Step Example</h2>
|
||||
<p>Generate drop-down options with varying levels of precision.</p>
|
||||
<p><input id="stepExample1" type="text" class="time" /> <input id="stepExample2" type="text" class="time" /></p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('#stepExample1').timepicker({ 'step': 15 });
|
||||
$('#stepExample2').timepicker({
|
||||
'step': function(i) {
|
||||
return (i%2) ? 15 : 45;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<pre class="code" data-language="javascript">$('#stepExample1').timepicker({ 'step': 15 });
|
||||
$('#stepExample2').timepicker({
|
||||
'step': function(i) {
|
||||
return (i%2) ? 15 : 45;
|
||||
}
|
||||
});</pre>
|
||||
</article>
|
||||
|
||||
<article>
|
||||
<div class="demo">
|
||||
<h2>forceRoundTime Example</h2>
|
||||
<p>jquery-timepicker allows entering times via the keyboard. Setting forceRoundTime to true will
|
||||
round the entered time to the nearest option on the dropdown list.</p>
|
||||
<p><input id="roundTimeExample" type="text" class="time" /> </p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('#roundTimeExample').timepicker({ 'forceRoundTime': true });
|
||||
});
|
||||
</script>
|
||||
|
||||
<pre class="code" data-language="javascript">$('#roundTimeExample').timepicker({ 'forceRoundTime': true });</pre>
|
||||
</article>
|
||||
|
||||
<article>
|
||||
<div class="demo">
|
||||
<h2>Select Example</h2>
|
||||
<p>jquery-timepicker can render itself as a select element too.</p>
|
||||
<p><input id="selectExample" class="time" /> <button id="selectButton">Toggle</button></p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('#selectExample').timepicker();
|
||||
$('#selectButton').click(function(e) {
|
||||
$('#selectExample').timepicker('option', { useSelect: true });
|
||||
$(this).hide();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<pre class="code" data-language="javascript">$('#selectExample').timepicker();
|
||||
$('#selectButton').click(function(e) {
|
||||
$('#selectExample').timepicker('option', { useSelect: true });
|
||||
$(this).hide();
|
||||
});</pre>
|
||||
</article>
|
||||
|
||||
<article>
|
||||
<div class="demo">
|
||||
<h2>Non-input Example</h2>
|
||||
<p>jquery-timepicker can be bound to any visibile DOM element, such as spans or divs.</p>
|
||||
<p><span id="spanExample" style="background:#f00; padding:0 10px; margin-right:100px;"></span> <button id="openSpanExample">Pick Time</button> </p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('#spanExample').timepicker();
|
||||
$('#openSpanExample').on('click', function(){
|
||||
$('#spanExample').timepicker('show');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<pre class="code" data-language="javascript">$('#spanExample').timepicker();
|
||||
$('#openSpanExample').on('click', function(){
|
||||
$('#spanExample').timepicker('show');
|
||||
});</pre>
|
||||
</article>
|
||||
|
||||
<article>
|
||||
<div class="demo">
|
||||
<h2>Datepair Plugin Example</h2>
|
||||
|
||||
<p>jquery-timepicker is designed to work with the <a href="http://jonthornton.github.com/Datepair.js">jquery-datepair plugin</a>.
|
||||
|
||||
<p id="datepairExample">
|
||||
<input type="text" class="date start" />
|
||||
<input type="text" class="time start" /> to
|
||||
<input type="text" class="time end" />
|
||||
<input type="text" class="date end" />
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<script src="http://jonthornton.github.io/Datepair.js/dist/datepair.js"></script>
|
||||
<script src="http://jonthornton.github.io/Datepair.js/dist/jquery.datepair.js"></script>
|
||||
<script>
|
||||
$('#datepairExample .time').timepicker({
|
||||
'showDuration': true,
|
||||
'timeFormat': 'g:ia'
|
||||
});
|
||||
|
||||
$('#datepairExample .date').datepicker({
|
||||
'format': 'm/d/yyyy',
|
||||
'autoclose': true
|
||||
});
|
||||
|
||||
$('#datepairExample').datepair();
|
||||
</script>
|
||||
|
||||
<pre class="code" data-language="javascript">
|
||||
<p id="datepairExample">
|
||||
<input type="text" class="date start" />
|
||||
<input type="text" class="time start" /> to
|
||||
<input type="text" class="time end" />
|
||||
<input type="text" class="date end" />
|
||||
</p>
|
||||
|
||||
<script type="text/javascript" src="datepair.js"></script>
|
||||
<script type="text/javascript" src="jquery.datepair.js"></script>
|
||||
<script>
|
||||
// initialize input widgets first
|
||||
$('#datepairExample .time').timepicker({
|
||||
'showDuration': true,
|
||||
'timeFormat': 'g:ia'
|
||||
});
|
||||
|
||||
$('#datepairExample .date').datepicker({
|
||||
'format': 'yyyy-m-d',
|
||||
'autoclose': true
|
||||
});
|
||||
|
||||
// initialize datepair
|
||||
$('#datepairExample').datepair();
|
||||
</script></pre>
|
||||
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Need Help?</h2>
|
||||
<p>Check <a href="https://github.com/jonthornton/jquery-timepicker#timepicker-plugin-for-jquery">the documentation</a> or <a href="https://github.com/jonthornton/jquery-timepicker/issues?state=open">submit an issue</a> on GitHub.</p>
|
||||
</section>
|
||||
|
||||
<footer>
|
||||
<p>© 2014 <a href="http://jonthornton.com">Jon Thornton</a></p>
|
||||
</footer>
|
||||
|
||||
<script type="text/javascript">
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-15605525-1']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
</script>
|
||||
</div></body>
|
||||
</html>
|
||||
@@ -1,72 +0,0 @@
|
||||
.ui-timepicker-wrapper {
|
||||
overflow-y: auto;
|
||||
height: 150px;
|
||||
width: 6.5em;
|
||||
background: #fff;
|
||||
border: 1px solid #ddd;
|
||||
-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);
|
||||
-moz-box-shadow:0 5px 10px rgba(0,0,0,0.2);
|
||||
box-shadow:0 5px 10px rgba(0,0,0,0.2);
|
||||
outline: none;
|
||||
z-index: 10001;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.ui-timepicker-wrapper.ui-timepicker-with-duration {
|
||||
width: 13em;
|
||||
}
|
||||
|
||||
.ui-timepicker-wrapper.ui-timepicker-with-duration.ui-timepicker-step-30,
|
||||
.ui-timepicker-wrapper.ui-timepicker-with-duration.ui-timepicker-step-60 {
|
||||
width: 11em;
|
||||
}
|
||||
|
||||
.ui-timepicker-list {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.ui-timepicker-duration {
|
||||
margin-left: 5px; color: #888;
|
||||
}
|
||||
|
||||
.ui-timepicker-list:hover .ui-timepicker-duration {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.ui-timepicker-list li {
|
||||
padding: 3px 0 3px 5px;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
color: #000;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.ui-timepicker-list:hover .ui-timepicker-selected {
|
||||
background: #fff; color: #000;
|
||||
}
|
||||
|
||||
li.ui-timepicker-selected,
|
||||
.ui-timepicker-list li:hover,
|
||||
.ui-timepicker-list .ui-timepicker-selected:hover {
|
||||
background: #1980EC; color: #fff;
|
||||
}
|
||||
|
||||
li.ui-timepicker-selected .ui-timepicker-duration,
|
||||
.ui-timepicker-list li:hover .ui-timepicker-duration {
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.ui-timepicker-list li.ui-timepicker-disabled,
|
||||
.ui-timepicker-list li.ui-timepicker-disabled:hover,
|
||||
.ui-timepicker-list li.ui-timepicker-selected.ui-timepicker-disabled {
|
||||
color: #888;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.ui-timepicker-list li.ui-timepicker-disabled:hover,
|
||||
.ui-timepicker-list li.ui-timepicker-selected.ui-timepicker-disabled {
|
||||
background: #f2f2f2;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -1,27 +0,0 @@
|
||||
{
|
||||
"name": "jt.timepicker",
|
||||
"version": "1.6.0",
|
||||
"title": "jquery-timepicker",
|
||||
"description": "A jQuery timepicker plugin inspired by Google Calendar. It supports both mouse and keyboard navigation.",
|
||||
"author": {
|
||||
"name": "Jon Thornton",
|
||||
"email": "thornton.jon@gmail.com",
|
||||
"url": "https://github.com/jonthornton"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "MIT-LICENSE.txt"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"jquery": ">=1.7"
|
||||
},
|
||||
"keywords": [ "timepicker", "time", "picker", "ui", "calendar", "input", "form" ],
|
||||
"homepage": "http://jonthornton.github.com/jquery-timepicker/",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonthornton/jquery-timepicker/issues"
|
||||
},
|
||||
"docs": "https://github.com/jonthornton/jquery-timepicker",
|
||||
"download": "https://github.com/jonthornton/jquery-timepicker"
|
||||
}
|
||||
@@ -1,512 +0,0 @@
|
||||
/*!
|
||||
* Datepicker for Bootstrap
|
||||
*
|
||||
* Copyright 2012 Stefan Petre
|
||||
* Improvements by Andrew Rowls
|
||||
* Licensed under the Apache License v2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*/
|
||||
.datepicker {
|
||||
padding: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
direction: ltr;
|
||||
/*.dow {
|
||||
border-top: 1px solid #ddd !important;
|
||||
}*/
|
||||
}
|
||||
.datepicker-inline {
|
||||
width: 220px;
|
||||
}
|
||||
.datepicker.datepicker-rtl {
|
||||
direction: rtl;
|
||||
}
|
||||
.datepicker.datepicker-rtl table tr td span {
|
||||
float: right;
|
||||
}
|
||||
.datepicker-dropdown {
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
.datepicker-dropdown:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
border-left: 7px solid transparent;
|
||||
border-right: 7px solid transparent;
|
||||
border-bottom: 7px solid #ccc;
|
||||
border-top: 0;
|
||||
border-bottom-color: rgba(0, 0, 0, 0.2);
|
||||
position: absolute;
|
||||
}
|
||||
.datepicker-dropdown:after {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
border-left: 6px solid transparent;
|
||||
border-right: 6px solid transparent;
|
||||
border-bottom: 6px solid #ffffff;
|
||||
border-top: 0;
|
||||
position: absolute;
|
||||
}
|
||||
.datepicker-dropdown.datepicker-orient-left:before {
|
||||
left: 6px;
|
||||
}
|
||||
.datepicker-dropdown.datepicker-orient-left:after {
|
||||
left: 7px;
|
||||
}
|
||||
.datepicker-dropdown.datepicker-orient-right:before {
|
||||
right: 6px;
|
||||
}
|
||||
.datepicker-dropdown.datepicker-orient-right:after {
|
||||
right: 7px;
|
||||
}
|
||||
.datepicker-dropdown.datepicker-orient-top:before {
|
||||
top: -7px;
|
||||
}
|
||||
.datepicker-dropdown.datepicker-orient-top:after {
|
||||
top: -6px;
|
||||
}
|
||||
.datepicker-dropdown.datepicker-orient-bottom:before {
|
||||
bottom: -7px;
|
||||
border-bottom: 0;
|
||||
border-top: 7px solid #999;
|
||||
}
|
||||
.datepicker-dropdown.datepicker-orient-bottom:after {
|
||||
bottom: -6px;
|
||||
border-bottom: 0;
|
||||
border-top: 6px solid #ffffff;
|
||||
}
|
||||
.datepicker > div {
|
||||
display: none;
|
||||
}
|
||||
.datepicker.days div.datepicker-days {
|
||||
display: block;
|
||||
}
|
||||
.datepicker.months div.datepicker-months {
|
||||
display: block;
|
||||
}
|
||||
.datepicker.years div.datepicker-years {
|
||||
display: block;
|
||||
}
|
||||
.datepicker table {
|
||||
margin: 0;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
.datepicker td,
|
||||
.datepicker th {
|
||||
text-align: center;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
border: none;
|
||||
}
|
||||
.table-striped .datepicker table tr td,
|
||||
.table-striped .datepicker table tr th {
|
||||
background-color: transparent;
|
||||
}
|
||||
.datepicker table tr td.day:hover,
|
||||
.datepicker table tr td.day.focused {
|
||||
background: #eeeeee;
|
||||
cursor: pointer;
|
||||
}
|
||||
.datepicker table tr td.old,
|
||||
.datepicker table tr td.new {
|
||||
color: #999999;
|
||||
}
|
||||
.datepicker table tr td.disabled,
|
||||
.datepicker table tr td.disabled:hover {
|
||||
background: none;
|
||||
color: #999999;
|
||||
cursor: default;
|
||||
}
|
||||
.datepicker table tr td.today,
|
||||
.datepicker table tr td.today:hover,
|
||||
.datepicker table tr td.today.disabled,
|
||||
.datepicker table tr td.today.disabled:hover {
|
||||
background-color: #fde19a;
|
||||
background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a));
|
||||
background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-image: -o-linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-image: linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0);
|
||||
border-color: #fdf59a #fdf59a #fbed50;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
color: #000;
|
||||
}
|
||||
.datepicker table tr td.today:hover,
|
||||
.datepicker table tr td.today:hover:hover,
|
||||
.datepicker table tr td.today.disabled:hover,
|
||||
.datepicker table tr td.today.disabled:hover:hover,
|
||||
.datepicker table tr td.today:active,
|
||||
.datepicker table tr td.today:hover:active,
|
||||
.datepicker table tr td.today.disabled:active,
|
||||
.datepicker table tr td.today.disabled:hover:active,
|
||||
.datepicker table tr td.today.active,
|
||||
.datepicker table tr td.today:hover.active,
|
||||
.datepicker table tr td.today.disabled.active,
|
||||
.datepicker table tr td.today.disabled:hover.active,
|
||||
.datepicker table tr td.today.disabled,
|
||||
.datepicker table tr td.today:hover.disabled,
|
||||
.datepicker table tr td.today.disabled.disabled,
|
||||
.datepicker table tr td.today.disabled:hover.disabled,
|
||||
.datepicker table tr td.today[disabled],
|
||||
.datepicker table tr td.today:hover[disabled],
|
||||
.datepicker table tr td.today.disabled[disabled],
|
||||
.datepicker table tr td.today.disabled:hover[disabled] {
|
||||
background-color: #fdf59a;
|
||||
}
|
||||
.datepicker table tr td.today:active,
|
||||
.datepicker table tr td.today:hover:active,
|
||||
.datepicker table tr td.today.disabled:active,
|
||||
.datepicker table tr td.today.disabled:hover:active,
|
||||
.datepicker table tr td.today.active,
|
||||
.datepicker table tr td.today:hover.active,
|
||||
.datepicker table tr td.today.disabled.active,
|
||||
.datepicker table tr td.today.disabled:hover.active {
|
||||
background-color: #fbf069 \9;
|
||||
}
|
||||
.datepicker table tr td.today:hover:hover {
|
||||
color: #000;
|
||||
}
|
||||
.datepicker table tr td.today.active:hover {
|
||||
color: #fff;
|
||||
}
|
||||
.datepicker table tr td.range,
|
||||
.datepicker table tr td.range:hover,
|
||||
.datepicker table tr td.range.disabled,
|
||||
.datepicker table tr td.range.disabled:hover {
|
||||
background: #eeeeee;
|
||||
-webkit-border-radius: 0;
|
||||
-moz-border-radius: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
.datepicker table tr td.range.today,
|
||||
.datepicker table tr td.range.today:hover,
|
||||
.datepicker table tr td.range.today.disabled,
|
||||
.datepicker table tr td.range.today.disabled:hover {
|
||||
background-color: #f3d17a;
|
||||
background-image: -moz-linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-image: -ms-linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f3c17a), to(#f3e97a));
|
||||
background-image: -webkit-linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-image: -o-linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-image: linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f3c17a', endColorstr='#f3e97a', GradientType=0);
|
||||
border-color: #f3e97a #f3e97a #edde34;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
-webkit-border-radius: 0;
|
||||
-moz-border-radius: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
.datepicker table tr td.range.today:hover,
|
||||
.datepicker table tr td.range.today:hover:hover,
|
||||
.datepicker table tr td.range.today.disabled:hover,
|
||||
.datepicker table tr td.range.today.disabled:hover:hover,
|
||||
.datepicker table tr td.range.today:active,
|
||||
.datepicker table tr td.range.today:hover:active,
|
||||
.datepicker table tr td.range.today.disabled:active,
|
||||
.datepicker table tr td.range.today.disabled:hover:active,
|
||||
.datepicker table tr td.range.today.active,
|
||||
.datepicker table tr td.range.today:hover.active,
|
||||
.datepicker table tr td.range.today.disabled.active,
|
||||
.datepicker table tr td.range.today.disabled:hover.active,
|
||||
.datepicker table tr td.range.today.disabled,
|
||||
.datepicker table tr td.range.today:hover.disabled,
|
||||
.datepicker table tr td.range.today.disabled.disabled,
|
||||
.datepicker table tr td.range.today.disabled:hover.disabled,
|
||||
.datepicker table tr td.range.today[disabled],
|
||||
.datepicker table tr td.range.today:hover[disabled],
|
||||
.datepicker table tr td.range.today.disabled[disabled],
|
||||
.datepicker table tr td.range.today.disabled:hover[disabled] {
|
||||
background-color: #f3e97a;
|
||||
}
|
||||
.datepicker table tr td.range.today:active,
|
||||
.datepicker table tr td.range.today:hover:active,
|
||||
.datepicker table tr td.range.today.disabled:active,
|
||||
.datepicker table tr td.range.today.disabled:hover:active,
|
||||
.datepicker table tr td.range.today.active,
|
||||
.datepicker table tr td.range.today:hover.active,
|
||||
.datepicker table tr td.range.today.disabled.active,
|
||||
.datepicker table tr td.range.today.disabled:hover.active {
|
||||
background-color: #efe24b \9;
|
||||
}
|
||||
.datepicker table tr td.selected,
|
||||
.datepicker table tr td.selected:hover,
|
||||
.datepicker table tr td.selected.disabled,
|
||||
.datepicker table tr td.selected.disabled:hover {
|
||||
background-color: #9e9e9e;
|
||||
background-image: -moz-linear-gradient(top, #b3b3b3, #808080);
|
||||
background-image: -ms-linear-gradient(top, #b3b3b3, #808080);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#b3b3b3), to(#808080));
|
||||
background-image: -webkit-linear-gradient(top, #b3b3b3, #808080);
|
||||
background-image: -o-linear-gradient(top, #b3b3b3, #808080);
|
||||
background-image: linear-gradient(top, #b3b3b3, #808080);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#b3b3b3', endColorstr='#808080', GradientType=0);
|
||||
border-color: #808080 #808080 #595959;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
color: #fff;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.datepicker table tr td.selected:hover,
|
||||
.datepicker table tr td.selected:hover:hover,
|
||||
.datepicker table tr td.selected.disabled:hover,
|
||||
.datepicker table tr td.selected.disabled:hover:hover,
|
||||
.datepicker table tr td.selected:active,
|
||||
.datepicker table tr td.selected:hover:active,
|
||||
.datepicker table tr td.selected.disabled:active,
|
||||
.datepicker table tr td.selected.disabled:hover:active,
|
||||
.datepicker table tr td.selected.active,
|
||||
.datepicker table tr td.selected:hover.active,
|
||||
.datepicker table tr td.selected.disabled.active,
|
||||
.datepicker table tr td.selected.disabled:hover.active,
|
||||
.datepicker table tr td.selected.disabled,
|
||||
.datepicker table tr td.selected:hover.disabled,
|
||||
.datepicker table tr td.selected.disabled.disabled,
|
||||
.datepicker table tr td.selected.disabled:hover.disabled,
|
||||
.datepicker table tr td.selected[disabled],
|
||||
.datepicker table tr td.selected:hover[disabled],
|
||||
.datepicker table tr td.selected.disabled[disabled],
|
||||
.datepicker table tr td.selected.disabled:hover[disabled] {
|
||||
background-color: #808080;
|
||||
}
|
||||
.datepicker table tr td.selected:active,
|
||||
.datepicker table tr td.selected:hover:active,
|
||||
.datepicker table tr td.selected.disabled:active,
|
||||
.datepicker table tr td.selected.disabled:hover:active,
|
||||
.datepicker table tr td.selected.active,
|
||||
.datepicker table tr td.selected:hover.active,
|
||||
.datepicker table tr td.selected.disabled.active,
|
||||
.datepicker table tr td.selected.disabled:hover.active {
|
||||
background-color: #666666 \9;
|
||||
}
|
||||
.datepicker table tr td.active,
|
||||
.datepicker table tr td.active:hover,
|
||||
.datepicker table tr td.active.disabled,
|
||||
.datepicker table tr td.active.disabled:hover {
|
||||
background-color: #006dcc;
|
||||
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
|
||||
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: linear-gradient(top, #0088cc, #0044cc);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
|
||||
border-color: #0044cc #0044cc #002a80;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
color: #fff;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.datepicker table tr td.active:hover,
|
||||
.datepicker table tr td.active:hover:hover,
|
||||
.datepicker table tr td.active.disabled:hover,
|
||||
.datepicker table tr td.active.disabled:hover:hover,
|
||||
.datepicker table tr td.active:active,
|
||||
.datepicker table tr td.active:hover:active,
|
||||
.datepicker table tr td.active.disabled:active,
|
||||
.datepicker table tr td.active.disabled:hover:active,
|
||||
.datepicker table tr td.active.active,
|
||||
.datepicker table tr td.active:hover.active,
|
||||
.datepicker table tr td.active.disabled.active,
|
||||
.datepicker table tr td.active.disabled:hover.active,
|
||||
.datepicker table tr td.active.disabled,
|
||||
.datepicker table tr td.active:hover.disabled,
|
||||
.datepicker table tr td.active.disabled.disabled,
|
||||
.datepicker table tr td.active.disabled:hover.disabled,
|
||||
.datepicker table tr td.active[disabled],
|
||||
.datepicker table tr td.active:hover[disabled],
|
||||
.datepicker table tr td.active.disabled[disabled],
|
||||
.datepicker table tr td.active.disabled:hover[disabled] {
|
||||
background-color: #0044cc;
|
||||
}
|
||||
.datepicker table tr td.active:active,
|
||||
.datepicker table tr td.active:hover:active,
|
||||
.datepicker table tr td.active.disabled:active,
|
||||
.datepicker table tr td.active.disabled:hover:active,
|
||||
.datepicker table tr td.active.active,
|
||||
.datepicker table tr td.active:hover.active,
|
||||
.datepicker table tr td.active.disabled.active,
|
||||
.datepicker table tr td.active.disabled:hover.active {
|
||||
background-color: #003399 \9;
|
||||
}
|
||||
.datepicker table tr td span {
|
||||
display: block;
|
||||
width: 23%;
|
||||
height: 54px;
|
||||
line-height: 54px;
|
||||
float: left;
|
||||
margin: 1%;
|
||||
cursor: pointer;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.datepicker table tr td span:hover {
|
||||
background: #eeeeee;
|
||||
}
|
||||
.datepicker table tr td span.disabled,
|
||||
.datepicker table tr td span.disabled:hover {
|
||||
background: none;
|
||||
color: #999999;
|
||||
cursor: default;
|
||||
}
|
||||
.datepicker table tr td span.active,
|
||||
.datepicker table tr td span.active:hover,
|
||||
.datepicker table tr td span.active.disabled,
|
||||
.datepicker table tr td span.active.disabled:hover {
|
||||
background-color: #006dcc;
|
||||
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
|
||||
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: linear-gradient(top, #0088cc, #0044cc);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
|
||||
border-color: #0044cc #0044cc #002a80;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
color: #fff;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.datepicker table tr td span.active:hover,
|
||||
.datepicker table tr td span.active:hover:hover,
|
||||
.datepicker table tr td span.active.disabled:hover,
|
||||
.datepicker table tr td span.active.disabled:hover:hover,
|
||||
.datepicker table tr td span.active:active,
|
||||
.datepicker table tr td span.active:hover:active,
|
||||
.datepicker table tr td span.active.disabled:active,
|
||||
.datepicker table tr td span.active.disabled:hover:active,
|
||||
.datepicker table tr td span.active.active,
|
||||
.datepicker table tr td span.active:hover.active,
|
||||
.datepicker table tr td span.active.disabled.active,
|
||||
.datepicker table tr td span.active.disabled:hover.active,
|
||||
.datepicker table tr td span.active.disabled,
|
||||
.datepicker table tr td span.active:hover.disabled,
|
||||
.datepicker table tr td span.active.disabled.disabled,
|
||||
.datepicker table tr td span.active.disabled:hover.disabled,
|
||||
.datepicker table tr td span.active[disabled],
|
||||
.datepicker table tr td span.active:hover[disabled],
|
||||
.datepicker table tr td span.active.disabled[disabled],
|
||||
.datepicker table tr td span.active.disabled:hover[disabled] {
|
||||
background-color: #0044cc;
|
||||
}
|
||||
.datepicker table tr td span.active:active,
|
||||
.datepicker table tr td span.active:hover:active,
|
||||
.datepicker table tr td span.active.disabled:active,
|
||||
.datepicker table tr td span.active.disabled:hover:active,
|
||||
.datepicker table tr td span.active.active,
|
||||
.datepicker table tr td span.active:hover.active,
|
||||
.datepicker table tr td span.active.disabled.active,
|
||||
.datepicker table tr td span.active.disabled:hover.active {
|
||||
background-color: #003399 \9;
|
||||
}
|
||||
.datepicker table tr td span.old,
|
||||
.datepicker table tr td span.new {
|
||||
color: #999999;
|
||||
}
|
||||
.datepicker th.datepicker-switch {
|
||||
width: 145px;
|
||||
}
|
||||
.datepicker thead tr:first-child th,
|
||||
.datepicker tfoot tr th {
|
||||
cursor: pointer;
|
||||
}
|
||||
.datepicker thead tr:first-child th:hover,
|
||||
.datepicker tfoot tr th:hover {
|
||||
background: #eeeeee;
|
||||
}
|
||||
.datepicker .cw {
|
||||
font-size: 10px;
|
||||
width: 12px;
|
||||
padding: 0 2px 0 5px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.datepicker thead tr:first-child th.cw {
|
||||
cursor: default;
|
||||
background-color: transparent;
|
||||
}
|
||||
.input-append.date .add-on i,
|
||||
.input-prepend.date .add-on i {
|
||||
cursor: pointer;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
.input-daterange input {
|
||||
text-align: center;
|
||||
}
|
||||
.input-daterange input:first-child {
|
||||
-webkit-border-radius: 3px 0 0 3px;
|
||||
-moz-border-radius: 3px 0 0 3px;
|
||||
border-radius: 3px 0 0 3px;
|
||||
}
|
||||
.input-daterange input:last-child {
|
||||
-webkit-border-radius: 0 3px 3px 0;
|
||||
-moz-border-radius: 0 3px 3px 0;
|
||||
border-radius: 0 3px 3px 0;
|
||||
}
|
||||
.input-daterange .add-on {
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
min-width: 16px;
|
||||
height: 20px;
|
||||
padding: 4px 5px;
|
||||
font-weight: normal;
|
||||
line-height: 20px;
|
||||
text-align: center;
|
||||
text-shadow: 0 1px 0 #ffffff;
|
||||
vertical-align: middle;
|
||||
background-color: #eeeeee;
|
||||
border: 1px solid #ccc;
|
||||
margin-left: -5px;
|
||||
margin-right: -5px;
|
||||
}
|
||||
.datepicker.dropdown-menu {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
z-index: 1000;
|
||||
float: left;
|
||||
display: none;
|
||||
min-width: 160px;
|
||||
list-style: none;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #ccc;
|
||||
border: 1px solid rgba(0, 0, 0, 0.2);
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
|
||||
-moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
|
||||
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
|
||||
-webkit-background-clip: padding-box;
|
||||
-moz-background-clip: padding;
|
||||
background-clip: padding-box;
|
||||
*border-right-width: 2px;
|
||||
*border-bottom-width: 2px;
|
||||
color: #333333;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.datepicker.dropdown-menu th,
|
||||
.datepicker.dropdown-menu td {
|
||||
padding: 4px 5px;
|
||||
}
|
||||
1671
public/jquery-timepicker/lib/bootstrap-datepicker.js
vendored
1671
public/jquery-timepicker/lib/bootstrap-datepicker.js
vendored
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.6 KiB |
@@ -1,195 +0,0 @@
|
||||
body {
|
||||
background: #f0f0f0;
|
||||
color: #444;
|
||||
font-family: helvetica, arial, sans-serif;
|
||||
font-size: 15px;
|
||||
line-height: 1.3;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
header,
|
||||
section,
|
||||
footer {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
header,
|
||||
footer {
|
||||
background: #d4d4d4;
|
||||
color: #666;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
header h1 a {
|
||||
font-family: Lucida Sans Unicode, Lucida Grande, sans-serif;
|
||||
font-size: 60px;
|
||||
font-weight: 200;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
header p {
|
||||
font-size: 23px;
|
||||
}
|
||||
|
||||
#header-links {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
top: 30px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#header-links a {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
#header-links a:hover {
|
||||
color: #06c;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #444;
|
||||
font-size: 35px;
|
||||
font-weight: normal;
|
||||
margin: 0;
|
||||
line-height: 1.1
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 20px 0 0 0;
|
||||
}
|
||||
|
||||
p:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
input {
|
||||
font-size: 13px;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
padding: 3px;
|
||||
background: #fff;
|
||||
border: 1px solid #aac;
|
||||
}
|
||||
|
||||
input.time {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
input.date {
|
||||
width: 90px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #06c;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
image {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.body-text {
|
||||
width: 700px;
|
||||
}
|
||||
|
||||
#examples article {
|
||||
padding-top: 100px;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
#examples article:first-child {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
#examples .demo {
|
||||
width: 450px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#examples .code {
|
||||
font-size: 12px;
|
||||
margin: 0 0 0 470px;
|
||||
}
|
||||
|
||||
footer {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Blackboard theme
|
||||
*
|
||||
* Adapted from Domenico Carbotta's TextMate theme of the same name
|
||||
*
|
||||
* @author Domenico Carbotta
|
||||
* @author Craig Campbell
|
||||
* @version 1.0.2
|
||||
*/
|
||||
pre {
|
||||
background: #0B1022;
|
||||
word-wrap: break-word;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
padding: 10px;
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
pre, code {
|
||||
font-family: 'Monaco', courier, monospace;
|
||||
}
|
||||
|
||||
pre .comment {
|
||||
color: #727272;
|
||||
}
|
||||
|
||||
pre .constant {
|
||||
color: #D8FA3C;
|
||||
}
|
||||
|
||||
pre .storage {
|
||||
color: #FBDE2D;
|
||||
}
|
||||
|
||||
pre .string, pre .comment.docstring {
|
||||
color: #61CE3C;
|
||||
}
|
||||
|
||||
pre .string.regexp, pre .support.tag.script, pre .support.tag.style {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
pre .keyword, pre .selector {
|
||||
color: #FBDE2D;
|
||||
}
|
||||
|
||||
pre .inherited-class {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
pre .entity {
|
||||
color: #FF6400;
|
||||
}
|
||||
|
||||
pre .support, *[data-language="c"] .function.call {
|
||||
color: #8DA6CE;
|
||||
}
|
||||
|
||||
pre .variable.global, pre .variable.class, pre .variable.instance {
|
||||
color: #FF6400;
|
||||
}
|
||||
|
||||
10
public/jquery-timepicker/lib/site.js
vendored
10
public/jquery-timepicker/lib/site.js
vendored
@@ -1,10 +0,0 @@
|
||||
/* Rainbow v1.1.9 rainbowco.de | included languages: generic, javascript */
|
||||
window.Rainbow=function(){function q(a){var b,c=a.getAttribute&&a.getAttribute("data-language")||0;if(!c){a=a.attributes;for(b=0;b<a.length;++b)if("data-language"===a[b].nodeName)return a[b].nodeValue}return c}function B(a){var b=q(a)||q(a.parentNode);if(!b){var c=/\blang(?:uage)?-(\w+)/;(a=a.className.match(c)||a.parentNode.className.match(c))&&(b=a[1])}return b}function C(a,b){for(var c in e[d]){c=parseInt(c,10);if(a==c&&b==e[d][c]?0:a<=c&&b>=e[d][c])delete e[d][c],delete j[d][c];if(a>=c&&a<e[d][c]||
|
||||
b>c&&b<e[d][c])return!0}return!1}function r(a,b){return'<span class="'+a.replace(/\./g," ")+(l?" "+l:"")+'">'+b+"</span>"}function s(a,b,c,h){var f=a.exec(c);if(f){++t;!b.name&&"string"==typeof b.matches[0]&&(b.name=b.matches[0],delete b.matches[0]);var k=f[0],i=f.index,u=f[0].length+i,g=function(){function f(){s(a,b,c,h)}t%100>0?f():setTimeout(f,0)};if(C(i,u))g();else{var m=v(b.matches),l=function(a,c,h){if(a>=c.length)h(k);else{var d=f[c[a]];if(d){var e=b.matches[c[a]],i=e.language,g=e.name&&e.matches?
|
||||
e.matches:e,j=function(b,d,e){var i;i=0;var g;for(g=1;g<c[a];++g)f[g]&&(i=i+f[g].length);d=e?r(e,d):d;k=k.substr(0,i)+k.substr(i).replace(b,d);l(++a,c,h)};i?n(d,i,function(a){j(d,a)}):typeof e==="string"?j(d,d,e):w(d,g.length?g:[g],function(a){j(d,a,e.matches?e.name:0)})}else l(++a,c,h)}};l(0,m,function(a){b.name&&(a=r(b.name,a));if(!j[d]){j[d]={};e[d]={}}j[d][i]={replace:f[0],"with":a};e[d][i]=u;g()})}}else h()}function v(a){var b=[],c;for(c in a)a.hasOwnProperty(c)&&b.push(c);return b.sort(function(a,
|
||||
b){return b-a})}function w(a,b,c){function h(b,k){k<b.length?s(b[k].pattern,b[k],a,function(){h(b,++k)}):D(a,function(a){delete j[d];delete e[d];--d;c(a)})}++d;h(b,0)}function D(a,b){function c(a,b,h,e){if(h<b.length){++x;var g=b[h],l=j[d][g],a=a.substr(0,g)+a.substr(g).replace(l.replace,l["with"]),g=function(){c(a,b,++h,e)};0<x%250?g():setTimeout(g,0)}else e(a)}var h=v(j[d]);c(a,h,0,b)}function n(a,b,c){var d=m[b]||[],f=m[y]||[],b=z[b]?d:d.concat(f);w(a.replace(/</g,"<").replace(/>/g,">").replace(/&(?![\w\#]+;)/g,
|
||||
"&"),b,c)}function o(a,b,c){if(b<a.length){var d=a[b],f=B(d);return!(-1<(" "+d.className+" ").indexOf(" rainbow "))&&f?(f=f.toLowerCase(),d.className+=d.className?" rainbow":"rainbow",n(d.innerHTML,f,function(k){d.innerHTML=k;j={};e={};p&&p(d,f);setTimeout(function(){o(a,++b,c)},0)})):o(a,++b,c)}c&&c()}function A(a,b){var a=a&&"function"==typeof a.getElementsByTagName?a:document,c=a.getElementsByTagName("pre"),d=a.getElementsByTagName("code"),f,e=[];for(f=0;f<d.length;++f)e.push(d[f]);for(f=0;f<
|
||||
c.length;++f)c[f].getElementsByTagName("code").length||e.push(c[f]);o(e,0,b)}var j={},e={},m={},z={},d=0,y=0,t=0,x=0,l,p;return{extend:function(a,b,c){1==arguments.length&&(b=a,a=y);z[a]=c;m[a]=b.concat(m[a]||[])},b:function(a){p=a},a:function(a){l=a},color:function(a,b,c){if("string"==typeof a)return n(a,b,c);if("function"==typeof a)return A(0,a);A(a,b)}}}();window.addEventListener?window.addEventListener("load",Rainbow.color,!1):window.attachEvent("onload",Rainbow.color);Rainbow.onHighlight=Rainbow.b;
|
||||
Rainbow.addClass=Rainbow.a;Rainbow.extend([{matches:{1:{name:"keyword.operator",pattern:/\=/g},2:{name:"string",matches:{name:"constant.character.escape",pattern:/\\('|"){1}/g}}},pattern:/(\(|\s|\[|\=|:)(('|")([^\\\1]|\\.)*?(\3))/gm},{name:"comment",pattern:/\/\*[\s\S]*?\*\/|(\/\/|\#)[\s\S]*?$/gm},{name:"constant.numeric",pattern:/\b(\d+(\.\d+)?(e(\+|\-)?\d+)?(f|d)?|0x[\da-f]+)\b/gi},{matches:{1:"keyword"},pattern:/\b(and|array|as|bool(ean)?|c(atch|har|lass|onst)|d(ef|elete|o(uble)?)|e(cho|lse(if)?|xit|xtends|xcept)|f(inally|loat|or(each)?|unction)|global|if|import|int(eger)?|long|new|object|or|pr(int|ivate|otected)|public|return|self|st(ring|ruct|atic)|switch|th(en|is|row)|try|(un)?signed|var|void|while)(?=\(|\b)/gi},
|
||||
{name:"constant.language",pattern:/true|false|null/g},{name:"keyword.operator",pattern:/\+|\!|\-|&(gt|lt|amp);|\||\*|\=/g},{matches:{1:"function.call"},pattern:/(\w+?)(?=\()/g},{matches:{1:"storage.function",2:"entity.name.function"},pattern:/(function)\s(.*?)(?=\()/g}]);Rainbow.extend("javascript",[{name:"selector",pattern:/(\s|^)\$(?=\.|\()/g},{name:"support",pattern:/\b(window|document)\b/g},{matches:{1:"support.property"},pattern:/\.(length|node(Name|Value))\b/g},{matches:{1:"support.function"},pattern:/(setTimeout|setInterval)(?=\()/g},{matches:{1:"support.method"},pattern:/\.(getAttribute|push|getElementById|getElementsByClassName|log|setTimeout|setInterval)(?=\()/g},{matches:{1:"support.tag.script",2:[{name:"string",pattern:/('|")(.*?)(\1)/g},{name:"entity.tag.script",
|
||||
pattern:/(\w+)/g}],3:"support.tag.script"},pattern:/(<\/?)(script.*?)(>)/g},{name:"string.regexp",matches:{1:"string.regexp.open",2:{name:"constant.regexp.escape",pattern:/\\(.){1}/g},3:"string.regexp.close",4:"string.regexp.modifier"},pattern:/(\/)(?!\*)(.+)(\/)([igm]{0,3})/g},{matches:{1:"storage",3:"entity.function"},pattern:/(var)?(\s|^)(.*)(?=\s?=\s?function\()/g},{name:"entity.function",pattern:/(\w+)(?=:\s{0,}function)/g}]);
|
||||
@@ -1,31 +0,0 @@
|
||||
{
|
||||
"name": "timepicker",
|
||||
"version": "1.8.0",
|
||||
"title": "jquery-timepicker",
|
||||
"author": {
|
||||
"name": "Jon Thornton",
|
||||
"url": "https://github.com/jonthornton"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"jquery": ">=1.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-contrib-uglify": "~0.2.2"
|
||||
},
|
||||
"main": "jquery.timepicker.min.js",
|
||||
"description": "A jQuery timepicker plugin inspired by Google Calendar. It supports both mouse and keyboard navigation.",
|
||||
"keywords": [ "timepicker", "time", "picker", "ui", "google calendar" ],
|
||||
"homepage": "http://jonthornton.github.com/jquery-timepicker/",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jonthornton/jquery-timepicker.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonthornton/jquery-timepicker/issues"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 212 B |
Binary file not shown.
|
After Width: | Height: | Size: 208 B |
Binary file not shown.
|
After Width: | Height: | Size: 335 B |
Binary file not shown.
|
After Width: | Height: | Size: 207 B |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user