Commit d0a418c3 authored by Arthur Verschaeve's avatar Arthur Verschaeve

PureMVC: new app UI & switch to npm for dependencies

* Included `todomvc-app-css`, this includes the new UI.
* Replaced bower by NPM.
* Include all files that aren't needed in the repo in the gitignore

Ref #1110
parent bc5391d3
node_modules/todomvc-app-css
!node_modules/todomvc-app-css/index.css
node_modules/todomvc-common
!node_modules/todomvc-common/base.js
!node_modules/todomvc-common/base.css
node_modules/npmvc
!node_modules/npmvc/lib/puremvc-1.0.1.js
node_modules/director
!node_modules/director/build/director.js
{
"name": "todomvc-puremvc",
"version": "0.0.0",
"dependencies": {
"puremvc": "~1.0.1",
"director": "~1.2.0",
"todomvc-common": "~0.3.0"
}
}
......@@ -3,7 +3,8 @@
<head>
<meta charset="utf-8">
<title>PureMVC • TodoMVC</title>
<link rel="stylesheet" href="bower_components/todomvc-common/base.css">
<link rel="stylesheet" href="node_modules/todomvc-common/base.css">
<link rel="stylesheet" href="node_modules/todomvc-app-css/index.css">
</head>
<body>
<section id="todoapp">
......@@ -40,13 +41,13 @@
</footer>
<!-- TODOMVC PROJECT BASE -->
<script src="bower_components/todomvc-common/base.js"></script>
<script src="node_modules/todomvc-common/base.js"></script>
<!-- FLATIRION DIRECTOR ROUTING LIBRARY -->
<script src="bower_components/director/director.js"></script>
<script src="node_modules/director/build/director.js"></script>
<!-- PUREMVC LIBRARY -->
<script src="bower_components/puremvc/puremvc-1.0.1.js"></script>
<script src="node_modules/npmvc/lib/puremvc-1.0.1.js"></script>
<!-- APPLICATION CONSTANTS -->
<script src="js/AppConstants.js"></script>
......
//
// Generated on Sun Dec 16 2012 22:47:05 GMT-0500 (EST) by Nodejitsu, Inc (Using Codesurgeon).
// Version 1.1.9
// Generated on Tue Dec 16 2014 12:13:47 GMT+0100 (CET) by Charlie Robbins, Paolo Fragomeni & the Contributors (Using Codesurgeon).
// Version 1.2.6
//
(function (exports) {
/*
* browser.js: Browser specific functionality for director.
*
* (C) 2011, Nodejitsu Inc.
* (C) 2011, Charlie Robbins, Paolo Fragomeni, & the Contributors.
* MIT LICENSE
*
*/
if (!Array.prototype.filter) {
Array.prototype.filter = function(filter, that) {
var other = [], v;
for (var i = 0, n = this.length; i < n; i++) {
if (i in this && filter.call(that, v = this[i], i, this)) {
other.push(v);
}
}
return other;
};
}
if (!Array.isArray){
Array.isArray = function(obj) {
return Object.prototype.toString.call(obj) === '[object Array]';
};
}
var dloc = document.location;
function dlocHashEmpty() {
......@@ -197,11 +178,12 @@ var Router = exports.Router = function (routes) {
};
Router.prototype.init = function (r) {
var self = this;
var self = this
, routeTo;
this.handler = function(onChangeEvent) {
var newURL = onChangeEvent && onChangeEvent.newURL || window.location.hash;
var url = self.history === true ? self.getPath() : newURL.replace(/.*#/, '');
self.dispatch('on', url);
self.dispatch('on', url.charAt(0) === '/' ? url : '/' + url);
};
listener.init(this.handler, this.history);
......@@ -210,13 +192,20 @@ Router.prototype.init = function (r) {
if (dlocHashEmpty() && r) {
dloc.hash = r;
} else if (!dlocHashEmpty()) {
self.dispatch('on', dloc.hash.replace(/^#/, ''));
self.dispatch('on', '/' + dloc.hash.replace(/^(#\/|#|\/)/, ''));
}
}
else {
var routeTo = dlocHashEmpty() && r ? r : !dlocHashEmpty() ? dloc.hash.replace(/^#/, '') : null;
if (routeTo) {
window.history.replaceState({}, document.title, routeTo);
if (this.convert_hash_in_init) {
// Use hash as route
routeTo = dlocHashEmpty() && r ? r : !dlocHashEmpty() ? dloc.hash.replace(/^#/, '') : null;
if (routeTo) {
window.history.replaceState({}, document.title, routeTo);
}
}
else {
// Use canonical url
routeTo = this.getPath();
}
// Router has been initialized, but due to the chrome bug it will not
......@@ -352,7 +341,7 @@ function paramifyString(str, params, mod) {
}
}
}
return mod === str ? "([._a-zA-Z0-9-]+)" : mod;
return mod === str ? "([._a-zA-Z0-9-%()]+)" : mod;
}
function regifyString(str, params) {
......@@ -363,11 +352,16 @@ function regifyString(str, params) {
out += str.substr(0, matches.index) + matches[0];
}
str = out += str.substr(last);
var captures = str.match(/:([^\/]+)/ig), length;
var captures = str.match(/:([^\/]+)/ig), capture, length;
if (captures) {
length = captures.length;
for (var i = 0; i < length; i++) {
str = str.replace(captures[i], paramifyString(captures[i], params));
capture = captures[i];
if (capture.slice(0, 2) === "::") {
str = capture.slice(1);
} else {
str = str.replace(capture, paramifyString(capture, params));
}
}
}
return str;
......@@ -393,6 +387,8 @@ function terminator(routes, delimiter, start, stop) {
return routes;
}
var QUERY_SEPARATOR = /\?.*/;
Router.prototype.configure = function(options) {
options = options || {};
for (var i = 0; i < this.methods.length; i++) {
......@@ -406,6 +402,7 @@ Router.prototype.configure = function(options) {
this.resource = options.resource;
this.history = options.html5history && this.historySupport || false;
this.run_in_init = this.history === true && options.run_handler_in_init !== false;
this.convert_hash_in_init = this.history === true && options.convert_hash_in_init !== false;
this.every = {
after: options.after || null,
before: options.before || null,
......@@ -422,6 +419,7 @@ Router.prototype.param = function(token, matcher) {
this.params[token] = function(str) {
return str.replace(compiled, matcher.source || matcher);
};
return this;
};
Router.prototype.on = Router.prototype.route = function(method, path, route) {
......@@ -449,8 +447,20 @@ Router.prototype.on = Router.prototype.route = function(method, path, route) {
this.insert(method, this.scope.concat(path), route);
};
Router.prototype.path = function(path, routesFn) {
var self = this, length = this.scope.length;
if (path.source) {
path = path.source.replace(/\\\//ig, "/");
}
path = path.split(new RegExp(this.delimiter));
path = terminator(path, this.delimiter);
this.scope = this.scope.concat(path);
routesFn.call(this, this);
this.scope.splice(length, path.length);
};
Router.prototype.dispatch = function(method, path, callback) {
var self = this, fns = this.traverse(method, path, this.routes, ""), invoked = this._invoked, after;
var self = this, fns = this.traverse(method, path.replace(QUERY_SEPARATOR, ""), this.routes, ""), invoked = this._invoked, after;
this._invoked = true;
if (!fns || fns.length === 0) {
this.last = [];
......@@ -485,20 +495,22 @@ Router.prototype.dispatch = function(method, path, callback) {
Router.prototype.invoke = function(fns, thisArg, callback) {
var self = this;
var apply;
if (this.async) {
_asyncEverySeries(fns, function apply(fn, next) {
apply = function(fn, next) {
if (Array.isArray(fn)) {
return _asyncEverySeries(fn, apply, next);
} else if (typeof fn == "function") {
fn.apply(thisArg, fns.captures.concat(next));
fn.apply(thisArg, (fns.captures || []).concat(next));
}
}, function() {
};
_asyncEverySeries(fns, apply, function() {
if (callback) {
callback.apply(thisArg, arguments);
}
});
} else {
_every(fns, function apply(fn) {
apply = function(fn) {
if (Array.isArray(fn)) {
return _every(fn, apply);
} else if (typeof fn === "function") {
......@@ -506,7 +518,8 @@ Router.prototype.invoke = function(fns, thisArg, callback) {
} else if (typeof fn === "string" && self.resource) {
self.resource[fn].apply(thisArg, fns.captures || []);
}
});
};
_every(fns, apply);
}
};
......@@ -686,7 +699,7 @@ Router.prototype.mount = function(routes, path) {
function insertOrMount(route, local) {
var rename = route, parts = route.split(self.delimiter), routeType = typeof routes[route], isRoute = parts[0] === "" || !self._methods[parts[0]], event = isRoute ? "on" : rename;
if (isRoute) {
rename = rename.slice((rename.match(new RegExp(self.delimiter)) || [ "" ])[0].length);
rename = rename.slice((rename.match(new RegExp("^" + self.delimiter)) || [ "" ])[0].length);
parts.shift();
}
if (isRoute && routeType === "object" && !Array.isArray(routes[route])) {
......
/**
* @fileOverview
* PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
* Reuse governed by Creative Commons Attribution 3.0
* Reuse governed by Creative Commons Attribution 3.0
* http://creativecommons.org/licenses/by/3.0/us/
* @author david.foley@puremvc.org
* @author david.foley@puremvc.org
*/
(function (scope){
if (null == scope)
scope= window;
scope= module.exports;
// if the global puremvc namespace already exists, turn back now
if (scope.puremvc)
{
return;
}
/* implementation begin */
/* implementation begin */
/**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
*
*
* @class puremvc.Observer
*
*
* A base Observer implementation.
*
*
* An Observer is an object that encapsulates information
* about an interested object with a method that should
* be called when a particular Notification is broadcast.
*
* about an interested object with a method that should
* be called when a particular Notification is broadcast.
*
* In PureMVC, the Observer class assumes these responsibilities:
*
*
* - Encapsulate the notification (callback) method of the interested object.
* - Encapsulate the notification context (this) of the interested object.
* - Provide methods for setting the notification method and context.
* - Provide a method for notifying the interested object.
*
*
* The notification method on the interested object should take
*
*
* The notification method on the interested object should take
* one parameter of type Notification.
*
*
* @param {Function} notifyMethod
*
*
* @param {Function} notifyMethod
* the notification method of the interested object
* @param {Object} notifyContext
* @param {Object} notifyContext
* the notification context of the interested object
* @constructor
*/
......@@ -58,7 +58,7 @@ function Observer (notifyMethod, notifyContext)
/**
* Set the Observers notification method.
*
*
* The notification method should take one parameter of type Notification
* @param {Function} notifyMethod
* the notification (callback) method of the interested object.
......@@ -71,10 +71,10 @@ Observer.prototype.setNotifyMethod= function (notifyMethod)
/**
* Set the Observers notification context.
*
*
* @param {Object} notifyContext
* the notification context (this) of the interested object.
*
*
* @return {void}
*/
Observer.prototype.setNotifyContext= function (notifyContext)
......@@ -84,7 +84,7 @@ Observer.prototype.setNotifyContext= function (notifyContext)
/**
* Get the Function that this Observer will invoke when it is notified.
*
*
* @private
* @return {Function}
*/
......@@ -95,7 +95,7 @@ Observer.prototype.getNotifyMethod= function ()
/**
* Get the Object that will serve as the Observers callback execution context
*
*
* @private
* @return {Object}
*/
......@@ -106,7 +106,7 @@ Observer.prototype.getNotifyContext= function ()
/**
* Notify the interested object.
*
*
* @param {puremvc.Notification} notification
* The Notification to pass to the interested objects notification method
* @return {void}
......@@ -118,9 +118,9 @@ Observer.prototype.notifyObserver= function (notification)
/**
* Compare an object to this Observers notification context.
*
*
* @param {Object} object
*
*
* @return {boolean}
*/
Observer.prototype.compareNotifyContext= function (object)
......@@ -130,7 +130,7 @@ Observer.prototype.compareNotifyContext= function (object)
/**
* The Observers callback Function
*
*
* @private
* @type {Function}
*/
......@@ -143,39 +143,39 @@ Observer.prototype.notify= null;
*/
Observer.prototype.context= null;
/**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
*
*
* @class puremvc.Notification
*
*
* A base Notification implementation.
*
* PureMVC does not rely upon underlying event models such as the one provided
*
* PureMVC does not rely upon underlying event models such as the one provided
* with the DOM or other browser centric W3C event models.
*
* The Observer Pattern as implemented within PureMVC exists to support
* event-driven communication between the application and the actors of the MVC
*
* The Observer Pattern as implemented within PureMVC exists to support
* event-driven communication between the application and the actors of the MVC
* triad.
*
* Notifications are not meant to be a replacement for events in the browser.
* Generally, Mediator implementors place event listeners on their view
* components, which they then handle in the usual way. This may lead to the
* broadcast of Notifications to trigger commands or to communicate with other
*
* Notifications are not meant to be a replacement for events in the browser.
* Generally, Mediator implementors place event listeners on their view
* components, which they then handle in the usual way. This may lead to the
* broadcast of Notifications to trigger commands or to communicate with other
* Mediators. {@link puremvc.Proxy Proxy},
* {@link puremvc.SimpleCommand SimpleCommand}
* and {@link puremvc.MacroCommand MacroCommand}
* instances communicate with each other and
* instances communicate with each other and
* {@link puremvc.Mediator Mediator}s
* by broadcasting Notifications.
*
*
* A key difference between browser events and PureMVC Notifications is that
* events follow the 'Chain of Responsibility' pattern, 'bubbling' up the
* display hierarchy until some parent component handles the event, while
* PureMVC Notification follow a 'Publish/Subscribe' pattern. PureMVC classes
* need not be related to each other in a parent/child relationship in order to
* events follow the 'Chain of Responsibility' pattern, 'bubbling' up the
* display hierarchy until some parent component handles the event, while
* PureMVC Notification follow a 'Publish/Subscribe' pattern. PureMVC classes
* need not be related to each other in a parent/child relationship in order to
* communicate with one another using Notifications.
*
* @constructor
*
* @constructor
* @param {string} name
* The Notification name
* @param {Object} [body]
......@@ -202,7 +202,7 @@ Notification.prototype.getName= function()
};
/**
* Set this Notifications body.
* Set this Notifications body.
* @param {Object} body
* @return {void}
*/
......@@ -234,7 +234,7 @@ Notification.prototype.setType= function(type)
/**
* Get the type of the Notification instance.
*
*
* @return {Object}
*/
Notification.prototype.getType= function()
......@@ -279,41 +279,41 @@ Notification.prototype.type= null;
*/
Notification.prototype.body= null;
/**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
*
*
* @class puremvc.Notifier
*
*
* A Base Notifier implementation.
*
* {@link puremvc.MacroCommand MacroCommand},
* {@link puremvc.SimpleCommand SimpleCommand},
* {@link puremvc.Mediator Mediator} and
*
* {@link puremvc.MacroCommand MacroCommand},
* {@link puremvc.SimpleCommand SimpleCommand},
* {@link puremvc.Mediator Mediator} and
* {@link puremvc.Proxy Proxy}
* all have a need to send Notifications
*
* The Notifier interface provides a common method called #sendNotification that
* relieves implementation code of the necessity to actually construct
*
* The Notifier interface provides a common method called #sendNotification that
* relieves implementation code of the necessity to actually construct
* Notifications.
*
*
* The Notifier class, which all of the above mentioned classes
* extend, provides an initialized reference to the
* extend, provides an initialized reference to the
* {@link puremvc.Facade Facade}
* Multiton, which is required for the convienience method
* for sending Notifications but also eases implementation as these
* classes have frequent
* {@link puremvc.Facade Facade} interactions
* classes have frequent
* {@link puremvc.Facade Facade} interactions
* and usually require access to the facade anyway.
*
*
* NOTE: In the MultiCore version of the framework, there is one caveat to
* notifiers, they cannot send notifications or reach the facade until they
* have a valid multitonKey.
*
* have a valid multitonKey.
*
* The multitonKey is set:
* - on a Command when it is executed by the Controller
* - on a Mediator is registered with the View
* - on a Proxy is registered with the Model.
*
* - on a Proxy is registered with the Model.
*
* @constructor
*/
function Notifier()
......@@ -323,9 +323,9 @@ function Notifier()
/**
* Create and send a Notification.
*
* Keeps us from having to construct new Notification instances in our
* Keeps us from having to construct new Notification instances in our
* implementation code.
*
*
* @param {string} notificationName
* A notification name
* @param {Object} [body]
......@@ -347,27 +347,27 @@ Notifier.prototype.sendNotification = function(notificationName, body, type)
/**
* @protected
* A reference to this Notifier's Facade. This reference will not be available
* until #initializeNotifier has been called.
*
* until #initializeNotifier has been called.
*
* @type {puremvc.Facade}
*/
Notifier.prototype.facade;
/**
* Initialize this Notifier instance.
*
* This is how a Notifier gets its multitonKey.
*
* This is how a Notifier gets its multitonKey.
* Calls to #sendNotification or to access the
* facade will fail until after this method
* facade will fail until after this method
* has been called.
*
* Mediators, Commands or Proxies may override
*
* Mediators, Commands or Proxies may override
* this method in order to send notifications
* or access the Multiton Facade instance as
* soon as possible. They CANNOT access the facade
* in their constructors, since this method will not
* yet have been called.
*
*
*
* @param {string} key
* The Notifiers multiton key;
......@@ -417,22 +417,22 @@ Notifier.prototype.multitonKey = null;
*/
Notifier.MULTITON_MSG = "multitonKey for this Notifier not yet initialized!";
/**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
*
*
* @class puremvc.SimpleCommand
* @extends puremvc.Notifier
*
* SimpleCommands encapsulate the business logic of your application. Your
* SimpleCommands encapsulate the business logic of your application. Your
* subclass should override the #execute method where your business logic will
* handle the
* handle the
* {@link puremvc.Notification Notification}
*
* Take a look at
*
* Take a look at
* {@link puremvc.Facade#registerCommand Facade's registerCommand}
* or {@link puremvc.Controller#registerCommand Controllers registerCommand}
* methods to see how to add commands to your application.
*
*
* @constructor
*/
function SimpleCommand () { };
......@@ -442,44 +442,44 @@ SimpleCommand.prototype.constructor= SimpleCommand;
/**
* Fulfill the use-case initiated by the given Notification
*
*
* In the Command Pattern, an application use-case typically begins with some
* user action, which results in a Notification is handled by the business logic
* in the #execute method of a command.
*
*
* @param {puremvc.Notification} notification
* The notification to handle.
* @return {void}
*/
SimpleCommand.prototype.execute= function (notification) { };
/**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
*
*
* @class puremvc.MacroCommand
* @extends puremvc.Notifier
*
*
* A base command implementation that executes other commands, such as
* {@link puremvc.SimpleCommand SimpleCommand}
* or {@link puremvc.MacroCommand MacroCommand}
* subclasses.
*
*
* A MacroCommand maintains an list of
* command constructor references called *SubCommands*.
*
*
* When #execute is called, the MacroCommand
* instantiates and calls #execute on each of its *SubCommands* in turn.
* Each *SubCommand* will be passed a reference to the original
* {@link puremvc.Notification Notification}
* {@link puremvc.Notification Notification}
* that was passed to the MacroCommands #execute method
*
* Unlike {@link puremvc.SimpleCommand SimpleCommand},
* your subclass should not override #execute but instead, should
* override the #initializeMacroCommand method, calling #addSubCommand once for
*
* Unlike {@link puremvc.SimpleCommand SimpleCommand},
* your subclass should not override #execute but instead, should
* override the #initializeMacroCommand method, calling #addSubCommand once for
* each *SubCommand* to be executed.
*
*
* If your subclass does define a constructor, be sure to call "super" like so
*
*
* function MyMacroCommand ()
* {
* MacroCommand.call(this);
......@@ -505,12 +505,12 @@ MacroCommand.prototype.subCommands= null;
/**
* @protected
* Initialize the MacroCommand.
*
* In your subclass, override this method to
* initialize the MacroCommand's *SubCommand*
* list with command class references like
*
* In your subclass, override this method to
* initialize the MacroCommand's *SubCommand*
* list with command class references like
* this:
*
*
* // Initialize MyMacroCommand
* MyMacroCommand.prototype.initializeMacroCommand= function ()
* {
......@@ -518,7 +518,7 @@ MacroCommand.prototype.subCommands= null;
* this.addSubCommand( com.me.myapp.controller.SecondCommand );
* this.addSubCommand( com.me.myapp.controller.ThirdCommand );
* };
*
*
* Note that *SubCommand*s may be any command implementor,
* MacroCommands or SimpleCommands are both acceptable.
* @return {void}
......@@ -528,7 +528,7 @@ MacroCommand.prototype.initializeMacroCommand= function() {}
/**
* @protected
* Add a *SubCommand*
*
*
* The *SubCommand*s will be called in First In / First Out (FIFO) order
* @param {Function} commandClassRef
* A reference to a subclassed SimpleCommand or MacroCommand constructor
......@@ -540,7 +540,7 @@ MacroCommand.prototype.addSubCommand= function(commandClassRef)
/**
* Execute this MacroCommands *SubCommands*
*
*
* The *SubCommand*s will be called in First In / First Out (FIFO) order
* @param {puremvc.Notification} note
* The Notification object to be passed to each *SubCommand*
......@@ -557,35 +557,35 @@ MacroCommand.prototype.execute= function(note)
}
};
/**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
*
*
* @class puremvc.Mediator
* @extends puremvc.Notifier
*
*
* A base Mediator implementation.
*
* In PureMVC, Mediator classes are used to mediate communication between a view
* In PureMVC, Mediator classes are used to mediate communication between a view
* component and the rest of the application.
*
* A Mediator should listen to its view components for events, and handle them
* by sending notifications (to be handled by other Mediators,
* {@link puremvc.SimpleCommand SimpleCommands}
* A Mediator should listen to its view components for events, and handle them
* by sending notifications (to be handled by other Mediators,
* {@link puremvc.SimpleCommand SimpleCommands}
* or
* {@link puremvc.MacroCommand MacroCommands})
* or passing data from the view component directly to a
* {@link puremvc.Proxy Proxy}, such as submitting
* {@link puremvc.MacroCommand MacroCommands})
* or passing data from the view component directly to a
* {@link puremvc.Proxy Proxy}, such as submitting
* the contents of a form to a service.
*
* Mediators should not perform business logic, maintain state or other
* information for its view component, or break the encapsulation of the view
* component by manipulating the view component's children. It should only call
*
* Mediators should not perform business logic, maintain state or other
* information for its view component, or break the encapsulation of the view
* component by manipulating the view component's children. It should only call
* methods or set properties on the view component.
*
* The view component should encapsulate its own behavior and implementation by
* exposing methods and properties that the Mediator can call without having to
*
* The view component should encapsulate its own behavior and implementation by
* exposing methods and properties that the Mediator can call without having to
* know about the view component's children.
*
*
* @constructor
* @param {string} [mediatorName]
* The Mediators name. The Mediators static #NAME value is used by default
......@@ -595,16 +595,16 @@ MacroCommand.prototype.execute= function(note)
function Mediator (mediatorName, viewComponent)
{
this.mediatorName= mediatorName || this.constructor.NAME;
this.viewComponent=viewComponent;
this.viewComponent=viewComponent;
};
/**
* @static
* The name of the Mediator.
*
*
* Typically, a Mediator will be written to serve one specific control or group
* of controls and so, will not have a need to be dynamically named.
*
*
* @type {string}
*/
Mediator.NAME= "Mediator";
......@@ -615,7 +615,7 @@ Mediator.prototype.constructor= Mediator;
/**
* Get the name of the Mediator
*
*
* @return {string}
* The Mediator name
*/
......@@ -628,10 +628,10 @@ Mediator.prototype.getMediatorName= function ()
* Set the Mediators view component. This could
* be a HTMLElement, a bespoke UiComponent wrapper
* class, a MooTools Element, a jQuery result or a
* css selector, depending on which DOM abstraction
* css selector, depending on which DOM abstraction
* library you are using.
*
*
*
*
* @param {Object} the view component
* @return {void}
*/
......@@ -642,21 +642,21 @@ Mediator.prototype.setViewComponent= function (viewComponent)
/**
* Get the Mediators view component.
*
*
* Additionally, an optional explicit getter can be
* be defined in the subclass that defines the
* be defined in the subclass that defines the
* view components, providing a more semantic interface
* to the Mediator.
*
*
* This is different from the AS3 implementation in
* the sense that no casting is required from the
* object supplied as the view component.
*
*
* MyMediator.prototype.getComboBox= function ()
* {
* return this.viewComponent;
* return this.viewComponent;
* }
*
*
* @return {Object}
* The view component
*/
......@@ -668,8 +668,8 @@ Mediator.prototype.getViewComponent= function ()
/**
* List the Notification names this Mediator is interested
* in being notified of.
*
* @return {Array}
*
* @return {Array}
* The list of Notification names.
*/
Mediator.prototype.listNotificationInterests= function ()
......@@ -679,11 +679,11 @@ Mediator.prototype.listNotificationInterests= function ()
/**
* Handle Notifications.
*
*
* Typically this will be handled in a switch statement
* with one 'case' entry per Notification the Mediator
* is interested in
*
*
* @param {puremvc.Notification} notification
* @return {void}
*/
......@@ -712,7 +712,7 @@ Mediator.prototype.onRemove= function ()
/**
* @ignore
* The Mediators name. Should only be accessed by Mediator subclasses.
*
*
* @protected
* @type string
*/
......@@ -721,35 +721,35 @@ Mediator.prototype.mediatorName= null;
/**
* @ignore
* The Mediators viewComponent. Should only be accessed by Mediator subclasses.
*
*
* @protected
* @type Object
*/
Mediator.prototype.viewComponent=null;
/**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
*
*
* @class puremvc.Proxy
* @extends puremvc.Notifier
*
* A base Proxy implementation.
*
* In PureMVC, Proxy classes are used to manage parts of the application's data
* A base Proxy implementation.
*
* In PureMVC, Proxy classes are used to manage parts of the application's data
* model.
*
* A Proxy might simply manage a reference to a local data object, in which case
* interacting with it might involve setting and getting of its data in
*
* A Proxy might simply manage a reference to a local data object, in which case
* interacting with it might involve setting and getting of its data in
* synchronous fashion.
*
* Proxy classes are also used to encapsulate the application's interaction with
* remote services to save or retrieve data, in which case, we adopt an
* asyncronous idiom; setting data (or calling a method) on the Proxy and
* listening for a
* {@link puremvc.Notification Notification}
* to be sent when the Proxy has retrieved the data from the service.
*
*
*
* Proxy classes are also used to encapsulate the application's interaction with
* remote services to save or retrieve data, in which case, we adopt an
* asyncronous idiom; setting data (or calling a method) on the Proxy and
* listening for a
* {@link puremvc.Notification Notification}
* to be sent when the Proxy has retrieved the data from the service.
*
*
* @param {string} [proxyName]
* The Proxy's name. If none is provided, the Proxy will use its constructors
* NAME property.
......@@ -817,7 +817,7 @@ Proxy.prototype.onRegister= function()
/**
* Called by the {@link puremvc.Model Model} when
* the Proxy is removed.
*
*
* @return {void}
*/
Proxy.prototype.onRemove= function()
......@@ -843,21 +843,21 @@ Proxy.prototype.proxyName= null;
*/
Proxy.prototype.data= null;
/**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
*
*
* @class puremvc.Facade
* Facade exposes the functionality of the Controller, Model and View
* actors to client facing code.
*
* This Facade implementation is a Multiton, so you should not call the
* constructor directly, but instead call the static Factory method,
* actors to client facing code.
*
* This Facade implementation is a Multiton, so you should not call the
* constructor directly, but instead call the static Factory method,
* passing the unique key for this instance to #getInstance
*
* @constructor
* @param {string} key
* The multiton key to use to retrieve the Facade instance.
* @throws {Error}
* @throws {Error}
* If an attempt is made to instantiate Facade directly
*/
function Facade(key)
......@@ -874,11 +874,11 @@ function Facade(key)
/**
* Initialize the Multiton Facade instance.
*
*
* Called automatically by the constructor. Override in your subclass to any
* subclass specific initializations. Be sure to call the 'super'
* subclass specific initializations. Be sure to call the 'super'
* initializeFacade method, though
*
*
* MyFacade.prototype.initializeFacade= function ()
* {
* Facade.call(this);
......@@ -894,10 +894,10 @@ Facade.prototype.initializeFacade = function()
};
/**
* Facade Multiton Factory method.
* Facade Multiton Factory method.
* Note that this method will return null if supplied a
* null or undefined multiton key.
*
*
* @param {string} key
* The multiton key use to retrieve a particular Facade instance
* @return {puremvc.Facade}
......@@ -906,7 +906,7 @@ Facade.getInstance = function(key)
{
if (null == key)
return null;
if(Facade.instanceMap[key] == null)
{
Facade.instanceMap[key] = new Facade(key);
......@@ -917,28 +917,28 @@ Facade.getInstance = function(key)
/**
* Initialize the {@link puremvc.Controller Controller}.
*
*
* Called by the #initializeFacade method.
*
*
* Override this method in your subclass of Facade
* if one or both of the following are true:
* - You wish to initialize a different Controller
* - You have
* - You have
* {@link puremvc.SimpleCommand SimpleCommand}s
* or {@link puremvc.MacroCommand MacroCommand}s
* to register with the Controllerat startup.
*
* If you don't want to initialize a different Controller,
* to register with the Controllerat startup.
*
* If you don't want to initialize a different Controller,
* call the 'super' initializeControlle method at the beginning of your
* method, then register commands.
*
*
* MyFacade.prototype.initializeController= function ()
* {
* Facade.prototype.initializeController.call(this);
* this.registerCommand(AppConstants.A_NOTE_NAME, ABespokeCommand)
* }
*
*
* @protected
* @return {void}
*/
......@@ -953,27 +953,27 @@ Facade.prototype.initializeController = function()
/**
* @protected
* Initialize the {@link puremvc.Model Model};
*
*
* Called by the #initializeFacade method.
* Override this method in your subclass of Facade if one of the following are
* true:
*
*
* - You wish to initialize a different Model.
*
* - You have {@link puremvc.Proxy Proxy}s to
* register with the Model that do not retrieve a reference to the Facade at
*
* - You have {@link puremvc.Proxy Proxy}s to
* register with the Model that do not retrieve a reference to the Facade at
* construction time.
*
*
* If you don't want to initialize a different Model
* call 'super' #initializeModel at the beginning of your method, then register
* call 'super' #initializeModel at the beginning of your method, then register
* Proxys.
*
*
* Note: This method is *rarely* overridden; in practice you are more
* likely to use a command to create and registerProxys with the Model>,
* likely to use a command to create and registerProxys with the Model>,
* since Proxys with mutable data will likely
* need to send Notifications and thus will likely want to fetch a reference to
* the Facade during their construction.
*
* need to send Notifications and thus will likely want to fetch a reference to
* the Facade during their construction.
*
* @return {void}
*/
Facade.prototype.initializeModel = function()
......@@ -986,32 +986,32 @@ Facade.prototype.initializeModel = function()
/**
* @protected
*
*
* Initialize the {@link puremvc.View View}.
*
*
* Called by the #initializeFacade method.
*
* Override this method in your subclass of Facade if one or both of the
*
* Override this method in your subclass of Facade if one or both of the
* following are true:
*
* - You wish to initialize a different View.
* - You have Observers to register with the View
*
* If you don't want to initialize a different View
*
* If you don't want to initialize a different View
* call 'super' #initializeView at the beginning of your
* method, then register Mediator instances.
*
*
* MyFacade.prototype.initializeView= function ()
* {
* Facade.prototype.initializeView.call(this);
* this.registerMediator(new MyMediator());
* };
*
*
* Note: This method is *rarely* overridden; in practice you are more
* likely to use a command to create and register Mediators
* with the View, since Mediator instances will need to send
* Notifications and thus will likely want to fetch a reference
* to the Facade during their construction.
* with the View, since Mediator instances will need to send
* Notifications and thus will likely want to fetch a reference
* to the Facade during their construction.
* @return {void}
*/
Facade.prototype.initializeView = function()
......@@ -1049,7 +1049,7 @@ Facade.prototype.removeCommand = function(notificationName)
/**
* Check if a command is registered for a given notification.
*
*
* @param {string} notificationName
* A Notification name
* @return {boolean}
......@@ -1063,7 +1063,7 @@ Facade.prototype.hasCommand = function(notificationName)
/**
* Register a Proxy with the {@link puremvc.Model#registerProxy Model}
* by name.
*
*
* @param {puremvc.Proxy} proxy
* The Proxy instance to be registered with the Model.
* @return {void}
......@@ -1075,7 +1075,7 @@ Facade.prototype.registerProxy = function(proxy)
/**
* Retrieve a Proxy from the Model
*
*
* @param {string} proxyName
* @return {puremvc.Proxy}
*/
......@@ -1116,7 +1116,7 @@ Facade.prototype.hasProxy = function(proxyName)
/**
* Register a Mediator with with the View.
*
*
* @param {puremvc.Mediator} mediator
* A reference to the Mediator to register
* @return {void}
......@@ -1131,7 +1131,7 @@ Facade.prototype.registerMediator = function(mediator)
/**
* Retrieve a Mediator from the View by name
*
*
* @param {string} mediatorName
* The Mediators name
* @return {puremvc.Mediator}
......@@ -1144,7 +1144,7 @@ Facade.prototype.retrieveMediator = function(mediatorName)
/**
* Remove a Mediator from the View.
*
*
* @param {string} mediatorName
* The name of the Mediator to remove.
* @return {puremvc.Mediator}
......@@ -1163,7 +1163,7 @@ Facade.prototype.removeMediator = function(mediatorName)
/**
* Check if a Mediator is registered or not.
*
*
* @param {string} mediatorName
* A Mediator name
* @return {boolean}
......@@ -1175,12 +1175,12 @@ Facade.prototype.hasMediator = function(mediatorName)
};
/**
* Create and send a
* Create and send a
* {@link puremvc.Notification Notification}
*
*
* Keeps us from having to construct new Notification instances in our
* implementation
*
*
* @param {string} notificationName
* The name of the Notification to send
* @param {Object} [body]
......@@ -1196,13 +1196,13 @@ Facade.prototype.sendNotification = function(notificationName, body, type)
/**
* Notify {@link puremvc.Observer Observer}s
*
*
* This method is left public mostly for backward compatibility, and to allow
* you to send custom notification classes using the facade.
*
* Usually you should just call sendNotification and pass the parameters, never
*
* Usually you should just call sendNotification and pass the parameters, never
* having to construct the notification yourself.
*
*
* @param {puremvc.Notification} notification
* The Notification to send
* @return {void}
......@@ -1216,12 +1216,12 @@ Facade.prototype.notifyObservers = function(notification)
};
/**
* Initialize the Facades Notifier capabilities by setting the Multiton key for
* Initialize the Facades Notifier capabilities by setting the Multiton key for
* this facade instance.
*
* Not called directly, but instead from the constructor when #getInstance is
*
* Not called directly, but instead from the constructor when #getInstance is
* invoked. It is necessary to be public in order to implement Notifier
*
*
* @param {string} key
* @return {void}
*/
......@@ -1245,8 +1245,8 @@ Facade.hasCore = function(key)
};
/**
* Remove a *Core*
*
* Remove a *Core*
*
* Remove the Model, View, Controller and Facade for a given key.
*
* @static
......@@ -1319,42 +1319,42 @@ Facade.instanceMap = [];
*/
Facade.MULTITON_MSG = "Facade instance for this Multiton key already constructed!";
/**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
*
*
* @class puremvc.View
*
*
* A Multiton View implementation.
*
*
* In PureMVC, the View class assumes these responsibilities
*
*
* - Maintain a cache of {@link puremvc.Mediator Mediator}
* instances.
*
* - Provide methods for registering, retrieving, and removing
*
* - Provide methods for registering, retrieving, and removing
* {@link puremvc.Mediator Mediator}.
*
* - Notifiying {@link puremvc.Mediator Mediator} when they are registered or
*
* - Notifiying {@link puremvc.Mediator Mediator} when they are registered or
* removed.
*
* - Managing the observer lists for each {@link puremvc.Notification Notification}
*
* - Managing the observer lists for each {@link puremvc.Notification Notification}
* in the application.
*
* - Providing a method for attaching {@link puremvc.Observer Observer} to an
*
* - Providing a method for attaching {@link puremvc.Observer Observer} to an
* {@link puremvc.Notification Notification}'s observer list.
*
*
* - Providing a method for broadcasting a {@link puremvc.Notification Notification}.
*
* - Notifying the {@link puremvc.Observer Observer}s of a given
*
* - Notifying the {@link puremvc.Observer Observer}s of a given
* {@link puremvc.Notification Notification} when it broadcast.
*
* This View implementation is a Multiton, so you should not call the
* constructor directly, but instead call the static Multiton
*
* This View implementation is a Multiton, so you should not call the
* constructor directly, but instead call the static Multiton
* Factory #getInstance method.
*
*
* @param {string} key
* @constructor
* @throws {Error}
* @throws {Error}
* if instance for this Multiton key has already been constructed
*/
function View(key)
......@@ -1374,11 +1374,11 @@ function View(key)
/**
* @protected
* Initialize the Singleton View instance
*
*
* Called automatically by the constructor, this is your opportunity to
* initialize the Singleton instance in your subclass without overriding the
* constructor
*
*
* @return {void}
*/
View.prototype.initializeView = function()
......@@ -1388,9 +1388,9 @@ View.prototype.initializeView = function()
/**
* View Singleton Factory method.
* Note that this method will return null if supplied a null
* Note that this method will return null if supplied a null
* or undefined multiton key.
*
*
* @return {puremvc.View}
* The Singleton instance of View
*/
......@@ -1398,7 +1398,7 @@ View.getInstance = function(key)
{
if (null == key)
return null;
if(View.instanceMap[key] == null)
{
View.instanceMap[key] = new View(key);
......@@ -1409,7 +1409,7 @@ View.getInstance = function(key)
/**
* Register an Observer to be notified of Notifications with a given name
*
*
* @param {string} notificationName
* The name of the Notifications to notify this Observer of
* @param {puremvc.Observer} observer
......@@ -1430,11 +1430,11 @@ View.prototype.registerObserver = function(notificationName, observer)
/**
* Notify the Observersfor a particular Notification.
*
*
* All previously attached Observers for this Notification's
* list are notified and are passed a reference to the INotification in
* list are notified and are passed a reference to the INotification in
* the order in which they were registered.
*
*
* @param {puremvc.Notification} notification
* The Notification to notify Observers of
* @return {void}
......@@ -1463,7 +1463,7 @@ View.prototype.notifyObservers = function(notification)
/**
* Remove the Observer for a given notifyContext from an observer list for
* a given Notification name
*
*
* @param {string} notificationName
* Which observer list to remove from
* @param {Object} notifyContext
......@@ -1491,19 +1491,19 @@ View.prototype.removeObserver = function(notificationName, notifyContext)
/**
* Register a Mediator instance with the View.
*
*
* Registers the Mediator so that it can be retrieved by name,
* and further interrogates the Mediator for its
* and further interrogates the Mediator for its
* {@link puremvc.Mediator#listNotificationInterests interests}.
*
* If the Mediator returns any Notification
* names to be notified about, an Observer is created encapsulating
* the Mediator instance's
* names to be notified about, an Observer is created encapsulating
* the Mediator instance's
* {@link puremvc.Mediator#handleNotification handleNotification}
* method and registering it as an Observer for all Notifications the
* method and registering it as an Observer for all Notifications the
* Mediator is interested in.
*
* @param {puremvc.Mediator}
*
* @param {puremvc.Mediator}
* a reference to the Mediator instance
*/
View.prototype.registerMediator = function(mediator)
......@@ -1536,7 +1536,7 @@ View.prototype.registerMediator = function(mediator)
/**
* Retrieve a Mediator from the View
*
*
* @param {string} mediatorName
* The name of the Mediator instance to retrieve
* @return {puremvc.Mediator}
......@@ -1549,7 +1549,7 @@ View.prototype.retrieveMediator = function(mediatorName)
/**
* Remove a Mediator from the View.
*
*
* @param {string} mediatorName
* Name of the Mediator instance to be removed
* @return {puremvc.Mediator}
......@@ -1581,7 +1581,7 @@ View.prototype.removeMediator = function(mediatorName)
/**
* Check if a Mediator is registered or not.
*
*
* @param {string} mediatorName
* @return {boolean}
* Whether a Mediator is registered with the given mediatorname
......@@ -1593,7 +1593,7 @@ View.prototype.hasMediator = function(mediatorName)
/**
* Remove a View instance
*
*
* @return {void}
*/
View.removeView = function(key)
......@@ -1648,9 +1648,9 @@ View.prototype.multitonKey = null;
*/
View.MULTITON_MSG = "View instance for this Multiton key already constructed!";
/**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
*
*
* @class puremvc.Model
*
* A Multiton Model implementation.
......@@ -1665,18 +1665,18 @@ View.MULTITON_MSG = "View instance for this Multiton key already constructed!";
* - Provide methods for registering, retrieving, and removing
* {@link puremvc.Proxy Proxy} instances.
*
* Your application must register
* {@link puremvc.Proxy Proxy} instances with the Model.
* Typically, you use a
* {@link puremvc.SimpleCommand SimpleCommand}
* Your application must register
* {@link puremvc.Proxy Proxy} instances with the Model.
* Typically, you use a
* {@link puremvc.SimpleCommand SimpleCommand}
* or
* {@link puremvc.MacroCommand MacroCommand}
* to create and register Proxy instances once the Facade has initialized the
* {@link puremvc.MacroCommand MacroCommand}
* to create and register Proxy instances once the Facade has initialized the
* *Core* actors.
*
* This Model implementation is a Multiton, so you should not call the
* constructor directly, but instead call the
* {@link #getInstance static Multiton Factory method}
* This Model implementation is a Multiton, so you should not call the
* constructor directly, but instead call the
* {@link #getInstance static Multiton Factory method}
* @constructor
* @param {string} key
* The Models multiton key
......@@ -1698,12 +1698,12 @@ function Model(key)
/**
* Initialize the Model instance.
*
*
* Called automatically by the constructor, this
* is your opportunity to initialize the Singleton
* instance in your subclass without overriding the
* constructor.
*
*
* @return void
*/
Model.prototype.initializeModel= function(){};
......@@ -1711,19 +1711,19 @@ Model.prototype.initializeModel= function(){};
/**
* Model Multiton Factory method.
* Note that this method will return null if supplied a null
* Note that this method will return null if supplied a null
* or undefined multiton key.
*
*
* @param {string} key
* The multiton key for the Model to retrieve
* @return {puremvc.Model}
* the instance for this Multiton key
* the instance for this Multiton key
*/
Model.getInstance= function(key)
{
if (null == key)
return null;
if(Model.instanceMap[key] == null)
{
Model.instanceMap[key]= new Model(key);
......@@ -1745,7 +1745,7 @@ Model.prototype.registerProxy= function(proxy)
/**
* Retrieve a Proxy from the Model
*
*
* @param {string} proxyName
* @return {puremvc.Proxy}
* The Proxy instance previously registered with the provided proxyName
......@@ -1768,7 +1768,7 @@ Model.prototype.hasProxy= function(proxyName)
/**
* Remove a Proxy from the Model.
*
*
* @param {string} proxyName
* The name of the Proxy instance to remove
* @return {puremvc.Proxy}
......@@ -1789,7 +1789,7 @@ Model.prototype.removeProxy= function(proxyName)
/**
* @static
* Remove a Model instance.
*
*
* @param {string} key
* @return {void}
*/
......@@ -1829,59 +1829,59 @@ Model.prototype.multitonKey;
/**
* @ignore
* Message Constants
*
*
* @static
* @type {string}
*/
Model.MULTITON_MSG= "Model instance for this Multiton key already constructed!";
/**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
*
*
* @class puremvc.Controller
*
* In PureMVC, the Controller class follows the 'Command and Controller'
*
* In PureMVC, the Controller class follows the 'Command and Controller'
* strategy, and assumes these responsibilities:
*
*
* - Remembering which
* {@link puremvc.SimpleCommand SimpleCommand}s
* or
* or
* {@link puremvc.MacroCommand MacroCommand}s
* are intended to handle which
* are intended to handle which
* {@link puremvc.Notification Notification}s
* - Registering itself as an
* - Registering itself as an
* {@link puremvc.Observer Observer} with
* the {@link puremvc.View View} for each
* the {@link puremvc.View View} for each
* {@link puremvc.Notification Notification}
* that it has an
* {@link puremvc.SimpleCommand SimpleCommand}
* or {@link puremvc.MacroCommand MacroCommand}
* that it has an
* {@link puremvc.SimpleCommand SimpleCommand}
* or {@link puremvc.MacroCommand MacroCommand}
* mapping for.
* - Creating a new instance of the proper
* - Creating a new instance of the proper
* {@link puremvc.SimpleCommand SimpleCommand}s
* or
* or
* {@link puremvc.MacroCommand MacroCommand}s
* to handle a given
* {@link puremvc.Notification Notification}
* to handle a given
* {@link puremvc.Notification Notification}
* when notified by the
* {@link puremvc.View View}.
* - Calling the command's execute method, passing in the
* - Calling the command's execute method, passing in the
* {@link puremvc.Notification Notification}.
*
* Your application must register
* Your application must register
* {@link puremvc.SimpleCommand SimpleCommand}s
* or {@link puremvc.MacroCommand MacroCommand}s
* or {@link puremvc.MacroCommand MacroCommand}s
* with the Controller.
*
* The simplest way is to subclass
* The simplest way is to subclass
* {@link puremvc.Facade Facade},
* and use its
* {@link puremvc.Facade#initializeController initializeController}
* and use its
* {@link puremvc.Facade#initializeController initializeController}
* method to add your registrations.
*
* @constructor
* This Controller implementation is a Multiton, so you should not call the
* constructor directly, but instead call the static #getInstance factory method,
* This Controller implementation is a Multiton, so you should not call the
* constructor directly, but instead call the static #getInstance factory method,
* passing the unique key for this instance to it.
* @param {string} key
* @throws {Error}
......@@ -1902,7 +1902,7 @@ function Controller(key)
/**
* @protected
*
*
* Initialize the multiton Controller instance.
*
* Called automatically by the constructor.
......@@ -1911,12 +1911,12 @@ function Controller(key)
* in your application, you should *also* subclass Controller
* and override the initializeController method in the
* following way.
*
*
* MyController.prototype.initializeController= function ()
* {
* this.view= MyView.getInstance(this.multitonKey);
* };
*
*
* @return {void}
*/
Controller.prototype.initializeController= function()
......@@ -1925,9 +1925,9 @@ Controller.prototype.initializeController= function()
};
/**
* The Controllers multiton factory method.
* Note that this method will return null if supplied a null
* or undefined multiton key.
* The Controllers multiton factory method.
* Note that this method will return null if supplied a null
* or undefined multiton key.
*
* @param {string} key
* A Controller's multiton key
......@@ -1938,7 +1938,7 @@ Controller.getInstance= function(key)
{
if (null == key)
return null;
if(null == this.instanceMap[key])
{
this.instanceMap[key]= new this(key);
......@@ -1966,10 +1966,10 @@ Controller.prototype.executeCommand= function(note)
};
/**
* Register a particular SimpleCommand or MacroCommand class as the handler for
* Register a particular SimpleCommand or MacroCommand class as the handler for
* a particular Notification.
*
* If an command already been registered to handle Notifications with this name,
* If an command already been registered to handle Notifications with this name,
* it is no longer used, the new command is used instead.
*
* The Observer for the new command is only created if this the irst time a
......@@ -2025,7 +2025,7 @@ Controller.prototype.removeCommand= function(notificationName)
* @static
* Remove a Controller instance.
*
* @param {string} key
* @param {string} key
* multitonKey of Controller instance to remove
* @return {void}
*/
......@@ -2036,7 +2036,7 @@ Controller.removeController= function(key)
/**
* Local reference to the Controller's View
*
*
* @protected
* @type {puremvc.View}
*/
......@@ -2044,7 +2044,7 @@ Controller.prototype.view= null;
/**
* Note name to command constructor mappings
*
*
* @protected
* @type {Object}
*/
......@@ -2052,7 +2052,7 @@ Controller.prototype.commandMap= null;
/**
* The Controller's multiton key
*
*
* @protected
* @type {string}
*/
......@@ -2060,7 +2060,7 @@ Controller.prototype.multitonKey= null;
/**
* Multiton key to Controller instance mappings
*
*
* @static
* @protected
* @type {Object}
......@@ -2069,7 +2069,7 @@ Controller.instanceMap= [];
/**
* @ignore
*
*
* Message constants
* @static
* @protected
......@@ -2077,9 +2077,9 @@ Controller.instanceMap= [];
*/
Controller.MULTITON_MSG= "controller key for this Multiton key already constructed"
/*
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
*
*
* @hide
* A an internal helper class used to assist classlet implementation. This
* class is not accessible by client code.
......@@ -2089,67 +2089,67 @@ var OopHelp=
/*
* @private
* A reference to the global scope. We use this rather than window
* in order to support both browser based and non browser baed
* in order to support both browser based and non browser baed
* JavaScript interpreters.
* @type {Object}
*/
global: (function(){return this})()
/*
* @private
* Extend one Function's prototype by another, emulating classic
* inheritance.
*
*
* @param {Function} child
* The Function to extend (subclass)
*
*
* @param {Function} parent
* The Function to extend from (superclass)
*
*
* @return {Function}
*
*
* A reference to the extended Function (subclass)
*/
, extend: function (child, parent)
{
if ('function' !== typeof child)
throw new TypeError('#extend- child should be Function');
throw new TypeError('#extend- child should be Function');
if ('function' !== typeof parent)
throw new TypeError('#extend- parent should be Function');
if (parent === child)
return;
var Transitive= new Function;
Transitive.prototype= parent.prototype;
child.prototype= new Transitive;
return child.prototype.constructor= child;
}
/*
* @private
* Decoarate one object with the properties of another.
*
* Decoarate one object with the properties of another.
*
* @param {Object} object
* The object to decorate.
*
*
* @param {Object} traits
* The object providing the properites that the first object
* will be decorated with. Note that only properties defined on
* will be decorated with. Note that only properties defined on
* this object will be copied- i.e. inherited properties will
* be ignored.
*
*
* @return {Object}
* THe decorated object (first argument)
*/
, decorate: function (object, traits)
{
{
for (var accessor in traits)
{
object[accessor]= traits[accessor];
}
}
return object;
}
};
......@@ -2157,51 +2157,51 @@ var OopHelp=
/**
* @member puremvc
*
*
* Declare a namespace and optionally make an Object the referent
* of that namespace.
*
*
* console.assert(null == window.tld, 'No tld namespace');
* // declare the tld namespace
* puremvc.declare('tld');
* console.assert('object' === typeof tld, 'The tld namespace was declared');
*
*
* // the method returns a reference to last namespace node in a created hierarchy
* var reference= puremvc.declare('tld.domain.app');
* console.assert(reference === tld.domain.app)
*
*
* // of course you can also declare your own objects as well
* var AppConstants=
* {
* APP_NAME: 'tld.domain.app.App'
* };
*
*
* puremvc.declare('tld.domain.app.AppConstants', AppConstants);
* console.assert(AppConstants === tld.domain.app.AppConstants
* , 'AppConstants was exported to the namespace');
*
*
* Note that you can also #declare within a closure. That way you
* can selectively export Objects to your own namespaces without
* leaking variables into the global scope.
*
*
* (function(){
* // this var is not accessible outside of this
* // closures call scope
* var hiddenValue= 'defaultValue';
*
*
* // export an object that references the hidden
* // variable and which can mutate it
* puremvc.declare
* (
* 'tld.domain.app.backdoor'
*
*
* , {
* setValue: function (value)
* {
* // assigns to the hidden var
* hiddenValue= value;
* }
*
*
* , getValue: function ()
* {
* // reads from the hidden var
......@@ -2216,31 +2216,31 @@ var OopHelp=
* tld.domain.app.backdoor.setValue('newValue');
* // the hidden var was mutated
* console.assert('newValue' === tld.domain.app.backdoor.getValue());
*
* On occasion, primarily during testing, you may want to use declare,
*
* On occasion, primarily during testing, you may want to use declare,
* but not have the global object be the namespace root. In these cases you
* can supply the optional third scope argument.
*
*
* var localScope= {}
* , object= {}
*
*
* puremvc.declare('mock.object', object, localScope);
*
*
* console.assert(null == window.mock, 'mock namespace is not in global scope');
* console.assert(object === localScope.mock.object, 'mock.object is available in localScope');
*
* console.assert(object === localScope.mock.object, 'mock.object is available in localScope');
*
* @param {string} string
* A qualified object name, e.g. 'com.example.Class'
*
*
* @param {Object} [object]
* An object to make the referent of the namespace.
*
* An object to make the referent of the namespace.
*
* @param {Object} [scope]
* The namespace's root node. If not supplied, the global
* scope will be namespaces root node.
*
*
* @return {Object}
*
*
* A reference to the last node of the Object hierarchy created.
*/
function declare (qualifiedName, object, scope)
......@@ -2250,18 +2250,18 @@ function declare (qualifiedName, object, scope)
, lastNode
, newNode
, nodeName;
for (var i= 0, n= nodes.length; i < n; i++)
{
lastNode= node;
nodeName= nodes[i];
node= (null == node[nodeName] ? node[nodeName] = {} : node[nodeName]);
}
if (null == object)
return node;
return lastNode[nodeName]= object;
};
......@@ -2270,15 +2270,15 @@ function declare (qualifiedName, object, scope)
/**
* @member puremvc
*
*
* Define a new classlet. Current editions of JavaScript do not have classes,
* but they can be emulated, and this method does this for you, saving you
* from having to work with Function prototype directly. The method does
* not extend any Native objects and is entirely opt in. Its particularly
* usefull if you want to make your PureMvc applications more portable, by
* decoupling them from a specific OOP abstraction library.
*
*
*
*
* puremvc.define
* (
* // the first object supplied is a class descriptor. None of these
......@@ -2286,32 +2286,32 @@ function declare (qualifiedName, object, scope)
* // constructor property, which if supplied, will be your classes
* // constructor.
* {
* // your classes namespace- if supplied, it will be
* // your classes namespace- if supplied, it will be
* // created for you
* name: 'com.example.UserMediator'
*
* // your classes parent class. If supplied, inheritance
*
* // your classes parent class. If supplied, inheritance
* // will be taken care of for you
* , parent: puremvc.Mediator
*
* // your classes constructor. If not supplied, one will be
*
* // your classes constructor. If not supplied, one will be
* // created for you
* , constructor: function UserMediator (component)
* {
* puremvc.Mediator.call(this, this.constructor.NAME, component);
* puremvc.Mediator.call(this, this.constructor.NAME, component);
* }
* }
*
*
* // the second object supplied defines your class traits, that is
* // the properties that will be defined on your classes prototype
* // and thereby on all instances of this class
* , {
* businessMethod: function ()
* {
* // impl
* // impl
* }
* }
*
*
* // the third object supplied defines your classes 'static' traits
* // that is, the methods and properties which will be defined on
* // your classes constructor
......@@ -2319,27 +2319,27 @@ function declare (qualifiedName, object, scope)
* NAME: 'userMediator'
* }
* );
*
*
* @param {Object} [classinfo]
* An object describing the class. This object can have any or all of
* the following properties:
*
* - name: String
*
* - name: String
* The classlets name. This can be any arbitrary qualified object
* name. 'com.example.Classlet' or simply 'MyClasslet' for example
* name. 'com.example.Classlet' or simply 'MyClasslet' for example
* The method will automatically create an object hierarchy refering
* to your class for you. Note that you will need to capture the
* to your class for you. Note that you will need to capture the
* methods return value to retrieve a reference to your class if the
* class name property is not defined.
* - parent: Function
* The classlets 'superclass'. Your class will be extended from this
* if supplied.
*
*
* - constructor: Function
* The classlets constructor. Note this is *not* a post construct
* The classlets constructor. Note this is *not* a post construct
* initialize method, but your classes constructor Function.
* If this attribute is not defined, a constructor will be created for
* If this attribute is not defined, a constructor will be created for
* you automatically. If you have supplied a parent class
* value and not defined the classes constructor, the automatically
* created constructor will invoke the super class constructor
......@@ -2347,22 +2347,22 @@ function declare (qualifiedName, object, scope)
* wish to invoke it's super constructor, you must do this manually, as
* there is no reference to the classes parent added to the constructor
* prototype.
*
*
* - scope: Object.
* For use in advanced scenarios. If the name attribute has been supplied,
* this value will be the root of the object hierarchy created for you.
* Use it do define your own class hierarchies in private scopes,
* accross iFrames, in your unit tests, or avoid collision with third
* party library namespaces.
*
*
* @param {Object} [traits]
* An Object, the properties of which will be added to the
* class constructors prototype.
*
*
* @param {Object} [staitcTraits]
* An Object, the properties of which will be added directly
* to this class constructor
*
*
* @return {Function}
* A reference to the classlets constructor
*/
......@@ -2384,14 +2384,14 @@ function define (classInfo, traits, staticTraits)
{
throw new TypeError('Class parent must be Function');
}
if (classInfo.hasOwnProperty('constructor'))
{
classConstructor= classInfo.constructor
if ('function' !== typeof classConstructor)
{
throw new TypeError('Class constructor must be Function')
}
}
}
else // there is no constructor, create one
{
......@@ -2405,60 +2405,60 @@ function define (classInfo, traits, staticTraits)
else // just create a Function
{
classConstructor= new Function;
}
}
}
if (doExtend)
{
OopHelp.extend(classConstructor, classParent);
}
if (traits)
{
prototype= classConstructor.prototype
OopHelp.decorate(prototype, traits);
// reassign constructor
// reassign constructor
prototype.constructor= classConstructor;
}
if (staticTraits)
{
OopHelp.decorate(classConstructor, staticTraits)
}
if (className)
{
if ('string' !== typeof className)
{
throw new TypeError('Class name must be primitive string');
}
declare (className, classConstructor, classScope);
}
return classConstructor;
};
/* implementation end */
// define the puremvc global namespace and export the actors
scope.puremvc=
{
View: View
, Model: Model
, Controller: Controller
, SimpleCommand: SimpleCommand
, MacroCommand: MacroCommand
, Facade: Facade
, Mediator: Mediator
, Observer: Observer
, Notification: Notification
, Notifier: Notifier
, Proxy: Proxy
, define: define
, declare: declare
};
})(this); // the 'this' parameter will resolve to global scope in all environments
}
return classConstructor;
};
/* implementation end */
// define the puremvc global namespace and export the actors
scope.puremvc=
{
View: View
, Model: Model
, Controller: Controller
, SimpleCommand: SimpleCommand
, MacroCommand: MacroCommand
, Facade: Facade
, Mediator: Mediator
, Observer: Observer
, Notification: Notification
, Notifier: Notifier
, Proxy: Proxy
, define: define
, declare: declare
};
})(this); // the 'this' parameter will resolve to global scope in all environments
\ No newline at end of file
......@@ -12,104 +12,77 @@ button {
font-size: 100%;
vertical-align: baseline;
font-family: inherit;
font-weight: inherit;
color: inherit;
-webkit-appearance: none;
-ms-appearance: none;
-o-appearance: none;
appearance: none;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
font-smoothing: antialiased;
}
body {
font: 14px 'Helvetica Neue', Helvetica, Arial, sans-serif;
line-height: 1.4em;
background: #eaeaea url('bg.png');
background: #f5f5f5;
color: #4d4d4d;
width: 550px;
min-width: 230px;
max-width: 550px;
margin: 0 auto;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
-ms-font-smoothing: antialiased;
-o-font-smoothing: antialiased;
font-smoothing: antialiased;
font-weight: 300;
}
button,
input[type="checkbox"] {
outline: none;
outline: none;
}
.hidden {
display: none;
}
#todoapp {
background: #fff;
background: rgba(255, 255, 255, 0.9);
margin: 130px 0 40px 0;
border: 1px solid #ccc;
position: relative;
border-top-left-radius: 2px;
border-top-right-radius: 2px;
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2),
0 25px 50px 0 rgba(0, 0, 0, 0.15);
}
#todoapp:before {
content: '';
border-left: 1px solid #f5d6d6;
border-right: 1px solid #f5d6d6;
width: 2px;
position: absolute;
top: 0;
left: 40px;
height: 100%;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2),
0 25px 50px 0 rgba(0, 0, 0, 0.1);
}
#todoapp input::-webkit-input-placeholder {
font-style: italic;
font-weight: 300;
color: #e6e6e6;
}
#todoapp input::-moz-placeholder {
font-style: italic;
color: #a9a9a9;
font-weight: 300;
color: #e6e6e6;
}
#todoapp input::input-placeholder {
font-style: italic;
font-weight: 300;
color: #e6e6e6;
}
#todoapp h1 {
position: absolute;
top: -120px;
top: -155px;
width: 100%;
font-size: 70px;
font-weight: bold;
font-size: 100px;
font-weight: 100;
text-align: center;
color: #b3b3b3;
color: rgba(255, 255, 255, 0.3);
text-shadow: -1px -1px rgba(0, 0, 0, 0.2);
color: rgba(175, 47, 47, 0.15);
-webkit-text-rendering: optimizeLegibility;
-moz-text-rendering: optimizeLegibility;
-ms-text-rendering: optimizeLegibility;
-o-text-rendering: optimizeLegibility;
text-rendering: optimizeLegibility;
}
#header {
padding-top: 15px;
border-radius: inherit;
}
#header:before {
content: '';
position: absolute;
top: 0;
right: 0;
left: 0;
height: 15px;
z-index: 2;
border-bottom: 1px solid #6c615c;
background: #8d7d77;
background: -webkit-gradient(linear, left top, left bottom, from(rgba(132, 110, 100, 0.8)),to(rgba(101, 84, 76, 0.8)));
background: -webkit-linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8));
background: linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8));
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#9d8b83', EndColorStr='#847670');
border-top-left-radius: 1px;
border-top-right-radius: 1px;
}
#new-todo,
.edit {
position: relative;
......@@ -117,6 +90,7 @@ input[type="checkbox"] {
width: 100%;
font-size: 24px;
font-family: inherit;
font-weight: inherit;
line-height: 1.4em;
border: 0;
outline: none;
......@@ -124,29 +98,23 @@ input[type="checkbox"] {
padding: 6px;
border: 1px solid #999;
box-shadow: inset 0 -1px 5px 0 rgba(0, 0, 0, 0.2);
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
-ms-font-smoothing: antialiased;
-o-font-smoothing: antialiased;
font-smoothing: antialiased;
}
#new-todo {
padding: 16px 16px 16px 60px;
border: none;
background: rgba(0, 0, 0, 0.02);
z-index: 2;
box-shadow: none;
background: rgba(0, 0, 0, 0.003);
box-shadow: inset 0 -2px 1px rgba(0,0,0,0.03);
}
#main {
position: relative;
z-index: 2;
border-top: 1px dotted #adadad;
border-top: 1px solid #e6e6e6;
}
label[for='toggle-all'] {
......@@ -155,19 +123,19 @@ label[for='toggle-all'] {
#toggle-all {
position: absolute;
top: -42px;
left: -4px;
width: 40px;
top: -55px;
left: -12px;
width: 60px;
height: 34px;
text-align: center;
/* Mobile Safari */
border: none;
border: none; /* Mobile Safari */
}
#toggle-all:before {
content: '»';
font-size: 28px;
color: #d9d9d9;
padding: 0 25px 7px;
content: '';
font-size: 22px;
color: #e6e6e6;
padding: 10px 27px 10px 27px;
}
#toggle-all:checked:before {
......@@ -183,7 +151,7 @@ label[for='toggle-all'] {
#todo-list li {
position: relative;
font-size: 24px;
border-bottom: 1px dotted #ccc;
border-bottom: 1px solid #ededed;
}
#todo-list li:last-child {
......@@ -215,28 +183,17 @@ label[for='toggle-all'] {
top: 0;
bottom: 0;
margin: auto 0;
/* Mobile Safari */
border: none;
border: none; /* Mobile Safari */
-webkit-appearance: none;
-ms-appearance: none;
-o-appearance: none;
appearance: none;
}
#todo-list li .toggle:after {
content: '✔';
/* 40 + a couple of pixels visual adjustment */
line-height: 43px;
font-size: 20px;
color: #d9d9d9;
text-shadow: 0 -1px 0 #bfbfbf;
content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="-10 -18 100 135"><circle cx="50" cy="50" r="50" fill="none" stroke="#ededed" stroke-width="3"/></svg>');
}
#todo-list li .toggle:checked:after {
color: #85ada7;
text-shadow: 0 1px 0 #669991;
bottom: 1px;
position: relative;
content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="-10 -18 100 135"><circle cx="50" cy="50" r="50" fill="none" stroke="#bddad5" stroke-width="3"/><path fill="#5dc2af" d="M72 25L42 71 27 56l-4 4 20 20 34-52z"/></svg>');
}
#todo-list li label {
......@@ -246,12 +203,11 @@ label[for='toggle-all'] {
margin-left: 45px;
display: block;
line-height: 1.2;
-webkit-transition: color 0.4s;
transition: color 0.4s;
}
#todo-list li.completed label {
color: #a9a9a9;
color: #d9d9d9;
text-decoration: line-through;
}
......@@ -264,21 +220,18 @@ label[for='toggle-all'] {
width: 40px;
height: 40px;
margin: auto 0;
font-size: 22px;
color: #a88a8a;
-webkit-transition: all 0.2s;
transition: all 0.2s;
font-size: 30px;
color: #cc9a9a;
margin-bottom: 11px;
transition: color 0.2s ease-out;
}
#todo-list li .destroy:hover {
text-shadow: 0 0 1px #000,
0 0 10px rgba(199, 107, 107, 0.8);
-webkit-transform: scale(1.3);
transform: scale(1.3);
color: #af5b5e;
}
#todo-list li .destroy:after {
content: '';
content: '×';
}
#todo-list li:hover .destroy {
......@@ -295,29 +248,25 @@ label[for='toggle-all'] {
#footer {
color: #777;
padding: 0 15px;
position: absolute;
right: 0;
bottom: -31px;
left: 0;
padding: 10px 15px;
height: 20px;
z-index: 1;
text-align: center;
border-top: 1px solid #e6e6e6;
}
#footer:before {
content: '';
position: absolute;
right: 0;
bottom: 31px;
bottom: 0;
left: 0;
height: 50px;
z-index: -1;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3),
0 6px 0 -3px rgba(255, 255, 255, 0.8),
0 7px 1px -3px rgba(0, 0, 0, 0.3),
0 43px 0 -6px rgba(255, 255, 255, 0.8),
0 44px 2px -6px rgba(0, 0, 0, 0.2);
overflow: hidden;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2),
0 8px 0 -3px #f6f6f6,
0 9px 1px -3px rgba(0, 0, 0, 0.2),
0 16px 0 -6px #f6f6f6,
0 17px 2px -6px rgba(0, 0, 0, 0.2);
}
#todo-count {
......@@ -325,6 +274,10 @@ label[for='toggle-all'] {
text-align: left;
}
#todo-count strong {
font-weight: 300;
}
#filters {
margin: 0;
padding: 0;
......@@ -339,49 +292,63 @@ label[for='toggle-all'] {
}
#filters li a {
color: #83756f;
margin: 2px;
color: inherit;
margin: 3px;
padding: 3px 7px;
text-decoration: none;
border: 1px solid transparent;
border-radius: 3px;
}
#filters li a.selected,
#filters li a:hover {
border-color: rgba(175, 47, 47, 0.1);
}
#filters li a.selected {
font-weight: bold;
border-color: rgba(175, 47, 47, 0.2);
}
#clear-completed {
#clear-completed,
html #clear-completed:active {
float: right;
position: relative;
line-height: 20px;
text-decoration: none;
background: rgba(0, 0, 0, 0.1);
font-size: 11px;
padding: 0 10px;
border-radius: 3px;
box-shadow: 0 -1px 0 0 rgba(0, 0, 0, 0.2);
cursor: pointer;
position: relative;
}
#clear-completed:hover {
background: rgba(0, 0, 0, 0.15);
box-shadow: 0 -1px 0 0 rgba(0, 0, 0, 0.3);
text-decoration: underline;
}
#info {
margin: 65px auto 0;
color: #a6a6a6;
font-size: 12px;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
color: #bfbfbf;
font-size: 10px;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
text-align: center;
}
#info p {
line-height: 1;
}
#info a {
color: inherit;
text-decoration: none;
font-weight: 400;
}
#info a:hover {
text-decoration: underline;
}
/*
Hack to remove background from Mobile Safari.
Can't use it globally since it destroys checkboxes in Firefox and Opera
Can't use it globally since it destroys checkboxes in Firefox
*/
@media screen and (-webkit-min-device-pixel-ratio:0) {
#toggle-all,
#todo-list li .toggle {
......@@ -393,10 +360,6 @@ label[for='toggle-all'] {
}
#toggle-all {
top: -56px;
left: -15px;
width: 65px;
height: 41px;
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
-webkit-appearance: none;
......@@ -404,151 +367,12 @@ label[for='toggle-all'] {
}
}
.hidden {
display: none;
}
hr {
margin: 20px 0;
border: 0;
border-top: 1px dashed #C5C5C5;
border-bottom: 1px dashed #F7F7F7;
}
.learn a {
font-weight: normal;
text-decoration: none;
color: #b83f45;
}
.learn a:hover {
text-decoration: underline;
color: #787e7e;
}
.learn h3,
.learn h4,
.learn h5 {
margin: 10px 0;
font-weight: 500;
line-height: 1.2;
color: #000;
}
.learn h3 {
font-size: 24px;
}
.learn h4 {
font-size: 18px;
}
.learn h5 {
margin-bottom: 0;
font-size: 14px;
}
.learn ul {
padding: 0;
margin: 0 0 30px 25px;
}
.learn li {
line-height: 20px;
}
.learn p {
font-size: 15px;
font-weight: 300;
line-height: 1.3;
margin-top: 0;
margin-bottom: 0;
}
.quote {
border: none;
margin: 20px 0 60px 0;
}
.quote p {
font-style: italic;
}
.quote p:before {
content: '“';
font-size: 50px;
opacity: .15;
position: absolute;
top: -20px;
left: 3px;
}
.quote p:after {
content: '”';
font-size: 50px;
opacity: .15;
position: absolute;
bottom: -42px;
right: 3px;
}
.quote footer {
position: absolute;
bottom: -40px;
right: 0;
}
.quote footer img {
border-radius: 3px;
}
.quote footer a {
margin-left: 5px;
vertical-align: middle;
}
.speech-bubble {
position: relative;
padding: 10px;
background: rgba(0, 0, 0, .04);
border-radius: 5px;
}
.speech-bubble:after {
content: '';
position: absolute;
top: 100%;
right: 30px;
border: 13px solid transparent;
border-top-color: rgba(0, 0, 0, .04);
}
.learn-bar > .learn {
position: absolute;
width: 272px;
top: 8px;
left: -300px;
padding: 10px;
border-radius: 5px;
background-color: rgba(255, 255, 255, .6);
-webkit-transition-property: left;
transition-property: left;
-webkit-transition-duration: 500ms;
transition-duration: 500ms;
}
@media (min-width: 899px) {
.learn-bar {
width: auto;
margin: 0 0 0 300px;
}
.learn-bar > .learn {
left: 8px;
@media (max-width: 430px) {
#footer {
height: 50px;
}
.learn-bar #todoapp {
width: 550px;
margin: 130px auto 40px auto;
#filters {
bottom: 10px;
}
}
hr {
margin: 20px 0;
border: 0;
border-top: 1px dashed #c5c5c5;
border-bottom: 1px dashed #f7f7f7;
}
.learn a {
font-weight: normal;
text-decoration: none;
color: #b83f45;
}
.learn a:hover {
text-decoration: underline;
color: #787e7e;
}
.learn h3,
.learn h4,
.learn h5 {
margin: 10px 0;
font-weight: 500;
line-height: 1.2;
color: #000;
}
.learn h3 {
font-size: 24px;
}
.learn h4 {
font-size: 18px;
}
.learn h5 {
margin-bottom: 0;
font-size: 14px;
}
.learn ul {
padding: 0;
margin: 0 0 30px 25px;
}
.learn li {
line-height: 20px;
}
.learn p {
font-size: 15px;
font-weight: 300;
line-height: 1.3;
margin-top: 0;
margin-bottom: 0;
}
#issue-count {
display: none;
}
.quote {
border: none;
margin: 20px 0 60px 0;
}
.quote p {
font-style: italic;
}
.quote p:before {
content: '“';
font-size: 50px;
opacity: .15;
position: absolute;
top: -20px;
left: 3px;
}
.quote p:after {
content: '”';
font-size: 50px;
opacity: .15;
position: absolute;
bottom: -42px;
right: 3px;
}
.quote footer {
position: absolute;
bottom: -40px;
right: 0;
}
.quote footer img {
border-radius: 3px;
}
.quote footer a {
margin-left: 5px;
vertical-align: middle;
}
.speech-bubble {
position: relative;
padding: 10px;
background: rgba(0, 0, 0, .04);
border-radius: 5px;
}
.speech-bubble:after {
content: '';
position: absolute;
top: 100%;
right: 30px;
border: 13px solid transparent;
border-top-color: rgba(0, 0, 0, .04);
}
.learn-bar > .learn {
position: absolute;
width: 272px;
top: 8px;
left: -300px;
padding: 10px;
border-radius: 5px;
background-color: rgba(255, 255, 255, .6);
transition-property: left;
transition-duration: 500ms;
}
@media (min-width: 899px) {
.learn-bar {
width: auto;
padding-left: 300px;
}
.learn-bar > .learn {
left: 8px;
}
}
/* global _ */
(function () {
'use strict';
/* jshint ignore:start */
// Underscore's Template Module
// Courtesy of underscorejs.org
var _ = (function (_) {
......@@ -112,8 +114,14 @@
})({});
if (location.hostname === 'todomvc.com') {
window._gaq = [['_setAccount','UA-31081062-1'],['_trackPageview']];(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.src='//www.google-analytics.com/ga.js';s.parentNode.insertBefore(g,s)}(document,'script'));
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-31081062-1', 'auto');
ga('send', 'pageview');
}
/* jshint ignore:end */
function redirect() {
if (location.hostname === 'tastejs.github.io') {
......@@ -175,13 +183,17 @@
if (learnJSON.backend) {
this.frameworkJSON = learnJSON.backend;
this.frameworkJSON.issueLabel = framework;
this.append({
backend: true
});
} else if (learnJSON[framework]) {
this.frameworkJSON = learnJSON[framework];
this.frameworkJSON.issueLabel = framework;
this.append();
}
this.fetchIssueCount();
}
Learn.prototype.append = function (opts) {
......@@ -212,6 +224,26 @@
document.body.insertAdjacentHTML('afterBegin', aside.outerHTML);
};
Learn.prototype.fetchIssueCount = function () {
var issueLink = document.getElementById('issue-count-link');
if (issueLink) {
var url = issueLink.href.replace('https://github.com', 'https://api.github.com/repos');
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onload = function (e) {
var parsedResponse = JSON.parse(e.target.responseText);
if (parsedResponse instanceof Array) {
var count = parsedResponse.length;
if (count !== 0) {
issueLink.innerHTML = 'This app has ' + count + ' open issues';
document.getElementById('issue-count').style.display = 'inline';
}
}
};
xhr.send();
}
};
redirect();
getFile('learn.json', Learn);
})();
{
"private": true,
"dependencies": {
"npmvc": "^1.0.1",
"director": "^1.2.0",
"todomvc-common": "^1.0.0",
"todomvc-app-css": "^1.0.0"
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment