├── 01_Visitor_Dashboard ├── css │ └── style.css ├── index.html ├── js │ ├── d3.js │ ├── react-bootstrap.js │ ├── react-dom-0.14.7.js │ └── react-with-addons-0.14.7.js └── lib │ ├── app.jsx │ └── charts │ ├── BarChart.jsx │ ├── DonutChart.jsx │ ├── LineChart.jsx │ ├── ProgressChart.jsx │ └── utils │ ├── ReactMixins.js │ └── SVGDefs.jsx ├── 02_Admin_Dashboard ├── part1 │ ├── css │ │ ├── bootstrap.css │ │ └── style.css │ ├── img │ │ └── logo.png │ ├── index.html │ ├── js │ │ ├── d3.js │ │ ├── react-bootstrap.js │ │ ├── react-dom-0.14.7.js │ │ └── react-with-addons-0.14.7.js │ └── lib │ │ ├── app.jsx │ │ └── charts │ │ └── utils │ │ ├── ReactMixins.js │ │ └── SVGDefs.jsx ├── part2 │ ├── css │ │ ├── bootstrap.css │ │ └── style.css │ ├── img │ │ └── logo.png │ ├── index.html │ ├── js │ │ ├── d3.js │ │ ├── react-bootstrap.js │ │ ├── react-dom-0.14.7.js │ │ └── react-with-addons-0.14.7.js │ └── lib │ │ ├── app.jsx │ │ └── charts │ │ ├── BarChart.jsx │ │ ├── DonutChart.jsx │ │ ├── LineChart.jsx │ │ ├── ProgressChart.jsx │ │ ├── StackChart.jsx │ │ └── utils │ │ ├── ReactMixins.js │ │ └── SVGDefs.jsx ├── part3 │ ├── css │ │ ├── bootstrap.css │ │ └── style.css │ ├── img │ │ └── logo.png │ ├── index.html │ ├── js │ │ ├── d3.js │ │ ├── react-bootstrap.js │ │ ├── react-dom-0.14.7.js │ │ └── react-with-addons-0.14.7.js │ └── lib │ │ ├── app.jsx │ │ └── charts │ │ ├── AreaChart.jsx │ │ ├── BarChart.jsx │ │ ├── DonutChart.jsx │ │ ├── LineChart.jsx │ │ ├── ProgressChart.jsx │ │ ├── StackChart.jsx │ │ └── utils │ │ ├── D3Utils.jsx │ │ ├── ReactMixins.js │ │ └── SVGDefs.jsx └── part4 │ ├── css │ ├── bootstrap.css │ └── style.css │ ├── img │ └── logo.png │ ├── index.html │ ├── js │ ├── EventEmitter.js │ ├── d3.js │ ├── react-bootstrap.js │ ├── react-dom-0.14.7.js │ └── react-with-addons-0.14.7.js │ └── lib │ ├── app.jsx │ └── charts │ ├── AreaChart.jsx │ ├── BarChart.jsx │ ├── DonutChart.jsx │ ├── LineChart.jsx │ ├── ProgressChart.jsx │ ├── StackChart.jsx │ └── utils │ ├── D3Utils.jsx │ ├── ReactMixins.js │ └── SVGDefs.jsx └── README.md /01_Visitor_Dashboard/css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #2c313b; 3 | 4 | font-family: 'Roboto', sans-serif !important; 5 | } 6 | 7 | h3{ 8 | color: #f8fdff; 9 | padding-left: 20px; 10 | padding-top: 20px; 11 | opacity: .8; 12 | font-weight: 400; 13 | font-size: 20px; 14 | } 15 | 16 | .top{ 17 | margin-bottom: 10px; 18 | background-color: #3f5175; 19 | border-radius:4px; 20 | height: 400px; 21 | box-shadow: 1px 1px 1px 0px rgba(37,41,51,1); 22 | } 23 | 24 | .bottom-left{ 25 | background-color: #3f5175; 26 | border-radius: 4px; 27 | height: 400px; 28 | box-shadow: 1px 1px 1px 0px rgba(37,41,51,1); 29 | } 30 | 31 | .bottom-right{ 32 | background-color: #3f5175; 33 | border-radius: 4px; 34 | height: 400px; 35 | 36 | box-shadow: 1px 1px 1px 0px rgba(37,41,51,1); 37 | } 38 | 39 | .shadow { 40 | -webkit-filter: drop-shadow( 0px 2px 2px rgba(0,0,0,.3) ); 41 | filter: drop-shadow( 0px 2px 2px rgba(0,0,0,.3) ); 42 | } 43 | 44 | .pad{ 45 | padding:20px; 46 | } 47 | 48 | .browser-legend{ 49 | font-size:14px; 50 | opacity:.8; 51 | } 52 | 53 | .bottom-left-svg{ 54 | padding-top:40px; 55 | text-align: center; 56 | } 57 | 58 | 59 | .bottom-right-svg{ 60 | text-align: center; 61 | } 62 | 63 | .line { 64 | fill: none; 65 | stroke: #7dc7f4; 66 | stroke-width: 5px; 67 | 68 | } 69 | 70 | .axis{ 71 | fill:#bbc7d9; 72 | opacity: 1; 73 | } 74 | 75 | .axis path, 76 | .axis line { 77 | fill: none; 78 | stroke: none; 79 | shape-rendering: crispEdges; 80 | 81 | } 82 | 83 | .axis text { 84 | font-size: 14px; 85 | } 86 | 87 | .y-grid .tick{ 88 | stroke: #4b5f87; 89 | opacity: 1; 90 | } 91 | 92 | .default-svg{ 93 | 94 | } 95 | 96 | 97 | .svg-container{ 98 | display: inline-block; 99 | position: relative; 100 | width: 100%; 101 | padding-bottom: 100%; 102 | vertical-align: middle; 103 | overflow: hidden; 104 | } 105 | 106 | .svg-content { 107 | display: inline-block; 108 | position: absolute; 109 | top: 0; 110 | left: 0; 111 | } 112 | 113 | .fontSize { 114 | font-size:.8em; 115 | height: auto; 116 | text-align: center; 117 | } 118 | 119 | .page-header{ 120 | height:35px; 121 | textAlign:center; 122 | } 123 | 124 | .page-h4{ 125 | line-height:35px; 126 | color:rgb(125, 199, 244); 127 | 128 | } -------------------------------------------------------------------------------- /01_Visitor_Dashboard/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Visitor Dashboard 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 25 | 26 | 27 | 28 |
29 |
30 | 35 |
36 |
37 |
38 |
39 | 40 |
41 |
42 |
43 |
44 |
45 |
46 | 47 |
48 |
49 |
50 |
51 | 52 |
53 |
54 |
55 |
56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /01_Visitor_Dashboard/js/react-dom-0.14.7.js: -------------------------------------------------------------------------------- 1 | /** 2 | * ReactDOM v0.14.7 3 | * 4 | * Copyright 2013-2015, Facebook, Inc. 5 | * All rights reserved. 6 | * 7 | * This source code is licensed under the BSD-style license found in the 8 | * LICENSE file in the root directory of this source tree. An additional grant 9 | * of patent rights can be found in the PATENTS file in the same directory. 10 | * 11 | */ 12 | // Based off https://github.com/ForbesLindesay/umd/blob/master/template.js 13 | ;(function(f) { 14 | // CommonJS 15 | if (typeof exports === "object" && typeof module !== "undefined") { 16 | module.exports = f(require('react')); 17 | 18 | // RequireJS 19 | } else if (typeof define === "function" && define.amd) { 20 | define(['react'], f); 21 | 22 | // 9 | 10 | 11 | 12 | 13 | 14 | 15 | 25 | 26 | 27 | 28 |
29 |
30 | (React + D3) Click here to find the tutorial on www.adeveloperdiary.com 31 |
32 |
33 | 34 |
35 | 36 | 37 |
38 | Admin 39 |
40 |
41 | Interaction Analytics 42 |
43 | 44 |
45 | 46 | 47 | 48 |
49 |
50 |
51 | 52 | 53 | 54 | 55 | 56 | 7 days 57 | 58 | 59 | 60 | 61 | 62 | 30 days 63 |
64 | 65 |
66 | 67 |
68 |
69 |
70 |
71 |
72 | Visitors 73 |
74 |
75 | 70% 76 |
77 |
78 |
79 |
80 | 3,502 81 |
82 |
83 |
84 |
85 |
86 | 87 |
88 |
89 |
90 |
91 | 92 |
93 |
94 |
95 |
96 | 97 |
98 |
99 |
100 |
101 | 102 |
103 |
104 |
105 |
106 | 107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
Traffic Source
116 |
117 | 118 | 119 | 120 | 121 | 122 | 7 days 123 | 124 | 125 | 126 | 127 | 128 | 30 days 129 |
130 | 131 |
132 |
133 |
134 |
135 |
136 |
137 |
Traffic Source
138 |
139 | 140 | 141 | 142 | 143 | 144 | 7 days 145 | 146 | 147 | 148 | 149 | 150 | 30 days 151 |
152 | 153 |
154 |
155 |
156 |
157 | 158 | 159 |
160 |
161 |
162 |
163 |
Traffic Source
164 |
165 | 166 | 167 | 168 | 169 | 170 | 7 days 171 | 172 | 173 | 174 | 175 | 176 | 30 days 177 |
178 | 179 |
180 |
181 |
182 |
183 |
184 |
185 |
Traffic Source
186 |
187 | 188 | 189 | 190 | 191 | 192 | 7 days 193 | 194 | 195 | 196 | 197 | 198 | 30 days 199 |
200 | 201 |
202 |
203 |
204 |
205 | 206 |
207 | 208 | 209 | 210 | 211 | 212 | 213 | -------------------------------------------------------------------------------- /02_Admin_Dashboard/part1/js/react-dom-0.14.7.js: -------------------------------------------------------------------------------- 1 | /** 2 | * ReactDOM v0.14.7 3 | * 4 | * Copyright 2013-2015, Facebook, Inc. 5 | * All rights reserved. 6 | * 7 | * This source code is licensed under the BSD-style license found in the 8 | * LICENSE file in the root directory of this source tree. An additional grant 9 | * of patent rights can be found in the PATENTS file in the same directory. 10 | * 11 | */ 12 | // Based off https://github.com/ForbesLindesay/umd/blob/master/template.js 13 | ;(function(f) { 14 | // CommonJS 15 | if (typeof exports === "object" && typeof module !== "undefined") { 16 | module.exports = f(require('react')); 17 | 18 | // RequireJS 19 | } else if (typeof define === "function" && define.amd) { 20 | define(['react'], f); 21 | 22 | // 9 | 10 | 11 | 12 | 13 | 14 | 15 | 25 | 26 | 27 |
28 |
29 | (React + D3) Click here to find the tutorial on www.adeveloperdiary.com 30 |
31 |
32 |
33 | 34 | 35 |
36 | Admin 37 |
38 |
39 | Interaction Analytics 40 |
41 |
42 | 43 |
44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /02_Admin_Dashboard/part2/js/react-dom-0.14.7.js: -------------------------------------------------------------------------------- 1 | /** 2 | * ReactDOM v0.14.7 3 | * 4 | * Copyright 2013-2015, Facebook, Inc. 5 | * All rights reserved. 6 | * 7 | * This source code is licensed under the BSD-style license found in the 8 | * LICENSE file in the root directory of this source tree. An additional grant 9 | * of patent rights can be found in the PATENTS file in the same directory. 10 | * 11 | */ 12 | // Based off https://github.com/ForbesLindesay/umd/blob/master/template.js 13 | ;(function(f) { 14 | // CommonJS 15 | if (typeof exports === "object" && typeof module !== "undefined") { 16 | module.exports = f(require('react')); 17 | 18 | // RequireJS 19 | } else if (typeof define === "function" && define.amd) { 20 | define(['react'], f); 21 | 22 | // 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 26 | 27 | 28 |
29 |
30 | (React + D3) Click here to find the tutorial on www.adeveloperdiary.com 31 |
32 |
33 |
34 | 35 | 36 |
37 | Admin 38 |
39 |
40 | Interaction Analytics 41 |
42 |
43 | 44 |
45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /02_Admin_Dashboard/part3/js/react-dom-0.14.7.js: -------------------------------------------------------------------------------- 1 | /** 2 | * ReactDOM v0.14.7 3 | * 4 | * Copyright 2013-2015, Facebook, Inc. 5 | * All rights reserved. 6 | * 7 | * This source code is licensed under the BSD-style license found in the 8 | * LICENSE file in the root directory of this source tree. An additional grant 9 | * of patent rights can be found in the PATENTS file in the same directory. 10 | * 11 | */ 12 | // Based off https://github.com/ForbesLindesay/umd/blob/master/template.js 13 | ;(function(f) { 14 | // CommonJS 15 | if (typeof exports === "object" && typeof module !== "undefined") { 16 | module.exports = f(require('react')); 17 | 18 | // RequireJS 19 | } else if (typeof define === "function" && define.amd) { 20 | define(['react'], f); 21 | 22 | // 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 27 | 28 | 29 |
30 |
31 | (React + D3) Click here to find the tutorial on www.adeveloperdiary.com 32 |
33 |
34 |
35 | 36 | 37 |
38 | Admin 39 |
40 |
41 | Interaction Analytics 42 |
43 |
44 | 45 |
46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /02_Admin_Dashboard/part4/js/EventEmitter.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * EventEmitter v4.2.11 - git.io/ee 3 | * Unlicense - http://unlicense.org/ 4 | * Oliver Caldwell - http://oli.me.uk/ 5 | * @preserve 6 | */ 7 | 8 | ;(function () { 9 | 'use strict'; 10 | 11 | /** 12 | * Class for managing events. 13 | * Can be extended to provide event functionality in other classes. 14 | * 15 | * @class EventEmitter Manages event registering and emitting. 16 | */ 17 | function EventEmitter() {} 18 | 19 | // Shortcuts to improve speed and size 20 | var proto = EventEmitter.prototype; 21 | var exports = this; 22 | var originalGlobalValue = exports.EventEmitter; 23 | 24 | /** 25 | * Finds the index of the listener for the event in its storage array. 26 | * 27 | * @param {Function[]} listeners Array of listeners to search through. 28 | * @param {Function} listener Method to look for. 29 | * @return {Number} Index of the specified listener, -1 if not found 30 | * @api private 31 | */ 32 | function indexOfListener(listeners, listener) { 33 | var i = listeners.length; 34 | while (i--) { 35 | if (listeners[i].listener === listener) { 36 | return i; 37 | } 38 | } 39 | 40 | return -1; 41 | } 42 | 43 | /** 44 | * Alias a method while keeping the context correct, to allow for overwriting of target method. 45 | * 46 | * @param {String} name The name of the target method. 47 | * @return {Function} The aliased method 48 | * @api private 49 | */ 50 | function alias(name) { 51 | return function aliasClosure() { 52 | return this[name].apply(this, arguments); 53 | }; 54 | } 55 | 56 | /** 57 | * Returns the listener array for the specified event. 58 | * Will initialise the event object and listener arrays if required. 59 | * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them. 60 | * Each property in the object response is an array of listener functions. 61 | * 62 | * @param {String|RegExp} evt Name of the event to return the listeners from. 63 | * @return {Function[]|Object} All listener functions for the event. 64 | */ 65 | proto.getListeners = function getListeners(evt) { 66 | var events = this._getEvents(); 67 | var response; 68 | var key; 69 | 70 | // Return a concatenated array of all matching events if 71 | // the selector is a regular expression. 72 | if (evt instanceof RegExp) { 73 | response = {}; 74 | for (key in events) { 75 | if (events.hasOwnProperty(key) && evt.test(key)) { 76 | response[key] = events[key]; 77 | } 78 | } 79 | } 80 | else { 81 | response = events[evt] || (events[evt] = []); 82 | } 83 | 84 | return response; 85 | }; 86 | 87 | /** 88 | * Takes a list of listener objects and flattens it into a list of listener functions. 89 | * 90 | * @param {Object[]} listeners Raw listener objects. 91 | * @return {Function[]} Just the listener functions. 92 | */ 93 | proto.flattenListeners = function flattenListeners(listeners) { 94 | var flatListeners = []; 95 | var i; 96 | 97 | for (i = 0; i < listeners.length; i += 1) { 98 | flatListeners.push(listeners[i].listener); 99 | } 100 | 101 | return flatListeners; 102 | }; 103 | 104 | /** 105 | * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful. 106 | * 107 | * @param {String|RegExp} evt Name of the event to return the listeners from. 108 | * @return {Object} All listener functions for an event in an object. 109 | */ 110 | proto.getListenersAsObject = function getListenersAsObject(evt) { 111 | var listeners = this.getListeners(evt); 112 | var response; 113 | 114 | if (listeners instanceof Array) { 115 | response = {}; 116 | response[evt] = listeners; 117 | } 118 | 119 | return response || listeners; 120 | }; 121 | 122 | /** 123 | * Adds a listener function to the specified event. 124 | * The listener will not be added if it is a duplicate. 125 | * If the listener returns true then it will be removed after it is called. 126 | * If you pass a regular expression as the event name then the listener will be added to all events that match it. 127 | * 128 | * @param {String|RegExp} evt Name of the event to attach the listener to. 129 | * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. 130 | * @return {Object} Current instance of EventEmitter for chaining. 131 | */ 132 | proto.addListener = function addListener(evt, listener) { 133 | var listeners = this.getListenersAsObject(evt); 134 | var listenerIsWrapped = typeof listener === 'object'; 135 | var key; 136 | 137 | for (key in listeners) { 138 | if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) { 139 | listeners[key].push(listenerIsWrapped ? listener : { 140 | listener: listener, 141 | once: false 142 | }); 143 | } 144 | } 145 | 146 | return this; 147 | }; 148 | 149 | /** 150 | * Alias of addListener 151 | */ 152 | proto.on = alias('addListener'); 153 | 154 | /** 155 | * Semi-alias of addListener. It will add a listener that will be 156 | * automatically removed after its first execution. 157 | * 158 | * @param {String|RegExp} evt Name of the event to attach the listener to. 159 | * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. 160 | * @return {Object} Current instance of EventEmitter for chaining. 161 | */ 162 | proto.addOnceListener = function addOnceListener(evt, listener) { 163 | return this.addListener(evt, { 164 | listener: listener, 165 | once: true 166 | }); 167 | }; 168 | 169 | /** 170 | * Alias of addOnceListener. 171 | */ 172 | proto.once = alias('addOnceListener'); 173 | 174 | /** 175 | * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad. 176 | * You need to tell it what event names should be matched by a regex. 177 | * 178 | * @param {String} evt Name of the event to create. 179 | * @return {Object} Current instance of EventEmitter for chaining. 180 | */ 181 | proto.defineEvent = function defineEvent(evt) { 182 | this.getListeners(evt); 183 | return this; 184 | }; 185 | 186 | /** 187 | * Uses defineEvent to define multiple events. 188 | * 189 | * @param {String[]} evts An array of event names to define. 190 | * @return {Object} Current instance of EventEmitter for chaining. 191 | */ 192 | proto.defineEvents = function defineEvents(evts) { 193 | for (var i = 0; i < evts.length; i += 1) { 194 | this.defineEvent(evts[i]); 195 | } 196 | return this; 197 | }; 198 | 199 | /** 200 | * Removes a listener function from the specified event. 201 | * When passed a regular expression as the event name, it will remove the listener from all events that match it. 202 | * 203 | * @param {String|RegExp} evt Name of the event to remove the listener from. 204 | * @param {Function} listener Method to remove from the event. 205 | * @return {Object} Current instance of EventEmitter for chaining. 206 | */ 207 | proto.removeListener = function removeListener(evt, listener) { 208 | var listeners = this.getListenersAsObject(evt); 209 | var index; 210 | var key; 211 | 212 | for (key in listeners) { 213 | if (listeners.hasOwnProperty(key)) { 214 | index = indexOfListener(listeners[key], listener); 215 | 216 | if (index !== -1) { 217 | listeners[key].splice(index, 1); 218 | } 219 | } 220 | } 221 | 222 | return this; 223 | }; 224 | 225 | /** 226 | * Alias of removeListener 227 | */ 228 | proto.off = alias('removeListener'); 229 | 230 | /** 231 | * Adds listeners in bulk using the manipulateListeners method. 232 | * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added. 233 | * You can also pass it a regular expression to add the array of listeners to all events that match it. 234 | * Yeah, this function does quite a bit. That's probably a bad thing. 235 | * 236 | * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once. 237 | * @param {Function[]} [listeners] An optional array of listener functions to add. 238 | * @return {Object} Current instance of EventEmitter for chaining. 239 | */ 240 | proto.addListeners = function addListeners(evt, listeners) { 241 | // Pass through to manipulateListeners 242 | return this.manipulateListeners(false, evt, listeners); 243 | }; 244 | 245 | /** 246 | * Removes listeners in bulk using the manipulateListeners method. 247 | * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. 248 | * You can also pass it an event name and an array of listeners to be removed. 249 | * You can also pass it a regular expression to remove the listeners from all events that match it. 250 | * 251 | * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once. 252 | * @param {Function[]} [listeners] An optional array of listener functions to remove. 253 | * @return {Object} Current instance of EventEmitter for chaining. 254 | */ 255 | proto.removeListeners = function removeListeners(evt, listeners) { 256 | // Pass through to manipulateListeners 257 | return this.manipulateListeners(true, evt, listeners); 258 | }; 259 | 260 | /** 261 | * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level. 262 | * The first argument will determine if the listeners are removed (true) or added (false). 263 | * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. 264 | * You can also pass it an event name and an array of listeners to be added/removed. 265 | * You can also pass it a regular expression to manipulate the listeners of all events that match it. 266 | * 267 | * @param {Boolean} remove True if you want to remove listeners, false if you want to add. 268 | * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once. 269 | * @param {Function[]} [listeners] An optional array of listener functions to add/remove. 270 | * @return {Object} Current instance of EventEmitter for chaining. 271 | */ 272 | proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) { 273 | var i; 274 | var value; 275 | var single = remove ? this.removeListener : this.addListener; 276 | var multiple = remove ? this.removeListeners : this.addListeners; 277 | 278 | // If evt is an object then pass each of its properties to this method 279 | if (typeof evt === 'object' && !(evt instanceof RegExp)) { 280 | for (i in evt) { 281 | if (evt.hasOwnProperty(i) && (value = evt[i])) { 282 | // Pass the single listener straight through to the singular method 283 | if (typeof value === 'function') { 284 | single.call(this, i, value); 285 | } 286 | else { 287 | // Otherwise pass back to the multiple function 288 | multiple.call(this, i, value); 289 | } 290 | } 291 | } 292 | } 293 | else { 294 | // So evt must be a string 295 | // And listeners must be an array of listeners 296 | // Loop over it and pass each one to the multiple method 297 | i = listeners.length; 298 | while (i--) { 299 | single.call(this, evt, listeners[i]); 300 | } 301 | } 302 | 303 | return this; 304 | }; 305 | 306 | /** 307 | * Removes all listeners from a specified event. 308 | * If you do not specify an event then all listeners will be removed. 309 | * That means every event will be emptied. 310 | * You can also pass a regex to remove all events that match it. 311 | * 312 | * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed. 313 | * @return {Object} Current instance of EventEmitter for chaining. 314 | */ 315 | proto.removeEvent = function removeEvent(evt) { 316 | var type = typeof evt; 317 | var events = this._getEvents(); 318 | var key; 319 | 320 | // Remove different things depending on the state of evt 321 | if (type === 'string') { 322 | // Remove all listeners for the specified event 323 | delete events[evt]; 324 | } 325 | else if (evt instanceof RegExp) { 326 | // Remove all events matching the regex. 327 | for (key in events) { 328 | if (events.hasOwnProperty(key) && evt.test(key)) { 329 | delete events[key]; 330 | } 331 | } 332 | } 333 | else { 334 | // Remove all listeners in all events 335 | delete this._events; 336 | } 337 | 338 | return this; 339 | }; 340 | 341 | /** 342 | * Alias of removeEvent. 343 | * 344 | * Added to mirror the node API. 345 | */ 346 | proto.removeAllListeners = alias('removeEvent'); 347 | 348 | /** 349 | * Emits an event of your choice. 350 | * When emitted, every listener attached to that event will be executed. 351 | * If you pass the optional argument array then those arguments will be passed to every listener upon execution. 352 | * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately. 353 | * So they will not arrive within the array on the other side, they will be separate. 354 | * You can also pass a regular expression to emit to all events that match it. 355 | * 356 | * @param {String|RegExp} evt Name of the event to emit and execute listeners for. 357 | * @param {Array} [args] Optional array of arguments to be passed to each listener. 358 | * @return {Object} Current instance of EventEmitter for chaining. 359 | */ 360 | proto.emitEvent = function emitEvent(evt, args) { 361 | var listenersMap = this.getListenersAsObject(evt); 362 | var listeners; 363 | var listener; 364 | var i; 365 | var key; 366 | var response; 367 | 368 | for (key in listenersMap) { 369 | if (listenersMap.hasOwnProperty(key)) { 370 | listeners = listenersMap[key].slice(0); 371 | i = listeners.length; 372 | 373 | while (i--) { 374 | // If the listener returns true then it shall be removed from the event 375 | // The function is executed either with a basic call or an apply if there is an args array 376 | listener = listeners[i]; 377 | 378 | if (listener.once === true) { 379 | this.removeListener(evt, listener.listener); 380 | } 381 | 382 | response = listener.listener.apply(this, args || []); 383 | 384 | if (response === this._getOnceReturnValue()) { 385 | this.removeListener(evt, listener.listener); 386 | } 387 | } 388 | } 389 | } 390 | 391 | return this; 392 | }; 393 | 394 | /** 395 | * Alias of emitEvent 396 | */ 397 | proto.trigger = alias('emitEvent'); 398 | 399 | /** 400 | * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on. 401 | * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it. 402 | * 403 | * @param {String|RegExp} evt Name of the event to emit and execute listeners for. 404 | * @param {...*} Optional additional arguments to be passed to each listener. 405 | * @return {Object} Current instance of EventEmitter for chaining. 406 | */ 407 | proto.emit = function emit(evt) { 408 | var args = Array.prototype.slice.call(arguments, 1); 409 | return this.emitEvent(evt, args); 410 | }; 411 | 412 | /** 413 | * Sets the current value to check against when executing listeners. If a 414 | * listeners return value matches the one set here then it will be removed 415 | * after execution. This value defaults to true. 416 | * 417 | * @param {*} value The new value to check for when executing listeners. 418 | * @return {Object} Current instance of EventEmitter for chaining. 419 | */ 420 | proto.setOnceReturnValue = function setOnceReturnValue(value) { 421 | this._onceReturnValue = value; 422 | return this; 423 | }; 424 | 425 | /** 426 | * Fetches the current value to check against when executing listeners. If 427 | * the listeners return value matches this one then it should be removed 428 | * automatically. It will return true by default. 429 | * 430 | * @return {*|Boolean} The current value to check for or the default, true. 431 | * @api private 432 | */ 433 | proto._getOnceReturnValue = function _getOnceReturnValue() { 434 | if (this.hasOwnProperty('_onceReturnValue')) { 435 | return this._onceReturnValue; 436 | } 437 | else { 438 | return true; 439 | } 440 | }; 441 | 442 | /** 443 | * Fetches the events object and creates one if required. 444 | * 445 | * @return {Object} The events storage object. 446 | * @api private 447 | */ 448 | proto._getEvents = function _getEvents() { 449 | return this._events || (this._events = {}); 450 | }; 451 | 452 | /** 453 | * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version. 454 | * 455 | * @return {Function} Non conflicting EventEmitter class. 456 | */ 457 | EventEmitter.noConflict = function noConflict() { 458 | exports.EventEmitter = originalGlobalValue; 459 | return EventEmitter; 460 | }; 461 | 462 | // Expose the class either via AMD, CommonJS or the global object 463 | if (typeof define === 'function' && define.amd) { 464 | define(function () { 465 | return EventEmitter; 466 | }); 467 | } 468 | else if (typeof module === 'object' && module.exports){ 469 | module.exports = EventEmitter; 470 | } 471 | else { 472 | exports.EventEmitter = EventEmitter; 473 | } 474 | }.call(this)); 475 | -------------------------------------------------------------------------------- /02_Admin_Dashboard/part4/js/react-dom-0.14.7.js: -------------------------------------------------------------------------------- 1 | /** 2 | * ReactDOM v0.14.7 3 | * 4 | * Copyright 2013-2015, Facebook, Inc. 5 | * All rights reserved. 6 | * 7 | * This source code is licensed under the BSD-style license found in the 8 | * LICENSE file in the root directory of this source tree. An additional grant 9 | * of patent rights can be found in the PATENTS file in the same directory. 10 | * 11 | */ 12 | // Based off https://github.com/ForbesLindesay/umd/blob/master/template.js 13 | ;(function(f) { 14 | // CommonJS 15 | if (typeof exports === "object" && typeof module !== "undefined") { 16 | module.exports = f(require('react')); 17 | 18 | // RequireJS 19 | } else if (typeof define === "function" && define.amd) { 20 | define(['react'], f); 21 | 22 | //