mirror of
https://github.com/wahyd4/cdnjs.git
synced 2026-08-28 22:25:58 +10:00
Merge branch 'master' of github.com:cdnjs/cdnjs
This commit is contained in:
+1
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ModelCore",
|
||||
"filename": "ModelCore.js",
|
||||
"filename": "ModelCore.min.js",
|
||||
"version": "1.0",
|
||||
"description": "A RESTful Javascript ORM for AngularJS",
|
||||
"homepage": "https://github.com/klederson/ModelCore/",
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Backbone.React.Component
|
||||
* @version 0.5.0
|
||||
* @author "Magalhas" José Magalhães <magalhas@gmail.com>
|
||||
* @license MIT <http://opensource.org/licenses/MIT>
|
||||
*/
|
||||
"use strict";!function(a,b){if("function"==typeof define&&define.amd)define(["react","backbone","underscore"],b);else if("undefined"!=typeof module){var c=require("react"),d=require("backbone"),e=require("underscore");module.exports=b(c,d,e)}else b(a.React,a.Backbone,a._)}(this,function(a,b,c){function d(a,e){e=e||{};var f,g=e.model,h=e.collection;(c.isElement(e.el)||b.$&&e.el instanceof b.$)&&(f=e.el,delete e.el),(g instanceof b.Model||g instanceof Object&&c.values(g)[0]instanceof b.Model)&&(delete e.model,this.model=g,this.setPropsBackbone(g,void 0,e)),(h instanceof b.Collection||h instanceof Object&&c.values(h)[0]instanceof b.Collection)&&(delete e.collection,this.collection=h,this.setPropsBackbone(h,void 0,e));var i=this.virtualComponent=c.defaults(a.apply(this,c.rest(arguments)),b.Events,b.React.Component,{clone:function(b,c){return new d(a,b,c).virtualComponent},cid:c.uniqueId(),wrapper:this});f&&i.setElement(f),i.initialize&&i.initialize(e),this.startModelListeners(),this.startCollectionListeners()}b.React||(b.React={}),b.React.Component={$:function(){return this.$el?this.$el.find.apply(this.$el,arguments):void 0},extend:function(f){function g(a,b){return new d(h,a,b).virtualComponent}g.extend=function(){return b.React.Component.extend(c.extend({},f,arguments[0]))},f.mixins?f.mixins[0]!==e&&f.mixins.splice(0,0,e):f.mixins=[e];var h=a.createClass(c.extend(g.prototype,f));return g},getCollection:function(){return this.getOwner().wrapper.collection},getModel:function(){return this.getOwner().wrapper.model},getOwner:function(){for(var a=this;a.props.__owner__;)a=a.props.__owner__;return a},mount:function(b,c){if(!b&&!this.el)throw new Error("No element to mount on");return b||(b=this.el),this.wrapper.component=a.renderComponent(this,b,c),this},remove:function(){this.wrapper.component&&this.wrapper.component.isMounted()&&this.unmount(),this.wrapper.stopListening(),this.stopListening()},setElement:function(a){if(a&&b.$&&a instanceof b.$){if(a.length>1)throw new Error("You can only assign one element to a component");this.el=a[0],this.$el=a}else a&&(this.el=a,b.$&&(this.$el=b.$(a)));return this},toHTML:function(){var b=this.clone(this.props);return a.renderComponentToString(b)},unmount:function(){var b=this.el.parentNode;if(!a.unmountComponentAtNode(b))throw new Error("There was an error unmounting the component");delete this.wrapper.component,this.setElement(b)}};var e={componentDidMount:function(){this.setElement(this.getDOMNode())},componentDidUpdate:function(){this.setElement(this.getDOMNode())}};return c.extend(d.prototype,b.Events,{onError:function(a,b,c){c.silent||this.setProps({isRequesting:!1,hasError:!0,error:b})},onRequest:function(a,b,c){c.silent||this.setProps({isRequesting:!0,hasError:!1})},onSync:function(a,b,c){c.silent||this.setProps({isRequesting:!1})},setPropsBackbone:function(a,c,d){if(a instanceof b.Collection||a instanceof b.Model)this.setProps.apply(this,arguments);else for(c in a)this.setPropsBackbone(a[c],c,d)},setProps:function(a,d,e){e||this.component&&this.component.isMounted()||(e=this.virtualComponent.props);var f={},g=a.toJSON?a.toJSON():a;d?f[d]=g:a instanceof b.Collection?f.collection=g:f=g,e?c.extend(e,f):(this.nextProps=c.extend(this.nextProps||{},f),c.defer(c.bind(function(){this.nextProps&&(this.component.setProps(this.nextProps),delete this.nextProps)},this)))},startCollectionListeners:function(a,d){if(a||(a=this.collection),a instanceof b.Collection)this.listenTo(a,"add remove change sort",c.partial(this.setPropsBackbone,a,d,void 0)).listenTo(a,"error",this.onError).listenTo(a,"request",this.onRequest).listenTo(a,"sync",this.onSync);else if(a)for(d in a)this.startCollectionListeners(a[d],d)},startModelListeners:function(a,d){if(a||(a=this.model),a instanceof b.Model)this.listenTo(a,"change",c.partial(this.setPropsBackbone,a,d,void 0)).listenTo(a,"error",this.onError).listenTo(a,"request",this.onRequest).listenTo(a,"sync",this.onSync);else if(a)for(d in a)this.startModelListeners(a[d],d)}}),b.React.Component});
|
||||
@@ -0,0 +1,408 @@
|
||||
/**
|
||||
* Backbone.React.Component
|
||||
* @version 0.5.0
|
||||
* @author "Magalhas" José Magalhães <magalhas@gmail.com>
|
||||
* @license MIT <http://opensource.org/licenses/MIT>
|
||||
*/
|
||||
'use strict';
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd)
|
||||
define(['react', 'backbone', 'underscore'], factory);
|
||||
else if (typeof module !== 'undefined') {
|
||||
var React = require('react');
|
||||
var Backbone = require('backbone');
|
||||
var _ = require('underscore');
|
||||
module.exports = factory(React, Backbone, _);
|
||||
} else
|
||||
factory(root.React, root.Backbone, root._);
|
||||
}(this, function (React, Backbone, _) {
|
||||
/**
|
||||
* @namespace Backbone.React.Component
|
||||
* @mixes React.Component
|
||||
* @mixes Backbone.Events
|
||||
* @desc The Reactor.Component is a React.Component wrapper to serve
|
||||
as a bridge between the React and Backbone worlds. Besides some extra members
|
||||
that may be set by extending/instancing a component, it works pretty much the
|
||||
same way that {@link http://facebook.github.io/react/|React} components do.
|
||||
<br />
|
||||
When bound to a model, the component gets automatically mounted/rendered on
|
||||
the DOM as the model changes. If already rendered it just updates the element
|
||||
by using {@link http://facebook.github.io/react/|React} virtual DOM engine.
|
||||
<br />
|
||||
Here lies the public API available on each component.
|
||||
* @example
|
||||
// Instancing a component
|
||||
var myComponent = new Backbone.React.Component({
|
||||
el: document.body,
|
||||
model: model
|
||||
});
|
||||
* @example
|
||||
// Extending a component
|
||||
/** @jsx React.DOM *\/
|
||||
var MyComponent = Backbone.React.Component.extend({
|
||||
render: function () {
|
||||
return <div>Hello world!</div>;
|
||||
}
|
||||
});
|
||||
*/
|
||||
if (!Backbone.React) Backbone.React = {};
|
||||
Backbone.React.Component =
|
||||
/** @lends Backbone.React.Component */
|
||||
{
|
||||
/**
|
||||
* Shortcut to this.$el.find. Inspired by Backbone.View.
|
||||
* @returns {Backbone.$}
|
||||
*/
|
||||
$: function () {
|
||||
if (this.$el)
|
||||
return this.$el.find.apply(this.$el, arguments);
|
||||
},
|
||||
/**
|
||||
* Wraps React.Component into Backbone.React.Component and extends to a new
|
||||
class.
|
||||
* @method extend
|
||||
* @memberof Component
|
||||
* @static
|
||||
*/
|
||||
extend: function (Clazz) {
|
||||
function Factory (props, children) {
|
||||
return (new Wrapper(Component, props, children)).virtualComponent;
|
||||
}
|
||||
// Allow deep extending
|
||||
Factory.extend = function () {
|
||||
return Backbone.React.Component.extend(_.extend({}, Clazz, arguments[0]));
|
||||
};
|
||||
// Apply mixin
|
||||
if (Clazz.mixins) {
|
||||
if (Clazz.mixins[0] !== mixin)
|
||||
Clazz.mixins.splice(0, 0, mixin);
|
||||
} else
|
||||
Clazz.mixins = [mixin];
|
||||
// Create the react component later used by Factory
|
||||
var Component = React.createClass(_.extend(Factory.prototype, Clazz));
|
||||
return Factory;
|
||||
},
|
||||
/**
|
||||
* Crawls to the owner of the component and gets the collection.
|
||||
*/
|
||||
getCollection: function () {
|
||||
return this.getOwner().wrapper.collection;
|
||||
},
|
||||
/**
|
||||
* Crawls to the owner of the component and gets the model.
|
||||
* @returns {Backbone.Model}
|
||||
*/
|
||||
getModel: function () {
|
||||
return this.getOwner().wrapper.model;
|
||||
},
|
||||
/**
|
||||
* Crawls this.props.__owner__ recursively until it finds the owner of this
|
||||
component. In case of being a parent component (no owners) it returns itself.
|
||||
* @returns {Backbone.React.Component}
|
||||
*/
|
||||
getOwner: function () {
|
||||
var owner = this;
|
||||
while (owner.props.__owner__) owner = owner.props.__owner__;
|
||||
return owner;
|
||||
},
|
||||
/**
|
||||
* Renders/mounts the component. It delegates to React.renderComponent.
|
||||
* @param {DOMElement} [el=this.el] The DOM element where we want to mount
|
||||
the component.
|
||||
* @param {Callback} [onRender] Callback to be executed when the component
|
||||
is rendered/mounted. If not passed it syncs this.model or this.collection
|
||||
with this.props.
|
||||
* @returns {this}
|
||||
*/
|
||||
mount: function (el, onRender) {
|
||||
if (!(el || this.el)) throw new Error('No element to mount on');
|
||||
else if (!el) el = this.el;
|
||||
this.wrapper.component = React.renderComponent(this, el, onRender);
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
* Stops all listeners and unmounts this component from the DOM.
|
||||
*/
|
||||
remove: function () {
|
||||
if (this.wrapper.component && this.wrapper.component.isMounted())
|
||||
this.unmount();
|
||||
this.wrapper.stopListening();
|
||||
this.stopListening();
|
||||
},
|
||||
/**
|
||||
* Sets a DOM element to render/mount this component on this.el and this.$el.
|
||||
* @param {DOMElement|Backbone.$} el The DOMElement where we want to render/mount
|
||||
the component.
|
||||
* @returns {this}
|
||||
*/
|
||||
setElement: function (el) {
|
||||
if (el && Backbone.$ && el instanceof Backbone.$) {
|
||||
if (el.length > 1) throw new Error('You can only assign one element to a component');
|
||||
this.el = el[0];
|
||||
this.$el = el;
|
||||
} else if (el) {
|
||||
this.el = el;
|
||||
if (Backbone.$) this.$el = Backbone.$(el);
|
||||
}
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
* Intended to be used on the server side (Nodejs), renders your component to
|
||||
a string ready to be used on the client side by delegating to React.renderComponentToString.
|
||||
* @returns {String} The HTML representation of this component.
|
||||
*/
|
||||
toHTML: function () {
|
||||
// Since we're only able to call renderComponentToString once, lets clone this component
|
||||
// and use it insteaad.
|
||||
var clone = this.clone(this.props);
|
||||
return React.renderComponentToString(clone);
|
||||
},
|
||||
/**
|
||||
* Unmount the component from the DOM.
|
||||
* @throws {Error} If component isn't unmounted successfully.
|
||||
*/
|
||||
unmount: function () {
|
||||
var parentNode = this.el.parentNode;
|
||||
if (!React.unmountComponentAtNode(parentNode)) {
|
||||
throw new Error('There was an error unmounting the component');
|
||||
}
|
||||
delete this.wrapper.component;
|
||||
this.setElement(parentNode);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Mixin used in all component instances.
|
||||
* @mixin
|
||||
*/
|
||||
var mixin = {
|
||||
/**
|
||||
* Sets this.el and this.$el when the component mounts.
|
||||
*/
|
||||
componentDidMount: function () {
|
||||
this.setElement(this.getDOMNode());
|
||||
},
|
||||
/**
|
||||
* Sets this.el and this.$el when the component updates.
|
||||
*/
|
||||
componentDidUpdate: function () {
|
||||
this.setElement(this.getDOMNode());
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Binds models and collections to a React.Component.
|
||||
* @class Wrapper
|
||||
* @mixes Backbone.Events
|
||||
*/
|
||||
function Wrapper (Component, props) {
|
||||
props = props || {};
|
||||
var el, model = props.model, collection = props.collection;
|
||||
// Check if props.el is a DOM element or a jQuery object
|
||||
if (_.isElement(props.el) || Backbone.$ && props.el instanceof Backbone.$) {
|
||||
el = props.el;
|
||||
delete props.el;
|
||||
}
|
||||
// Check if props.model is a Backbone.Model or an hashmap of them
|
||||
if (model instanceof Backbone.Model ||
|
||||
model instanceof Object && _.values(model)[0] instanceof Backbone.Model) {
|
||||
delete props.model;
|
||||
/**
|
||||
* The model or models bound to this component.
|
||||
*/
|
||||
this.model = model;
|
||||
// Set model(s) attributes on props for the first render
|
||||
this.setPropsBackbone(model, void 0, props);
|
||||
}
|
||||
// Check if props.collection is a Backbone.Collection or an hashmap of them
|
||||
if (collection instanceof Backbone.Collection ||
|
||||
collection instanceof Object && _.values(collection)[0] instanceof Backbone.Collection) {
|
||||
delete props.collection;
|
||||
/**
|
||||
* The collection or collections bound to this component.
|
||||
*/
|
||||
this.collection = collection;
|
||||
// Set collection(s) models on props for the first render
|
||||
this.setPropsBackbone(collection, void 0, props);
|
||||
}
|
||||
// Instance the component mixing Backbone.Events, our public API and some special
|
||||
// properties.
|
||||
var component = this.virtualComponent = _.defaults(Component.apply(this, _.rest(arguments)),
|
||||
Backbone.Events, Backbone.React.Component, {
|
||||
/**
|
||||
* Clones the component wrapper and returns the component.
|
||||
* @returns {Backbone.React.Component}
|
||||
*/
|
||||
clone: function (props, children) {
|
||||
return (new Wrapper(Component, props, children)).virtualComponent;
|
||||
},
|
||||
// Assign a component unique id, this is handy sometimes as a DOM attribute
|
||||
cid: _.uniqueId(),
|
||||
// One to one relationship between the wrapper and the component
|
||||
wrapper: this
|
||||
});
|
||||
// Set element
|
||||
if (el) component.setElement(el);
|
||||
// Call initialize if available
|
||||
if (component.initialize) component.initialize(props);
|
||||
// Start listeners
|
||||
this.startModelListeners();
|
||||
this.startCollectionListeners();
|
||||
}
|
||||
_.extend(Wrapper.prototype, Backbone.Events,
|
||||
/** @lends Wrapper.prototype */
|
||||
{
|
||||
/**
|
||||
* Sets this.props when a model/collection request results in error. It delegates to this.setProps.
|
||||
* @private
|
||||
* @param {Backbone.Model|Backbone.Collection} modelOrCollection The model or collection
|
||||
that was sync.
|
||||
* @param {Object} res The XHR error response.
|
||||
* @param {Object} options
|
||||
* @listens Backbone.Model#error
|
||||
* @listens Backbone.Collection#error
|
||||
*/
|
||||
onError: function (modelOrCollection, res, options) {
|
||||
// Set props only if there's no silent option
|
||||
if (!options.silent)
|
||||
this.setProps({
|
||||
isRequesting: false,
|
||||
hasError: true,
|
||||
error: res
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Sets this.props when a model/collection request starts. It delegates to this.setProps.
|
||||
* @private
|
||||
* @param {Backbone.Model|Backbone.Collection} modelOrCollection The model or collection
|
||||
that was sync.
|
||||
* @param {XMLHttpRequest} xhr
|
||||
* @param {Object} options
|
||||
* @listens Backbone.Model#request
|
||||
* @listens Backbone.Collection#request
|
||||
*/
|
||||
onRequest: function (modelOrCollection, xhr, options) {
|
||||
// Set props only if there's no silent option
|
||||
if (!options.silent)
|
||||
this.setProps({
|
||||
isRequesting: true,
|
||||
hasError: false
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Sets this.props when a model/collection syncs. It delegates to this.setProps.
|
||||
* @private
|
||||
* @param {Backbone.Model|Backbone.Collection} modelOrCollection The model or collection
|
||||
that was sync.
|
||||
* @param {Object} res The XHR request response.
|
||||
* @param {Object} options
|
||||
* @listens Backbone.Model#sync
|
||||
* @listens Backbone.Collection#sync
|
||||
*/
|
||||
onSync: function (modelOrCollection, res, options) {
|
||||
// Set props only if there's no silent option
|
||||
if (!options.silent)
|
||||
this.setProps({isRequesting: false});
|
||||
},
|
||||
/**
|
||||
* Used internally to set this.collection or this.model on this.props. Delegates to
|
||||
this.setProps.
|
||||
* @private
|
||||
* @param {Backbone.Collection|Backbone.Model|Object} modelOrCollection The
|
||||
model or collection or hashmap of them that we're delegating to this.setProps.
|
||||
* @param {String} [key] In case of multiple collections a key is passed to identify
|
||||
the collection.
|
||||
* @param {Object} [target] Used by the constructor to set props for the component
|
||||
first render.
|
||||
* @listens Backbone.Collection#add
|
||||
* @listens Backbone.Collection#remove
|
||||
* @listens Backbone.Collection#change
|
||||
* @listens Backbone.Model#change
|
||||
*/
|
||||
setPropsBackbone: function (modelOrCollection, key, target) {
|
||||
if (!(modelOrCollection instanceof Backbone.Collection ||
|
||||
modelOrCollection instanceof Backbone.Model)) {
|
||||
for (key in modelOrCollection)
|
||||
this.setPropsBackbone(modelOrCollection[key], key, target);
|
||||
return;
|
||||
}
|
||||
this.setProps.apply(this, arguments);
|
||||
},
|
||||
/**
|
||||
* Sets a model, collection or object into this.props by delegating to this.setProps.
|
||||
* @private
|
||||
* @param {Backbone.Collection|Backbone.Model|Object} [modelOrCollection] The model
|
||||
or collection we're setting into this.props or target. Also accepts a raw object.
|
||||
* @param {String} [key] The key to be used inside this.props.
|
||||
* @param {Object} [target] If we're setting the data on an object instead of
|
||||
delegating to this.setProps.
|
||||
*/
|
||||
setProps: function (modelOrCollection, key, target) {
|
||||
// If the component isn't rendered/mounted set target because you can't set props
|
||||
// on an unmounted (virtual) component.
|
||||
if (!target && !(this.component && this.component.isMounted())) target = this.virtualComponent.props;
|
||||
var props = {};
|
||||
var newProps = modelOrCollection.toJSON ? modelOrCollection.toJSON() : modelOrCollection;
|
||||
|
||||
if (key)
|
||||
props[key] = newProps;
|
||||
else if (modelOrCollection instanceof Backbone.Collection)
|
||||
props.collection = newProps;
|
||||
else // if (modelOrCollection instanceof Backbone.Model)
|
||||
props = newProps;
|
||||
|
||||
if (target) _.extend(target, props);
|
||||
else {
|
||||
this.nextProps = _.extend(this.nextProps || {}, props);
|
||||
_.defer(_.bind(function () {
|
||||
if (this.nextProps) {
|
||||
this.component.setProps(this.nextProps);
|
||||
delete this.nextProps;
|
||||
}
|
||||
}, this));
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Binds this.props.collection to any this.collection changes, making the component
|
||||
to get instantly rerendered. This has high performance since it uses the
|
||||
{@link http://facebook.github.io/react/|React} virtual DOM.
|
||||
* @param {Backbone.Collection|Object} [collection=this.collection] In case of being
|
||||
an object it calls startCollectionListeners for each entry.
|
||||
* @param {String} [key] In case of multiple collections a key is passed to identify
|
||||
the collection.
|
||||
*/
|
||||
startCollectionListeners: function (collection, key) {
|
||||
if (!collection) collection = this.collection;
|
||||
if (collection instanceof Backbone.Collection)
|
||||
this
|
||||
.listenTo(collection, 'add remove change sort', _.partial(this.setPropsBackbone, collection, key, void 0))
|
||||
.listenTo(collection, 'error', this.onError)
|
||||
.listenTo(collection, 'request', this.onRequest)
|
||||
.listenTo(collection, 'sync', this.onSync);
|
||||
else if (collection)
|
||||
for (key in collection)
|
||||
this.startCollectionListeners(collection[key], key);
|
||||
},
|
||||
/**
|
||||
* Binds this.props to any this.model changes, making the screen component
|
||||
get instantly rerendered in the screen. This has high performance
|
||||
since it uses the {@link http://facebook.github.io/react/|React} virtual DOM.
|
||||
* @param {Backbone.Model|Object} [model=this.model] In case of being
|
||||
an object it calls startModelListeners for each entry.
|
||||
* @param {String} [key] In case of multiple models a key is passed to identify
|
||||
the model.
|
||||
*/
|
||||
startModelListeners: function (model, key) {
|
||||
if (!model) model = this.model;
|
||||
if (model instanceof Backbone.Model)
|
||||
this
|
||||
.listenTo(model, 'change', _.partial(this.setPropsBackbone, model, key, void 0))
|
||||
.listenTo(model, 'error', this.onError)
|
||||
.listenTo(model, 'request', this.onRequest)
|
||||
.listenTo(model, 'sync', this.onSync);
|
||||
else if (model)
|
||||
for (key in model)
|
||||
this.startModelListeners(model[key], key);
|
||||
}
|
||||
});
|
||||
|
||||
return Backbone.React.Component;
|
||||
}));
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "backbone-react-component",
|
||||
"version": "0.4.2",
|
||||
"version": "0.5.0",
|
||||
"filename": "backbone-react-component.js",
|
||||
"description": "Backbone.React.Component is a wrapper for React.Component and brings all the power of Facebook's React to Backbone.js",
|
||||
"author": {
|
||||
@@ -12,14 +12,15 @@
|
||||
"url": "https://github.com/magalhas/backbone-react-component.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"backbone": "~1.1.1",
|
||||
"underscore": "~1.6.0",
|
||||
"react": "~0.8.0"
|
||||
"backbone": "^1.1.2",
|
||||
"underscore": "^1.6.0",
|
||||
"react": "^0.9.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt-contrib-uglify": "~0.3.2",
|
||||
"grunt": "~0.4.2",
|
||||
"grunt-contrib-jasmine": "~0.6.1"
|
||||
"grunt-contrib-uglify": "^0.3.2",
|
||||
"grunt": "^0.4.2",
|
||||
"grunt-contrib-jasmine": "^0.6.1",
|
||||
"grunt-contrib-copy": "^0.5.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "grunt test",
|
||||
@@ -36,7 +37,7 @@
|
||||
],
|
||||
"main": "lib/component",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
"node": ">=0.10"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
|
||||
@@ -0,0 +1,902 @@
|
||||
(function(root, factory) {
|
||||
if(typeof exports === 'object') {
|
||||
module.exports = factory(require('underscore'), require('backbone'));
|
||||
}
|
||||
else if(typeof define === 'function' && define.amd) {
|
||||
define(['underscore', 'backbone'], factory);
|
||||
}
|
||||
else {
|
||||
root.Backbone.Obscura = factory(root._, root.Backbone);
|
||||
}
|
||||
}(this, function(_, Backbone) {
|
||||
var require=function(name){return {"backbone":Backbone,"underscore":_}[name];};
|
||||
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"HusaU0":[function(require,module,exports){
|
||||
|
||||
var _ = require('underscore');
|
||||
var Backbone = require('backbone');
|
||||
|
||||
var FilteredCollection = require('backbone-filtered-collection');
|
||||
var SortedCollection = require('backbone-sorted-collection');
|
||||
var PaginatedCollection = require('backbone-paginated-collection');
|
||||
var proxyCollection = require('backbone-collection-proxy');
|
||||
var proxyEvents = require('./src/proxy-events.js');
|
||||
|
||||
function Obscura(superset, options) {
|
||||
this._superset = superset;
|
||||
|
||||
this._filtered = new FilteredCollection(superset, options);
|
||||
this._sorted = new SortedCollection(this._filtered, options);
|
||||
this._paginated = new PaginatedCollection(this._sorted, options);
|
||||
|
||||
proxyCollection(this._paginated, this);
|
||||
proxyEvents.call(this, this._filtered, filteredEvents);
|
||||
proxyEvents.call(this, this._sorted, sortedEvents);
|
||||
proxyEvents.call(this, this._paginated, paginatedEvents);
|
||||
}
|
||||
|
||||
var methods = {
|
||||
|
||||
superset: function() {
|
||||
return this._superset;
|
||||
},
|
||||
|
||||
getFilteredLength: function() {
|
||||
return this._filtered.length;
|
||||
},
|
||||
|
||||
removeTransforms: function() {
|
||||
this._filtered.resetFilters();
|
||||
this._sorted.removeSort();
|
||||
this._paginated.removePagination();
|
||||
return this;
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
this.stopListening();
|
||||
this._filtered.destroy();
|
||||
this._sorted.destroy();
|
||||
this._paginated.destroy();
|
||||
this.length = 0;
|
||||
|
||||
this.trigger('obscura:destroy');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Methods on `this._filtered` we will expose to the outside world
|
||||
var filteredMethods = [
|
||||
'filterBy', 'removeFilter', 'resetFilters', 'refilter', 'hasFilter',
|
||||
'getFilters'
|
||||
];
|
||||
|
||||
// Events fired from `this._filtered` that we will forward
|
||||
var filteredEvents = [
|
||||
'filtered:add', 'filtered:remove', 'filtered:reset'
|
||||
];
|
||||
|
||||
// Methods on `this._sorted` we will expose to the outside world
|
||||
var sortedMethods = [ 'setSort', 'reverseSort', 'removeSort' ];
|
||||
|
||||
// Events fired from `this._sorted` that we will forward
|
||||
var sortedEvents = [
|
||||
'sorted:add', 'sorted:remove'
|
||||
];
|
||||
|
||||
// Methods on `this._paginated` we will expose to the outside world
|
||||
var paginatedMethods = [
|
||||
'setPerPage', 'setPage', 'getPerPage', 'getNumPages', 'getPage',
|
||||
'hasNextPage', 'hasPrevPage', 'nextPage', 'prevPage', 'movePage',
|
||||
'removePagination', 'firstPage', 'lastPage'
|
||||
];
|
||||
|
||||
// Events fired from `this._paginated` that we will forward
|
||||
var paginatedEvents = [
|
||||
'paginated:change:perPage', 'paginated:change:page', 'paginated:change:numPages'
|
||||
];
|
||||
|
||||
// Extend obscura with each of the above methods, passing the call to the underlying
|
||||
// collection.
|
||||
//
|
||||
// The return value is checked because some of the methods return `this` to allow
|
||||
// chaining, and returning the internal collection would break the abstraction. In
|
||||
// the cases where it would return the internal collection, we can return a reference
|
||||
// to the Obscura proxy, which gives it the expected behavior.
|
||||
|
||||
_.each(filteredMethods, function(method) {
|
||||
methods[method] = function() {
|
||||
var result = FilteredCollection.prototype[method].apply(this._filtered, arguments);
|
||||
return result === this._filtered ? this : result;
|
||||
};
|
||||
});
|
||||
|
||||
_.each(paginatedMethods, function(method) {
|
||||
methods[method] = function() {
|
||||
var result = PaginatedCollection.prototype[method].apply(this._paginated, arguments);
|
||||
return result === this._paginated ? this : result;
|
||||
};
|
||||
});
|
||||
|
||||
_.each(sortedMethods, function(method) {
|
||||
methods[method] = function() {
|
||||
var result = SortedCollection.prototype[method].apply(this._sorted, arguments);
|
||||
return result === this._sorted ? this : result;
|
||||
};
|
||||
});
|
||||
|
||||
_.extend(Obscura.prototype, methods, Backbone.Events);
|
||||
|
||||
// Expose the other proxy types so that the user can use them on their own if they want
|
||||
Obscura.FilteredCollection = FilteredCollection;
|
||||
Obscura.SortedCollection = SortedCollection;
|
||||
Obscura.PaginatedCollection = PaginatedCollection;
|
||||
|
||||
module.exports = Obscura;
|
||||
|
||||
|
||||
},{"./src/proxy-events.js":9,"backbone":false,"backbone-collection-proxy":3,"backbone-filtered-collection":4,"backbone-paginated-collection":6,"backbone-sorted-collection":7,"underscore":false}],"obscura":[function(require,module,exports){
|
||||
module.exports=require('HusaU0');
|
||||
},{}],3:[function(require,module,exports){
|
||||
|
||||
var _ = require('underscore');
|
||||
var Backbone = require('backbone');
|
||||
|
||||
// Methods in the collection prototype that we won't expose
|
||||
var blacklistedMethods = [
|
||||
"_onModelEvent", "_prepareModel", "_removeReference", "_reset", "add",
|
||||
"initialize", "sync", "remove", "reset", "set", "push", "pop", "unshift",
|
||||
"shift", "sort", "parse", "fetch", "create", "model", "off", "on",
|
||||
"listenTo", "listenToOnce", "bind", "trigger", "once", "stopListening"
|
||||
];
|
||||
|
||||
var eventWhiteList = [
|
||||
'add', 'remove', 'reset', 'sort', 'destroy'
|
||||
];
|
||||
|
||||
function proxyCollection(from, target) {
|
||||
|
||||
function updateLength() {
|
||||
target.length = from.length;
|
||||
}
|
||||
|
||||
function pipeEvents(eventName) {
|
||||
var args = _.toArray(arguments);
|
||||
var isChangeEvent = eventName === 'change' ||
|
||||
eventName.slice(0, 7) === 'change:';
|
||||
|
||||
// In the case of a `reset` event, the Collection.models reference
|
||||
// is updated to a new array, so we need to update our reference.
|
||||
if (eventName === 'reset') {
|
||||
target.models = from.models;
|
||||
}
|
||||
|
||||
if (_.contains(eventWhiteList, eventName)) {
|
||||
if (_.contains(['add', 'remove', 'destory'], eventName)) {
|
||||
args[2] = target;
|
||||
} else if (_.contains(['reset', 'sort'], eventName)) {
|
||||
args[1] = target;
|
||||
}
|
||||
target.trigger.apply(this, args);
|
||||
} else if (isChangeEvent) {
|
||||
// In some cases I was seeing change events fired after the model
|
||||
// had already been removed from the collection.
|
||||
if (target.contains(args[1])) {
|
||||
target.trigger.apply(this, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var methods = {};
|
||||
|
||||
_.each(_.functions(Backbone.Collection.prototype), function(method) {
|
||||
if (!_.contains(blacklistedMethods, method)) {
|
||||
methods[method] = function() {
|
||||
return from[method].apply(from, arguments);
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
_.extend(target, Backbone.Events, methods);
|
||||
|
||||
target.listenTo(from, 'all', updateLength);
|
||||
target.listenTo(from, 'all', pipeEvents);
|
||||
target.models = from.models;
|
||||
|
||||
updateLength();
|
||||
return target;
|
||||
}
|
||||
|
||||
module.exports = proxyCollection;
|
||||
|
||||
|
||||
},{"backbone":false,"underscore":false}],4:[function(require,module,exports){
|
||||
var _ = require('underscore');
|
||||
var Backbone = require('backbone');
|
||||
var proxyCollection = require('backbone-collection-proxy');
|
||||
var createFilter = require('./src/create-filter.js');
|
||||
|
||||
// Beware of `this`
|
||||
// All of the following functions are meant to be called in the context
|
||||
// of the FilteredCollection object, but are not public functions.
|
||||
|
||||
function invalidateCache() {
|
||||
this._filterResultCache = {};
|
||||
}
|
||||
|
||||
function invalidateCacheForFilter(filterName) {
|
||||
for (var cid in this._filterResultCache) {
|
||||
if (this._filterResultCache.hasOwnProperty(cid)) {
|
||||
delete this._filterResultCache[cid][filterName];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addFilter(filterName, filterObj) {
|
||||
// If we've already had a filter of this name, we need to invalidate
|
||||
// any and all of the cached results
|
||||
if (this._filters[filterName]) {
|
||||
invalidateCacheForFilter.call(this, filterName);
|
||||
}
|
||||
|
||||
this._filters[filterName] = filterObj;
|
||||
this.trigger('filtered:add', filterName);
|
||||
}
|
||||
|
||||
function removeFilter(filterName) {
|
||||
delete this._filters[filterName];
|
||||
invalidateCacheForFilter.call(this, filterName);
|
||||
this.trigger('filtered:remove', filterName);
|
||||
}
|
||||
|
||||
function execFilterOnModel(model) {
|
||||
if (!this._filterResultCache[model.cid]) {
|
||||
this._filterResultCache[model.cid] = {};
|
||||
}
|
||||
|
||||
var cache = this._filterResultCache[model.cid];
|
||||
|
||||
for (var filterName in this._filters) {
|
||||
if (this._filters.hasOwnProperty(filterName)) {
|
||||
// if we haven't already calculated this, calculate it and cache
|
||||
if (!cache.hasOwnProperty(filterName)) {
|
||||
cache[filterName] = this._filters[filterName].fn(model);
|
||||
}
|
||||
if (!cache[filterName]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function execFilter() {
|
||||
var filtered = [];
|
||||
|
||||
// Filter the collection
|
||||
if (this._superset) {
|
||||
filtered = this._superset.filter(_.bind(execFilterOnModel, this));
|
||||
}
|
||||
|
||||
this._collection.reset(filtered);
|
||||
this.length = this._collection.length;
|
||||
}
|
||||
|
||||
function onAddChange(model) {
|
||||
// reset the cached results
|
||||
this._filterResultCache[model.cid] = {};
|
||||
|
||||
if (execFilterOnModel.call(this, model)) {
|
||||
if (!this._collection.get(model.cid)) {
|
||||
var index = this.superset().indexOf(model);
|
||||
|
||||
// Find the index at which to insert the model in the
|
||||
// filtered collection by finding the index of the
|
||||
// previous non-filtered model in the filtered collection
|
||||
var filteredIndex = null;
|
||||
for (var i = index - 1; i >= 0; i -= 1) {
|
||||
if (this.contains(this.superset().at(i))) {
|
||||
filteredIndex = this.indexOf(this.superset().at(i)) + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
filteredIndex = filteredIndex || 0;
|
||||
|
||||
this._collection.add(model, { at: filteredIndex });
|
||||
}
|
||||
} else {
|
||||
if (this._collection.get(model.cid)) {
|
||||
this._collection.remove(model);
|
||||
}
|
||||
}
|
||||
this.length = this._collection.length;
|
||||
}
|
||||
|
||||
// This fires on 'change:[attribute]' events. We only want to
|
||||
// remove this model if it fails the test, but not add it if
|
||||
// it does. If we remove it, it will prevent the 'change'
|
||||
// events from being forwarded, and if we add it, it will cause
|
||||
// an unneccesary 'change' event to be forwarded without the
|
||||
// 'change:[attribute]' that goes along with it.
|
||||
function onModelAttributeChange(model) {
|
||||
// reset the cached results
|
||||
this._filterResultCache[model.cid] = {};
|
||||
|
||||
if (!execFilterOnModel.call(this, model)) {
|
||||
if (this._collection.get(model.cid)) {
|
||||
this._collection.remove(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onAll(eventName, model, value) {
|
||||
if (eventName.slice(0, 7) === "change:") {
|
||||
onModelAttributeChange.call(this, arguments[1]);
|
||||
}
|
||||
}
|
||||
|
||||
function onModelRemove(model) {
|
||||
if (this.contains(model)) {
|
||||
this._collection.remove(model);
|
||||
}
|
||||
this.length = this._collection.length;
|
||||
}
|
||||
|
||||
function Filtered(superset) {
|
||||
// Save a reference to the original collection
|
||||
this._superset = superset;
|
||||
|
||||
// The idea is to keep an internal backbone collection with the filtered
|
||||
// set, and expose limited functionality.
|
||||
this._collection = new Backbone.Collection(superset.toArray());
|
||||
proxyCollection(this._collection, this);
|
||||
|
||||
// Set up the filter data structures
|
||||
this.resetFilters();
|
||||
|
||||
this.listenTo(this._superset, 'reset sort', execFilter);
|
||||
this.listenTo(this._superset, 'add change', onAddChange);
|
||||
this.listenTo(this._superset, 'remove', onModelRemove);
|
||||
this.listenTo(this._superset, 'all', onAll);
|
||||
}
|
||||
|
||||
var methods = {
|
||||
|
||||
defaultFilterName: '__default',
|
||||
|
||||
filterBy: function(filterName, filter) {
|
||||
// Allow the user to skip the filter name if they're only using one filter
|
||||
if (!filter) {
|
||||
filter = filterName;
|
||||
filterName = this.defaultFilterName;
|
||||
}
|
||||
|
||||
addFilter.call(this, filterName, createFilter(filter));
|
||||
|
||||
execFilter.call(this);
|
||||
return this;
|
||||
},
|
||||
|
||||
removeFilter: function(filterName) {
|
||||
if (!filterName) {
|
||||
filterName = this.defaultFilterName;
|
||||
}
|
||||
|
||||
removeFilter.call(this, filterName);
|
||||
|
||||
execFilter.call(this);
|
||||
return this;
|
||||
},
|
||||
|
||||
resetFilters: function() {
|
||||
this._filters = {};
|
||||
invalidateCache.call(this);
|
||||
|
||||
this.trigger('filtered:reset');
|
||||
|
||||
execFilter.call(this);
|
||||
return this;
|
||||
},
|
||||
|
||||
superset: function() {
|
||||
return this._superset;
|
||||
},
|
||||
|
||||
refilter: function(arg) {
|
||||
if (typeof arg === "object" && arg.cid) {
|
||||
// is backbone model, refilter that one
|
||||
onAddChange.call(this, arg);
|
||||
} else {
|
||||
// refilter everything
|
||||
invalidateCache.call(this);
|
||||
execFilter.call(this);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
getFilters: function() {
|
||||
return _.keys(this._filters);
|
||||
},
|
||||
|
||||
hasFilter: function(name) {
|
||||
return _.contains(this.getFilters(), name);
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
this.stopListening();
|
||||
this._collection.reset([]);
|
||||
this._superset = this._collection;
|
||||
this.length = 0;
|
||||
|
||||
this.trigger('filtered:destroy');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Build up the prototype
|
||||
_.extend(Filtered.prototype, methods, Backbone.Events);
|
||||
|
||||
module.exports = Filtered;
|
||||
|
||||
|
||||
},{"./src/create-filter.js":5,"backbone":false,"backbone-collection-proxy":3,"underscore":false}],5:[function(require,module,exports){
|
||||
var _ = require('underscore');
|
||||
|
||||
// Converts a key and value into a function that accepts a model
|
||||
// and returns a boolean.
|
||||
function convertKeyValueToFunction(key, value) {
|
||||
return function(model) {
|
||||
return model.get(key) === value;
|
||||
};
|
||||
}
|
||||
|
||||
// Converts a key and an associated filter function into a function
|
||||
// that accepts a model and returns a boolean.
|
||||
function convertKeyFunctionToFunction(key, fn) {
|
||||
return function(model) {
|
||||
return fn(model.get(key));
|
||||
};
|
||||
}
|
||||
|
||||
function createFilterObject(filterFunction, keys) {
|
||||
// Make sure the keys value is either an array or null
|
||||
if (!_.isArray(keys)) {
|
||||
keys = null;
|
||||
}
|
||||
return { fn: filterFunction, keys: keys };
|
||||
}
|
||||
|
||||
// Accepts an object in the form of:
|
||||
//
|
||||
// {
|
||||
// key: value,
|
||||
// key: function(val) { ... }
|
||||
// }
|
||||
//
|
||||
// and turns it into a function that accepts a model an returns a
|
||||
// boolean + a list of the keys that the function depends on.
|
||||
function createFilterFromObject(filterObj) {
|
||||
var keys = _.keys(filterObj);
|
||||
|
||||
var filterFunctions = _.map(keys, function(key) {
|
||||
var val = filterObj[key];
|
||||
if (_.isFunction(val)) {
|
||||
return convertKeyFunctionToFunction(key, val);
|
||||
}
|
||||
return convertKeyValueToFunction(key, val);
|
||||
});
|
||||
|
||||
// Iterate through each of the generated filter functions. If any
|
||||
// are false, kill the computation and return false. The function
|
||||
// is only true if all of the subfunctions are true.
|
||||
var filterFunction = function(model) {
|
||||
for (var i = 0; i < filterFunctions.length; i++) {
|
||||
if (!filterFunctions[i](model)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
return createFilterObject(filterFunction, keys);
|
||||
}
|
||||
|
||||
// Expects one of the following:
|
||||
//
|
||||
// - A filter function that accepts a model + (optional) array of
|
||||
// keys to listen to changes for or null)
|
||||
// - An object describing a filter
|
||||
function createFilter(filter, keys) {
|
||||
// This must go first because _.isObject(fn) === true
|
||||
if (_.isFunction(filter)) {
|
||||
return createFilterObject(filter, keys);
|
||||
}
|
||||
|
||||
// If the filter is an object describing a filter, generate the
|
||||
// appropriate function.
|
||||
if (_.isObject(filter)) {
|
||||
return createFilterFromObject(filter);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = createFilter;
|
||||
|
||||
|
||||
},{"underscore":false}],6:[function(require,module,exports){
|
||||
|
||||
var _ = require('underscore');
|
||||
var Backbone = require('backbone');
|
||||
var proxyCollection = require('backbone-collection-proxy');
|
||||
|
||||
function getPageLimits() {
|
||||
var start = this.getPage() * this.getPerPage();
|
||||
var end = start + this.getPerPage();
|
||||
return [start, end];
|
||||
}
|
||||
|
||||
function updatePagination() {
|
||||
var pages = getPageLimits.call(this);
|
||||
this._collection.reset(this.superset().slice(pages[0], pages[1]));
|
||||
}
|
||||
|
||||
function updateNumPages() {
|
||||
var currentNumPages = this._totalPages;
|
||||
var length = this.superset().length;
|
||||
var perPage = this.getPerPage();
|
||||
|
||||
// If the # of objects can be exactly divided by the number
|
||||
// of pages, it would leave an empty last page if we took
|
||||
// the floor.
|
||||
var totalPages = length % perPage === 0 ?
|
||||
(length / perPage) : Math.floor(length / perPage) + 1;
|
||||
|
||||
var numPagesChanged = this._totalPages !== totalPages;
|
||||
this._totalPages = totalPages;
|
||||
|
||||
if (numPagesChanged) {
|
||||
this.trigger('paginated:change:numPages', { numPages: totalPages });
|
||||
}
|
||||
|
||||
// Test to see if we are past the last page, and if so,
|
||||
// move back. Return true so that we can test to see if
|
||||
// this happened.
|
||||
if (this.getPage() >= totalPages) {
|
||||
this.setPage(totalPages - 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function recalculatePagination() {
|
||||
if (updateNumPages.call(this)) { return; }
|
||||
updatePagination.call(this);
|
||||
}
|
||||
|
||||
// Given two arrays of backbone models, with at most one model added
|
||||
// and one model removed from each, return the model in arrayA that
|
||||
// is not in arrayB or undefined.
|
||||
function difference(arrayA, arrayB) {
|
||||
var maxLength = _.max([ arrayA.length, arrayB.length ]);
|
||||
|
||||
for (var i = 0, j = 0; i < maxLength; i += 1, j += 1) {
|
||||
if (arrayA[i] !== arrayB[j]) {
|
||||
if (arrayB[i-1] === arrayA[i]) {
|
||||
j -= 1;
|
||||
} else if (arrayB[i+1] === arrayA[i]) {
|
||||
j += 1;
|
||||
} else {
|
||||
return arrayA[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onAddRemove(model, collection, options) {
|
||||
if (updateNumPages.call(this)) { return; }
|
||||
|
||||
var pages = getPageLimits.call(this);
|
||||
var start = pages[0], end = pages[1];
|
||||
|
||||
// We are only adding and removing at most one model at a time,
|
||||
// so we can find just those two models. We could probably rewrite
|
||||
// `collectionDifference` to only make on pass instead of two. This
|
||||
// is a bottleneck on the total size of collections. I was getting
|
||||
// slow unit tests around 30,000 models / page in Firefox.
|
||||
var toAdd = difference(this.superset().slice(start, end), this._collection.toArray());
|
||||
var toRemove = difference(this._collection.toArray(), this.superset().slice(start, end));
|
||||
|
||||
if (toRemove) {
|
||||
this._collection.remove(toRemove);
|
||||
}
|
||||
|
||||
if (toAdd) {
|
||||
this._collection.add(toAdd, {
|
||||
at: this.superset().indexOf(toAdd) - start
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function Paginated(superset, options) {
|
||||
// Save a reference to the original collection
|
||||
this._superset = superset;
|
||||
|
||||
// The idea is to keep an internal backbone collection with the paginated
|
||||
// set, and expose limited functionality.
|
||||
this._collection = new Backbone.Collection(superset.toArray());
|
||||
this._page = 0;
|
||||
this.setPerPage((options && options.perPage) ? options.perPage : null);
|
||||
|
||||
proxyCollection(this._collection, this);
|
||||
|
||||
this.listenTo(this._superset, 'add remove', onAddRemove);
|
||||
this.listenTo(this._superset, 'reset sort', recalculatePagination);
|
||||
}
|
||||
|
||||
var methods = {
|
||||
|
||||
removePagination: function() {
|
||||
this.setPerPage(null);
|
||||
return this;
|
||||
},
|
||||
|
||||
setPerPage: function(perPage) {
|
||||
this._perPage = perPage;
|
||||
recalculatePagination.call(this);
|
||||
this.setPage(0);
|
||||
|
||||
this.trigger('paginated:change:perPage', {
|
||||
perPage: perPage,
|
||||
numPages: this.getNumPages()
|
||||
});
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
setPage: function(page) {
|
||||
// The lowest page we could set
|
||||
var lowerLimit = 0;
|
||||
// The highest page we could set
|
||||
var upperLimit = this.getNumPages() - 1;
|
||||
|
||||
// If the page is higher or lower than these limits,
|
||||
// set it to the limit.
|
||||
page = page > lowerLimit ? page : lowerLimit;
|
||||
page = page < upperLimit ? page : upperLimit;
|
||||
page = page < 0 ? 0 : page;
|
||||
|
||||
this._page = page;
|
||||
updatePagination.call(this);
|
||||
|
||||
this.trigger('paginated:change:page', { page: page });
|
||||
return this;
|
||||
},
|
||||
|
||||
getPerPage: function() {
|
||||
return this._perPage || this.superset().length || 1;
|
||||
},
|
||||
|
||||
getNumPages: function() {
|
||||
return this._totalPages;
|
||||
},
|
||||
|
||||
getPage: function() {
|
||||
return this._page;
|
||||
},
|
||||
|
||||
hasNextPage: function() {
|
||||
return this.getPage() < this.getNumPages() - 1;
|
||||
},
|
||||
|
||||
hasPrevPage: function() {
|
||||
return this.getPage() > 0;
|
||||
},
|
||||
|
||||
nextPage: function() {
|
||||
this.movePage(1);
|
||||
return this;
|
||||
},
|
||||
|
||||
prevPage: function() {
|
||||
this.movePage(-1);
|
||||
return this;
|
||||
},
|
||||
|
||||
firstPage: function() {
|
||||
this.setPage(0);
|
||||
},
|
||||
|
||||
lastPage: function() {
|
||||
this.setPage(this.getNumPages() - 1);
|
||||
},
|
||||
|
||||
movePage: function(delta) {
|
||||
this.setPage(this.getPage() + delta);
|
||||
return this;
|
||||
},
|
||||
|
||||
superset: function() {
|
||||
return this._superset;
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
this.stopListening();
|
||||
this._collection.reset([]);
|
||||
this._superset = this._collection;
|
||||
this._page = 0;
|
||||
this._totalPages = 0;
|
||||
this.length = 0;
|
||||
|
||||
this.trigger('paginated:destroy');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Build up the prototype
|
||||
_.extend(Paginated.prototype, methods, Backbone.Events);
|
||||
|
||||
module.exports = Paginated;
|
||||
|
||||
|
||||
},{"backbone":false,"backbone-collection-proxy":3,"underscore":false}],7:[function(require,module,exports){
|
||||
|
||||
var _ = require('underscore');
|
||||
var Backbone =require('backbone');
|
||||
var proxyCollection = require('backbone-collection-proxy');
|
||||
var reverseSortedIndex = require('./src/reverse-sorted-index.js');
|
||||
|
||||
function lookupIterator(value) {
|
||||
return _.isFunction(value) ? value : function(obj){ return obj.get(value); };
|
||||
}
|
||||
|
||||
function modelInsertIndex(model) {
|
||||
if (!this._comparator) {
|
||||
return this._superset.indexOf(model);
|
||||
} else {
|
||||
if (!this._reverse) {
|
||||
return _.sortedIndex(this._collection.toArray(), model, lookupIterator(this._comparator));
|
||||
} else {
|
||||
return reverseSortedIndex(this._collection.toArray(), model, lookupIterator(this._comparator));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onAdd(model) {
|
||||
var index = modelInsertIndex.call(this, model);
|
||||
this._collection.add(model, { at: index });
|
||||
}
|
||||
|
||||
function onRemove(model) {
|
||||
if (this.contains(model)) {
|
||||
this._collection.remove(model);
|
||||
}
|
||||
}
|
||||
|
||||
function onChange(model) {
|
||||
if (this.contains(model) && this._collection.indexOf(model) !== modelInsertIndex.call(this, model)) {
|
||||
this._collection.remove(model);
|
||||
onAdd.call(this, model);
|
||||
}
|
||||
}
|
||||
|
||||
function sort() {
|
||||
if (!this._comparator) {
|
||||
this._collection.reset(this._superset.toArray());
|
||||
return;
|
||||
}
|
||||
|
||||
var newOrder = this._superset.sortBy(this._comparator);
|
||||
this._collection.reset(this._reverse ? newOrder.reverse() : newOrder);
|
||||
}
|
||||
|
||||
function Sorted(superset) {
|
||||
// Save a reference to the original collection
|
||||
this._superset = superset;
|
||||
this._reverse = false;
|
||||
this._comparator = null;
|
||||
|
||||
// The idea is to keep an internal backbone collection with the paginated
|
||||
// set, and expose limited functionality.
|
||||
this._collection = new Backbone.Collection(superset.toArray());
|
||||
proxyCollection(this._collection, this);
|
||||
|
||||
this.listenTo(this._superset, 'add', onAdd);
|
||||
this.listenTo(this._superset, 'remove', onRemove);
|
||||
this.listenTo(this._superset, 'change', onChange);
|
||||
this.listenTo(this._superset, 'reset', sort);
|
||||
}
|
||||
|
||||
var methods = {
|
||||
|
||||
setSort: function(comparator, direction) {
|
||||
this._reverse = direction === 'desc' ? true : false;
|
||||
this._comparator = comparator;
|
||||
|
||||
sort.call(this);
|
||||
|
||||
if (!comparator) {
|
||||
this.trigger('sorted:remove');
|
||||
} else {
|
||||
this.trigger('sorted:add');
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
reverseSort: function() {
|
||||
this._reverse = !this._reverse;
|
||||
sort.call(this);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
removeSort: function() {
|
||||
this.setSort();
|
||||
return this;
|
||||
},
|
||||
|
||||
superset: function() {
|
||||
return this._superset;
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
this.stopListening();
|
||||
this._collection.reset([]);
|
||||
this._superset = this._collection;
|
||||
this.length = 0;
|
||||
|
||||
this.trigger('sorted:destroy');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Build up the prototype
|
||||
_.extend(Sorted.prototype, methods, Backbone.Events);
|
||||
|
||||
module.exports = Sorted;
|
||||
|
||||
|
||||
},{"./src/reverse-sorted-index.js":8,"backbone":false,"backbone-collection-proxy":3,"underscore":false}],8:[function(require,module,exports){
|
||||
|
||||
var _ = require('underscore');
|
||||
|
||||
// Underscore provides a .sortedIndex function that works
|
||||
// when sorting ascending based on a function or a key, but there's no
|
||||
// way to do the same thing when sorting descending. This is a slight
|
||||
// modification of the underscore / backbone code to do the same thing
|
||||
// but descending.
|
||||
|
||||
function lookupIterator(value) {
|
||||
return _.isFunction(value) ? value : function(obj){ return obj[value]; };
|
||||
}
|
||||
|
||||
function reverseSortedIndex(array, obj, iterator, context) {
|
||||
iterator = iterator == null ? _.identity : lookupIterator(iterator);
|
||||
var value = iterator.call(context, obj);
|
||||
var low = 0, high = array.length;
|
||||
while (low < high) {
|
||||
var mid = (low + high) >>> 1;
|
||||
iterator.call(context, array[mid]) < value ? high = mid : low = mid + 1;
|
||||
}
|
||||
return low;
|
||||
}
|
||||
|
||||
module.exports = reverseSortedIndex;
|
||||
|
||||
},{"underscore":false}],9:[function(require,module,exports){
|
||||
var _ = require('underscore');
|
||||
|
||||
function proxyEvents(from, eventNames) {
|
||||
_.each(eventNames, function(eventName) {
|
||||
this.listenTo(from, eventName, function() {
|
||||
var args = _.toArray(arguments);
|
||||
args.unshift(eventName);
|
||||
this.trigger.apply(this, args);
|
||||
});
|
||||
}, this);
|
||||
}
|
||||
|
||||
module.exports = proxyEvents;
|
||||
|
||||
},{"underscore":false}]},{},[])
|
||||
return require('obscura');
|
||||
|
||||
}));
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "backbone.obscura",
|
||||
"filename": "backbone.obscura.min.js",
|
||||
"version": "0.1.5",
|
||||
"version": "0.1.6",
|
||||
"description": "A read-only proxy of a Backbone.Collection that can easily be filtered, sorted, and paginated.",
|
||||
"homepage": "https://github.com/jmorrell/backbone.obscura",
|
||||
"main": "index.js",
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
.highlight .hll{background-color:#ffc}.highlight{background:#f0f3f3}.highlight .c{color:#09f;font-style:italic}.highlight .err{color:#a00;background-color:#faa}.highlight .k{color:#069;font-weight:bold}.highlight .o{color:#555}.highlight .cm{color:#09f;font-style:italic}.highlight .cp{color:#099}.highlight .c1{color:#09f;font-style:italic}.highlight .cs{color:#09f;font-weight:bold;font-style:italic}.highlight .gd{background-color:#fcc;border:1px solid #c00}.highlight .ge{font-style:italic}.highlight .gr{color:#f00}.highlight .gh{color:#030;font-weight:bold}.highlight .gi{background-color:#cfc;border:1px solid #0c0}.highlight .go{color:#aaa}.highlight .gp{color:#009;font-weight:bold}.highlight .gs{font-weight:bold}.highlight .gu{color:#030;font-weight:bold}.highlight .gt{color:#9c6}.highlight .kc{color:#069;font-weight:bold}.highlight .kd{color:#069;font-weight:bold}.highlight .kn{color:#069;font-weight:bold}.highlight .kp{color:#069}.highlight .kr{color:#069;font-weight:bold}.highlight .kt{color:#078;font-weight:bold}.highlight .m{color:#f60}.highlight .s{color:#c30}.highlight .na{color:#309}.highlight .nb{color:#366}.highlight .nc{color:#0a8;font-weight:bold}.highlight .no{color:#360}.highlight .nd{color:#99f}.highlight .ni{color:#999;font-weight:bold}.highlight .ne{color:#c00;font-weight:bold}.highlight .nf{color:#c0f}.highlight .nl{color:#99f}.highlight .nn{color:#0cf;font-weight:bold}.highlight .nt{color:#309;font-weight:bold}.highlight .nv{color:#033}.highlight .ow{color:#000;font-weight:bold}.highlight .w{color:#bbb}.highlight .mf{color:#f60}.highlight .mh{color:#f60}.highlight .mi{color:#f60}.highlight .mo{color:#f60}.highlight .sb{color:#c30}.highlight .sc{color:#c30}.highlight .sd{color:#c30;font-style:italic}.highlight .s2{color:#c30}.highlight .se{color:#c30;font-weight:bold}.highlight .sh{color:#c30}.highlight .si{color:#a00}.highlight .sx{color:#c30}.highlight .sr{color:#3aa}.highlight .s1{color:#c30}.highlight .ss{color:#fc3}.highlight .bp{color:#366}.highlight .vc{color:#033}.highlight .vg{color:#033}.highlight .vi{color:#033}.highlight .il{color:#f60}.type-csharp .highlight .k{color:#00f}.type-csharp .highlight .kt{color:#00f}.type-csharp .highlight .nf{color:#000;font-weight:normal}.type-csharp .highlight .nc{color:#2b91af}.type-csharp .highlight .nn{color:#000}.type-csharp .highlight .s{color:#a31515}.type-csharp .highlight .sc{color:#a31515}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
$(function(){$('button[type="submit"]').click(function(){var c=$(this).parent(),b=[],a=$("<pre/>",{"class":"prettyprint"});$.each(c.serializeArray(),function(e,d){b.push(d.name+" => "+d.value)});a.html("\n"+b.join("\n\n")+"\n");c.replaceWith(a);return false});$("#target-editor-with-custom-buttons").markdown({additionalButtons:[[{name:"groupCustom",data:[{name:"cmdBeer",title:"Beer",icon:"icon icon-glass",callback:function(g){var b,h,c=g.getSelection(),f=g.getContent(),d=["Heinekken","Budweiser","Iron City","Amstel Light","Red Stripe","Smithwicks","Westvleteren","Sierra Nevada","Guinness","Corona","Calsberg"],a=Math.floor((Math.random()*10)+1);b=d[a];g.replaceSelection(b);h=c.start;g.setSelection(h,h+b.length)}}]}]]});$("#editor-triger-init").click(function(){$("#target-editor").markdown({savable:true,onShow:function(a){alert("Showing "+a.$textarea.prop("tagName").toLowerCase()+"#"+a.$textarea.attr("id")+" as Markdown Editor...")},onPreview:function(c){var b;if(c.isDirty()){var a=c.getContent();b="Prepended text here...\n"+a+"\nApended text here..."}else{b="Default content"}return b},onSave:function(a){alert('Saving "'+a.getContent()+'"...')},onBlur:function(a){alert("Blur triggered!")}});$(this).hide();return false})});
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
var toMarkdown=function(l){var h=[{patterns:"p",replacement:function(j,i,p){return p?"\n\n"+p+"\n":""}},{patterns:"br",type:"void",replacement:"\n"},{patterns:"h([1-6])",replacement:function(s,j,q,t){var p="";for(var r=0;r<j;r++){p+="#"}return"\n\n"+p+" "+t+"\n"}},{patterns:"hr",type:"void",replacement:"\n\n* * *\n"},{patterns:"a",replacement:function(q,j,r){var i=j.match(n("href")),p=j.match(n("title"));return i?"["+r+"]("+i[1]+(p&&p[1]?' "'+p[1]+'"':"")+")":q}},{patterns:["b","strong"],replacement:function(j,i,p){return p?"**"+p+"**":""}},{patterns:["i","em"],replacement:function(j,i,p){return p?"_"+p+"_":""}},{patterns:"code",replacement:function(j,i,p){return p?"`"+p+"`":""}},{patterns:"img",type:"void",replacement:function(r,i,s){var q=i.match(n("src")),j=i.match(n("alt")),p=i.match(n("title"));return"!["+(j&&j[1]?j[1]:"")+"]("+q[1]+(p&&p[1]?' "'+p[1]+'"':"")+")"}}];for(var k=0,m=h.length;k<m;k++){if(typeof h[k].patterns==="string"){l=e(l,{tag:h[k].patterns,replacement:h[k].replacement,type:h[k].type})}else{for(var f=0,g=h[k].patterns.length;f<g;f++){l=e(l,{tag:h[k].patterns[f],replacement:h[k].replacement,type:h[k].type})}}}function e(j,q){var r=q.type==="void"?"<"+q.tag+"\\b([^>]*)\\/?>":"<"+q.tag+"\\b([^>]*)>([\\s\\S]*?)<\\/"+q.tag+">",p=new RegExp(r,"gi"),i="";if(typeof q.replacement==="string"){i=j.replace(p,q.replacement)}else{i=j.replace(p,function(v,u,t,s){return q.replacement.call(this,v,u,t,s)})}return i}function n(i){return new RegExp(i+"\\s*=\\s*[\"']?([^\"']*)[\"']?","i")}l=l.replace(/<pre\b[^>]*>`([\s\S]*)`<\/pre>/gi,function(i,j){j=j.replace(/^\t+/g," ");j=j.replace(/\n/g,"\n ");return"\n\n "+j+"\n"});l=l.replace(/^(\s{0,3}\d+)\. /g,"$1\\. ");var o=/<(ul|ol)\b[^>]*>(?:(?!<ul|<ol)[\s\S])*?<\/\1>/gi;while(l.match(o)){l=l.replace(o,function(i){return c(i)})}function c(i){i=i.replace(/<(ul|ol)\b[^>]*>([\s\S]*?)<\/\1>/gi,function(r,p,s){var j=s.split("</li>");j.splice(j.length-1,1);for(k=0,m=j.length;k<m;k++){if(j[k]){var q=(p==="ol")?(k+1)+". ":"* ";j[k]=j[k].replace(/\s*<li[^>]*>([\s\S]*)/i,function(t,u){u=u.replace(/^\s+/,"");u=u.replace(/\n\n/g,"\n\n ");u=u.replace(/\n([ ]*)+(\*|\d+\.) /g,"\n$1 $2 ");return q+u})}}return j.join("\n")});return"\n\n"+i.replace(/[ \t]+\n|\s+$/g,"")}var b=/<blockquote\b[^>]*>((?:(?!<blockquote)[\s\S])*?)<\/blockquote>/gi;while(l.match(b)){l=l.replace(b,function(i){return a(i)})}function a(i){i=i.replace(/<blockquote\b[^>]*>([\s\S]*?)<\/blockquote>/gi,function(p,j){j=j.replace(/^\s+|\s+$/g,"");j=d(j);j=j.replace(/^/gm,"> ");j=j.replace(/^(>([ \t]{2,}>)+)/gm,"> >");return j});return i}function d(i){i=i.replace(/^[\t\r\n]+|[\t\r\n]+$/g,"");i=i.replace(/\n\s+\n/g,"\n\n");i=i.replace(/\n{3,}/g,"\n\n");return i}return d(l)};if(typeof exports==="object"){exports.toMarkdown=toMarkdown};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
.md-editor{display:block;border:1px solid #ddd}.md-editor>.md-header,.md-editor .md-footer{display:block;padding:6px 4px;background:#fff}.md-editor>.md-preview{background:#fff;border-top:1px dashed #ddd;border-bottom:1px dashed #ddd;min-height:10px}.md-editor>textarea{font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:14px;outline:0;outline:thin dotted \9;margin:0;display:block;padding:0;width:100%;border:0;border-top:1px dashed #ddd;border-bottom:1px dashed #ddd;border-radius:0;box-shadow:none;background:#eee}.md-editor>textarea:focus{box-shadow:none;background:#fff}.md-editor.active{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,0.6)}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "bootstrap-markdown",
|
||||
"filename": "js/bootstrap-markdown.js",
|
||||
"version": "2.1.1",
|
||||
"version": "2.2.1",
|
||||
"description": "A bootstrap plugin for markdown editing",
|
||||
"homepage": "https://github.com/toopay/bootstrap-markdown",
|
||||
"keywords": [
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,70 @@
|
||||
html, body, iframe, div {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
#epiceditor-utilbar {
|
||||
position:fixed;
|
||||
bottom:10px;
|
||||
right:10px;
|
||||
}
|
||||
|
||||
#epiceditor-utilbar button {
|
||||
display:block;
|
||||
float:left;
|
||||
width:30px;
|
||||
height:30px;
|
||||
border:none;
|
||||
background:none;
|
||||
}
|
||||
|
||||
#epiceditor-utilbar button.epiceditor-toggle-preview-btn {
|
||||
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAf9JREFUeNrsVu1twjAQLZmAEcIGYYKGDWACkgkSkPiQ+CifAoEgyQTQDegEpROQDZoRMgH0HToj1yIglKr90Vg62T6f/e4d9gu50+n09BctlwFnwP8TOAgCA10VRr2ZELaHhbBXx3HCVMC+71voXmD6g4Qi2NB13e1DwAAkZhtmmKYRcxsJhHeBPc8bMMufbDU0PxF4vV4TSyth8477csI6lTV/a71er9tioonBarXaIAmLErliNWyqoM8nrJPpHFNLWLcI4xvj5XKpMo2ZgcvzIvs+75S0wKwPPB/CnpWXsG00Gra2WCwshekOVoC9Sb6IGN1ge2HNsWK+B0iJqxAL5oSpYeDJJW02mxVYLAWSGfDtebylA68Bc4wh+ahK5PcxLh6PR5GUpym/iTOfz89PqNVqhRI4iQf1/o174HNMVYDSGeTDmXQ3znogCGrtdpsYVBhER1aH2Wzm8iE7UR74DMTWGNxUQWmNYqTEzq8APoo9sJ8wKoR5eU7T6VQVjZAvx4YvDJWt1Ol0QsTqkppF8EW8/12OhTnSpT2LCe2/KiCTyUQVkJgPuwgb6XG32w05Xui4q0imLLNDxA/uSuZ4PNaZqZlSsejDYfd6veihj8RoNDK5XOUHAen3Dfr9/j7VZxEJ6AwuxCCvhMTM7oNAARhl/0Ay4Az419qXAAMAfBdK7281j6YAAAAASUVORK5CYII=);
|
||||
}
|
||||
|
||||
#epiceditor-utilbar button.epiceditor-toggle-edit-btn {
|
||||
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAnVJREFUeNrsV+lt4lAQNtEWAB2QCtZ0ABWsqYB1BU5AgDgkQOISl9cV4FQQtgLYCuKtIN4K4gogM9H3pMmLTTh24c+O9An7+XnOb8aP1G63M64hN8aV5GqGvxyyyfO8Y3S6hDtc2wTfcZyLRPwdvxEbPSviIwjIRtO49s9ONSRLMIGvwkBI+EPYEEqyQmcZdl2Xo3BgcJ90xPUGDh1veLFYWCBK9oQ6P4BgiXVO6fUjg5zCJcE6kVxsLEN4QTlWzO5yuRwlGp7P55zOxz1RRqK2SfKD8BvOG4IHxUqlEnxop9lsZpITa0KWndGwIeQIXswzHbynpK2xzjXbeBfxdDrlhbUWjYyuiJS9fBJxgL3PItKsprNQrVaD1GQyYUVP2oYelDziPoPnT5+k2QajleEC3usI/exM7oYiXor0hpxS8qhLv5FIVVrcBwkp5ueclbS27qNMvkj7kg3nZX1qtVqAaSUN5OGUwn2M4RUb3263plh700E6I7wTKn1suCAW3PF4zL1r1Ov1SBhXZLEJFqGTQCq5N1BZIp3s+DOi5fXcG7lGo1Ea5DIFSWzcq7a4R6uYqJmlkSqHoeGKeq+w905MtGKj0Yje9TE5ID9pqictQQwmXTfh82cIJ0NML0d0QY8MdhMn13A4zENB0hAJEYn6EnGL3MZ0hsyG3Ww2g70jU8lgMOhqHicJz+KfovVkz3J5/FardfhBgDZzS90SeoJ8cXjQJlUAEmZUCx30kYiTfr9vgFRc72+ChCHSzNH+Qgk+fA7b7fZZJ5AAiIRhT4zUv3/Y07LiaPW9yPE2L5jrI/p/d7wVEZe0U8bJkvr/F+ZS8irAAIorRozUvI0gAAAAAElFTkSuQmCC);
|
||||
}
|
||||
|
||||
#epiceditor-utilbar button.epiceditor-fullscreen-btn {
|
||||
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAY5JREFUeNrsV8tthDAQhYgCtoV04BKghK2En5AQBw4IITjwq2RLgBJcwpawHZAxMpGDYGwTFPaQkUbG1sybj58NmNM0GVfIh3GRXBbYEid932N9d1zXHWWAGAb4m+9VsUA0H5SubKkKIGA4qyUC2qKBxSCe541HKln7dV2nVbHRtq0Nw7CXGNtz/jzwqjZ5odtqTOagQRC82KRpGkcS/L2Ok7lXZV3Xp7Q6DMNR2mqNthMhKXLqzcUCc6Wgn3wU1wlX1PboHs8tjaLoyVtLT7JFK2ZZM6CZvWyE+X1Voaj3la3DMA63epGqqm4wfyCBH8xmz1+Z1WVZ2vyqU2HvHtv9OI4PsRpjL91YV2a7pcB8onmOifYFUhSFLQCTnQtkDpokyYv73JBtcAQsA3zGTXJBEgNXgrF3CcrBZGwnC+4uqxHnH+zN8/ybvexZwvZNhlsHbrt5CyCgDtu1XosUe58K4kuOF9EKnKYp20eVrxDUJssyreM0bDg4kIw0EfCbftvqQ6KKYf7/wvyVfAkwAMjqoFSaWbrBAAAAAElFTkSuQmCC);
|
||||
}
|
||||
|
||||
@media
|
||||
only screen and (-webkit-min-device-pixel-ratio: 2),
|
||||
only screen and ( min--moz-device-pixel-ratio: 2),
|
||||
only screen and ( -o-min-device-pixel-ratio: 2/1),
|
||||
only screen and ( min-device-pixel-ratio: 2),
|
||||
only screen and ( min-resolution: 192dpi),
|
||||
only screen and ( min-resolution: 2dppx) {
|
||||
#epiceditor-utilbar button.epiceditor-toggle-preview-btn {
|
||||
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAMAAAANIilAAAABrVBMVEWIiIiHh4eIiIiJiYmEhISEhISEhISMjIyNjY2MjIyNjY2MjIyFhYWDg4OFhYWKioqKioqBgYGJiYmJiYmJiYmKioqKioqFhYWIiIiJiYmIiIiJiYmIiIiGhoaIiIiGhoaIiIiHh4eHh4eGhoaFhYWKioqFhYWEhISFhYWEhISDg4ONjY2NjY2MjIyHh4eMjIyLi4uCgoKCgoKCgoKBgYGBgYGOjo6Ojo6BgYGPj4+Ojo6Hh4eNjY2Pj4+BgYGNjY2BgYGHh4eQkJCNjY2FhYWHh4eDg4OQkJCQkJCAgICCgoKAgICAgICQkJCQkJCQkJCAgICQkJCAgICQkJCFhYWHh4eHh4eGhoaKioqGhoaMjIyDg4OEhISDg4OEhISDg4OEhISKioqBgYGJiYmKioqKioqJiYmMjIyEhISCgoKGhoaLi4uPj4+Pj4+BgYGKioqDg4OGhoaGhoaMjIyHh4eEhISEhISDg4OIiIiJiYmGhoaHh4eJiYkAAACAgICFhYWQkJCIiIiEhISLi4uDg4OHh4eGhoaCgoKBgYGJiYmMjIyOjo6KioqNjY2Pj4+o6Lr0AAAAfnRSTlPfvxDPEL8gv5/Pr3AQ3++vn8+/cCCA34/vj8/vMJ+vgJ+vYN/fMIBAv4/v38/v39+PgBBg74DPgGAwMHDvrzBQj1AggJ8wIHC/IM9gjxBQgO+vv89Qz0C/70Bgz89ggIDvYN/fII8wIHDvMJ+/QBBAMBDPnxBgML9AEI/vQACT8cYwAAACXElEQVR42u2WV1caURRGJ73H9J7YW+y99957ARREURAFQRFEOFGMkybxN+eec2cWUwBnrTwli/1yvvnm7PvEuoMAf0FGzsj/nDwxOTUzdyoxNzM1OWFU7h0aPtUxPNRrQPZ0XKagw3OF7Nm9TMOuJ43cQmpavSWV3HRhgKakcmvjhSEaW/VyV/tvg7R3aeU+9ULZ/fLEQ/ndMvXbPrV88EvBvQdOMCsLMzjNd5TFgSTr3SpWOCuUTYWTVVV6m+Sdr0qqqVGxw6pqXUPyZlziFaU9Vi3HVSyzag+D/YlcbXLZLm+85AsOgMK4hkIABz/YkSVVdpS3fnKevQCIYgCcGqKslGd0g3dbIIR5fP8cZCkMdOANWeSLEJZklt5StxEWcmLIuw+AHGE+YiEWE67jGxnlO8xv8OGTEBGRRSACmNtYyBUjgcCCKJPLqjYMAeD04ENEGIjQ7AGikuUFNhdF8Vogj0T5bDyqEjh55AwI4N7/hmRTe4zRxEM+ZuKYFSYeEP9HzPtuEFjm9pKf9W5KQLbKhSVMbkymfHL90i+s/wR5PM9iCaYiLOcLTogCrKEIYwkLD19T25/4bR+unSG3bkOQwiG1QZfV6gryBaqL5c01XCCZ9lbOCOvNUpouUOGishSK+dpKUHMZ2M6Jz7ZHNEO+hOoLUWVZZROx6a8hn+VcRWh1EOtBUuhcPiy+pBdg3fZ3DaOj2ma7LtXVW1uj0XVqTW2aS9/bUP8jJfUN3is+N97mp8nV9Wavka9kZ/e6zuzuNP59Hhkbn53+QkzPjo+NZP6TZOSM/L/LfwAJ69Ba3fXmtwAAAABJRU5ErkJggg==);
|
||||
background-size: 30px 30px;
|
||||
}
|
||||
|
||||
#epiceditor-utilbar button.epiceditor-toggle-edit-btn {
|
||||
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAMAAAANIilAAAACNFBMVEWIiIiHh4eIiIiGhoaEhISDg4OCgoKDg4OMjIyNjY2MjIyMjIyLi4uMjIyKioqCgoKNjY2Ojo6Dg4ONjY2FhYWFhYWCgoKKioqKioqLi4uLi4uMjIyLi4uFhYWKioqKioqEhISJiYmJiYmEhISEhISFhYWEhISGhoaHh4eJiYmNjY2Hh4eKioqDg4ODg4OCgoKOjo6Ojo6Dg4OOjo6BgYGOjo6AgICCgoKNjY2Dg4OPj4+BgYGBgYGAgICOjo6BgYGOjo6AgICOjo6BgYGBgYGAgICPj4+QkJCQkJCQkJCQkJCPj4+NjY2IiIiIiIiFhYWFhYWEhISEhISGhoaDg4OGhoaDg4OHh4eDg4OCgoKMjIyLi4uLi4uKioqNjY2KioqNjY2NjY2NjY2Dg4OKioqGhoaJiYmIiIiGhoaFhYWEhISFhYWFhYWOjo6Pj4+FhYWGhoaPj4+Hh4eMjIyMjIyMjIyJiYmIiIiIiIiOjo6Ojo6CgoKBgYGPj4+QkJCHh4eHh4eEhISIiIiDg4OEhISDg4ODg4OLi4uHh4eEhISMjIyFhYWGhoaHh4eOjo6IiIiKioqKioqMjIyGhoaIiIiJiYmIiIiFhYWGhoaGhoaHh4eKioqJiYmLi4uIiIiGhoaJiYmHh4eGhoaGhoaJiYmFhYWKioqPj4+IiIiGhoYAAACAgICCgoKQkJCPj4+BgYGDg4OFhYWHh4eOjo6JiYmGhoaLi4uEhISIiIiNjY2MjIyKioqRGRgVAAAAq3RSTlNQz7+Pz4AQr4/vIK+Av99QICBQzyCv37/PcM+f378QgHAwgIBgnxBQMK+PgFCf34Bwn0BQv2Ag7zBwEFDvj4CAv1DvYK/f398gUICA39+fYHAwQHAQn78gz0DfYO8wgO+/YECPIK9gz89Av8/f31AwgK9A72AwIGCAMM+PICCvrxCfr+/fYCAgYO9QgGBQjyCPYM8QcM8wEEAgn58Qn+8w7+/fv0DvQEBA7wCxres+AAAC50lEQVR42u2XVUMbQRSFU3d3d3d3d8EpUKRoKbS40+LuDsEtQOFQKA2FEvhz3XsnS5IlJLB9a/s95J49M99sXpJsNPgD/st/oZwxJJGhTn4+RLxQJ78k9xnUyU+HJV6pk6OGiXR1ciy5sZizfPMrwzl9mIiak5x6/sLnUZmH9+9eqqAQCftyakXkqFUq7MpX6JbW2WBHDnxtmJUAIMiGfD3AYINArDdsCppNfmewxQqx4aRVObFm0ibLAW+aNYkz5ZL4SdusRIkI8SVKOcFyp/cu5ftYA6ySc4Kl3DZuxs4dhfAZV+CDQtNFm0lWuLsBFPoqXF9g9bjSZrlqypwqAC1TClqAtYprIVfLjT+f0gfAXyn7oY9GNZ/KiWVumX17OYYAIUp3O+AnDu7bZqxOk5zU+ZOpPwD0UABNBaEAaPYACBVCZ5Ik14vlg5ClVjFpC0NZ6lplGa0nxN2gSZkg2vtB9FOmKDUNCyemcTStMXXcpmh4yGUl5ToAORMOaGiflhtkoRKCfq41yTw+GFsHKeeIRUfwwbwKOo/eIATi3GQNivREVxyIZsqeADL1+swuvZEiAJ4UmsEUsVEODRAnNp2iulzekrVAbyJLPrYctJTJ7nGQjI7uMULXBIBjIyQWUWLeAGik0E39sQGKYU0QMmp1vGnADSjj0EFtk5uOjuKzOtgok8r34rxasMzEjDFhjdDJNsE7u2VXh9oYDgNllp/n8IgfzJbwXhq9zlRu5soZWtFFl/Zy8SkaljK0R6inJTEinLQo5aSFE889kkqUWvsCdM37ZcnHYnrNBhably5QyoJDtFuJK1xMF3mHgVlkHM2e4eYB02Xxfts/NwXBuSMWLIG7sTmbb/+Hzj3fy1wuQD6N3DMX5/g0VHDDQ3aXAR4jXsEb5/co9fbLN2KdlJbO/zmM5a0qH+KukXxOnfzoO5GmTr5M7mOoktP4xrfUyffIvQ118pNBiTvq5AeDxNV//W+CFX4Doxg1lHC8FNUAAAAASUVORK5CYII=);
|
||||
background-size: 30px 30px;
|
||||
}
|
||||
|
||||
#epiceditor-utilbar button.epiceditor-fullscreen-btn {
|
||||
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAMAAAANIilAAAAA5FBMVEWPj4+JiYmJiYmCgoKGhoaPj4+Li4uEhISAgICNjY2Li4uNjY2QkJCFhYWEhISLi4uHh4eHh4eIiIiHh4eGhoaHh4eEhISOjo6EhISJiYmFhYWJiYmFhYWNjY2NjY2Hh4eOjo6CgoKGhoaKioqKioqJiYmKioqDg4ODg4OBgYGGhoaKioqKioqLi4uMjIyMjIyIiIiIiIiMjIyOjo6GhoaDg4ONjY2EhISPj4+CgoIAAACJiYmHh4eIiIiFhYWCgoKPj4+Li4uAgICKioqEhISGhoaBgYGOjo6MjIyQkJCNjY2Dg4O2Jy/OAAAAO3RSTlMQz0DPEHDPz0DvMDBAQBBAQBAQz88wMM/v7zAw788Q7xAQQM9AEBDPEEAwMO/v7zDvMEBA70BAQEBAAAENmbYAAAG1SURBVHja7dftM0JREMdxD5GkEEqKpBJRSc8rQq7Q////2Dnm3t85jtkTmmGG75t7Z3c/t9fN0Tf6x1/Dz0ZrZGZf/BJ8a9QjM/vCwks9Px5aBcslC+P3nPVmi8dcczrcHHM2flug1CHRYcoYNd0YFlrAL1yHqPOC9g9IdbAfjHAjYFjoT+FI1MfRiAM/cZdEl0+oVidVvRaMcAOMgJWGBUYSVhrWjdfvjKqrq1Vzsu7Cy1Vo7XXZhYuj0ahwfHY+sjo/Oy7woyhitkTQsESsZawstG6VlvDCfIlUmfSVVjpDqtL8goBLbKFhsRcwalxcB100CDkxLLQbJxKwpvb3At7Y2iRuJzd4V26HuM2tDQkPWMOamu1Awkeetx2qtDy/lvZaCW173pGIWetA/xBbF+ZgiVgjGcdutLJ7xO1l9VnMiWGhJdzl4vx4CNpN+ifJXUy7RPEuZ2C1AIY1NG5kHI4Dx8MynnBtovYkqHzi25OyP8ONiKFh3djQsCIecn2i/lBvMU+UXxwi3HyE832jvD0RsLuP8CN3Oh0+feRmixE+g7CdLb43WiEz++Jb+M//x/gB/ArCl0G4nsFuEQAAAABJRU5ErkJggg==);
|
||||
background-size: 30px 30px;
|
||||
}
|
||||
}
|
||||
|
||||
#epiceditor-utilbar button:last-child {
|
||||
margin-left:15px;
|
||||
}
|
||||
|
||||
#epiceditor-utilbar button:hover {
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.epiceditor-edit-mode #epiceditor-utilbar button.epiceditor-toggle-edit-btn {
|
||||
display:none;
|
||||
}
|
||||
|
||||
.epiceditor-preview-mode #epiceditor-utilbar button.epiceditor-toggle-preview-btn {
|
||||
display:none;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
html { padding:10px; }
|
||||
|
||||
body {
|
||||
border:0;
|
||||
background:rgb(41,41,41);
|
||||
font-family:monospace;
|
||||
font-size:14px;
|
||||
padding:10px;
|
||||
color:#ddd;
|
||||
line-height:1.35em;
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
html { padding:10px; }
|
||||
|
||||
body {
|
||||
border:0;
|
||||
background:#fcfcfc;
|
||||
font-family:monospace;
|
||||
font-size:14px;
|
||||
padding:10px;
|
||||
line-height:1.35em;
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
body {
|
||||
font-family: Georgia, "Times New Roman", Times, serif;
|
||||
line-height: 1.5;
|
||||
font-size: 87.5%;
|
||||
word-wrap: break-word;
|
||||
margin: 2em;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
outline: 0;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
margin: 1.0em 0 0.5em;
|
||||
font-weight: inherit;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.357em;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.143em;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0 0 1.2em;
|
||||
}
|
||||
|
||||
del {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
tr:nth-child(odd) {
|
||||
background-color: #dddddd;
|
||||
}
|
||||
|
||||
img {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
code {
|
||||
background-color: #f2f2f2;
|
||||
background-color: rgba(40, 40, 0, 0.06);
|
||||
}
|
||||
|
||||
pre {
|
||||
background-color: #f2f2f2;
|
||||
background-color: rgba(40, 40, 0, 0.06);
|
||||
margin: 10px 0;
|
||||
overflow: hidden;
|
||||
padding: 15px;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
pre code {
|
||||
font-size: 100%;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
background: #f7f7f7;
|
||||
border-left: 1px solid #bbb;
|
||||
font-style: italic;
|
||||
margin: 1.5em 10px;
|
||||
padding: 0.5em 10px;
|
||||
}
|
||||
|
||||
blockquote:before {
|
||||
color: #bbb;
|
||||
content: "\201C";
|
||||
font-size: 3em;
|
||||
line-height: 0.1em;
|
||||
margin-right: 0.2em;
|
||||
vertical-align: -.4em;
|
||||
}
|
||||
|
||||
blockquote:after {
|
||||
color: #bbb;
|
||||
content: "\201D";
|
||||
font-size: 3em;
|
||||
line-height: 0.1em;
|
||||
vertical-align: -.45em;
|
||||
}
|
||||
|
||||
blockquote > p:first-child {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
table {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
border: 0;
|
||||
border-spacing: 0;
|
||||
font-size: 0.857em;
|
||||
margin: 10px 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table table {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
table tr th {
|
||||
background: #757575;
|
||||
background: rgba(0, 0, 0, 0.51);
|
||||
border-bottom-style: none;
|
||||
}
|
||||
|
||||
table tr th,
|
||||
table tr th a,
|
||||
table tr th a:hover {
|
||||
color: #FFF;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table tbody tr th {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
tr td,
|
||||
tr th {
|
||||
padding: 4px 9px;
|
||||
border: 1px solid #fff;
|
||||
text-align: left; /* LTR */
|
||||
}
|
||||
|
||||
tr:nth-child(odd) {
|
||||
background: #e4e4e4;
|
||||
background: rgba(0, 0, 0, 0.105);
|
||||
}
|
||||
|
||||
tr,
|
||||
tr:nth-child(even) {
|
||||
background: #efefef;
|
||||
background: rgba(0, 0, 0, 0.063);
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0071B3;
|
||||
}
|
||||
|
||||
a:hover,
|
||||
a:focus {
|
||||
color: #018fe2;
|
||||
}
|
||||
|
||||
a:active {
|
||||
color: #23aeff;
|
||||
}
|
||||
|
||||
a:link,
|
||||
a:visited {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover,
|
||||
a:active,
|
||||
a:focus {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,368 @@
|
||||
html { padding:0 10px; }
|
||||
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
background:#fff;
|
||||
}
|
||||
|
||||
#epiceditor-wrapper{
|
||||
background:white;
|
||||
}
|
||||
|
||||
#epiceditor-preview{
|
||||
padding-top:10px;
|
||||
padding-bottom:10px;
|
||||
font-family: Helvetica,arial,freesans,clean,sans-serif;
|
||||
font-size:13px;
|
||||
line-height:1.6;
|
||||
}
|
||||
|
||||
#epiceditor-preview>*:first-child{
|
||||
margin-top:0!important;
|
||||
}
|
||||
|
||||
#epiceditor-preview>*:last-child{
|
||||
margin-bottom:0!important;
|
||||
}
|
||||
|
||||
#epiceditor-preview a{
|
||||
color:#4183C4;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
#epiceditor-preview a:hover{
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
#epiceditor-preview h1,
|
||||
#epiceditor-preview h2,
|
||||
#epiceditor-preview h3,
|
||||
#epiceditor-preview h4,
|
||||
#epiceditor-preview h5,
|
||||
#epiceditor-preview h6{
|
||||
margin:20px 0 10px;
|
||||
padding:0;
|
||||
font-weight:bold;
|
||||
-webkit-font-smoothing:antialiased;
|
||||
}
|
||||
|
||||
#epiceditor-preview h1 tt,
|
||||
#epiceditor-preview h1 code,
|
||||
#epiceditor-preview h2 tt,
|
||||
#epiceditor-preview h2 code,
|
||||
#epiceditor-preview h3 tt,
|
||||
#epiceditor-preview h3 code,
|
||||
#epiceditor-preview h4 tt,
|
||||
#epiceditor-preview h4 code,
|
||||
#epiceditor-preview h5 tt,
|
||||
#epiceditor-preview h5 code,
|
||||
#epiceditor-preview h6 tt,
|
||||
#epiceditor-preview h6 code{
|
||||
font-size:inherit;
|
||||
}
|
||||
|
||||
#epiceditor-preview h1{
|
||||
font-size:28px;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
#epiceditor-preview h2{
|
||||
font-size:24px;
|
||||
border-bottom:1px solid #ccc;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
#epiceditor-preview h3{
|
||||
font-size:18px;
|
||||
}
|
||||
|
||||
#epiceditor-preview h4{
|
||||
font-size:16px;
|
||||
}
|
||||
|
||||
#epiceditor-preview h5{
|
||||
font-size:14px;
|
||||
}
|
||||
|
||||
#epiceditor-preview h6{
|
||||
color:#777;
|
||||
font-size:14px;
|
||||
}
|
||||
|
||||
#epiceditor-preview p,
|
||||
#epiceditor-preview blockquote,
|
||||
#epiceditor-preview ul,
|
||||
#epiceditor-preview ol,
|
||||
#epiceditor-preview dl,
|
||||
#epiceditor-preview li,
|
||||
#epiceditor-preview table,
|
||||
#epiceditor-preview pre{
|
||||
margin:15px 0;
|
||||
}
|
||||
|
||||
#epiceditor-preview hr{
|
||||
background:transparent url('../../images/modules/pulls/dirty-shade.png') repeat-x 0 0;
|
||||
border:0 none;
|
||||
color:#ccc;
|
||||
height:4px;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
#epiceditor-preview>h2:first-child,
|
||||
#epiceditor-preview>h1:first-child,
|
||||
#epiceditor-preview>h1:first-child+h2,
|
||||
#epiceditor-preview>h3:first-child,
|
||||
#epiceditor-preview>h4:first-child,
|
||||
#epiceditor-preview>h5:first-child,
|
||||
#epiceditor-preview>h6:first-child{
|
||||
margin-top:0;
|
||||
padding-top:0;
|
||||
}
|
||||
|
||||
#epiceditor-preview h1+p,
|
||||
#epiceditor-preview h2+p,
|
||||
#epiceditor-preview h3+p,
|
||||
#epiceditor-preview h4+p,
|
||||
#epiceditor-preview h5+p,
|
||||
#epiceditor-preview h6+p{
|
||||
margin-top:0;
|
||||
}
|
||||
|
||||
#epiceditor-preview li p.first{
|
||||
display:inline-block;
|
||||
}
|
||||
|
||||
#epiceditor-preview ul,
|
||||
#epiceditor-preview ol{
|
||||
padding-left:30px;
|
||||
}
|
||||
|
||||
#epiceditor-preview ul li>:first-child,
|
||||
#epiceditor-preview ol li>:first-child{
|
||||
margin-top:0;
|
||||
}
|
||||
|
||||
#epiceditor-preview ul li>:last-child,
|
||||
#epiceditor-preview ol li>:last-child{
|
||||
margin-bottom:0;
|
||||
}
|
||||
|
||||
#epiceditor-preview dl{
|
||||
padding:0;
|
||||
}
|
||||
|
||||
#epiceditor-preview dl dt{
|
||||
font-size:14px;
|
||||
font-weight:bold;
|
||||
font-style:italic;
|
||||
padding:0;
|
||||
margin:15px 0 5px;
|
||||
}
|
||||
|
||||
#epiceditor-preview dl dt:first-child{
|
||||
padding:0;
|
||||
}
|
||||
|
||||
#epiceditor-preview dl dt>:first-child{
|
||||
margin-top:0;
|
||||
}
|
||||
|
||||
#epiceditor-preview dl dt>:last-child{
|
||||
margin-bottom:0;
|
||||
}
|
||||
|
||||
#epiceditor-preview dl dd{
|
||||
margin:0 0 15px;
|
||||
padding:0 15px;
|
||||
}
|
||||
|
||||
#epiceditor-preview dl dd>:first-child{
|
||||
margin-top:0;
|
||||
}
|
||||
|
||||
#epiceditor-preview dl dd>:last-child{
|
||||
margin-bottom:0;
|
||||
}
|
||||
|
||||
#epiceditor-preview blockquote{
|
||||
border-left:4px solid #DDD;
|
||||
padding:0 15px;
|
||||
color:#777;
|
||||
}
|
||||
|
||||
#epiceditor-preview blockquote>:first-child{
|
||||
margin-top:0;
|
||||
}
|
||||
|
||||
#epiceditor-preview blockquote>:last-child{
|
||||
margin-bottom:0;
|
||||
}
|
||||
|
||||
#epiceditor-preview table{
|
||||
padding:0;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
#epiceditor-preview table tr{
|
||||
border-top:1px solid #ccc;
|
||||
background-color:#fff;
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
#epiceditor-preview table tr:nth-child(2n){
|
||||
background-color:#f8f8f8;
|
||||
}
|
||||
|
||||
#epiceditor-preview table tr th{
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
#epiceditor-preview table tr th,
|
||||
#epiceditor-preview table tr td{
|
||||
border:1px solid #ccc;
|
||||
text-align:left;
|
||||
margin:0;
|
||||
padding:6px 13px;
|
||||
}
|
||||
|
||||
#epiceditor-preview table tr th>:first-child,
|
||||
#epiceditor-preview table tr td>:first-child{
|
||||
margin-top:0;
|
||||
}
|
||||
|
||||
#epiceditor-preview table tr th>:last-child,
|
||||
#epiceditor-preview table tr td>:last-child{
|
||||
margin-bottom:0;
|
||||
}
|
||||
|
||||
#epiceditor-preview img{
|
||||
max-width:100%;
|
||||
}
|
||||
|
||||
#epiceditor-preview span.frame{
|
||||
display:block;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
#epiceditor-preview span.frame>span{
|
||||
border:1px solid #ddd;
|
||||
display:block;
|
||||
float:left;
|
||||
overflow:hidden;
|
||||
margin:13px 0 0;
|
||||
padding:7px;
|
||||
width:auto;
|
||||
}
|
||||
|
||||
#epiceditor-preview span.frame span img{
|
||||
display:block;
|
||||
float:left;
|
||||
}
|
||||
|
||||
#epiceditor-preview span.frame span span{
|
||||
clear:both;
|
||||
color:#333;
|
||||
display:block;
|
||||
padding:5px 0 0;
|
||||
}
|
||||
|
||||
#epiceditor-preview span.align-center{
|
||||
display:block;
|
||||
overflow:hidden;
|
||||
clear:both;
|
||||
}
|
||||
|
||||
#epiceditor-preview span.align-center>span{
|
||||
display:block;
|
||||
overflow:hidden;
|
||||
margin:13px auto 0;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
#epiceditor-preview span.align-center span img{
|
||||
margin:0 auto;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
#epiceditor-preview span.align-right{
|
||||
display:block;
|
||||
overflow:hidden;
|
||||
clear:both;
|
||||
}
|
||||
|
||||
#epiceditor-preview span.align-right>span{
|
||||
display:block;
|
||||
overflow:hidden;
|
||||
margin:13px 0 0;
|
||||
text-align:right;
|
||||
}
|
||||
|
||||
#epiceditor-preview span.align-right span img{
|
||||
margin:0;
|
||||
text-align:right;
|
||||
}
|
||||
|
||||
#epiceditor-preview span.float-left{
|
||||
display:block;
|
||||
margin-right:13px;
|
||||
overflow:hidden;
|
||||
float:left;
|
||||
}
|
||||
|
||||
#epiceditor-preview span.float-left span{
|
||||
margin:13px 0 0;
|
||||
}
|
||||
|
||||
#epiceditor-preview span.float-right{
|
||||
display:block;
|
||||
margin-left:13px;
|
||||
overflow:hidden;
|
||||
float:right;
|
||||
}
|
||||
|
||||
#epiceditor-preview span.float-right>span{
|
||||
display:block;
|
||||
overflow:hidden;
|
||||
margin:13px auto 0;
|
||||
text-align:right;
|
||||
}
|
||||
|
||||
#epiceditor-preview code,
|
||||
#epiceditor-preview tt{
|
||||
margin:0 2px;
|
||||
padding:0 5px;
|
||||
white-space:nowrap;
|
||||
border:1px solid #eaeaea;
|
||||
background-color:#f8f8f8;
|
||||
border-radius:3px;
|
||||
}
|
||||
|
||||
#epiceditor-preview pre>code{
|
||||
margin:0;
|
||||
padding:0;
|
||||
white-space:pre;
|
||||
border:none;
|
||||
background:transparent;
|
||||
}
|
||||
|
||||
#epiceditor-preview .highlight pre,
|
||||
#epiceditor-preview pre{
|
||||
background-color:#f8f8f8;
|
||||
border:1px solid #ccc;
|
||||
font-size:13px;
|
||||
line-height:19px;
|
||||
overflow:auto;
|
||||
padding:6px 10px;
|
||||
border-radius:3px;
|
||||
}
|
||||
|
||||
#epiceditor-preview pre code,
|
||||
#epiceditor-preview pre tt{
|
||||
background-color:transparent;
|
||||
border:none;
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
html { padding:0 10px; }
|
||||
|
||||
body {
|
||||
margin:0;
|
||||
padding:10px 0;
|
||||
background:#000;
|
||||
}
|
||||
|
||||
#epiceditor-preview h1,
|
||||
#epiceditor-preview h2,
|
||||
#epiceditor-preview h3,
|
||||
#epiceditor-preview h4,
|
||||
#epiceditor-preview h5,
|
||||
#epiceditor-preview h6,
|
||||
#epiceditor-preview p,
|
||||
#epiceditor-preview blockquote {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
#epiceditor-preview {
|
||||
background:#000;
|
||||
font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", Arial, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 18px;
|
||||
color: #ccc;
|
||||
}
|
||||
#epiceditor-preview a {
|
||||
color: #fff;
|
||||
}
|
||||
#epiceditor-preview a:hover {
|
||||
color: #00ff00;
|
||||
text-decoration: none;
|
||||
}
|
||||
#epiceditor-preview a img {
|
||||
border: none;
|
||||
}
|
||||
#epiceditor-preview p {
|
||||
margin-bottom: 9px;
|
||||
}
|
||||
#epiceditor-preview h1,
|
||||
#epiceditor-preview h2,
|
||||
#epiceditor-preview h3,
|
||||
#epiceditor-preview h4,
|
||||
#epiceditor-preview h5,
|
||||
#epiceditor-preview h6 {
|
||||
color: #cdcdcd;
|
||||
line-height: 36px;
|
||||
}
|
||||
#epiceditor-preview h1 {
|
||||
margin-bottom: 18px;
|
||||
font-size: 30px;
|
||||
}
|
||||
#epiceditor-preview h2 {
|
||||
font-size: 24px;
|
||||
}
|
||||
#epiceditor-preview h3 {
|
||||
font-size: 18px;
|
||||
}
|
||||
#epiceditor-preview h4 {
|
||||
font-size: 16px;
|
||||
}
|
||||
#epiceditor-preview h5 {
|
||||
font-size: 14px;
|
||||
}
|
||||
#epiceditor-preview h6 {
|
||||
font-size: 13px;
|
||||
}
|
||||
#epiceditor-preview hr {
|
||||
margin: 0 0 19px;
|
||||
border: 0;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
#epiceditor-preview blockquote {
|
||||
padding: 13px 13px 21px 15px;
|
||||
margin-bottom: 18px;
|
||||
font-family:georgia,serif;
|
||||
font-style: italic;
|
||||
}
|
||||
#epiceditor-preview blockquote:before {
|
||||
content:"\201C";
|
||||
font-size:40px;
|
||||
margin-left:-10px;
|
||||
font-family:georgia,serif;
|
||||
color:#eee;
|
||||
}
|
||||
#epiceditor-preview blockquote p {
|
||||
font-size: 14px;
|
||||
font-weight: 300;
|
||||
line-height: 18px;
|
||||
margin-bottom: 0;
|
||||
font-style: italic;
|
||||
}
|
||||
#epiceditor-preview code, #epiceditor-preview pre {
|
||||
font-family: Monaco, Andale Mono, Courier New, monospace;
|
||||
}
|
||||
#epiceditor-preview code {
|
||||
background-color: #000;
|
||||
color: #f92672;
|
||||
padding: 1px 3px;
|
||||
font-size: 12px;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
#epiceditor-preview pre {
|
||||
display: block;
|
||||
padding: 14px;
|
||||
color:#66d9ef;
|
||||
margin: 0 0 18px;
|
||||
line-height: 16px;
|
||||
font-size: 11px;
|
||||
border: 1px solid #d9d9d9;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
#epiceditor-preview pre code {
|
||||
background-color: #000;
|
||||
color:#ccc;
|
||||
font-size: 11px;
|
||||
padding: 0;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "epiceditor",
|
||||
"filename": "js/epiceditor.min.js",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.2",
|
||||
"description": "EpicEditor is an embeddable JavaScript Markdown editor with split fullscreen editing, live previewing, automatic draft saving, offline support, and more. For developers, it offers a robust API, can be easily themed, and allows you to swap out the bundled Markdown parser with anything you throw at it.",
|
||||
"homepage": "http://epiceditor.com",
|
||||
"keywords": [
|
||||
@@ -14,11 +14,11 @@
|
||||
"web": "http://epiceditor.com"
|
||||
}
|
||||
],
|
||||
"repositories": [
|
||||
"repository": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://github.com/OscarGodson/EpicEditor"
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jquery.SPServices",
|
||||
"filename": "jquery.SPServices.min.js",
|
||||
"version": "2013.02a",
|
||||
"version": "2014.01",
|
||||
"description": "SPServices is a jQuery library which abstracts SharePoint's Web Services and makes them easier to use. It also includes functions which use the various Web Service operations to provide more useful (and cool) capabilities. It works entirely client side and requires no server install.",
|
||||
"homepage": "http://spservices.codeplex.com/",
|
||||
"keywords": [
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"name": "postscribe",
|
||||
"filename": "postscribe.min.js",
|
||||
"description": "Asynchronously write javascript, even with document.write.",
|
||||
"version": "1.1.2",
|
||||
"keywords": ["document.write", "tag writer", "asynchronous", "javascript", "after load"],
|
||||
"author": {
|
||||
"name": "Derek Brans",
|
||||
"email": "dbrans@gmail.com",
|
||||
"web": "http://github.com/dbrans"
|
||||
},
|
||||
"contributors": [{
|
||||
"name": "Derek Brans",
|
||||
"email": "dbrans@gmail.com",
|
||||
"web": "http://github.com/dbrans"
|
||||
}, {
|
||||
"name": "Nick Sullivan",
|
||||
"email": "nick@sullivanflock.com",
|
||||
"web": "http://creationeer.me"
|
||||
},{
|
||||
"name": "Joshua Newman",
|
||||
"email": "joshua.newman@krux.com"
|
||||
}],
|
||||
"maintainers": [{
|
||||
"name": "Joshua Newman",
|
||||
"email": "joshua.newman@krux.com"
|
||||
}],
|
||||
"bugs": "https://github.com/krux/postscribe/issues",
|
||||
"licenses": [{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/krux/postscribe/blob/master/LICENSE"
|
||||
}],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:krux/postscribe.git"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"grunt": ">=0.4",
|
||||
"phantomjs": "~1.9",
|
||||
"grunt-cli": "~0.1",
|
||||
"grunt-contrib-concat": "~0.3",
|
||||
"grunt-contrib-jshint": "~0.7",
|
||||
"grunt-contrib-qunit": "~0.3",
|
||||
"grunt-contrib-uglify": "~0.2",
|
||||
"grunt-contrib-watch": "~0.5",
|
||||
"lodash": "~2.4",
|
||||
"testem": "~0.5"
|
||||
},
|
||||
"homepage": "https://krux.github.com/postscribe",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "grunt jshint",
|
||||
"tdd": "grunt watch",
|
||||
"test": "grunt"
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "reactive-coffee",
|
||||
"filename": "reactive-coffee.min.js",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"description": "A lightweight CoffeeScript library/DSL for reactive programming and for declaratively building scalable web UIs.",
|
||||
"homepage": "http://yang.github.io/reactive-coffee/",
|
||||
"keywords": [
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
/*! sprintf.js | Copyright (c) 2007-2013 Alexandru Marasteanu <hello at alexei dot ro> | 3 clause BSD license */
|
||||
|
||||
(function(ctx) {
|
||||
var sprintf = function() {
|
||||
if (!sprintf.cache.hasOwnProperty(arguments[0])) {
|
||||
sprintf.cache[arguments[0]] = sprintf.parse(arguments[0]);
|
||||
}
|
||||
return sprintf.format.call(null, sprintf.cache[arguments[0]], arguments);
|
||||
};
|
||||
|
||||
sprintf.format = function(parse_tree, argv) {
|
||||
var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length;
|
||||
for (i = 0; i < tree_length; i++) {
|
||||
node_type = get_type(parse_tree[i]);
|
||||
if (node_type === 'string') {
|
||||
output.push(parse_tree[i]);
|
||||
}
|
||||
else if (node_type === 'array') {
|
||||
match = parse_tree[i]; // convenience purposes only
|
||||
if (match[2]) { // keyword argument
|
||||
arg = argv[cursor];
|
||||
for (k = 0; k < match[2].length; k++) {
|
||||
if (!arg.hasOwnProperty(match[2][k])) {
|
||||
throw(sprintf('[sprintf] property "%s" does not exist', match[2][k]));
|
||||
}
|
||||
arg = arg[match[2][k]];
|
||||
}
|
||||
}
|
||||
else if (match[1]) { // positional argument (explicit)
|
||||
arg = argv[match[1]];
|
||||
}
|
||||
else { // positional argument (implicit)
|
||||
arg = argv[cursor++];
|
||||
}
|
||||
|
||||
if (/[^s]/.test(match[8]) && (get_type(arg) != 'number')) {
|
||||
throw(sprintf('[sprintf] expecting number but found %s', get_type(arg)));
|
||||
}
|
||||
switch (match[8]) {
|
||||
case 'b': arg = arg.toString(2); break;
|
||||
case 'c': arg = String.fromCharCode(arg); break;
|
||||
case 'd': arg = parseInt(arg, 10); break;
|
||||
case 'e': arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential(); break;
|
||||
case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg); break;
|
||||
case 'o': arg = arg.toString(8); break;
|
||||
case 's': arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg); break;
|
||||
case 'u': arg = arg >>> 0; break;
|
||||
case 'x': arg = arg.toString(16); break;
|
||||
case 'X': arg = arg.toString(16).toUpperCase(); break;
|
||||
}
|
||||
arg = (/[def]/.test(match[8]) && match[3] && arg >= 0 ? '+'+ arg : arg);
|
||||
pad_character = match[4] ? match[4] == '0' ? '0' : match[4].charAt(1) : ' ';
|
||||
pad_length = match[6] - String(arg).length;
|
||||
pad = match[6] ? str_repeat(pad_character, pad_length) : '';
|
||||
output.push(match[5] ? arg + pad : pad + arg);
|
||||
}
|
||||
}
|
||||
return output.join('');
|
||||
};
|
||||
|
||||
sprintf.cache = {};
|
||||
|
||||
sprintf.parse = function(fmt) {
|
||||
var _fmt = fmt, match = [], parse_tree = [], arg_names = 0;
|
||||
while (_fmt) {
|
||||
if ((match = /^[^\x25]+/.exec(_fmt)) !== null) {
|
||||
parse_tree.push(match[0]);
|
||||
}
|
||||
else if ((match = /^\x25{2}/.exec(_fmt)) !== null) {
|
||||
parse_tree.push('%');
|
||||
}
|
||||
else if ((match = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt)) !== null) {
|
||||
if (match[2]) {
|
||||
arg_names |= 1;
|
||||
var field_list = [], replacement_field = match[2], field_match = [];
|
||||
if ((field_match = /^([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
|
||||
field_list.push(field_match[1]);
|
||||
while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {
|
||||
if ((field_match = /^\.([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
|
||||
field_list.push(field_match[1]);
|
||||
}
|
||||
else if ((field_match = /^\[(\d+)\]/.exec(replacement_field)) !== null) {
|
||||
field_list.push(field_match[1]);
|
||||
}
|
||||
else {
|
||||
throw('[sprintf] huh?');
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw('[sprintf] huh?');
|
||||
}
|
||||
match[2] = field_list;
|
||||
}
|
||||
else {
|
||||
arg_names |= 2;
|
||||
}
|
||||
if (arg_names === 3) {
|
||||
throw('[sprintf] mixing positional and named placeholders is not (yet) supported');
|
||||
}
|
||||
parse_tree.push(match);
|
||||
}
|
||||
else {
|
||||
throw('[sprintf] huh?');
|
||||
}
|
||||
_fmt = _fmt.substring(match[0].length);
|
||||
}
|
||||
return parse_tree;
|
||||
};
|
||||
|
||||
var vsprintf = function(fmt, argv, _argv) {
|
||||
_argv = argv.slice(0);
|
||||
_argv.splice(0, 0, fmt);
|
||||
return sprintf.apply(null, _argv);
|
||||
};
|
||||
|
||||
/**
|
||||
* helpers
|
||||
*/
|
||||
function get_type(variable) {
|
||||
return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase();
|
||||
}
|
||||
|
||||
function str_repeat(input, multiplier) {
|
||||
for (var output = []; multiplier > 0; output[--multiplier] = input) {/* do nothing */}
|
||||
return output.join('');
|
||||
}
|
||||
|
||||
/**
|
||||
* export to either browser or node.js
|
||||
*/
|
||||
ctx.sprintf = sprintf;
|
||||
ctx.vsprintf = vsprintf;
|
||||
})(typeof exports != "undefined" ? exports : window);
|
||||
+1
@@ -0,0 +1 @@
|
||||
/*! sprintf.js | Copyright (c) 2007-2013 Alexandru Marasteanu <hello at alexei dot ro> | 3 clause BSD license */(function(e){function r(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function i(e,t){for(var n=[];t>0;n[--t]=e);return n.join("")}var t=function(){return t.cache.hasOwnProperty(arguments[0])||(t.cache[arguments[0]]=t.parse(arguments[0])),t.format.call(null,t.cache[arguments[0]],arguments)};t.format=function(e,n){var s=1,o=e.length,u="",a,f=[],l,c,h,p,d,v;for(l=0;l<o;l++){u=r(e[l]);if(u==="string")f.push(e[l]);else if(u==="array"){h=e[l];if(h[2]){a=n[s];for(c=0;c<h[2].length;c++){if(!a.hasOwnProperty(h[2][c]))throw t('[sprintf] property "%s" does not exist',h[2][c]);a=a[h[2][c]]}}else h[1]?a=n[h[1]]:a=n[s++];if(/[^s]/.test(h[8])&&r(a)!="number")throw t("[sprintf] expecting number but found %s",r(a));switch(h[8]){case"b":a=a.toString(2);break;case"c":a=String.fromCharCode(a);break;case"d":a=parseInt(a,10);break;case"e":a=h[7]?a.toExponential(h[7]):a.toExponential();break;case"f":a=h[7]?parseFloat(a).toFixed(h[7]):parseFloat(a);break;case"o":a=a.toString(8);break;case"s":a=(a=String(a))&&h[7]?a.substring(0,h[7]):a;break;case"u":a>>>=0;break;case"x":a=a.toString(16);break;case"X":a=a.toString(16).toUpperCase()}a=/[def]/.test(h[8])&&h[3]&&a>=0?"+"+a:a,d=h[4]?h[4]=="0"?"0":h[4].charAt(1):" ",v=h[6]-String(a).length,p=h[6]?i(d,v):"",f.push(h[5]?a+p:p+a)}}return f.join("")},t.cache={},t.parse=function(e){var t=e,n=[],r=[],i=0;while(t){if((n=/^[^\x25]+/.exec(t))!==null)r.push(n[0]);else if((n=/^\x25{2}/.exec(t))!==null)r.push("%");else{if((n=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(t))===null)throw"[sprintf] huh?";if(n[2]){i|=1;var s=[],o=n[2],u=[];if((u=/^([a-z_][a-z_\d]*)/i.exec(o))===null)throw"[sprintf] huh?";s.push(u[1]);while((o=o.substring(u[0].length))!=="")if((u=/^\.([a-z_][a-z_\d]*)/i.exec(o))!==null)s.push(u[1]);else{if((u=/^\[(\d+)\]/.exec(o))===null)throw"[sprintf] huh?";s.push(u[1])}n[2]=s}else i|=2;if(i===3)throw"[sprintf] mixing positional and named placeholders is not (yet) supported";r.push(n)}t=t.substring(n[0].length)}return r};var n=function(e,n,r){return r=n.slice(0),r.splice(0,0,e),t.apply(null,r)};e.sprintf=t,e.vsprintf=n})(typeof exports!="undefined"?exports:window);
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "sprintf",
|
||||
"npmName": "sprintf-js",
|
||||
"npmFileMap": [{
|
||||
"basePath": "/src/",
|
||||
"files": [
|
||||
"sprintf.js",
|
||||
"sprintf.min.js"
|
||||
]
|
||||
}],
|
||||
"filename": "sprintf.min.js",
|
||||
"version": "0.0.7",
|
||||
"description": "JavaScript sprintf implementation",
|
||||
"homepage:": "https://www.npmjs.org/package/sprintf-js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/alexei/sprintf.js.git"
|
||||
},
|
||||
"author": {
|
||||
"name": "Alexandru Marasteanu",
|
||||
"email": "hello@alexei.ro",
|
||||
"url": "http://alexei.ro/"
|
||||
},
|
||||
"license": "BSD"
|
||||
}
|
||||
Reference in New Issue
Block a user