code
stringlengths
2
1.05M
var util = require('util'); var wolfram = require('wolfram'); var BaseTrigger = require('./baseTrigger.js').BaseTrigger; /* Trigger that responds to messages using Wolfram Alpha. command = string - a message must start with this + a space before a response will be given appId = string - the app ID to use when creating a new client OR client = wolfram client - use this as the client if it is passed as an option */ var WolframAlphaTrigger = function() { WolframAlphaTrigger.super_.apply(this, arguments); }; util.inherits(WolframAlphaTrigger, BaseTrigger); var type = "WolframAlphaTrigger"; exports.triggerType = type; exports.create = function(name, chatBot, options) { var trigger = new WolframAlphaTrigger(type, name, chatBot, options); trigger.client = trigger.options.client || wolfram.createClient(trigger.options.appId); return trigger; }; // Return true if a message was sent WolframAlphaTrigger.prototype._respondToFriendMessage = function(userId, message) { return this._respond(userId, message); } // Return true if a message was sent WolframAlphaTrigger.prototype._respondToChatMessage = function(roomId, chatterId, message) { return this._respond(roomId, message); } WolframAlphaTrigger.prototype._respond = function(toId, message) { var question = this._stripCommand(message); if (question) { var that = this; this.client.query(question, function(err, result) { if (err) { that._sendMessageAfterDelay(toId, "¯\\_(ツ)_/¯"); return; } var bestResult = that._getBestResult(result); if (bestResult) { that._sendMessageAfterDelay(toId, bestResult); } else { that._sendMessageAfterDelay(toId, "¯\\_(ツ)_/¯"); } }); return true; } return false; } WolframAlphaTrigger.prototype._stripCommand = function(message) { if (this.options.command && message && message.toLowerCase().indexOf(this.options.command.toLowerCase() + " ") == 0) { return message.substring(this.options.command.length + 1); } return null; } WolframAlphaTrigger.prototype._getBestResult = function(results) { if (results) { // Look for primary result first for (var i=0; i < results.length; i++) { if (results[i].primary) { var text = _extractResult(results[i]); if (text) { return text; } } } // Otherwise just get the 2nd result (1st is the input interpretation) if (results.length > 1) { var text = _extractResult(results[1]); if (text) { return text; } } } return null; } var _extractResult = function(result) { if (result.subpods[0] && result.subpods[0].value) { return result.subpods[0].value; } else if (result.subpods[0] && result.subpods[0].image) { return result.subpods[0].image; } return null; }
define(function() { return { blank_function: function(){}, }; });
'use strict'; angular.module('nachosSettingsApp') .controller('Packages', function ($scope, $timeout, $state) { var packages = require('nachos-packages'); var _ = require('lodash'); $scope.types = packages.Packages.TYPES; $scope.view = function (item) { $state.go('main.package-settings', {item: item}) }; $scope.getItems = function (type) { return $scope[type]; }; packages.getAll(true) .then(function (packages) { $timeout(function () { var packageTypes = Object.keys(packages); packageTypes.forEach(function (type) { packages[type] = _.filter(packages[type], function (pkg) { return pkg.config.settings; }); }); _.merge($scope, packages); }); }); });
/* * JScript Render - Javascript renderization tools * http://www.pleets.org * Copyright 2014, Pleets Apps * Free to use under the MIT license. * http://www.opensource.org/licenses/mit-license.php * * Date: 2015-01-22 */ /* JScriptRender alias */ if (!window.hasOwnProperty('JScriptRender')) JScriptRender = {}; /* relative path to the element whose script is currently being processed.*/ if (typeof document.currentScript != "undefined" && document.currentScript != null) { var str = document.currentScript.src; JScriptRender.PATH = (str.lastIndexOf("/") == -1) ? "." : str.substring(0, str.lastIndexOf("/")); } else { /* alternative method to get the currentScript (older browsers) */ // ... /* else get the URL path */ JScriptRender.PATH = '.'; } JScriptRender.STATE = 'loading'; /* Standard class */ JScriptRender.StdClass = { include: function(url, ajax, callback) { callback = callback || new Function(); url = JScriptRender.PATH + '/' + url; if (typeof ajax == "undefined" || ajax == false) { var script = document.createElement("script"); script.src = url; script.type = 'text/javascript'; script.id = 'JScriptRender-module'; /* IE */ if (script.readyState) { script.onreadystatechange = function() { if (this.readyState == 'complete') { var scriptTag = document.querySelector('#' + script.id); scriptTag.parentNode.removeChild(scriptTag); callback(); } } } /* Others */ else { script.onload = function() { var scriptTag = document.querySelector('#' + script.id); scriptTag.parentNode.removeChild(scriptTag); callback(); } } var head = document.querySelector('head'); head.appendChild(script); } else { var xhr = new XMLHttpRequest(); // To prevent 412 (Precondition Failed) use GET method instead of POST // Set async to false to can use xhr.status after xhr.send() xhr.open("GET", url, false); xhr.onreadystatechange = function() { if (xhr.readyState == 4 && xhr.status == 200) eval(xhr.responseText); if (xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 404)) { callback(); } } xhr.send(); if (xhr.status == 404) return false; } return true; }, require: function(url, callback) { if (!this.include(url, true, callback)) alert('The resource ' + url + ' probably does not exists'); }, array_include: function(urlArray, callback) { var that = this; var resource = urlArray[0]; callback = callback || new Function(); if (urlArray.length > 0) this.include(resource, false, function(){ urlArray = urlArray.splice(1, urlArray.length); that.array_include(urlArray, callback); }); else callback(); }, ready: function(handler) { handler = handler || new Function(); var libReady = function(handler) { setTimeout(function(){ if (JScriptRender.STATE == "complete") handler(); else return libReady(handler); }, 100); } if (document.readyState == "complete") libReady(handler); else { document.onreadystatechange = function () { if (document.readyState == "complete") { libReady(handler); } } } } } /* Short alias */ var $jS = JScriptRender; for (var f in $jS.StdClass) { $jS[f] = $jS.StdClass[f]; }; /* Load classes */ try { $jS.array_include([ // Languages 'language/en_US.js', 'language/es_ES.js', // General settings 'settings/general.js', // Validators 'validator/MathExpression.js', 'validator/StringLength.js', 'validator/Digits.js', 'validator/Alnum.js', 'validator/Date.js', 'validator/FileFormat.js', // Filters 'filter/InputFilter.js', // Html 'html/Overlay.js', 'html/Loader.js', 'html/Dialog.js', 'html/Form.js', 'html/FormValidator.js', // Exceptions 'exception/Exception.js', // Readers 'readers/File.js', // jQuery utils 'jquery/Ajax.js', 'jquery/UI.js', 'jquery/Debug.js', 'jquery/Animation.js', // Utils 'utils/DateControl.js', ], function(){ JScriptRender.STATE = 'complete'; }); } catch (e) { JScriptRender.STATE = 'error'; }
{ "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "Unnamed: 0": 0, "Incident Number": 103340050, "Date": "11\/30\/2010", "Time": "10:11 AM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.141234, -87.955480 ], "Address": "3432 W GREEN TREE RD", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 0, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 1, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 6, "m_clusterK7": 0, "e_clusterK8": 5, "g_clusterK8": 5, "m_clusterK8": 5, "e_clusterK9": 6, "g_clusterK9": 6, "m_clusterK9": 6, "e_clusterK10": 9, "g_clusterK10": 9, "m_clusterK10": 9 }, "geometry": { "type": "Point", "coordinates": [ -87.95547972300767, 43.141234471579239 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 1, "Incident Number": 103330075, "Date": "11\/29\/2010", "Time": "12:29 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.142692, -87.956732 ], "Address": "6864 N DARIEN ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 0, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 1, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 6, "m_clusterK7": 0, "e_clusterK8": 5, "g_clusterK8": 5, "m_clusterK8": 5, "e_clusterK9": 6, "g_clusterK9": 6, "m_clusterK9": 6, "e_clusterK10": 9, "g_clusterK10": 9, "m_clusterK10": 9 }, "geometry": { "type": "Point", "coordinates": [ -87.95673217897118, 43.14269243167027 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 2, "Incident Number": 103310054, "Date": "11\/27\/2010", "Time": "11:54 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.111108, -87.951570 ], "Address": "5163 N 31ST ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 2, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.951570132003951, 43.111107586733226 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 3, "Incident Number": 103280154, "Date": "11\/24\/2010", "Time": "09:32 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.094825, -87.925830 ], "Address": "4240 N GREEN BAY AV", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.925830436263183, 43.094825077442394 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 4, "Incident Number": 103270046, "Date": "11\/23\/2010", "Time": "10:04 AM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.111995, -87.960129 ], "Address": "3800 W VILLARD AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 3, "g_clusterK4": 1, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.960129274719549, 43.111995274719554 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 5, "Incident Number": 103260018, "Date": "11\/22\/2010", "Time": "01:26 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.092135, -87.946872 ], "Address": "4120 N 27TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.946872393531265, 43.092134884817369 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 6, "Incident Number": 103260064, "Date": "11\/22\/2010", "Time": "11:41 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.104746, -87.976893 ], "Address": "5110 W HAMPTON AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 3, "g_clusterK4": 1, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -87.976892755756253, 43.104746460470757 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 7, "Incident Number": 103260086, "Date": "11\/22\/2010", "Time": "01:39 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.100316, -87.938238 ], "Address": "4565 N 21ST ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.938238124790587, 43.100315528449414 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 8, "Incident Number": 103260176, "Date": "11\/22\/2010", "Time": "08:59 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.105059, -87.944159 ], "Address": "4825 N 25TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.944159150325802, 43.105058947544592 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 9, "Incident Number": 103250131, "Date": "11\/21\/2010", "Time": "07:30 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.104476, -87.937241 ], "Address": "2000 W HAMPTON AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.9372405, 43.104476460470757 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 10, "Incident Number": 103250172, "Date": "11\/21\/2010", "Time": "11:28 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.105290, -87.939211 ], "Address": "4852 N 22ND ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.93921073740357, 43.105290212410488 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 11, "Incident Number": 103230067, "Date": "11\/19\/2010", "Time": "11:38 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.102962, -87.945780 ], "Address": "4730 N TEUTONIA AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.945780053234827, 43.10296169499096 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 12, "Incident Number": 103220010, "Date": "11\/18\/2010", "Time": "01:32 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.104476, -87.937843 ], "Address": "2030 W HAMPTON AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.937843080904841, 43.104476460470757 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 13, "Incident Number": 103210075, "Date": "11\/17\/2010", "Time": "01:58 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.100323, -87.938096 ], "Address": "2040 W CORNELL ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.938095767413031, 43.100322848779207 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 14, "Incident Number": 103200098, "Date": "11\/16\/2010", "Time": "03:14 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.145527, -87.965702 ], "Address": "7027 N 43RD ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 2, "g_clusterK5": 0, "m_clusterK5": 2, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 0, "g_clusterK7": 6, "m_clusterK7": 0, "e_clusterK8": 5, "g_clusterK8": 5, "m_clusterK8": 5, "e_clusterK9": 6, "g_clusterK9": 6, "m_clusterK9": 6, "e_clusterK10": 9, "g_clusterK10": 9, "m_clusterK10": 9 }, "geometry": { "type": "Point", "coordinates": [ -87.965701665329448, 43.145527096860782 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 15, "Incident Number": 103180174, "Date": "11\/14\/2010", "Time": "10:22 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.096257, -87.930569 ], "Address": "4365 N 16TH ST", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.930568569824999, 43.096257199001684 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 16, "Incident Number": 103180180, "Date": "11\/14\/2010", "Time": "11:05 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.108794, -87.942799 ], "Address": "5019 N 24TH PL", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.942799092041994, 43.108794031363601 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 17, "Incident Number": 103170018, "Date": "11\/13\/2010", "Time": "02:27 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.097195, -87.927469 ], "Address": "4401 N GREEN BAY AV", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.927469290062717, 43.097194729384334 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 18, "Incident Number": 103170054, "Date": "11\/13\/2010", "Time": "07:39 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.089634, -87.934653 ], "Address": "1902 W CAPITOL DR", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 3, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.934653471550575, 43.089634486005963 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 19, "Incident Number": 103160084, "Date": "11\/12\/2010", "Time": "02:34 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.104802, -87.952823 ], "Address": "4810 N 32ND ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.952823455522804, 43.104801791156483 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 20, "Incident Number": 103160128, "Date": "11\/12\/2010", "Time": "06:47 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.092414, -87.943404 ], "Address": "4142 N 24TH PL", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.943404407957999, 43.092414220093502 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 21, "Incident Number": 103170002, "Date": "11\/12\/2010", "Time": "11:45 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.095346, -87.944578 ], "Address": "4305 N 25TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.944577588146871, 43.095346082434041 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 22, "Incident Number": 103140026, "Date": "11\/10\/2010", "Time": "06:05 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.107292, -87.949732 ], "Address": "2918 W CAMERON AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.949732080904838, 43.107292486005974 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 23, "Incident Number": 103140168, "Date": "11\/10\/2010", "Time": "08:42 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.111189, -87.939034 ], "Address": "5160 N 22ND ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.939034037289346, 43.111189169452551 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 24, "Incident Number": 103120072, "Date": "11\/08\/2010", "Time": "09:17 AM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.113977, -87.957553 ], "Address": "5304 N 36TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 3, "g_clusterK4": 1, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.957553360782697, 43.113977413266781 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 25, "Incident Number": 103110152, "Date": "11\/07\/2010", "Time": "09:45 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.119022, -87.955285 ], "Address": "3415 W SILVER SPRING DR", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 3, "g_clusterK4": 1, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.955285440147009, 43.119022432909269 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 26, "Incident Number": 103090010, "Date": "11\/05\/2010", "Time": "01:36 AM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.113977, -87.957553 ], "Address": "5304 N 36TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 3, "g_clusterK4": 1, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.957553360782697, 43.113977413266781 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 27, "Incident Number": 103090044, "Date": "11\/05\/2010", "Time": "10:45 AM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.147729, -87.964301 ], "Address": "7155 N 42ND ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 0, "m_clusterK5": 2, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 0, "g_clusterK7": 6, "m_clusterK7": 0, "e_clusterK8": 5, "g_clusterK8": 5, "m_clusterK8": 5, "e_clusterK9": 6, "g_clusterK9": 6, "m_clusterK9": 6, "e_clusterK10": 9, "g_clusterK10": 9, "m_clusterK10": 9 }, "geometry": { "type": "Point", "coordinates": [ -87.964301363996938, 43.147728870349326 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 28, "Incident Number": 103050099, "Date": "11\/01\/2010", "Time": "01:12 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.098136, -87.948059 ], "Address": "2800 W ATKINSON AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.948058735931809, 43.098135998143093 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 29, "Incident Number": 103340142, "Date": "11\/30\/2010", "Time": "06:04 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.089878, -87.999093 ], "Address": "6927 W CAPITOL DR", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 6, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -87.999093167638065, 43.089878495672174 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 30, "Incident Number": 103340153, "Date": "11\/30\/2010", "Time": "07:28 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.068555, -87.977424 ], "Address": "2722 N 51ST ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.977423867996052, 43.068555136274455 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 31, "Incident Number": 103330217, "Date": "11\/29\/2010", "Time": "11:33 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.069913, -87.977392 ], "Address": "2802 N 51ST ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.977392367996046, 43.069913413266789 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 32, "Incident Number": 103300035, "Date": "11\/26\/2010", "Time": "05:40 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.045996, -87.981956 ], "Address": "5425 W MARTIN DR", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 5, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 5, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 3, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.981956246725233, 43.045995973051141 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 33, "Incident Number": 103300076, "Date": "11\/26\/2010", "Time": "11:39 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.085024, -88.007175 ], "Address": "3722 N 76TH ST #9", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 2, "m_clusterK5": 0, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 6, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.007175400744643, 43.08502385789717 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 34, "Incident Number": 103300168, "Date": "11\/26\/2010", "Time": "08:50 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.062354, -87.981961 ], "Address": "2377 N 55TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.981960580933503, 43.062354 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 35, "Incident Number": 103280015, "Date": "11\/24\/2010", "Time": "04:06 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.073954, -87.983024 ], "Address": "3020 N 56TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.98302387910455, 43.07395441326679 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 36, "Incident Number": 103280028, "Date": "11\/24\/2010", "Time": "09:14 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.088723, -88.003318 ], "Address": "7311 W APPLETON AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 6, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.003317751608236, 43.088722588322163 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 37, "Incident Number": 103280091, "Date": "11\/24\/2010", "Time": "03:41 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.038912, -87.970039 ], "Address": "4500 W WISCONSIN AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.970038791890119, 43.038911973541886 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 38, "Incident Number": 103250141, "Date": "11\/21\/2010", "Time": "07:52 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.073236, -87.980911 ], "Address": "2971 N 54TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.980911106468724, 43.073235586733233 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 39, "Incident Number": 103240091, "Date": "11\/20\/2010", "Time": "01:17 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.065394, -87.978616 ], "Address": "2560 N 52ND ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.978616315170925, 43.065393850726934 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 40, "Incident Number": 103220044, "Date": "11\/18\/2010", "Time": "10:05 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.075403, -88.003383 ], "Address": "7240 W BURLEIGH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 6, "g_clusterK10": 6, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.003382642102835, 43.075402500432702 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 41, "Incident Number": 103170186, "Date": "11\/13\/2010", "Time": "11:28 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.076691, -87.974859 ], "Address": "3167 N 49TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.974858606468729, 43.076690612268465 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 42, "Incident Number": 103140132, "Date": "11\/10\/2010", "Time": "04:50 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.075403, -88.003383 ], "Address": "7240 W BURLEIGH ST #3", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 6, "g_clusterK10": 6, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.003382642102835, 43.075402500432702 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 43, "Incident Number": 103100021, "Date": "11\/06\/2010", "Time": "06:21 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.063647, -87.978983 ], "Address": "5211 W LISBON AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.978983426048714, 43.063647266980347 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 44, "Incident Number": 103100022, "Date": "11\/06\/2010", "Time": "12:52 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.063647, -87.978983 ], "Address": "5211 W LISBON AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.978983426048714, 43.063647266980347 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 45, "Incident Number": 103080047, "Date": "11\/04\/2010", "Time": "11:08 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.033702, -88.007136 ], "Address": "304 N 76TH ST", "e_clusterK2": 1, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 0, "m_clusterK3": 2, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 5, "g_clusterK6": 3, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 2, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 6, "m_clusterK8": 3, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 6, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -88.007135651856203, 43.033702164796935 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 46, "Incident Number": 103060147, "Date": "11\/02\/2010", "Time": "08:53 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.067921, -87.980195 ], "Address": "5325 W CENTER ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.980195396162443, 43.067920832932757 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 47, "Incident Number": 103050061, "Date": "11\/01\/2010", "Time": "10:37 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.068082, -87.987110 ], "Address": "5920 W CENTER ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 6, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.987110223007676, 43.068082471579245 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 48, "Incident Number": 103320012, "Date": "11\/28\/2010", "Time": "01:54 AM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.974111, -87.953210 ], "Address": "3894 S MINER ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.953209515557759, 42.974111082226777 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 49, "Incident Number": 103310151, "Date": "11\/27\/2010", "Time": "10:31 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.988278, -87.985380 ], "Address": "5703 W OKLAHOMA AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 4, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 2, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.985379540535376, 42.988277882245292 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 50, "Incident Number": 103310163, "Date": "11\/27\/2010", "Time": "11:39 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.982712, -87.947021 ], "Address": "3413 S 26TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.947020548184923, 42.982712276992316 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 51, "Incident Number": 103300088, "Date": "11\/26\/2010", "Time": "01:11 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.985736, -87.955408 ], "Address": "3267 W LAKEFIELD DR", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.955408265912467, 42.985735943360986 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 52, "Incident Number": 103290046, "Date": "11\/25\/2010", "Time": "01:38 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.987418, -88.003066 ], "Address": "7230 W LAKEFIELD DR", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 4, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 2, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -88.003065794044772, 42.987418437705479 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 53, "Incident Number": 103280155, "Date": "11\/24\/2010", "Time": "08:51 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.004194, -87.959015 ], "Address": "2222 S 36TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.959014970136948, 43.004194187344922 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 54, "Incident Number": 103250015, "Date": "11\/21\/2010", "Time": "02:09 AM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.984535, -87.952299 ], "Address": "3330 S 30TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.952298651361332, 42.984534995994537 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 55, "Incident Number": 103190149, "Date": "11\/15\/2010", "Time": "06:46 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.984705, -87.948466 ], "Address": "3333 S 27TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.948466383970114, 42.984705397388694 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 56, "Incident Number": 103070089, "Date": "11\/03\/2010", "Time": "02:17 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.981738, -87.956894 ], "Address": "3454 S 34TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.956893652238705, 42.981738311327483 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 57, "Incident Number": 103070111, "Date": "11\/03\/2010", "Time": "04:23 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.984891, -87.948438 ], "Address": "3355 S 27TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.948437518897848, 42.984890912488318 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 58, "Incident Number": 103070174, "Date": "11\/03\/2010", "Time": "09:38 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.981120, -87.949373 ], "Address": "2701 W MORGAN AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.949373470973669, 42.981119531738969 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 59, "Incident Number": 103330034, "Date": "11\/29\/2010", "Time": "07:30 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.998959, -87.928611 ], "Address": "2501 S 13TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 3, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.928611048184919, 42.998958922009365 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 60, "Incident Number": 103320120, "Date": "11\/28\/2010", "Time": "05:01 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.001281, -87.929010 ], "Address": "1314 W HAYES AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.929009580904832, 43.001281486005979 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 61, "Incident Number": 103320154, "Date": "11\/28\/2010", "Time": "08:33 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.007463, -87.917706 ], "Address": "2034 S 5TH PL", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.91770592296163, 43.007462664723874 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 62, "Incident Number": 103310120, "Date": "11\/27\/2010", "Time": "07:19 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.017300, -87.919733 ], "Address": "1332 S 7TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.919733455133297, 43.0173 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 63, "Incident Number": 103280004, "Date": "11\/24\/2010", "Time": "01:11 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.997663, -87.930590 ], "Address": "1416 W HARRISON AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 0, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.930589887731543, 42.997662511541193 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 64, "Incident Number": 103280072, "Date": "11\/24\/2010", "Time": "01:09 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.014082, -87.923354 ], "Address": "921 W LAPHAM BL", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.9233535, 43.014081532315899 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 65, "Incident Number": 103260017, "Date": "11\/22\/2010", "Time": "01:42 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.008064, -87.928214 ], "Address": "2004 S 13TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.928213528420756, 43.008064155981316 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 66, "Incident Number": 103250047, "Date": "11\/21\/2010", "Time": "06:57 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.020087, -87.936520 ], "Address": "1829 W WASHINGTON ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 0, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.936520080904842, 43.020086543424412 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 67, "Incident Number": 103240126, "Date": "11\/20\/2010", "Time": "06:15 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.000802, -87.931194 ], "Address": "2420 S 15TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.931194477350303, 43.0008024970858 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 68, "Incident Number": 103220135, "Date": "11\/18\/2010", "Time": "08:25 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.007360, -87.922271 ], "Address": "825 W ALMA ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.922270948929551, 43.007359506780681 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 69, "Incident Number": 103220143, "Date": "11\/18\/2010", "Time": "09:12 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.024137, -87.915354 ], "Address": "700 S 4TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.915353651758195, 43.024136651758219 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 70, "Incident Number": 103210032, "Date": "11\/17\/2010", "Time": "08:19 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.015807, -87.925432 ], "Address": "1505 S 11TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.92543151875455, 43.015807005828378 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 71, "Incident Number": 103210090, "Date": "11\/17\/2010", "Time": "03:54 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.006678, -87.918672 ], "Address": "2072 S 6TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.918672470136954, 43.006678491257446 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 72, "Incident Number": 103210094, "Date": "11\/17\/2010", "Time": "04:05 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.016595, -87.938028 ], "Address": "1440 S 20TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.938028419574266, 43.016594857320229 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 73, "Incident Number": 103200040, "Date": "11\/16\/2010", "Time": "08:47 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.004678, -87.928771 ], "Address": "1314 W GRANT ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.928771164723869, 43.004677514859424 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 74, "Incident Number": 103190043, "Date": "11\/15\/2010", "Time": "09:13 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": "THEFT FROM MOTOR VEHICLE", "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.006843, -87.920049 ], "Address": "2063 S 7TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.920049062611639, 43.006842754371291 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 75, "Incident Number": 103190069, "Date": "11\/15\/2010", "Time": "11:39 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.018090, -87.926004 ], "Address": "1116 W MADISON ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.926003664723865, 43.018089504327826 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 76, "Incident Number": 103190123, "Date": "11\/15\/2010", "Time": "04:49 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.017003, -87.928321 ], "Address": "1315 W GREENFIELD AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.928320776992322, 43.017002510098898 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 77, "Incident Number": 103190158, "Date": "11\/15\/2010", "Time": "07:31 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.008957, -87.933749 ], "Address": "1645 W FOREST HOME AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.933749320284264, 43.008956801538439 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 78, "Incident Number": 103170091, "Date": "11\/13\/2010", "Time": "01:11 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.021755, -87.930496 ], "Address": "914 S 15TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.930495959605366, 43.021755 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 79, "Incident Number": 103160067, "Date": "11\/12\/2010", "Time": "01:22 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.009154, -87.926976 ], "Address": "1946 S 12TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.926976484563667, 43.009153826533549 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 80, "Incident Number": 103160114, "Date": "11\/12\/2010", "Time": "05:09 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.013709, -87.934199 ], "Address": "1611 S 17TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.934199011541182, 43.013709366639745 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 81, "Incident Number": 103150161, "Date": "11\/11\/2010", "Time": "09:42 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.017064, -87.929694 ], "Address": "1408-B W GREENFIELD AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.929693832361934, 43.01706350432783 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 82, "Incident Number": 103110033, "Date": "11\/07\/2010", "Time": "08:25 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.018897, -87.919806 ], "Address": "1213 S 7TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.91980628309301, 43.018896580485922 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 83, "Incident Number": 103090114, "Date": "11\/05\/2010", "Time": "03:39 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.019139, -87.925821 ], "Address": "1132 W SCOTT ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.925821032301869, 43.01913904167106 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 84, "Incident Number": 103090116, "Date": "11\/05\/2010", "Time": "04:01 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.014082, -87.923354 ], "Address": "921 W LAPHAM BL", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.9233535, 43.014081532315899 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 85, "Incident Number": 103060069, "Date": "11\/02\/2010", "Time": "12:10 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.016986, -87.927183 ], "Address": "1209 W GREENFIELD AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.927183167638063, 43.016985546742632 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 86, "Incident Number": 103050046, "Date": "11\/01\/2010", "Time": "09:38 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.023242, -87.906702 ], "Address": "354 E NATIONAL AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.906701923394323, 43.023242482110845 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 87, "Incident Number": 103340029, "Date": "11\/30\/2010", "Time": "08:02 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.001414, -87.934474 ], "Address": "2370 S 17TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.934474499567315, 43.001413742714533 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 88, "Incident Number": 103340043, "Date": "11\/30\/2010", "Time": "08:25 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.999107, -87.937060 ], "Address": "2508 S 19TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.937060093625988, 42.999107139820858 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 89, "Incident Number": 103320128, "Date": "11\/28\/2010", "Time": "05:39 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.979579, -87.946904 ], "Address": "2536 W WARNIMONT AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.946904251197296, 42.979579016417269 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 90, "Incident Number": 103320177, "Date": "11\/28\/2010", "Time": "10:11 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.930484, -87.942770 ], "Address": "2210 W COLLEGE AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.942769819180043, 42.930484270096592 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 91, "Incident Number": 103320179, "Date": "11\/28\/2010", "Time": "10:48 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.003557, -87.934480 ], "Address": "2251 S 17TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.934480022649694, 43.003557282820708 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 92, "Incident Number": 103310145, "Date": "11\/27\/2010", "Time": "09:53 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.960886, -87.943756 ], "Address": "4575 S 23RD ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.943755831842338, 42.960886174880095 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 93, "Incident Number": 103280170, "Date": "11\/24\/2010", "Time": "11:16 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.973874, -87.931773 ], "Address": "1508 W HOWARD AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.931772832361929, 42.973874474897478 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 94, "Incident Number": 103270148, "Date": "11\/23\/2010", "Time": "02:28 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.006571, -87.936615 ], "Address": "1837 W BECHER ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.936614863725538, 43.006570513994035 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 95, "Incident Number": 103270174, "Date": "11\/23\/2010", "Time": "08:50 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.980992, -87.922359 ], "Address": "821 W MORGAN AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.922359220093483, 42.980991539529263 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 96, "Incident Number": 103270190, "Date": "11\/23\/2010", "Time": "09:49 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.985224, -87.933860 ], "Address": "3257 S 16TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.933859848632579, 42.985224 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 97, "Incident Number": 103260115, "Date": "11\/22\/2010", "Time": "04:32 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.003043, -87.935598 ], "Address": "1800 W LINCOLN AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.935598006443271, 43.003042705318954 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 98, "Incident Number": 103260130, "Date": "11\/22\/2010", "Time": "05:42 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.996727, -87.937880 ], "Address": "1920 W WINDLAKE AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 1, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.937879552455428, 42.996727486005966 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 99, "Incident Number": 103190017, "Date": "11\/15\/2010", "Time": "07:11 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.998625, -87.937084 ], "Address": "2526 S 19TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.937083940706572, 42.998625303912519 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 100, "Incident Number": 103180018, "Date": "11\/14\/2010", "Time": "03:34 AM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.981081, -87.933464 ], "Address": "1577 W MORGAN AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.933464444630388, 42.981080502885547 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 101, "Incident Number": 103160102, "Date": "11\/12\/2010", "Time": "05:09 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.935381, -87.936735 ], "Address": "6038 S 18TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.93673499509525, 42.935381413266782 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 102, "Incident Number": 103100049, "Date": "11\/06\/2010", "Time": "09:25 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.997698, -87.937179 ], "Address": "2575 S 19TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.937179048184916, 42.997697696087471 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 103, "Incident Number": 103320009, "Date": "11\/28\/2010", "Time": "01:25 AM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.988324, -87.920654 ], "Address": "702 W OKLAHOMA AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.920653667638064, 42.988323518754562 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 104, "Incident Number": 103310086, "Date": "11\/27\/2010", "Time": "03:20 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.997293, -87.899369 ], "Address": "2611 S KINNICKINNIC AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.899369126871633, 42.99729321697685 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 105, "Incident Number": 103300159, "Date": "11\/26\/2010", "Time": "08:22 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.002911, -87.900440 ], "Address": "711 E LINCOLN AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 3, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.900439803912519, 43.00291052120739 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 106, "Incident Number": 103280024, "Date": "11\/24\/2010", "Time": "08:23 AM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.004368, -87.901572 ], "Address": "2201 S WINCHESTER ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 3, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.901571541548464, 43.004367838190319 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 107, "Incident Number": 103280038, "Date": "11\/24\/2010", "Time": "10:05 AM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.989783, -87.878429 ], "Address": "3000 S WENTWORTH AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.878429325408376, 42.989782765768254 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 108, "Incident Number": 103270038, "Date": "11\/23\/2010", "Time": "09:11 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.997239, -87.920032 ], "Address": "2610 S 7TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.920032466241807, 42.9972387171793 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 109, "Incident Number": 103260053, "Date": "11\/22\/2010", "Time": "09:43 AM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.983864, -87.894390 ], "Address": "3333 S CLEMENT AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.894389538807175, 42.983864308355912 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 110, "Incident Number": 103260138, "Date": "11\/22\/2010", "Time": "05:28 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.003990, -87.905155 ], "Address": "2223 S KINNICKINNIC AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 3, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.905155262854052, 43.003989660828744 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 111, "Incident Number": 103230077, "Date": "11\/19\/2010", "Time": "01:34 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.997051, -87.898601 ], "Address": "2640 S KINNICKINNIC AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.89860108817139, 42.997051077258753 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 112, "Incident Number": 103200146, "Date": "11\/16\/2010", "Time": "07:37 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.987735, -87.902803 ], "Address": "3120 S ADAMS AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.902803437388357, 42.987734832361951 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 113, "Incident Number": 103180001, "Date": "11\/14\/2010", "Time": "12:01 AM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.002643, -87.903979 ], "Address": "2306 S KINNICKINNIC AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 3, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.903978670667826, 43.002642656125531 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 114, "Incident Number": 103170013, "Date": "11\/13\/2010", "Time": "01:33 AM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.001914, -87.903457 ], "Address": "2353 S KINNICKINNIC AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 3, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 1, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.903456829332171, 43.001914391049787 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 115, "Incident Number": 103170036, "Date": "11\/13\/2010", "Time": "06:01 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.997012, -87.914135 ], "Address": "2624 S 3RD ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.914135495672156, 42.997012239800341 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 116, "Incident Number": 103160132, "Date": "11\/12\/2010", "Time": "07:25 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.991478, -87.928703 ], "Address": "2916 S 13TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 0, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.928703426279853, 42.991478245628713 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 117, "Incident Number": 103130048, "Date": "11\/09\/2010", "Time": "10:09 AM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.995597, -87.901182 ], "Address": "609 E RUSSELL AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.901182167638055, 42.995597481245447 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 118, "Incident Number": 103120182, "Date": "11\/08\/2010", "Time": "08:41 PM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.979586, -87.908500 ], "Address": "3555 S HOWELL AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.908499887904441, 42.979585607853714 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 119, "Incident Number": 103110031, "Date": "11\/07\/2010", "Time": "07:44 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.994287, -87.932628 ], "Address": "2763 S 15TH PL", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.932627537076414, 42.994286612268439 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 120, "Incident Number": 103060033, "Date": "11\/02\/2010", "Time": "08:58 AM", "Police District": 6.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.986647, -87.919178 ], "Address": "3173 S 6TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 4, "g_clusterK7": 4, "m_clusterK7": 4, "e_clusterK8": 2, "g_clusterK8": 2, "m_clusterK8": 2, "e_clusterK9": 0, "g_clusterK9": 0, "m_clusterK9": 0, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.919177555398278, 42.986646838190325 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 121, "Incident Number": 103340079, "Date": "11\/30\/2010", "Time": "12:19 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.069477, -87.923002 ], "Address": "908 W HADLEY ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.923001829447742, 43.069477493219331 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 122, "Incident Number": 103340197, "Date": "11\/30\/2010", "Time": "11:43 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.067981, -87.964474 ], "Address": "2700 N 41ST ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 4, "g_clusterK9": 1, "m_clusterK9": 4, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.964474063472991, 43.067980735036656 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 123, "Incident Number": 103350144, "Date": "11\/30\/2010", "Time": "09:45 PM", "Police District": 3.0, "Offense 1": "DISORDERLY CONDUCT", "Offense 2": "MOTOR VEHICLE THEFT", "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.052354, -87.962243 ], "Address": "3819 W WALNUT ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.9622425, 43.052354488458803 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 124, "Incident Number": 103330160, "Date": "11\/29\/2010", "Time": "06:05 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.054303, -87.926952 ], "Address": "1808 N 12TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.926951502502973, 43.054302664108967 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 125, "Incident Number": 103310012, "Date": "11\/27\/2010", "Time": "02:22 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.063271, -87.938724 ], "Address": "2440 N 21ST ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.938724386317915, 43.06327141326679 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 126, "Incident Number": 103310074, "Date": "11\/27\/2010", "Time": "01:43 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.070760, -87.921449 ], "Address": "2859 N 8TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.921449080933499, 43.07076 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 127, "Incident Number": 103300032, "Date": "11\/26\/2010", "Time": "04:07 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.064295, -87.949991 ], "Address": "2900 W WRIGHT ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.949990714006134, 43.064295214006151 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 128, "Incident Number": 103300039, "Date": "11\/26\/2010", "Time": "07:44 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.062570, -87.961023 ], "Address": "2402 N 38TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.961022860782691, 43.06256983236193 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 129, "Incident Number": 103300043, "Date": "11\/26\/2010", "Time": "08:35 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.059300, -87.957632 ], "Address": "3500 W GARFIELD AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.957631707657015, 43.059300207657017 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 130, "Incident Number": 103280039, "Date": "11\/24\/2010", "Time": "08:02 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.051452, -87.961697 ], "Address": "3851 W GALENA ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.961697370507565, 43.051452447283289 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 131, "Incident Number": 103280171, "Date": "11\/24\/2010", "Time": "11:17 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.058744, -87.925559 ], "Address": "2137 N 11TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.925558617577224, 43.058744360811346 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 132, "Incident Number": 103270058, "Date": "11\/23\/2010", "Time": "11:02 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.057880, -87.953451 ], "Address": "3132 W LLOYD ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.953450642102837, 43.057879500432691 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 133, "Incident Number": 103270113, "Date": "11\/23\/2010", "Time": "04:26 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.064139, -87.950495 ], "Address": "2995 W WRIGHT ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.950495404747784, 43.064138785993876 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 134, "Incident Number": 103260032, "Date": "11\/22\/2010", "Time": "08:43 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.053985, -87.945158 ], "Address": "1835 N 25TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.945157632003955, 43.053984670552268 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 135, "Incident Number": 103250149, "Date": "11\/21\/2010", "Time": "08:56 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.052712, -87.944261 ], "Address": "2459 W WALNUT ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.944260667638062, 43.052711543424408 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 136, "Incident Number": 103250177, "Date": "11\/21\/2010", "Time": "11:50 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.067646, -87.968801 ], "Address": "2673 N 44TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.968800632003948, 43.067646335276123 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 137, "Incident Number": 103240077, "Date": "11\/20\/2010", "Time": "12:08 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.064073, -87.976196 ], "Address": "2476 N 50TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.976196364100915, 43.064073 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 138, "Incident Number": 103240119, "Date": "11\/20\/2010", "Time": "03:17 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.067561, -87.924226 ], "Address": "1011 W CENTER ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.924225954582923, 43.067561455570122 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 139, "Incident Number": 103220099, "Date": "11\/18\/2010", "Time": "03:55 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.063983, -87.942422 ], "Address": "2474 N 24TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.942421765597373, 43.063983237280631 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 140, "Incident Number": 103210012, "Date": "11\/17\/2010", "Time": "01:01 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.059699, -87.962266 ], "Address": "2216 N 39TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.962265919066496, 43.059698664723868 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 141, "Incident Number": 103190028, "Date": "11\/15\/2010", "Time": "08:13 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.071339, -87.937862 ], "Address": "2011 W LOCUST ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 4, "g_clusterK6": 3, "m_clusterK6": 4, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 4, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 2, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.93786185122606, 43.071338776839099 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 142, "Incident Number": 103190178, "Date": "11\/15\/2010", "Time": "08:05 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.044466, -87.961931 ], "Address": "3939 W HIGHLAND BL", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.961931481678135, 43.044465535057199 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 143, "Incident Number": 103180060, "Date": "11\/14\/2010", "Time": "11:21 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.053524, -87.954046 ], "Address": "1730 N 32ND ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.954046389636133, 43.053524497085817 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 144, "Incident Number": 103170057, "Date": "11\/13\/2010", "Time": "09:55 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.069256, -87.960914 ], "Address": "2762 N 38TH ST", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 5, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 3, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 1, "m_clusterK9": 4, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.960913886317911, 43.069255742714518 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 145, "Incident Number": 103170076, "Date": "11\/13\/2010", "Time": "11:50 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.061078, -87.945047 ], "Address": "2323 N 25TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.945046972720689, 43.061078080097658 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 146, "Incident Number": 103170164, "Date": "11\/13\/2010", "Time": "09:56 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.052354, -87.962243 ], "Address": "3819 W WALNUT ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.9622425, 43.052354488458803 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 147, "Incident Number": 103160026, "Date": "11\/12\/2010", "Time": "08:44 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.059420, -87.972418 ], "Address": "2207 N 47TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 5, "g_clusterK6": 3, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 3, "g_clusterK8": 6, "m_clusterK8": 3, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.972417573720136, 43.059419580904859 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 148, "Incident Number": 103160038, "Date": "11\/12\/2010", "Time": "09:55 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.067087, -87.968811 ], "Address": "2645 N 44TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.968810606468722, 43.067087444630374 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 149, "Incident Number": 103150051, "Date": "11\/11\/2010", "Time": "10:55 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.060741, -87.945071 ], "Address": "2500 W NORTH AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.945071085722603, 43.060741304016787 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 150, "Incident Number": 103120139, "Date": "11\/08\/2010", "Time": "05:21 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.062913, -87.959901 ], "Address": "2419 N 37TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.959900606468722, 43.062912586733233 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 151, "Incident Number": 103110084, "Date": "11\/07\/2010", "Time": "12:36 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.067947, -87.956990 ], "Address": "3420 W CENTER ST", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.956990497085812, 43.06794651875456 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 152, "Incident Number": 103100074, "Date": "11\/06\/2010", "Time": "09:09 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.055568, -87.946275 ], "Address": "1926 N 26TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.946275386317922, 43.0555684715506 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 153, "Incident Number": 103100154, "Date": "11\/06\/2010", "Time": "08:34 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.051788, -87.957596 ], "Address": "1610 N 35TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.957595893531277, 43.051788 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 154, "Incident Number": 103090054, "Date": "11\/05\/2010", "Time": "11:16 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.059276, -87.965786 ], "Address": "2202 N 42ND ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.965785915171367, 43.059276115182655 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 155, "Incident Number": 103080060, "Date": "11\/04\/2010", "Time": "12:30 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.059179, -87.931349 ], "Address": "2200 N 15TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.931348669271742, 43.05917912059661 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 156, "Incident Number": 103080106, "Date": "11\/04\/2010", "Time": "05:37 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.063721, -87.977455 ], "Address": "2462 N 51ST ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.977455389636134, 43.063721497085822 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 157, "Incident Number": 103070119, "Date": "11\/03\/2010", "Time": "05:14 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.057418, -87.966919 ], "Address": "4238 W LISBON AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.966918749783645, 43.057417598130186 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 158, "Incident Number": 103060146, "Date": "11\/02\/2010", "Time": "05:52 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.060371, -87.932835 ], "Address": "1613 W NORTH AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.932835212306358, 43.060370869066936 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 159, "Incident Number": 103060172, "Date": "11\/02\/2010", "Time": "11:29 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.069267, -87.937520 ], "Address": "2769 N 20TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 7, "g_clusterK10": 2, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.937519555398268, 43.06926700582838 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 160, "Incident Number": 103050082, "Date": "11\/01\/2010", "Time": "11:58 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.060495, -87.934513 ], "Address": "1730 W NORTH AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.9345135, 43.06049451875456 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 161, "Incident Number": 103050083, "Date": "11\/01\/2010", "Time": "11:59 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.060495, -87.934513 ], "Address": "1730 W NORTH AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.9345135, 43.06049451875456 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 162, "Incident Number": 103050087, "Date": "11\/01\/2010", "Time": "12:19 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.058025, -87.956296 ], "Address": "2100 N 34TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.956295911853132, 43.05802474854292 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 163, "Incident Number": 103330138, "Date": "11\/29\/2010", "Time": "03:45 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.133425, -88.015532 ], "Address": "6352 N 84TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 8, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.015532400167714, 43.133425103525894 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 164, "Incident Number": 103310003, "Date": "11\/27\/2010", "Time": "12:19 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.100146, -88.001864 ], "Address": "4544 N 72ND ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 2, "m_clusterK5": 0, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.001863886317921, 43.10014558673322 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 165, "Incident Number": 103310100, "Date": "11\/27\/2010", "Time": "04:34 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.122903, -88.030706 ], "Address": "5772 N 95TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 4, "g_clusterK10": 4, "m_clusterK10": 4 }, "geometry": { "type": "Point", "coordinates": [ -88.030706419066505, 43.122903432973629 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 166, "Incident Number": 103310138, "Date": "11\/27\/2010", "Time": "08:58 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.090027, -87.977129 ], "Address": "5100 W CAPITOL DR", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 2, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.977129146132881, 43.090027319263378 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 167, "Incident Number": 103310148, "Date": "11\/27\/2010", "Time": "10:09 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.112266, -88.012480 ], "Address": "8120 W VILLARD AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 4 }, "geometry": { "type": "Point", "coordinates": [ -88.0124805, 43.11226550432783 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 168, "Incident Number": 103300149, "Date": "11\/26\/2010", "Time": "06:59 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.105769, -88.008679 ], "Address": "7661 W LUSCHER AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.008679097709916, 43.105768584392813 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 169, "Incident Number": 103300154, "Date": "11\/26\/2010", "Time": "07:02 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.105081, -88.009222 ], "Address": "7724 W HAMPTON AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.009222416180961, 43.105081493219338 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 170, "Incident Number": 103280096, "Date": "11\/24\/2010", "Time": "04:02 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.090066, -87.988433 ], "Address": "6100 W CAPITOL DR", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -87.9884325, 43.090066486005981 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 171, "Incident Number": 103270194, "Date": "11\/23\/2010", "Time": "10:06 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.090065, -87.982037 ], "Address": "5500 W CAPITOL DR", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 3, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.982036682574247, 43.090065102462006 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 172, "Incident Number": 103260016, "Date": "11\/22\/2010", "Time": "02:06 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.099299, -87.995586 ], "Address": "4502 N 67TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -87.995586386317925, 43.099298884817358 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 173, "Incident Number": 103260031, "Date": "11\/22\/2010", "Time": "07:44 AM", "Police District": 7.0, "Offense 1": "THEFT FROM MOTOR VEHICLE", "Offense 2": "MOTOR VEHICLE THEFT", "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.108490, -88.010131 ], "Address": "7922 W GRANTOSA DR", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.010130686392614, 43.108490282560908 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 174, "Incident Number": 103260194, "Date": "11\/22\/2010", "Time": "09:36 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.122601, -88.030790 ], "Address": "5759 N 95TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 4, "g_clusterK10": 4, "m_clusterK10": 4 }, "geometry": { "type": "Point", "coordinates": [ -88.030789540971554, 43.122600701915871 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 175, "Incident Number": 103250063, "Date": "11\/21\/2010", "Time": "11:34 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.111674, -88.006212 ], "Address": "5153 N 76TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.006211599255352, 43.111674419095152 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 176, "Incident Number": 103250091, "Date": "11\/21\/2010", "Time": "02:31 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.120691, -88.008117 ], "Address": "5644 N 78TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.008117413526577, 43.120690596716535 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 177, "Incident Number": 103250130, "Date": "11\/21\/2010", "Time": "03:30 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.091413, -87.978483 ], "Address": "5241 W FOND DU LAC AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 3, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.978483420720352, 43.091412647593977 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 178, "Incident Number": 103250162, "Date": "11\/21\/2010", "Time": "10:23 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.106517, -88.002001 ], "Address": "4871 N 72ND ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.00200065753917, 43.106516832361933 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 179, "Incident Number": 103240042, "Date": "11\/20\/2010", "Time": "07:53 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.091504, -87.973416 ], "Address": "4070 N 48TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.973416379104549, 43.091503742714536 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 180, "Incident Number": 103230111, "Date": "11\/19\/2010", "Time": "04:18 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.095581, -87.995655 ], "Address": "4302 N 67TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -87.995654860782693, 43.095581413266785 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 181, "Incident Number": 103230124, "Date": "11\/19\/2010", "Time": "05:44 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.105823, -88.010349 ], "Address": "7833 W LUSCHER AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.010348652922886, 43.105822743811053 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 182, "Incident Number": 103230127, "Date": "11\/19\/2010", "Time": "05:28 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.108227, -88.015948 ], "Address": "4977 N 84TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 4, "m_clusterK10": 4 }, "geometry": { "type": "Point", "coordinates": [ -88.015947650325813, 43.108226580904841 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 183, "Incident Number": 103220038, "Date": "11\/18\/2010", "Time": "08:58 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.098093, -87.993103 ], "Address": "4436 N 65TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -87.993103360782698, 43.098092832361942 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 184, "Incident Number": 103220041, "Date": "11\/18\/2010", "Time": "09:24 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.097227, -88.004780 ], "Address": "7408 W CONGRESS ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 2, "m_clusterK5": 0, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.004780276992321, 43.097226504327828 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 185, "Incident Number": 103220083, "Date": "11\/18\/2010", "Time": "02:09 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.123050, -88.005856 ], "Address": "5772 N 76TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.005855842460818, 43.123049580904848 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 186, "Incident Number": 103220100, "Date": "11\/18\/2010", "Time": "04:26 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.090129, -87.984044 ], "Address": "5670 W CAPITOL DR", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -87.984044406341383, 43.090129294285902 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 187, "Incident Number": 103200027, "Date": "11\/16\/2010", "Time": "06:35 AM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.132311, -88.015566 ], "Address": "6300 N 84TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 8, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.015565867996045, 43.132311471550594 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 188, "Incident Number": 103200111, "Date": "11\/16\/2010", "Time": "04:56 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.114355, -88.003519 ], "Address": "5297 N 74TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.003518671965892, 43.114355444630377 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 189, "Incident Number": 103190012, "Date": "11\/15\/2010", "Time": "04:02 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.100484, -87.989521 ], "Address": "6222 W FOND DU LAC AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -87.989520888683842, 43.100483677505814 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 190, "Incident Number": 103190015, "Date": "11\/15\/2010", "Time": "07:00 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.091577, -87.988220 ], "Address": "4071 N 61ST ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -87.988219624790574, 43.091577419095159 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 191, "Incident Number": 103190053, "Date": "11\/15\/2010", "Time": "10:20 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.102118, -87.993432 ], "Address": "6518 W MEDFORD AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -87.993431671767027, 43.102117760126411 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 192, "Incident Number": 103190096, "Date": "11\/15\/2010", "Time": "03:18 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.119285, -87.998310 ], "Address": "6929 W SILVER SPRING DR", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -87.998310167638067, 43.119284524525632 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 193, "Incident Number": 103190183, "Date": "11\/15\/2010", "Time": "11:01 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.121352, -88.003071 ], "Address": "7329 W THURSTON AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.003071167638055, 43.121351538952347 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 194, "Incident Number": 103180075, "Date": "11\/14\/2010", "Time": "12:35 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.115588, -87.993612 ], "Address": "5375 N 66TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -87.99361159925536, 43.115588245628715 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 195, "Incident Number": 103180141, "Date": "11\/14\/2010", "Time": "06:35 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.124887, -88.009711 ], "Address": "5877 N 79TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.009711106468728, 43.124886586733226 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 196, "Incident Number": 103160029, "Date": "11\/12\/2010", "Time": "07:52 AM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.133882, -88.022204 ], "Address": "8821 W MILL RD", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 8, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.022204025535217, 43.133881528420758 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 197, "Incident Number": 103150041, "Date": "11\/11\/2010", "Time": "09:03 AM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.099784, -88.005690 ], "Address": "4529 N 75TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 5, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 5, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.005689599255362, 43.099784413266775 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 198, "Incident Number": 103150135, "Date": "11\/11\/2010", "Time": "07:23 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.098241, -87.987050 ], "Address": "6003 W FOND DU LAC AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -87.987050096889433, 43.098241296958953 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 199, "Incident Number": 103140029, "Date": "11\/10\/2010", "Time": "07:50 AM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.115365, -88.024798 ], "Address": "9021 W CUSTER AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 4, "g_clusterK10": 4, "m_clusterK10": 4 }, "geometry": { "type": "Point", "coordinates": [ -88.024797995343633, 43.115364582430779 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 200, "Incident Number": 103140178, "Date": "11\/10\/2010", "Time": "09:33 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.090134, -87.984393 ], "Address": "5700 W CAPITOL DR", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -87.984392972630985, 43.090134401484285 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 201, "Incident Number": 103130018, "Date": "11\/09\/2010", "Time": "01:56 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.112222, -88.009471 ], "Address": "7829 W VILLARD AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.009470806826712, 43.112222488458826 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 202, "Incident Number": 103120156, "Date": "11\/08\/2010", "Time": "06:16 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.118503, -88.030454 ], "Address": "9426 W SHERIDAN AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 4, "g_clusterK10": 4, "m_clusterK10": 4 }, "geometry": { "type": "Point", "coordinates": [ -88.030453583819025, 43.118502525967912 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 203, "Incident Number": 103100087, "Date": "11\/06\/2010", "Time": "01:55 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.113187, -87.984968 ], "Address": "5253 N 58TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 0, "e_clusterK6": 5, "g_clusterK6": 1, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 6, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 7, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 8, "m_clusterK9": 1, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -87.984968157539171, 43.113186502914203 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 204, "Incident Number": 103080036, "Date": "11\/04\/2010", "Time": "09:27 AM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.132331, -88.012134 ], "Address": "8110 W BENDER AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 8, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.012134, 43.132331460470745 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 205, "Incident Number": 103070032, "Date": "11\/03\/2010", "Time": "07:38 AM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.114669, -88.028344 ], "Address": "9316 W APPLETON AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 4, "g_clusterK10": 4, "m_clusterK10": 4 }, "geometry": { "type": "Point", "coordinates": [ -88.028344421432436, 43.114668735789614 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 206, "Incident Number": 103050011, "Date": "11\/01\/2010", "Time": "01:47 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.098036, -87.988364 ], "Address": "6114 W MEDFORD AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -87.988363749495193, 43.09803584514389 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 207, "Incident Number": 103320086, "Date": "11\/28\/2010", "Time": "11:24 AM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.070954, -87.886531 ], "Address": "1909 E LOCUST ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.886530859445756, 43.070954189562201 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 208, "Incident Number": 103300064, "Date": "11\/26\/2010", "Time": "11:10 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.062957, -87.899252 ], "Address": "2441 N WEIL ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.899251639217297, 43.062957 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 209, "Incident Number": 103300072, "Date": "11\/26\/2010", "Time": "12:25 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.065937, -87.904161 ], "Address": "2609 N BOOTH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.904161055398276, 43.065936754371279 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 210, "Incident Number": 103280080, "Date": "11\/24\/2010", "Time": "01:42 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.074757, -87.901884 ], "Address": "722 E BURLEIGH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.901883580904837, 43.074756533181265 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 211, "Incident Number": 103280168, "Date": "11\/24\/2010", "Time": "11:13 PM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.062822, -87.885629 ], "Address": "2461 N MURRAY AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.885628847848949, 43.062822077911889 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 212, "Incident Number": 103270009, "Date": "11\/23\/2010", "Time": "12:14 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.063596, -87.896603 ], "Address": "2472 N DOUSMAN ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.896602893531266, 43.063595580904831 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 213, "Incident Number": 103270048, "Date": "11\/23\/2010", "Time": "10:05 AM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.068781, -87.888370 ], "Address": "1721 E RIVERSIDE PL", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.888370248542898, 43.06878054674263 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 214, "Incident Number": 103270094, "Date": "11\/23\/2010", "Time": "03:08 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.075449, -87.901474 ], "Address": "3128 N FRATNEY ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.901473926279849, 43.075448968636408 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 215, "Incident Number": 103260169, "Date": "11\/22\/2010", "Time": "08:28 PM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.081850, -87.876516 ], "Address": "2701 E EDGEWOOD AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.876516369566787, 43.081850165994183 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 216, "Incident Number": 103210011, "Date": "11\/17\/2010", "Time": "12:22 AM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.050222, -87.900863 ], "Address": "1538 N MARSHALL ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 2, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.900862879104551, 43.050222052455439 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 217, "Incident Number": 103210085, "Date": "11\/17\/2010", "Time": "03:10 PM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.064942, -87.881512 ], "Address": "2302 E WEBSTER PL", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.881512080904841, 43.064942489324189 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 218, "Incident Number": 103210171, "Date": "11\/17\/2010", "Time": "08:46 PM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.072595, -87.886633 ], "Address": "2972 N CRAMER ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.886632926279859, 43.072595413266782 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 219, "Incident Number": 103190112, "Date": "11\/15\/2010", "Time": "04:11 PM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.077696, -87.882753 ], "Address": "2200 E HARTFORD AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.882752768951846, 43.077696231048144 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 220, "Incident Number": 103190154, "Date": "11\/15\/2010", "Time": "07:12 PM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.070806, -87.878048 ], "Address": "2863 N DOWNER AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.878048073720137, 43.070806341104515 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 221, "Incident Number": 103190160, "Date": "11\/15\/2010", "Time": "08:06 PM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.072956, -87.885469 ], "Address": "3001 N MURRAY AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.885468573720146, 43.072956167638068 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 222, "Incident Number": 103180013, "Date": "11\/14\/2010", "Time": "02:07 AM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.067355, -87.886242 ], "Address": "1909 E PARK PL", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.886242167638059, 43.067354502885522 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 223, "Incident Number": 103180166, "Date": "11\/14\/2010", "Time": "09:24 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.067602, -87.900447 ], "Address": "2705 N BREMEN ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.900446719348693, 43.067602153976225 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 224, "Incident Number": 103170144, "Date": "11\/13\/2010", "Time": "07:07 PM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.065099, -87.881870 ], "Address": "2555 N FARWELL AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.881869632003955, 43.065099251457099 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 225, "Incident Number": 103170191, "Date": "11\/13\/2010", "Time": "11:53 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.075456, -87.900281 ], "Address": "3129 N BREMEN ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.900280584251718, 43.075456082434066 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 226, "Incident Number": 103150091, "Date": "11\/11\/2010", "Time": "03:20 PM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.074721, -87.891493 ], "Address": "3100 N CAMBRIDGE AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.891492818891393, 43.074721482289341 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 227, "Incident Number": 103140028, "Date": "11\/10\/2010", "Time": "07:48 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.071308, -87.901550 ], "Address": "2907 N FRATNEY ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.901549540971544, 43.071307742714538 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 228, "Incident Number": 103140052, "Date": "11\/10\/2010", "Time": "09:58 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.080135, -87.895840 ], "Address": "1212 E TOWNSEND ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.895839913266769, 43.080135442148887 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 229, "Incident Number": 103140066, "Date": "11\/10\/2010", "Time": "11:12 AM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.081101, -87.886488 ], "Address": "3469 N CRAMER ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.886487606468719, 43.081101282820697 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 230, "Incident Number": 103070029, "Date": "11\/03\/2010", "Time": "07:22 AM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.054516, -87.898052 ], "Address": "1802 N HUMBOLDT AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.898051967554011, 43.054516423166497 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 231, "Incident Number": 103060047, "Date": "11\/02\/2010", "Time": "10:16 AM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.047150, -87.908552 ], "Address": "1310 N BROADWAY", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.9085516374777, 43.047149846931731 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 232, "Incident Number": 103060145, "Date": "11\/02\/2010", "Time": "07:24 PM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.076609, -87.890233 ], "Address": "3242 N NEWHALL ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.89023292627985, 43.076609077990668 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 233, "Incident Number": 103050040, "Date": "11\/01\/2010", "Time": "09:08 AM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.068032, -87.883014 ], "Address": "2728 N MARYLAND AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.883014407958001, 43.068032413266792 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 234, "Incident Number": 103330035, "Date": "11\/29\/2010", "Time": "08:14 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.048989, -87.946280 ], "Address": "1413 N 26TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.946280102573581, 43.048988863725555 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 235, "Incident Number": 103320085, "Date": "11\/28\/2010", "Time": "01:32 PM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.043002, -87.914521 ], "Address": "300 W STATE ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 3, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 2, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 6, "m_clusterK8": 0, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 0, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.914521217594213, 43.043001651138887 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 236, "Incident Number": 103310038, "Date": "11\/27\/2010", "Time": "09:47 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.044615, -87.933865 ], "Address": "1110 N 17TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 2, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.933865441647669, 43.044614541540604 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 237, "Incident Number": 103310039, "Date": "11\/27\/2010", "Time": "09:48 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.048617, -87.951702 ], "Address": "3035 W VLIET ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.951701955537757, 43.048617116587081 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 238, "Incident Number": 103300093, "Date": "11\/26\/2010", "Time": "01:21 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.044615, -87.933865 ], "Address": "1110 N 17TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 2, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.933865441647669, 43.044614541540604 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 239, "Incident Number": 103300152, "Date": "11\/26\/2010", "Time": "07:32 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.043225, -87.943284 ], "Address": "2419 W STATE ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 2, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.943284, 43.043224528420765 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 240, "Incident Number": 103290014, "Date": "11\/25\/2010", "Time": "03:33 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.047692, -87.952416 ], "Address": "1318 N 31ST ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.952416393531266, 43.047692497085819 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 241, "Incident Number": 103290021, "Date": "11\/25\/2010", "Time": "08:18 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.049168, -87.952488 ], "Address": "1419 N 31ST ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.952487613682081, 43.049167522621048 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 242, "Incident Number": 103270200, "Date": "11\/23\/2010", "Time": "08:05 PM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.044958, -87.910863 ], "Address": "1114 N WATER ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 0, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.910863272664486, 43.044958016100161 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 243, "Incident Number": 103260083, "Date": "11\/22\/2010", "Time": "01:27 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.038629, -87.948922 ], "Address": "2733 W WISCONSIN AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 2, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.9489225, 43.038628513994041 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 244, "Incident Number": 103260201, "Date": "11\/22\/2010", "Time": "11:47 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.037418, -87.938263 ], "Address": "1215 W MICHIGAN ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.9382625689001, 43.037417819939883 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 245, "Incident Number": 103250062, "Date": "11\/21\/2010", "Time": "11:25 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.045863, -87.955533 ], "Address": "3303 W JUNEAU AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.955533167638066, 43.045862543424391 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 246, "Incident Number": 103230035, "Date": "11\/19\/2010", "Time": "10:17 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.040356, -87.949099 ], "Address": "2800 W WELLS ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.949099264561838, 43.040355598498159 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 247, "Incident Number": 103230094, "Date": "11\/19\/2010", "Time": "02:59 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.045105, -87.932336 ], "Address": "1145 N CALLAHAN PL", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 2, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.932336011277329, 43.045105168465533 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 248, "Incident Number": 103200010, "Date": "11\/16\/2010", "Time": "01:13 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.049375, -87.957614 ], "Address": "1426 N 35TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.957613893531274, 43.049375497085805 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 249, "Incident Number": 103180019, "Date": "11\/14\/2010", "Time": "03:43 AM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.044586, -87.910789 ], "Address": "101 E HIGHLAND BL", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 0, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.910788825289259, 43.044585612252284 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 250, "Incident Number": 103180031, "Date": "11\/14\/2010", "Time": "06:31 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.044463, -87.927831 ], "Address": "1218 W HIGHLAND AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 2, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.927831419095156, 43.044462511541184 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 251, "Incident Number": 103180072, "Date": "11\/14\/2010", "Time": "12:28 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.043859, -87.941590 ], "Address": "1035 N 23RD ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 2, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.9415901281088, 43.043859335276125 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 252, "Incident Number": 103180107, "Date": "11\/14\/2010", "Time": "03:31 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.049448, -87.956416 ], "Address": "1430 N 34TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.956415919066501, 43.049447748542917 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 253, "Incident Number": 103170030, "Date": "11\/13\/2010", "Time": "03:27 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.044445, -87.936573 ], "Address": "1924 W HIGHLAND AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 2, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 2, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.93657280252755, 43.044445461624591 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 254, "Incident Number": 103120083, "Date": "11\/08\/2010", "Time": "12:20 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.044427, -87.948453 ], "Address": "2725 W HIGHLAND BL", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.948452750072121, 43.044426568382697 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 255, "Incident Number": 103120115, "Date": "11\/08\/2010", "Time": "01:38 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.044489, -87.930187 ], "Address": "1400 W HIGHLAND AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 2, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.930187404700263, 43.044489234674941 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 256, "Incident Number": 103110005, "Date": "11\/07\/2010", "Time": "12:20 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.033650, -87.953004 ], "Address": "3109 W MT VERNON AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.953004, 43.033650477350321 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 257, "Incident Number": 103110029, "Date": "11\/07\/2010", "Time": "05:10 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.040311, -87.954153 ], "Address": "3130 W WELLS ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.954152725921873, 43.040311478792596 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 258, "Incident Number": 103110036, "Date": "11\/07\/2010", "Time": "08:58 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.045894, -87.944603 ], "Address": "2464 W JUNEAU AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.9446025, 43.04589351154118 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 259, "Incident Number": 103110044, "Date": "11\/07\/2010", "Time": "09:13 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.045903, -87.950691 ], "Address": "2924 W JUNEAU AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.950691, 43.04590253318127 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 260, "Incident Number": 103110067, "Date": "11\/07\/2010", "Time": "11:22 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.040329, -87.956112 ], "Address": "3330 W WELLS ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.956112463356263, 43.040329478792607 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 261, "Incident Number": 103100026, "Date": "11\/06\/2010", "Time": "02:01 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.043212, -87.946123 ], "Address": "2537 W STATE ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.9461235, 43.043211546742612 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 262, "Incident Number": 103070034, "Date": "11\/03\/2010", "Time": "08:23 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.047275, -87.941650 ], "Address": "2306 W MC KINLEY AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.941650332361931, 43.0472754893242 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 263, "Incident Number": 103060076, "Date": "11\/02\/2010", "Time": "01:05 PM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.040256, -87.951654 ], "Address": "2937 W WELLS ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.951654083819022, 43.040256498990381 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 264, "Incident Number": 103340034, "Date": "11\/30\/2010", "Time": "08:46 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.102434, -88.021615 ], "Address": "8652 W GRANTOSA DR", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 4, "g_clusterK10": 4, "m_clusterK10": 4 }, "geometry": { "type": "Point", "coordinates": [ -88.021615346673087, 43.102434120751226 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 265, "Incident Number": 103340098, "Date": "11\/30\/2010", "Time": "01:52 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.137184, -88.039744 ], "Address": "6605 N BOURBON ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 8, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.039744038404066, 43.137184353655321 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 266, "Incident Number": 103330027, "Date": "11\/29\/2010", "Time": "06:01 AM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.135959, -88.037602 ], "Address": "6524 N BEALE ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 8, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.037601915257127, 43.135958969888961 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 267, "Incident Number": 103310154, "Date": "11\/27\/2010", "Time": "10:58 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.115831, -88.055563 ], "Address": "5356 N LOVERS LANE RD", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 4, "g_clusterK10": 4, "m_clusterK10": 4 }, "geometry": { "type": "Point", "coordinates": [ -88.055562858908644, 43.11583055398463 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 268, "Incident Number": 103270025, "Date": "11\/23\/2010", "Time": "06:41 AM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.104727, -88.051550 ], "Address": "11101 W HAMPTON AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 4, "g_clusterK10": 4, "m_clusterK10": 4 }, "geometry": { "type": "Point", "coordinates": [ -88.051550139188649, 43.104726546742626 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 269, "Incident Number": 103270052, "Date": "11\/23\/2010", "Time": "10:49 AM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.119565, -88.041196 ], "Address": "10332 W SILVER SPRING DR", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 4, "g_clusterK10": 4, "m_clusterK10": 4 }, "geometry": { "type": "Point", "coordinates": [ -88.041196105633858, 43.119565409832241 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 270, "Incident Number": 103250089, "Date": "11\/21\/2010", "Time": "02:25 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.096347, -88.026378 ], "Address": "4361 N 91ST ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 4, "g_clusterK10": 4, "m_clusterK10": 4 }, "geometry": { "type": "Point", "coordinates": [ -88.026377635322163, 43.096347335276135 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 271, "Incident Number": 103240113, "Date": "11\/20\/2010", "Time": "04:34 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.104846, -88.025149 ], "Address": "9033 W HAMPTON AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 4, "g_clusterK10": 4, "m_clusterK10": 4 }, "geometry": { "type": "Point", "coordinates": [ -88.025149347321644, 43.104845734190583 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 272, "Incident Number": 103240124, "Date": "11\/20\/2010", "Time": "05:56 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.134705, -88.041474 ], "Address": "6432 N 104TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 8, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.041474379104557, 43.134704528449419 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 273, "Incident Number": 103240164, "Date": "11\/20\/2010", "Time": "10:03 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.100597, -88.011155 ], "Address": "7881 W BECKETT AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.011155329332169, 43.100597358301201 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 274, "Incident Number": 103220057, "Date": "11\/18\/2010", "Time": "11:20 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.074206, -88.014863 ], "Address": "3034 N 82ND ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 3, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 2, "m_clusterK5": 0, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 6, "g_clusterK10": 6, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.014862893531273, 43.074206276992328 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 275, "Incident Number": 103210162, "Date": "11\/17\/2010", "Time": "09:19 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.097197, -88.009030 ], "Address": "7716 W CONGRESS ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 5, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 5, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.009029974464767, 43.097197471579236 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 276, "Incident Number": 103200019, "Date": "11\/16\/2010", "Time": "04:29 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.108975, -88.023127 ], "Address": "8875 N POTOMAC AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 4, "g_clusterK10": 4, "m_clusterK10": 4 }, "geometry": { "type": "Point", "coordinates": [ -88.023127226198667, 43.108974848804472 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 277, "Incident Number": 103180175, "Date": "11\/14\/2010", "Time": "10:10 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.117352, -88.054176 ], "Address": "11400 W SILVER SPRING DR", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 4, "g_clusterK10": 4, "m_clusterK10": 4 }, "geometry": { "type": "Point", "coordinates": [ -88.054176231894473, 43.117352391078434 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 278, "Incident Number": 103170111, "Date": "11\/13\/2010", "Time": "02:54 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.137621, -88.038576 ], "Address": "6626 N BOURBON ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 8, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.038575519822416, 43.137621286658515 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 279, "Incident Number": 103170173, "Date": "11\/13\/2010", "Time": "10:22 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.089780, -88.007555 ], "Address": "7603 W CAPITOL DR", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 2, "m_clusterK5": 0, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 6, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -88.007555082207986, 43.089779753376021 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 280, "Incident Number": 103140053, "Date": "11\/10\/2010", "Time": "10:06 AM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.140602, -88.041153 ], "Address": "10406 W FOND DU LAC AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 8, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.041152700357983, 43.140602260920808 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 281, "Incident Number": 103130148, "Date": "11\/09\/2010", "Time": "07:21 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.068031, -88.009392 ], "Address": "7718 W CENTER ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 1, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 0, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 6, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -88.009392221622704, 43.068030504327844 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 282, "Incident Number": 103110056, "Date": "11\/07\/2010", "Time": "10:37 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.092306, -88.042122 ], "Address": "4135 N 104TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 4, "g_clusterK10": 4, "m_clusterK10": 4 }, "geometry": { "type": "Point", "coordinates": [ -88.042121599255353, 43.092306 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 283, "Incident Number": 103110146, "Date": "11\/07\/2010", "Time": "09:02 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.096485, -88.041638 ], "Address": "4355 N 104TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 4, "g_clusterK10": 4, "m_clusterK10": 4 }, "geometry": { "type": "Point", "coordinates": [ -88.041638078423333, 43.096485451641279 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 284, "Incident Number": 103100152, "Date": "11\/06\/2010", "Time": "09:07 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.137351, -88.042521 ], "Address": "6606 N 105TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 8, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.042520951266823, 43.137351469905816 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 285, "Incident Number": 103090165, "Date": "11\/05\/2010", "Time": "10:15 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.119523, -88.039642 ], "Address": "10202 W SILVER SPRING DR", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 4, "g_clusterK10": 4, "m_clusterK10": 4 }, "geometry": { "type": "Point", "coordinates": [ -88.039641525535217, 43.119523461624581 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 286, "Incident Number": 103100025, "Date": "11\/05\/2010", "Time": "11:42 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.139832, -88.040291 ], "Address": "10311 W FOND DU LAC AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 8, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.04029136237591, 43.139831665387298 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 287, "Incident Number": 103060051, "Date": "11\/02\/2010", "Time": "10:35 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.097317, -88.022476 ], "Address": "4408 N 88TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 4, "g_clusterK10": 4, "m_clusterK10": 4 }, "geometry": { "type": "Point", "coordinates": [ -88.022475897426403, 43.097317407438396 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 288, "Incident Number": 103050053, "Date": "11\/01\/2010", "Time": "10:11 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.088090, -88.035017 ], "Address": "9844 W LISBON AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 5, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 5, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 4, "g_clusterK10": 4, "m_clusterK10": 4 }, "geometry": { "type": "Point", "coordinates": [ -88.03501737512083, 43.088090411592567 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 289, "Incident Number": 103340017, "Date": "11\/30\/2010", "Time": "02:09 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.084831, -87.935022 ], "Address": "1914 W NASH ST", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.935021580904845, 43.084831493219333 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 290, "Incident Number": 103340066, "Date": "11\/30\/2010", "Time": "11:11 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.086007, -87.938141 ], "Address": "2033 W VIENNA AV", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.938140919095162, 43.086007499567316 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 291, "Incident Number": 103340152, "Date": "11\/30\/2010", "Time": "07:09 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.075665, -87.918622 ], "Address": "3139 N 6TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 2, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.918621588146863, 43.075665167638078 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 292, "Incident Number": 103310075, "Date": "11\/27\/2010", "Time": "01:50 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.088364, -87.917162 ], "Address": "3900 N PORT WASHINGTON AV", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 1, "g_clusterK7": 0, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.917162335247468, 43.088364 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 293, "Incident Number": 103310128, "Date": "11\/27\/2010", "Time": "06:42 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.049296, -87.919250 ], "Address": "619 W KNEELAND ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 4, "e_clusterK6": 2, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 1, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 0, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 0, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.91924978265267, 43.049295980795478 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 294, "Incident Number": 103300005, "Date": "11\/26\/2010", "Time": "01:26 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.091433, -87.918398 ], "Address": "4095 N 6TH ST", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 0, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.918398164752531, 43.091433 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 295, "Incident Number": 103300007, "Date": "11\/26\/2010", "Time": "01:26 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.067846, -87.913977 ], "Address": "2712 N MARTIN L KING JR DR", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.913976652199935, 43.067846180768456 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 296, "Incident Number": 103300008, "Date": "11\/26\/2010", "Time": "01:09 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.063245, -87.917062 ], "Address": "2449 N 5TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.917061643112447, 43.063245167638058 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 297, "Incident Number": 103290004, "Date": "11\/25\/2010", "Time": "01:17 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.084322, -87.916026 ], "Address": "3716 N 5TH ST", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.916026386317924, 43.084321826533568 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 298, "Incident Number": 103290063, "Date": "11\/25\/2010", "Time": "05:43 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.073066, -87.918961 ], "Address": "616 W CHAMBERS ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.918960997085804, 43.073066460470763 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 299, "Incident Number": 103280074, "Date": "11\/24\/2010", "Time": "01:14 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.086133, -87.895154 ], "Address": "1237 E VIENNA AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.895154305845764, 43.086132546742618 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 300, "Incident Number": 103280079, "Date": "11\/24\/2010", "Time": "12:22 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.076773, -87.903989 ], "Address": "3205 N BOOTH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.903989080933499, 43.076773424923545 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 301, "Incident Number": 103280081, "Date": "11\/24\/2010", "Time": "01:48 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.072720, -87.910945 ], "Address": "2966 N 1ST ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.91094456116933, 43.072720376074784 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 302, "Incident Number": 103270080, "Date": "11\/23\/2010", "Time": "01:30 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.089191, -87.919933 ], "Address": "715 W CAPITOL DR", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 0, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.919932953785192, 43.089190815519132 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 303, "Incident Number": 103270137, "Date": "11\/23\/2010", "Time": "06:08 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.089123, -87.901290 ], "Address": "709 E CAPITOL DR", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.901290391972481, 43.089122501154783 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 304, "Incident Number": 103270203, "Date": "11\/23\/2010", "Time": "10:47 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.079720, -87.942215 ], "Address": "2400 W HOPKINS ST", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 2, "m_clusterK5": 4, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 2, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.942214570546113, 43.079720134914979 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 305, "Incident Number": 103260167, "Date": "11\/22\/2010", "Time": "08:17 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.104095, -87.913634 ], "Address": "306 W HAMPTON AV", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 0, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.9136335, 43.104095453257401 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 306, "Incident Number": 103250060, "Date": "11\/21\/2010", "Time": "10:01 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.080039, -87.909430 ], "Address": "3379 N PALMER ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.909429624213658, 43.080038968636387 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 307, "Incident Number": 103240096, "Date": "11\/20\/2010", "Time": "01:28 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.091710, -87.919525 ], "Address": "4102 N 7TH ST", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 0, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.919525086704567, 43.091710208436723 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 308, "Incident Number": 103240171, "Date": "11\/20\/2010", "Time": "11:15 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.071341, -87.928321 ], "Address": "1324 W LOCUST ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 4, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 2, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 5, "g_clusterK10": 0, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.928321332361932, 43.071341467684121 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 309, "Incident Number": 103230013, "Date": "11\/19\/2010", "Time": "05:23 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.087839, -87.898432 ], "Address": "3869 N HUMBOLDT BL", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.898431889433652, 43.087839361071147 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 310, "Incident Number": 103210036, "Date": "11\/17\/2010", "Time": "09:03 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.087104, -87.935633 ], "Address": "3850 N 19TH PL", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 3, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.935633404639773, 43.087104387731557 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 311, "Incident Number": 103200164, "Date": "11\/16\/2010", "Time": "04:34 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.087905, -87.900824 ], "Address": "3888 N FRATNEY ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.900824349674195, 43.087904580904848 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 312, "Incident Number": 103180042, "Date": "11\/14\/2010", "Time": "08:05 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.090559, -87.920813 ], "Address": "4050 N 8TH ST", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 0, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.920812893531277, 43.090558826533567 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 313, "Incident Number": 103180043, "Date": "11\/14\/2010", "Time": "08:58 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.078085, -87.903863 ], "Address": "3270 N BOOTH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.903862886317924, 43.078084575076474 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 314, "Incident Number": 103170105, "Date": "11\/13\/2010", "Time": "02:13 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.056472, -87.907690 ], "Address": "318 E BROWN ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.907689974464773, 43.056472493219339 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 315, "Incident Number": 103160089, "Date": "11\/12\/2010", "Time": "03:50 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.092363, -87.917074 ], "Address": "4160 N PORT WASHINGTON AV", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 0, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.917073928300951, 43.092362640573619 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 316, "Incident Number": 103160104, "Date": "11\/12\/2010", "Time": "05:14 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.065396, -87.919866 ], "Address": "2566 N 7TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.919865882422769, 43.065395580904834 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 317, "Incident Number": 103160181, "Date": "11\/12\/2010", "Time": "11:49 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.077220, -87.916610 ], "Address": "3240 N JULIA ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 2, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.916609510935615, 43.077220155433039 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 318, "Incident Number": 103150149, "Date": "11\/11\/2010", "Time": "04:50 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.066296, -87.907790 ], "Address": "2625 N RICHARDS ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.907789632003954, 43.066296167638058 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 319, "Incident Number": 103140045, "Date": "11\/10\/2010", "Time": "08:00 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.054832, -87.906103 ], "Address": "1858 N COMMERCE ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.90610335204012, 43.054832318858864 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 320, "Incident Number": 103140199, "Date": "11\/10\/2010", "Time": "11:46 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.085813, -87.897911 ], "Address": "1002 E VIENNA AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.897911018321849, 43.085812514859413 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 321, "Incident Number": 103130017, "Date": "11\/09\/2010", "Time": "02:25 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.049831, -87.922850 ], "Address": "849 W SOMERS ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 2, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.922850194856579, 43.049831132650738 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 322, "Incident Number": 103120021, "Date": "11\/08\/2010", "Time": "04:58 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.087176, -87.934413 ], "Address": "3854 N 19TH ST", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.934413386317914, 43.087175968636387 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 323, "Incident Number": 103120104, "Date": "11\/08\/2010", "Time": "02:24 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.079437, -87.923659 ], "Address": "3321 N 10TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 4, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 2, "g_clusterK9": 7, "m_clusterK9": 2, "e_clusterK10": 5, "g_clusterK10": 0, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.92365909925536, 43.079436922009364 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 324, "Incident Number": 103110153, "Date": "11\/07\/2010", "Time": "10:05 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.084730, -87.935024 ], "Address": "1925 W NASH ST", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.935023908867862, 43.08472991271028 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 325, "Incident Number": 103100083, "Date": "11\/06\/2010", "Time": "12:36 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.084088, -87.945783 ], "Address": "3618 N 26TH ST", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.945783371891196, 43.084088497085816 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 326, "Incident Number": 103100120, "Date": "11\/06\/2010", "Time": "05:53 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.076945, -87.940611 ], "Address": "2218 W AUER AV", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 2, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.940611, 43.07694548211083 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 327, "Incident Number": 103070036, "Date": "11\/03\/2010", "Time": "08:50 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.085157, -87.895101 ], "Address": "1201 E SINGER CR", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 0, "g_clusterK4": 0, "m_clusterK4": 0, "e_clusterK5": 3, "g_clusterK5": 3, "m_clusterK5": 3, "e_clusterK6": 2, "g_clusterK6": 2, "m_clusterK6": 2, "e_clusterK7": 1, "g_clusterK7": 1, "m_clusterK7": 1, "e_clusterK8": 0, "g_clusterK8": 0, "m_clusterK8": 0, "e_clusterK9": 3, "g_clusterK9": 3, "m_clusterK9": 3, "e_clusterK10": 0, "g_clusterK10": 0, "m_clusterK10": 0 }, "geometry": { "type": "Point", "coordinates": [ -87.895100801028846, 43.085156557667723 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 328, "Incident Number": 103070076, "Date": "11\/03\/2010", "Time": "12:44 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.075611, -87.937398 ], "Address": "3121 N 20TH ST", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 2, "m_clusterK10": 5 }, "geometry": { "type": "Point", "coordinates": [ -87.937398055398276, 43.075611115182653 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 329, "Incident Number": 103340046, "Date": "11\/30\/2010", "Time": "09:41 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.077691, -87.949719 ], "Address": "3229 N 29TH ST", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 2, "m_clusterK5": 4, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 2, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.949718599255348, 43.077690838190307 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 330, "Incident Number": 103340071, "Date": "11\/30\/2010", "Time": "11:48 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.093547, -87.969238 ], "Address": "4207 N 44TH PL", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.969237674223137, 43.09354723277692 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 331, "Incident Number": 103340087, "Date": "11\/30\/2010", "Time": "01:01 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.088872, -87.974851 ], "Address": "4906 W FOND DU LAC AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.974851391598023, 43.088871896214314 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 332, "Incident Number": 103330002, "Date": "11\/29\/2010", "Time": "12:17 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.084476, -87.960783 ], "Address": "3700 N 38TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 4, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.960783386317914, 43.084475580904837 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 333, "Incident Number": 103330024, "Date": "11\/29\/2010", "Time": "05:35 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.088841, -87.967258 ], "Address": "3945 N SHERMAN BL", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.967258106468719, 43.088840947544583 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 334, "Incident Number": 103320114, "Date": "11\/28\/2010", "Time": "04:37 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.077084, -87.949784 ], "Address": "2900 W AUER AV", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 2, "m_clusterK5": 4, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 3, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 2, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.949783730269601, 43.077084230269627 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 335, "Incident Number": 103320140, "Date": "11\/28\/2010", "Time": "07:07 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.100504, -87.975576 ], "Address": "4574 N 50TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -87.975575944601729, 43.100503742714523 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 336, "Incident Number": 103300037, "Date": "11\/26\/2010", "Time": "05:53 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.084467, -87.963131 ], "Address": "3703 N 40TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.963130632003953, 43.084467419095148 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 337, "Incident Number": 103280064, "Date": "11\/24\/2010", "Time": "12:12 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.079174, -87.962589 ], "Address": "3900 W CONCORDIA AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.962588639222915, 43.07917422723488 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 338, "Incident Number": 103270164, "Date": "11\/23\/2010", "Time": "08:14 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.077733, -87.965694 ], "Address": "4200 W BONNY PL", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.965694, 43.077732525967903 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 339, "Incident Number": 103260026, "Date": "11\/22\/2010", "Time": "07:34 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.087322, -87.972854 ], "Address": "4732 W FOND DU LAC AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.972854176784665, 43.087321801286812 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 340, "Incident Number": 103260028, "Date": "11\/22\/2010", "Time": "07:45 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.076358, -87.966642 ], "Address": "3152 N 42ND PL", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.966642386317915, 43.076357664723872 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 341, "Incident Number": 103260111, "Date": "11\/22\/2010", "Time": "03:46 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.097533, -87.959274 ], "Address": "4414 N 37TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 5, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.959274042847483, 43.097533459893839 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 342, "Incident Number": 103260193, "Date": "11\/22\/2010", "Time": "10:21 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.099038, -87.983022 ], "Address": "4485 N 56TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 3, "g_clusterK4": 1, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -87.983021606468725, 43.099038199001683 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 343, "Incident Number": 103250008, "Date": "11\/21\/2010", "Time": "12:57 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.079697, -87.974705 ], "Address": "3322 N 49TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.974704871891191, 43.079696664723883 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 344, "Incident Number": 103250147, "Date": "11\/21\/2010", "Time": "08:37 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.093710, -87.970146 ], "Address": "4210 N 45TH PL", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.970146350251099, 43.09371 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 345, "Incident Number": 103250148, "Date": "11\/21\/2010", "Time": "08:42 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.086997, -87.947071 ], "Address": "3835 N 27TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.947070566506781, 43.086997089647411 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 346, "Incident Number": 103240173, "Date": "11\/20\/2010", "Time": "11:33 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.076929, -87.959440 ], "Address": "3626 W FOND DU LAC AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 4, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.959440458480188, 43.076929451583958 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 347, "Incident Number": 103230010, "Date": "11\/19\/2010", "Time": "04:03 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.084762, -87.948354 ], "Address": "2800 W HOPKINS ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.948354166900941, 43.084762191072357 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 348, "Incident Number": 103230163, "Date": "11\/19\/2010", "Time": "09:29 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.071345, -87.973651 ], "Address": "2873 N 48TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.97365057372015, 43.07134503136362 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 349, "Incident Number": 103220113, "Date": "11\/18\/2010", "Time": "05:34 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.085583, -87.958362 ], "Address": "3756 N 36TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 5, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 5, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 3, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.958362386317916, 43.085582832361951 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 350, "Incident Number": 103210009, "Date": "11\/17\/2010", "Time": "12:36 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.080436, -87.962252 ], "Address": "3361 N 39TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.9622516392173, 43.080435838190311 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 351, "Incident Number": 103210055, "Date": "11\/17\/2010", "Time": "11:45 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.074072, -87.948505 ], "Address": "3028 N 28TH ST", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 0, "m_clusterK7": 2, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 6, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.948504919066494, 43.074071832361938 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 352, "Incident Number": 103200048, "Date": "11\/16\/2010", "Time": "09:21 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.081619, -87.965472 ], "Address": "4200 W FOND DU LAC AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.965472146031914, 43.08161943310791 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 353, "Incident Number": 103180168, "Date": "11\/14\/2010", "Time": "09:00 PM", "Police District": 5.0, "Offense 1": "BURGLARY\/BREAKING AND ENTERING", "Offense 2": "MOTOR VEHICLE THEFT", "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.071776, -87.948546 ], "Address": "2904 N 28TH ST", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 7, "g_clusterK9": 2, "m_clusterK9": 4, "e_clusterK10": 7, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.948546393531274, 43.071776245628712 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 354, "Incident Number": 103170048, "Date": "11\/13\/2010", "Time": "09:07 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.085042, -87.959583 ], "Address": "3728 N 37TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 0, "m_clusterK7": 5, "e_clusterK8": 4, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 7, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.959582860782689, 43.085042329447759 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 355, "Incident Number": 103170050, "Date": "11\/13\/2010", "Time": "08:34 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.070868, -87.969874 ], "Address": "2850 N 45TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.969874360782697, 43.070867664723863 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 356, "Incident Number": 103170063, "Date": "11\/13\/2010", "Time": "10:24 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.069428, -87.965771 ], "Address": "2771 N GRANT BL", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.96577059593713, 43.06942816763808 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 357, "Incident Number": 103170086, "Date": "11\/13\/2010", "Time": "12:43 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.094583, -87.962918 ], "Address": "4251 N 40TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 1, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.962918073720147, 43.094583115182644 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 358, "Incident Number": 103160027, "Date": "11\/12\/2010", "Time": "08:47 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.087321, -87.963012 ], "Address": "3927 W ROOSEVELT DR", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 4, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.963012347192688, 43.087320661925247 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 359, "Incident Number": 103160168, "Date": "11\/12\/2010", "Time": "10:27 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.073911, -87.949802 ], "Address": "3023 N 29TH ST", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 0, "m_clusterK7": 2, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 6, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.949801632003954, 43.073910754371298 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 360, "Incident Number": 103150100, "Date": "11\/11\/2010", "Time": "03:54 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.072075, -87.969928 ], "Address": "2925 N 45TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.969927602573591, 43.072074586733237 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 361, "Incident Number": 103150146, "Date": "11\/11\/2010", "Time": "08:34 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.072605, -87.972285 ], "Address": "2944 N 47TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 6, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.972285386317921, 43.072604832361947 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 362, "Incident Number": 103140034, "Date": "11\/10\/2010", "Time": "08:15 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.077067, -87.946061 ], "Address": "2600 W AUER AV", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 2, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.946061114191565, 43.077067317454194 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 363, "Incident Number": 103140096, "Date": "11\/10\/2010", "Time": "01:46 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.087407, -87.968392 ], "Address": "3878 N 44TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.968392218885612, 43.087407216159576 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 364, "Incident Number": 103140108, "Date": "11\/10\/2010", "Time": "02:36 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.069696, -87.942780 ], "Address": "2410 W HADLEY ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 2, "m_clusterK7": 2, "e_clusterK8": 6, "g_clusterK8": 6, "m_clusterK8": 6, "e_clusterK9": 2, "g_clusterK9": 2, "m_clusterK9": 7, "e_clusterK10": 7, "g_clusterK10": 2, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.942779832361936, 43.06969552596793 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 365, "Incident Number": 103130011, "Date": "11\/09\/2010", "Time": "01:31 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.075187, -87.950583 ], "Address": "2925 W BURLEIGH ST", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 4, "m_clusterK5": 4, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 3, "e_clusterK7": 2, "g_clusterK7": 0, "m_clusterK7": 2, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 6, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.950583167638058, 43.07518746681874 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 366, "Incident Number": 103130114, "Date": "11\/09\/2010", "Time": "04:38 PM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.078447, -87.948501 ], "Address": "3265 N 28TH ST", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 2, "m_clusterK5": 4, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 2, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.948501132003955, 43.078447005828394 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 367, "Incident Number": 103120042, "Date": "11\/08\/2010", "Time": "09:06 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.095339, -87.960830 ], "Address": "3826 W MARION ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 0, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.960830104565048, 43.095338911302065 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 368, "Incident Number": 103120140, "Date": "11\/08\/2010", "Time": "05:21 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.098166, -87.970668 ], "Address": "4443 N 46TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.970668132003951, 43.098166089647407 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 369, "Incident Number": 103110022, "Date": "11\/07\/2010", "Time": "03:52 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.078024, -87.970946 ], "Address": "3244 N 46TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.970946419066493, 43.078023639188643 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 370, "Incident Number": 103100057, "Date": "11\/06\/2010", "Time": "09:54 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.085286, -87.978336 ], "Address": "3740 N 52ND ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.97833585356932, 43.08528566472387 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 371, "Incident Number": 103100173, "Date": "11\/06\/2010", "Time": "11:18 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.075962, -87.966642 ], "Address": "3134 N 42ND PL", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 6 }, "geometry": { "type": "Point", "coordinates": [ -87.966642386317915, 43.075961664723877 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 372, "Incident Number": 103080017, "Date": "11\/04\/2010", "Time": "05:01 AM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.085106, -87.960851 ], "Address": "3735 N 38TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 4, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 2, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.960850624790581, 43.085106419095155 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 373, "Incident Number": 103080117, "Date": "11\/04\/2010", "Time": "06:08 PM", "Police District": 7.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.105366, -87.983861 ], "Address": "4825 N 57TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 2, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 5, "g_clusterK6": 5, "m_clusterK6": 5, "e_clusterK7": 5, "g_clusterK7": 5, "m_clusterK7": 5, "e_clusterK8": 3, "g_clusterK8": 3, "m_clusterK8": 3, "e_clusterK9": 1, "g_clusterK9": 1, "m_clusterK9": 1, "e_clusterK10": 3, "g_clusterK10": 3, "m_clusterK10": 3 }, "geometry": { "type": "Point", "coordinates": [ -87.983861157539181, 43.105365502914196 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 374, "Incident Number": 103060013, "Date": "11\/02\/2010", "Time": "01:49 AM", "Police District": 5.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.080346, -87.949669 ], "Address": "3355 N 29TH ST", "e_clusterK2": 0, "g_clusterK2": 1, "m_clusterK2": 0, "e_clusterK3": 1, "g_clusterK3": 1, "m_clusterK3": 1, "e_clusterK4": 3, "g_clusterK4": 3, "m_clusterK4": 3, "e_clusterK5": 4, "g_clusterK5": 2, "m_clusterK5": 2, "e_clusterK6": 4, "g_clusterK6": 4, "m_clusterK6": 4, "e_clusterK7": 0, "g_clusterK7": 0, "m_clusterK7": 2, "e_clusterK8": 4, "g_clusterK8": 4, "m_clusterK8": 4, "e_clusterK9": 7, "g_clusterK9": 7, "m_clusterK9": 7, "e_clusterK10": 5, "g_clusterK10": 2, "m_clusterK10": 2 }, "geometry": { "type": "Point", "coordinates": [ -87.94966909925536, 43.080345502914184 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 375, "Incident Number": 103340117, "Date": "11\/30\/2010", "Time": "03:49 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.022612, -87.942286 ], "Address": "2300 W NATIONAL AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.942286063909251, 43.022611857518335 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 376, "Incident Number": 103330063, "Date": "11\/29\/2010", "Time": "09:42 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.018778, -87.953826 ], "Address": "1212 S 32ND ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 4, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.953825568343461, 43.018778199600071 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 377, "Incident Number": 103330195, "Date": "11\/29\/2010", "Time": "08:55 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.009324, -87.943798 ], "Address": "2400 W LEGION ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.943797596654164, 43.009324166362994 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 378, "Incident Number": 103330209, "Date": "11\/29\/2010", "Time": "10:38 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.019105, -87.947953 ], "Address": "2700 W SCOTT ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.947953306726035, 43.019104974175271 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 379, "Incident Number": 103320095, "Date": "11\/28\/2010", "Time": "02:17 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.018127, -87.942175 ], "Address": "1238 S 23RD ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.942175451815075, 43.018126857897158 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 380, "Incident Number": 103320142, "Date": "11\/28\/2010", "Time": "07:12 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.006266, -87.949300 ], "Address": "2119 S 28TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.949300099255353, 43.006266167638074 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 381, "Incident Number": 103310130, "Date": "11\/27\/2010", "Time": "08:07 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.005600, -87.946558 ], "Address": "2151 S 26TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.946558084828638, 43.005599612268441 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 382, "Incident Number": 103300003, "Date": "11\/26\/2010", "Time": "12:26 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.019676, -87.942156 ], "Address": "1100 S 23RD ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.942155651712582, 43.019675504443128 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 383, "Incident Number": 103300079, "Date": "11\/26\/2010", "Time": "12:45 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.016848, -87.961361 ], "Address": "3735 W GREENFIELD AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.96136058381903, 43.016848492353951 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 384, "Incident Number": 103290034, "Date": "11\/25\/2010", "Time": "11:07 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.017890, -87.946305 ], "Address": "1310 S 26TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.946304651697048, 43.017890372033662 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 385, "Incident Number": 103280071, "Date": "11\/22\/2010", "Time": "06:30 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.016201, -87.942203 ], "Address": "1434 S 23RD ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.942202948496856, 43.016201329447739 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 386, "Incident Number": 103250133, "Date": "11\/21\/2010", "Time": "07:35 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.008228, -87.948071 ], "Address": "2009 S LAYTON BL", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.948071102573593, 43.008228335276129 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 387, "Incident Number": 103250155, "Date": "11\/21\/2010", "Time": "09:49 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.022574, -87.953834 ], "Address": "804 S 32ND ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 0, "m_clusterK6": 3, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 4, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.953833893531268, 43.022574167638055 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 388, "Incident Number": 103210027, "Date": "11\/17\/2010", "Time": "06:55 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.014529, -87.957639 ], "Address": "1565 S 35TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.957639055398275, 43.01452883819033 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 389, "Incident Number": 103210107, "Date": "11\/17\/2010", "Time": "04:56 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.022772, -87.953835 ], "Address": "736 S 32ND ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 0, "m_clusterK6": 3, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 4, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.953834951815082, 43.022772167638067 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 390, "Incident Number": 103190021, "Date": "11\/15\/2010", "Time": "07:41 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 42.999038, -87.950492 ], "Address": "2516 S 29TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.950492404639775, 42.999037774078147 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 391, "Incident Number": 103170038, "Date": "11\/13\/2010", "Time": "07:03 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.012525, -87.954083 ], "Address": "3200 W MITCHELL ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.954082766236311, 43.012525465564487 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 392, "Incident Number": 103170133, "Date": "11\/13\/2010", "Time": "05:35 PM", "Police District": 1.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.010416, -87.939934 ], "Address": "1829 S MUSKEGO AV", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.939934085925159, 43.010416496826011 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 393, "Incident Number": 103160115, "Date": "11\/12\/2010", "Time": "06:04 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.010199, -87.956898 ], "Address": "3435 W BURNHAM ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.956897643419893, 43.010198943606028 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 394, "Incident Number": 103150029, "Date": "11\/11\/2010", "Time": "09:00 AM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.019567, -87.943542 ], "Address": "1118 S 24TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.943542393531274, 43.019566690259097 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 395, "Incident Number": 103150049, "Date": "11\/11\/2010", "Time": "09:26 AM", "Police District": 3.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.031358, -87.935133 ], "Address": "1721 W CANAL ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 4, "m_clusterK5": 1, "e_clusterK6": 3, "g_clusterK6": 3, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 4, "g_clusterK9": 4, "m_clusterK9": 2, "e_clusterK10": 7, "g_clusterK10": 7, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.935133444457492, 43.031358468406182 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 396, "Incident Number": 103120161, "Date": "11\/08\/2010", "Time": "06:01 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.016020, -87.941394 ], "Address": "2212 W ORCHARD ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 1, "e_clusterK6": 0, "g_clusterK6": 0, "m_clusterK6": 0, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 1 }, "geometry": { "type": "Point", "coordinates": [ -87.941394, 43.016020478792619 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 397, "Incident Number": 103060071, "Date": "11\/02\/2010", "Time": "12:16 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.022617, -87.951409 ], "Address": "836 S 30TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 0, "m_clusterK6": 3, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.951408991679315, 43.022617428225821 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 398, "Incident Number": 103060110, "Date": "11\/02\/2010", "Time": "04:56 PM", "Police District": 2.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.023105, -87.950226 ], "Address": "738-A S 29TH ST", "e_clusterK2": 0, "g_clusterK2": 0, "m_clusterK2": 0, "e_clusterK3": 0, "g_clusterK3": 0, "m_clusterK3": 0, "e_clusterK4": 2, "g_clusterK4": 2, "m_clusterK4": 2, "e_clusterK5": 1, "g_clusterK5": 1, "m_clusterK5": 4, "e_clusterK6": 3, "g_clusterK6": 0, "m_clusterK6": 3, "e_clusterK7": 3, "g_clusterK7": 3, "m_clusterK7": 3, "e_clusterK8": 1, "g_clusterK8": 1, "m_clusterK8": 1, "e_clusterK9": 5, "g_clusterK9": 5, "m_clusterK9": 5, "e_clusterK10": 1, "g_clusterK10": 1, "m_clusterK10": 7 }, "geometry": { "type": "Point", "coordinates": [ -87.950226386317922, 43.023104664723888 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 399, "Incident Number": 103330064, "Date": "11\/29\/2010", "Time": "11:38 AM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.136304, -88.014707 ], "Address": "6513 N 83RD ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 8, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.014707117432991, 43.136304098245759 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 400, "Incident Number": 103320034, "Date": "11\/28\/2010", "Time": "06:03 AM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.136209, -87.982039 ], "Address": "6515 N 56TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 5, "g_clusterK8": 5, "m_clusterK8": 5, "e_clusterK9": 6, "g_clusterK9": 6, "m_clusterK9": 6, "e_clusterK10": 9, "g_clusterK10": 9, "m_clusterK10": 9 }, "geometry": { "type": "Point", "coordinates": [ -87.982038676437952, 43.136208754371296 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 401, "Incident Number": 103310113, "Date": "11\/27\/2010", "Time": "05:33 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.134270, -88.018511 ], "Address": "8534 W MILL RD", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 8, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.018510583819022, 43.134269508222985 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 402, "Incident Number": 103300083, "Date": "11\/26\/2010", "Time": "12:52 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.136940, -88.005562 ], "Address": "6550 N 76TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 5, "g_clusterK8": 5, "m_clusterK8": 5, "e_clusterK9": 6, "g_clusterK9": 6, "m_clusterK9": 6, "e_clusterK10": 8, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.005562376219956, 43.13694042576028 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 403, "Incident Number": 103290044, "Date": "11\/25\/2010", "Time": "12:28 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.134261, -88.021112 ], "Address": "8750 W MILL RD", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 8, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.02111239064574, 43.13426050822298 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 404, "Incident Number": 103280131, "Date": "11\/24\/2010", "Time": "07:00 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.177620, -87.995689 ], "Address": "6841 W BROWN DEER RD", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 5, "g_clusterK8": 5, "m_clusterK8": 5, "e_clusterK9": 6, "g_clusterK9": 6, "m_clusterK9": 6, "e_clusterK10": 9, "g_clusterK10": 9, "m_clusterK10": 9 }, "geometry": { "type": "Point", "coordinates": [ -87.995688834123513, 43.177620146505738 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 405, "Incident Number": 103270032, "Date": "11\/23\/2010", "Time": "06:46 AM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.138585, -87.980762 ], "Address": "6643 N 55TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 5, "g_clusterK8": 5, "m_clusterK8": 5, "e_clusterK9": 6, "g_clusterK9": 6, "m_clusterK9": 6, "e_clusterK10": 9, "g_clusterK10": 9, "m_clusterK10": 9 }, "geometry": { "type": "Point", "coordinates": [ -87.980761632003947, 43.138584838190326 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 406, "Incident Number": 103270097, "Date": "11\/23\/2010", "Time": "03:28 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.142318, -88.006914 ], "Address": "7713 W BEECHWOOD AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 5, "g_clusterK8": 5, "m_clusterK8": 5, "e_clusterK9": 6, "g_clusterK9": 6, "m_clusterK9": 6, "e_clusterK10": 8, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.006913916180963, 43.142317513994044 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 407, "Incident Number": 103250105, "Date": "11\/21\/2010", "Time": "04:17 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.187295, -88.002731 ], "Address": "9217 N 75TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 5, "g_clusterK8": 5, "m_clusterK8": 5, "e_clusterK9": 6, "g_clusterK9": 6, "m_clusterK9": 6, "e_clusterK10": 9, "g_clusterK10": 9, "m_clusterK10": 9 }, "geometry": { "type": "Point", "coordinates": [ -88.00273116694683, 43.187294836764423 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 408, "Incident Number": 103210066, "Date": "11\/17\/2010", "Time": "12:49 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.184292, -88.002890 ], "Address": "9099 N 75TH ST", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 5, "g_clusterK8": 5, "m_clusterK8": 5, "e_clusterK9": 6, "g_clusterK9": 6, "m_clusterK9": 6, "e_clusterK10": 9, "g_clusterK10": 9, "m_clusterK10": 9 }, "geometry": { "type": "Point", "coordinates": [ -88.002889846630268, 43.184291653369741 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 409, "Incident Number": 103210176, "Date": "11\/17\/2010", "Time": "08:06 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.177231, -88.057391 ], "Address": "11800 W BROWN DEER RD", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 5, "g_clusterK8": 5, "m_clusterK8": 5, "e_clusterK9": 8, "g_clusterK9": 6, "m_clusterK9": 6, "e_clusterK10": 8, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.057391090224328, 43.177230511250862 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 410, "Incident Number": 103200127, "Date": "11\/16\/2010", "Time": "06:12 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.141488, -88.010511 ], "Address": "8000 W GREEN TREE RD", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 5, "g_clusterK8": 5, "m_clusterK8": 5, "e_clusterK9": 6, "g_clusterK9": 6, "m_clusterK9": 6, "e_clusterK10": 8, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.010511312333279, 43.14148831233328 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 411, "Incident Number": 103200159, "Date": "11\/16\/2010", "Time": "08:42 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.177582, -88.026562 ], "Address": "9301 W BROWN DEER RD", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 5, "g_clusterK8": 5, "m_clusterK8": 5, "e_clusterK9": 6, "g_clusterK9": 6, "m_clusterK9": 6, "e_clusterK10": 8, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.026561974464769, 43.177581527843849 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 412, "Incident Number": 103160175, "Date": "11\/12\/2010", "Time": "10:57 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.148877, -88.001995 ], "Address": "7300 W GOOD HOPE RD", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 5, "g_clusterK8": 5, "m_clusterK8": 5, "e_clusterK9": 6, "g_clusterK9": 6, "m_clusterK9": 6, "e_clusterK10": 9, "g_clusterK10": 9, "m_clusterK10": 9 }, "geometry": { "type": "Point", "coordinates": [ -88.001994814936054, 43.148877321765724 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 413, "Incident Number": 103120177, "Date": "11\/08\/2010", "Time": "08:14 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.148725, -87.985549 ], "Address": "6000 W GOOD HOPE RD", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 5, "g_clusterK8": 5, "m_clusterK8": 5, "e_clusterK9": 6, "g_clusterK9": 6, "m_clusterK9": 6, "e_clusterK10": 9, "g_clusterK10": 9, "m_clusterK10": 9 }, "geometry": { "type": "Point", "coordinates": [ -87.985549375496419, 43.148724762966474 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 414, "Incident Number": 103110069, "Date": "11\/07\/2010", "Time": "11:26 AM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.134261, -88.023700 ], "Address": "8924 W MILL RD", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 7, "g_clusterK8": 7, "m_clusterK8": 7, "e_clusterK9": 8, "g_clusterK9": 8, "m_clusterK9": 8, "e_clusterK10": 8, "g_clusterK10": 8, "m_clusterK10": 8 }, "geometry": { "type": "Point", "coordinates": [ -88.023700393559935, 43.134261482687748 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 415, "Incident Number": 103090027, "Date": "11\/05\/2010", "Time": "03:25 AM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.134127, -87.990859 ], "Address": "6400 W MILL RD", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 0, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 5, "g_clusterK8": 5, "m_clusterK8": 5, "e_clusterK9": 6, "g_clusterK9": 6, "m_clusterK9": 6, "e_clusterK10": 9, "g_clusterK10": 9, "m_clusterK10": 9 }, "geometry": { "type": "Point", "coordinates": [ -87.99085880768402, 43.134127275217885 ] } }, { "type": "Feature", "properties": { "Unnamed: 0": 416, "Incident Number": 103090135, "Date": "11\/05\/2010", "Time": "06:20 PM", "Police District": 4.0, "Offense 1": "MOTOR VEHICLE THEFT", "Offense 2": null, "Offense 3": null, "Offense 4": null, "Offense 5": null, "Location": [ 43.126571, -87.981450 ], "Address": "5515 W FLORIST AV", "e_clusterK2": 1, "g_clusterK2": 1, "m_clusterK2": 1, "e_clusterK3": 2, "g_clusterK3": 2, "m_clusterK3": 2, "e_clusterK4": 1, "g_clusterK4": 1, "m_clusterK4": 1, "e_clusterK5": 2, "g_clusterK5": 0, "m_clusterK5": 0, "e_clusterK6": 1, "g_clusterK6": 1, "m_clusterK6": 1, "e_clusterK7": 6, "g_clusterK7": 6, "m_clusterK7": 6, "e_clusterK8": 5, "g_clusterK8": 5, "m_clusterK8": 5, "e_clusterK9": 6, "g_clusterK9": 6, "m_clusterK9": 6, "e_clusterK10": 9, "g_clusterK10": 9, "m_clusterK10": 9 }, "geometry": { "type": "Point", "coordinates": [ -87.981450076605668, 43.126570542847475 ] } } ] }
const React = require('react') const { shell } = require('electron') const ModalOKCancel = require('./modal-ok-cancel') const { dispatch } = require('../lib/dispatcher') module.exports = class UpdateAvailableModal extends React.Component { render () { const state = this.props.state return ( <div className='update-available-modal'> <p><strong>A new version of WebTorrent is available: v{state.modal.version}</strong></p> <p> We have an auto-updater for Windows and Mac. We don't have one for Linux yet, so you'll have to download the new version manually. </p> <ModalOKCancel cancelText='SKIP THIS RELEASE' onCancel={handleSkip} okText='SHOW DOWNLOAD PAGE' onOK={handleShow} /> </div> ) function handleShow () { // TODO: use the GitHub urls from config.js shell.openExternal('https://github.com/webtorrent/webtorrent-desktop/releases') dispatch('exitModal') } function handleSkip () { dispatch('skipVersion', state.modal.version) dispatch('exitModal') } } }
'use strict' /** * OAuth 2.0 Authentication Protocol * * OAuth 2.0 is the successor to OAuth 1.0, and is designed to overcome * perceived shortcomings in the earlier version. The authentication flow is * essentially the same. The user is first redirected to the service provider * to authorize access. After authorization has been granted, the user is * redirected back to the application with a code that can be exchanged for an * access token. The application requesting access, known as a client, is iden- * tified by an ID and secret. * * For more information on OAuth in Passport.js, check out: * http://passportjs.org/guide/oauth/ * * @param {Object} req * @param {string} accessToken * @param {string} refreshToken * @param {Object} profile * @param {Function} next */ module.exports = module.exports = (app) => { const passport = app.services.PassportService.passport return (req, accessToken, refreshToken, profile, next) => { const query = { identifier: profile.id, protocol: 'oauth2', tokens: {accessToken: accessToken} } if (refreshToken !== undefined) { query.tokens.refreshToken = refreshToken } passport.connect(req, query, profile, next) } }
/** * @license * lodash 4.0.0 <https://lodash.com/> * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ ;(function() { /** Used as a safe reference for `undefined` in pre-ES5 environments. */ var undefined; /** Used as the semantic version number. */ var VERSION = '4.0.0'; /** Used to compose bitmasks for wrapper metadata. */ var BIND_FLAG = 1, BIND_KEY_FLAG = 2, CURRY_BOUND_FLAG = 4, CURRY_FLAG = 8, CURRY_RIGHT_FLAG = 16, PARTIAL_FLAG = 32, PARTIAL_RIGHT_FLAG = 64, ARY_FLAG = 128, REARG_FLAG = 256, FLIP_FLAG = 512; /** Used to compose bitmasks for comparison styles. */ var UNORDERED_COMPARE_FLAG = 1, PARTIAL_COMPARE_FLAG = 2; /** Used as default options for `_.truncate`. */ var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = '...'; /** Used to detect hot functions by number of calls within a span of milliseconds. */ var HOT_COUNT = 150, HOT_SPAN = 16; /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; /** Used to indicate the type of lazy iteratees. */ var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3; /** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 1.7976931348623157e+308, NAN = 0 / 0; /** Used as references for the maximum length and index of an array. */ var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; /** Used as the internal argument placeholder. */ var PLACEHOLDER = '__lodash_placeholder__'; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', arrayTag = '[object Array]', boolTag = '[object Boolean]', dateTag = '[object Date]', errorTag = '[object Error]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', mapTag = '[object Map]', numberTag = '[object Number]', objectTag = '[object Object]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', symbolTag = '[object Symbol]', weakMapTag = '[object WeakMap]'; var arrayBufferTag = '[object ArrayBuffer]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', int16Tag = '[object Int16Array]', int32Tag = '[object Int32Array]', uint8Tag = '[object Uint8Array]', uint8ClampedTag = '[object Uint8ClampedArray]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]'; /** Used to match empty string literals in compiled template source. */ var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; /** Used to match HTML entities and HTML characters. */ var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g, reUnescapedHtml = /[&<>"'`]/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source); /** Used to match template delimiters. */ var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g; /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; /** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source); /** Used to match leading and trailing whitespace. */ var reTrim = /^\s+|\s+$/g, reTrimStart = /^\s+/, reTrimEnd = /\s+$/; /** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; /** Used to match [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). */ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; /** Used to match `RegExp` flags from their coerced string values. */ var reFlags = /\w*$/; /** Used to detect hexadecimal string values. */ var reHasHexPrefix = /^0x/i; /** Used to detect bad signed hexadecimal string values. */ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; /** Used to detect binary string values. */ var reIsBinary = /^0b[01]+$/i; /** Used to detect host constructors (Safari > 5). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Used to detect octal string values. */ var reIsOctal = /^0o[0-7]+$/i; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; /** Used to match latin-1 supplementary letters (excluding mathematical operators). */ var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g; /** Used to ensure capturing order of template delimiters. */ var reNoMatch = /($^)/; /** Used to match unescaped characters in compiled string literals. */ var reUnescapedString = /['\n\r\u2028\u2029\\]/g; /** Used to compose unicode character classes. */ var rsAstralRange = '\\ud800-\\udfff', rsComboRange = '\\u0300-\\u036f\\ufe20-\\ufe23', rsDingbatRange = '\\u2700-\\u27bf', rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', rsQuoteRange = '\\u2018\\u2019\\u201c\\u201d', rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', rsVarRange = '\\ufe0e\\ufe0f', rsBreakRange = rsMathOpRange + rsNonCharRange + rsQuoteRange + rsSpaceRange; /** Used to compose unicode capture groups. */ var rsAstral = '[' + rsAstralRange + ']', rsBreak = '[' + rsBreakRange + ']', rsCombo = '[' + rsComboRange + ']', rsDigits = '\\d+', rsDingbat = '[' + rsDingbatRange + ']', rsLower = '[' + rsLowerRange + ']', rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', rsModifier = '(?:\\ud83c[\\udffb-\\udfff])', rsNonAstral = '[^' + rsAstralRange + ']', rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', rsUpper = '[' + rsUpperRange + ']', rsZWJ = '\\u200d'; /** Used to compose unicode regexes. */ var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')', rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')', reOptMod = rsModifier + '?', rsOptVar = '[' + rsVarRange + ']?', rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; /** Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). */ var reComboMark = RegExp(rsCombo, 'g'); /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ var reComplexSymbol = RegExp(rsSymbol + rsSeq, 'g'); /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); /** Used to match non-compound words composed of alphanumeric characters. */ var reBasicWord = /[a-zA-Z0-9]+/g; /** Used to match complex or compound words. */ var reComplexWord = RegExp([ rsUpper + '?' + rsLower + '+(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', rsUpperMisc + '+(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')', rsUpper + '?' + rsLowerMisc + '+', rsDigits + '(?:' + rsLowerMisc + '+)?', rsEmoji ].join('|'), 'g'); /** Used to detect strings that need a more robust regexp to match words. */ var reHasComplexWord = /[a-z][A-Z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; /** Used to assign default `context` object properties. */ var contextProps = [ 'Array', 'Date', 'Error', 'Float32Array', 'Float64Array', 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' ]; /** Used to make template sourceURLs easier to identify. */ var templateCounter = -1; /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false; /** Used to map latin-1 supplementary letters to basic latin letters. */ var deburredLetters = { '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', '\xc7': 'C', '\xe7': 'c', '\xd0': 'D', '\xf0': 'd', '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', '\xcC': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', '\xeC': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', '\xd1': 'N', '\xf1': 'n', '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', '\xc6': 'Ae', '\xe6': 'ae', '\xde': 'Th', '\xfe': 'th', '\xdf': 'ss' }; /** Used to map characters to HTML entities. */ var htmlEscapes = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;', '`': '&#96;' }; /** Used to map HTML entities to characters. */ var htmlUnescapes = { '&amp;': '&', '&lt;': '<', '&gt;': '>', '&quot;': '"', '&#39;': "'", '&#96;': '`' }; /** Used to determine if values are of the language type `Object`. */ var objectTypes = { 'function': true, 'object': true }; /** Used to escape characters for inclusion in compiled string literals. */ var stringEscapes = { '\\': '\\', "'": "'", '\n': 'n', '\r': 'r', '\u2028': 'u2028', '\u2029': 'u2029' }; /** Built-in method references without a dependency on `root`. */ var freeParseFloat = parseFloat, freeParseInt = parseInt; /** Detect free variable `exports`. */ var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null; /** Detect free variable `module`. */ var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null; /** Detect free variable `global` from Node.js. */ var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); /** Detect free variable `self`. */ var freeSelf = checkGlobal(objectTypes[typeof self] && self); /** Detect free variable `window`. */ var freeWindow = checkGlobal(objectTypes[typeof window] && window); /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = (freeModule && freeModule.exports === freeExports) ? freeExports : null; /** Detect `this` as the global object. */ var thisGlobal = checkGlobal(objectTypes[typeof this] && this); /** * Used as a reference to the global object. * * The `this` value is used if it's the global object to avoid Greasemonkey's * restricted `window` object, otherwise the `window` object is used. */ var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); /*--------------------------------------------------------------------------*/ /** * Adds the key-value `pair` to `map`. * * @private * @param {Object} map The map to modify. * @param {Array} pair The key-value pair to add. * @returns {Object} Returns `map`. */ function addMapEntry(map, pair) { map.set(pair[0], pair[1]); return map; } /** * Adds `value` to `set`. * * @private * @param {Object} set The set to modify. * @param {*} value The value to add. * @returns {Object} Returns `set`. */ function addSetEntry(set, value) { set.add(value); return set; } /** * A faster alternative to `Function#apply`, this function invokes `func` * with the `this` binding of `thisArg` and the arguments of `args`. * * @private * @param {Function} func The function to invoke. * @param {*} thisArg The `this` binding of `func`. * @param {...*} [args] The arguments to invoke `func` with. * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, args) { var length = args ? args.length : 0; switch (length) { case 0: return func.call(thisArg); case 1: return func.call(thisArg, args[0]); case 2: return func.call(thisArg, args[0], args[1]); case 3: return func.call(thisArg, args[0], args[1], args[2]); } return func.apply(thisArg, args); } /** * Creates a new array concatenating `array` with `other`. * * @private * @param {Array} array The first array to concatenate. * @param {Array} other The second array to concatenate. * @returns {Array} Returns the new concatenated array. */ function arrayConcat(array, other) { var index = -1, length = array.length, othIndex = -1, othLength = other.length, result = Array(length + othLength); while (++index < length) { result[index] = array[index]; } while (++othIndex < othLength) { result[index++] = other[othIndex]; } return result; } /** * A specialized version of `_.forEach` for arrays without support for * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEach(array, iteratee) { var index = -1, length = array.length; while (++index < length) { if (iteratee(array[index], index, array) === false) { break; } } return array; } /** * A specialized version of `_.forEachRight` for arrays without support for * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEachRight(array, iteratee) { var length = array.length; while (length--) { if (iteratee(array[length], length, array) === false) { break; } } return array; } /** * A specialized version of `_.every` for arrays without support for * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`. */ function arrayEvery(array, predicate) { var index = -1, length = array.length; while (++index < length) { if (!predicate(array[index], index, array)) { return false; } } return true; } /** * A specialized version of `_.filter` for arrays without support for * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function arrayFilter(array, predicate) { var index = -1, length = array.length, resIndex = -1, result = []; while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result[++resIndex] = value; } } return result; } /** * A specialized version of `_.includes` for arrays without support for * specifying an index to search from. * * @private * @param {Array} array The array to search. * @param {*} target The value to search for. * @returns {boolean} Returns `true` if `target` is found, else `false`. */ function arrayIncludes(array, value) { return !!array.length && baseIndexOf(array, value, 0) > -1; } /** * A specialized version of `_.includesWith` for arrays without support for * specifying an index to search from. * * @private * @param {Array} array The array to search. * @param {*} target The value to search for. * @param {Function} comparator The comparator invoked per element. * @returns {boolean} Returns `true` if `target` is found, else `false`. */ function arrayIncludesWith(array, value, comparator) { var index = -1, length = array.length; while (++index < length) { if (comparator(value, array[index])) { return true; } } return false; } /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, length = array.length, result = Array(length); while (++index < length) { result[index] = iteratee(array[index], index, array); } return result; } /** * Appends the elements of `values` to `array`. * * @private * @param {Array} array The array to modify. * @param {Array} values The values to append. * @returns {Array} Returns `array`. */ function arrayPush(array, values) { var index = -1, length = values.length, offset = array.length; while (++index < length) { array[offset + index] = values[index]; } return array; } /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initFromArray] Specify using the first element of `array` as the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduce(array, iteratee, accumulator, initFromArray) { var index = -1, length = array.length; if (initFromArray && length) { accumulator = array[++index]; } while (++index < length) { accumulator = iteratee(accumulator, array[index], index, array); } return accumulator; } /** * A specialized version of `_.reduceRight` for arrays without support for * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initFromArray] Specify using the last element of `array` as the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduceRight(array, iteratee, accumulator, initFromArray) { var length = array.length; if (initFromArray && length) { accumulator = array[--length]; } while (length--) { accumulator = iteratee(accumulator, array[length], length, array); } return accumulator; } /** * A specialized version of `_.some` for arrays without support for iteratee * shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. */ function arraySome(array, predicate) { var index = -1, length = array.length; while (++index < length) { if (predicate(array[index], index, array)) { return true; } } return false; } /** * The base implementation of methods like `_.max` and `_.min` which accepts a * `comparator` to determine the extremum value. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The iteratee invoked per iteration. * @param {Function} comparator The comparator used to compare values. * @returns {*} Returns the extremum value. */ function baseExtremum(array, iteratee, comparator) { var index = -1, length = array.length; while (++index < length) { var value = array[index], current = iteratee(value); if (current != null && (computed === undefined ? current === current : comparator(current, computed) )) { var computed = current, result = value; } } return result; } /** * The base implementation of methods like `_.find` and `_.findKey`, without * support for iteratee shorthands, which iterates over `collection` using * the provided `eachFunc`. * * @private * @param {Array|Object} collection The collection to search. * @param {Function} predicate The function invoked per iteration. * @param {Function} eachFunc The function to iterate over `collection`. * @param {boolean} [retKey] Specify returning the key of the found element instead of the element itself. * @returns {*} Returns the found element or its key, else `undefined`. */ function baseFind(collection, predicate, eachFunc, retKey) { var result; eachFunc(collection, function(value, key, collection) { if (predicate(value, key, collection)) { result = retKey ? key : value; return false; } }); return result; } /** * The base implementation of `_.findIndex` and `_.findLastIndex` without * support for iteratee shorthands. * * @private * @param {Array} array The array to search. * @param {Function} predicate The function invoked per iteration. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {number} Returns the index of the matched value, else `-1`. */ function baseFindIndex(array, predicate, fromRight) { var length = array.length, index = fromRight ? length : -1; while ((fromRight ? index-- : ++index < length)) { if (predicate(array[index], index, array)) { return index; } } return -1; } /** * The base implementation of `_.indexOf` without `fromIndex` bounds checks. * * @private * @param {Array} array The array to search. * @param {*} value The value to search for. * @param {number} fromIndex The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. */ function baseIndexOf(array, value, fromIndex) { if (value !== value) { return indexOfNaN(array, fromIndex); } var index = fromIndex - 1, length = array.length; while (++index < length) { if (array[index] === value) { return index; } } return -1; } /** * The base implementation of `_.reduce` and `_.reduceRight`, without support * for iteratee shorthands, which iterates over `collection` using the provided * `eachFunc`. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} accumulator The initial value. * @param {boolean} initFromCollection Specify using the first or last element of `collection` as the initial value. * @param {Function} eachFunc The function to iterate over `collection`. * @returns {*} Returns the accumulated value. */ function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) { eachFunc(collection, function(value, index, collection) { accumulator = initFromCollection ? (initFromCollection = false, value) : iteratee(accumulator, value, index, collection); }); return accumulator; } /** * The base implementation of `_.sortBy` which uses `comparer` to define * the sort order of `array` and replaces criteria objects with their * corresponding values. * * @private * @param {Array} array The array to sort. * @param {Function} comparer The function to define sort order. * @returns {Array} Returns `array`. */ function baseSortBy(array, comparer) { var length = array.length; array.sort(comparer); while (length--) { array[length] = array[length].value; } return array; } /** * The base implementation of `_.sum` without support for iteratee shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {number} Returns the sum. */ function baseSum(array, iteratee) { var result, index = -1, length = array.length; while (++index < length) { var current = iteratee(array[index]); if (current !== undefined) { result = result === undefined ? current : (result + current); } } return result; } /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. * * @private * @param {number} n The number of times to invoke `iteratee`. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the array of results. */ function baseTimes(n, iteratee) { var index = -1, result = Array(n); while (++index < n) { result[index] = iteratee(index); } return result; } /** * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array * of key-value pairs for `object` corresponding to the property names of `props`. * * @private * @param {Object} object The object to query. * @param {Array} props The property names to get values for. * @returns {Object} Returns the new array of key-value pairs. */ function baseToPairs(object, props) { return arrayMap(props, function(key) { return [key, object[key]]; }); } /** * The base implementation of `_.unary` without support for storing wrapper metadata. * * @private * @param {Function} func The function to cap arguments for. * @returns {Function} Returns the new function. */ function baseUnary(func) { return function(value) { return func(value); }; } /** * The base implementation of `_.values` and `_.valuesIn` which creates an * array of `object` property values corresponding to the property names * of `props`. * * @private * @param {Object} object The object to query. * @param {Array} props The property names to get values for. * @returns {Object} Returns the array of property values. */ function baseValues(object, props) { return arrayMap(props, function(key) { return object[key]; }); } /** * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol * that is not found in the character symbols. * * @private * @param {Array} strSymbols The string symbols to inspect. * @param {Array} chrSymbols The character symbols to find. * @returns {number} Returns the index of the first unmatched string symbol. */ function charsStartIndex(strSymbols, chrSymbols) { var index = -1, length = strSymbols.length; while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} return index; } /** * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol * that is not found in the character symbols. * * @private * @param {Array} strSymbols The string symbols to inspect. * @param {Array} chrSymbols The character symbols to find. * @returns {number} Returns the index of the last unmatched string symbol. */ function charsEndIndex(strSymbols, chrSymbols) { var index = strSymbols.length; while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} return index; } /** * Checks if `value` is a global object. * * @private * @param {*} value The value to check. * @returns {null|Object} Returns `value` if it's a global object, else `null`. */ function checkGlobal(value) { return (value && value.Object === Object) ? value : null; } /** * Compares values to sort them in ascending order. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {number} Returns the sort order indicator for `value`. */ function compareAscending(value, other) { if (value !== other) { var valIsNull = value === null, valIsUndef = value === undefined, valIsReflexive = value === value; var othIsNull = other === null, othIsUndef = other === undefined, othIsReflexive = other === other; if ((value > other && !othIsNull) || !valIsReflexive || (valIsNull && !othIsUndef && othIsReflexive) || (valIsUndef && othIsReflexive)) { return 1; } if ((value < other && !valIsNull) || !othIsReflexive || (othIsNull && !valIsUndef && valIsReflexive) || (othIsUndef && valIsReflexive)) { return -1; } } return 0; } /** * Used by `_.orderBy` to compare multiple properties of a value to another * and stable sort them. * * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, * specify an order of "desc" for descending or "asc" for ascending sort order * of corresponding values. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {boolean[]|string[]} orders The order to sort by for each property. * @returns {number} Returns the sort order indicator for `object`. */ function compareMultiple(object, other, orders) { var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length; while (++index < length) { var result = compareAscending(objCriteria[index], othCriteria[index]); if (result) { if (index >= ordersLength) { return result; } var order = orders[index]; return result * (order == 'desc' ? -1 : 1); } } // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications // that causes it, under certain circumstances, to provide the same value for // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 // for more details. // // This also ensures a stable sort in V8 and other engines. // See https://code.google.com/p/v8/issues/detail?id=90 for more details. return object.index - other.index; } /** * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters. * * @private * @param {string} letter The matched letter to deburr. * @returns {string} Returns the deburred letter. */ function deburrLetter(letter) { return deburredLetters[letter]; } /** * Used by `_.escape` to convert characters to HTML entities. * * @private * @param {string} chr The matched character to escape. * @returns {string} Returns the escaped character. */ function escapeHtmlChar(chr) { return htmlEscapes[chr]; } /** * Used by `_.template` to escape characters for inclusion in compiled string literals. * * @private * @param {string} chr The matched character to escape. * @returns {string} Returns the escaped character. */ function escapeStringChar(chr) { return '\\' + stringEscapes[chr]; } /** * Gets the index at which the first occurrence of `NaN` is found in `array`. * * @private * @param {Array} array The array to search. * @param {number} fromIndex The index to search from. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {number} Returns the index of the matched `NaN`, else `-1`. */ function indexOfNaN(array, fromIndex, fromRight) { var length = array.length, index = fromIndex + (fromRight ? 0 : -1); while ((fromRight ? index-- : ++index < length)) { var other = array[index]; if (other !== other) { return index; } } return -1; } /** * Checks if `value` is a host object in IE < 9. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a host object, else `false`. */ function isHostObject(value) { // Many host objects are `Object` objects that can coerce to strings // despite having improperly defined `toString` methods. var result = false; if (value != null && typeof value.toString != 'function') { try { result = !!(value + ''); } catch (e) {} } return result; } /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; length = length == null ? MAX_SAFE_INTEGER : length; return value > -1 && value % 1 == 0 && value < length; } /** * Converts `iterator` to an array. * * @private * @param {Object} iterator The iterator to convert. * @returns {Array} Returns the converted array. */ function iteratorToArray(iterator) { var data, result = []; while (!(data = iterator.next()).done) { result.push(data.value); } return result; } /** * Converts `map` to an array. * * @private * @param {Object} map The map to convert. * @returns {Array} Returns the converted array. */ function mapToArray(map) { var index = -1, result = Array(map.size); map.forEach(function(value, key) { result[++index] = [key, value]; }); return result; } /** * Replaces all `placeholder` elements in `array` with an internal placeholder * and returns an array of their indexes. * * @private * @param {Array} array The array to modify. * @param {*} placeholder The placeholder to replace. * @returns {Array} Returns the new array of placeholder indexes. */ function replaceHolders(array, placeholder) { var index = -1, length = array.length, resIndex = -1, result = []; while (++index < length) { if (array[index] === placeholder) { array[index] = PLACEHOLDER; result[++resIndex] = index; } } return result; } /** * Converts `set` to an array. * * @private * @param {Object} set The set to convert. * @returns {Array} Returns the converted array. */ function setToArray(set) { var index = -1, result = Array(set.size); set.forEach(function(value) { result[++index] = value; }); return result; } /** * Gets the number of symbols in `string`. * * @param {string} string The string to inspect. * @returns {number} Returns the string size. */ function stringSize(string) { if (!(string && reHasComplexSymbol.test(string))) { return string.length; } var result = reComplexSymbol.lastIndex = 0; while (reComplexSymbol.test(string)) { result++; } return result; } /** * Converts `string` to an array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the converted array. */ function stringToArray(string) { return string.match(reComplexSymbol); } /** * Used by `_.unescape` to convert HTML entities to characters. * * @private * @param {string} chr The matched character to unescape. * @returns {string} Returns the unescaped character. */ function unescapeHtmlChar(chr) { return htmlUnescapes[chr]; } /*--------------------------------------------------------------------------*/ /** * Create a new pristine `lodash` function using the `context` object. * * @static * @memberOf _ * @category Utility * @param {Object} [context=root] The context object. * @returns {Function} Returns a new `lodash` function. * @example * * _.mixin({ 'foo': _.constant('foo') }); * * var lodash = _.runInContext(); * lodash.mixin({ 'bar': lodash.constant('bar') }); * * _.isFunction(_.foo); * // => true * _.isFunction(_.bar); * // => false * * lodash.isFunction(lodash.foo); * // => false * lodash.isFunction(lodash.bar); * // => true * * // using `context` to mock `Date#getTime` use in `_.now` * var mock = _.runInContext({ * 'Date': function() { * return { 'getTime': getTimeMock }; * } * }); * * // or creating a suped-up `defer` in Node.js * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; */ function runInContext(context) { context = context ? _.defaults({}, context, _.pick(root, contextProps)) : root; /** Built-in constructor references. */ var Date = context.Date, Error = context.Error, Math = context.Math, RegExp = context.RegExp, TypeError = context.TypeError; /** Used for built-in method references. */ var arrayProto = context.Array.prototype, objectProto = context.Object.prototype; /** Used to resolve the decompiled source of functions. */ var funcToString = context.Function.prototype.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** Used to generate unique IDs. */ var idCounter = 0; /** Used to infer the `Object` constructor. */ var objectCtorString = funcToString.call(Object); /** * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Used to restore the original `_` reference in `_.noConflict`. */ var oldDash = root._; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ var _Symbol = context.Symbol, Reflect = context.Reflect, Uint8Array = context.Uint8Array, clearTimeout = context.clearTimeout, enumerate = Reflect ? Reflect.enumerate : undefined, getPrototypeOf = Object.getPrototypeOf, getOwnPropertySymbols = Object.getOwnPropertySymbols, iteratorSymbol = typeof (iteratorSymbol = _Symbol && _Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined, propertyIsEnumerable = objectProto.propertyIsEnumerable, setTimeout = context.setTimeout, splice = arrayProto.splice; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeCeil = Math.ceil, nativeFloor = Math.floor, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = Object.keys, nativeMax = Math.max, nativeMin = Math.min, nativeParseInt = context.parseInt, nativeRandom = Math.random, nativeReverse = arrayProto.reverse; /* Built-in method references that are verified to be native. */ var Map = getNative(context, 'Map'), Set = getNative(context, 'Set'), WeakMap = getNative(context, 'WeakMap'), nativeCreate = getNative(Object, 'create'); /** Used to store function metadata. */ var metaMap = WeakMap && new WeakMap; /** Used to detect maps and sets. */ var mapCtorString = Map ? funcToString.call(Map) : '', setCtorString = Set ? funcToString.call(Set) : ''; /** Used to convert symbols to primitives and strings. */ var symbolProto = _Symbol ? _Symbol.prototype : undefined, symbolValueOf = _Symbol ? symbolProto.valueOf : undefined, symbolToString = _Symbol ? symbolProto.toString : undefined; /** Used to lookup unminified function names. */ var realNames = {}; /*------------------------------------------------------------------------*/ /** * Creates a `lodash` object which wraps `value` to enable implicit method * chaining. Methods that operate on and return arrays, collections, and * functions can be chained together. Methods that retrieve a single value or * may return a primitive value will automatically end the chain sequence and * return the unwrapped value. Otherwise, the value must be unwrapped with * `_#value`. * * Explicit chaining, which must be unwrapped with `_#value` in all cases, * may be enabled using `_.chain`. * * The execution of chained methods is lazy, that is, it's deferred until * `_#value` is implicitly or explicitly called. * * Lazy evaluation allows several methods to support shortcut fusion. Shortcut * fusion is an optimization to merge iteratee calls; this avoids the creation * of intermediate arrays and can greatly reduce the number of iteratee executions. * Sections of a chain sequence qualify for shortcut fusion if the section is * applied to an array of at least two hundred elements and any iteratees * accept only one argument. The heuristic for whether a section qualifies * for shortcut fusion is subject to change. * * Chaining is supported in custom builds as long as the `_#value` method is * directly or indirectly included in the build. * * In addition to lodash methods, wrappers have `Array` and `String` methods. * * The wrapper `Array` methods are: * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` * * The wrapper `String` methods are: * `replace` and `split` * * The wrapper methods that support shortcut fusion are: * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` * * The chainable wrapper methods are: * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, * `at`, `before`, `bind`, `bindAll`, `bindKey`, `chain`, `chunk`, `commit`, * `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, `curry`, * `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, `difference`, * `differenceBy`, `differenceWith`, `drop`, `dropRight`, `dropRightWhile`, * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flip`, `flow`, * `flowRight`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, * `forOwnRight`, `fromPairs`, `functions`, `functionsIn`, `groupBy`, `initial`, * `intersection`, `intersectionBy`, `intersectionWith`, invert`, `invokeMap`, * `iteratee`, `keyBy`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, * `matches`, `matchesProperty`, `memoize`, `merge`, `mergeWith`, `method`, * `methodOf`, `mixin`, `negate`, `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, * `over`, `overArgs`, `overEvery`, `overSome`, `partial`, `partialRight`, * `partition`, `pick`, `pickBy`, `plant`, `property`, `propertyOf`, `pull`, * `pullAll`, `pullAllBy`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, * `reject`, `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, * `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, * `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, * `toArray`, `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, * `unary`, `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, * `unset`, `unshift`, `unzip`, `unzipWith`, `values`, `valuesIn`, `without`, * `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, `zipObject`, and `zipWith` * * The wrapper methods that are **not** chainable by default are: * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `endsWith`, `eq`, * `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, * `findLast`, `findLastIndex`, `findLastKey`, `floor`, `get`, `gt`, `gte`, * `has`, `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, * `invoke`, `isArguments`, `isArray`, `isArrayLike`, `isArrayLikeObject`, * `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, * `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMatch`, * `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`, * `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`, * `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`, `last`, * `lastIndexOf`, `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, * `mean`, `min`, `minBy`, `noConflict`, `noop`, `now`, `pad`, `padEnd`, * `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `repeat`, * `result`, `round`, `runInContext`, `sample`, `shift`, `size`, `snakeCase`, * `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, * `startCase`, `startsWith`, `subtract`, `sum`, sumBy`, `template`, `times`, * `toLower`, `toInteger`, `toLength`, `toNumber`, `toSafeInteger`, toString`, * `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, * `upperCase`, `upperFirst`, `value`, and `words` * * @name _ * @constructor * @category Chain * @param {*} value The value to wrap in a `lodash` instance. * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * function square(n) { * return n * n; * } * * var wrapped = _([1, 2, 3]); * * // returns an unwrapped value * wrapped.reduce(_.add); * // => 6 * * // returns a wrapped value * var squares = wrapped.map(square); * * _.isArray(squares); * // => false * * _.isArray(squares.value()); * // => true */ function lodash(value) { if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { if (value instanceof LodashWrapper) { return value; } if (hasOwnProperty.call(value, '__wrapped__')) { return wrapperClone(value); } } return new LodashWrapper(value); } /** * The function whose prototype all chaining wrappers inherit from. * * @private */ function baseLodash() { // No operation performed. } /** * The base constructor for creating `lodash` wrapper objects. * * @private * @param {*} value The value to wrap. * @param {boolean} [chainAll] Enable chaining for all wrapper methods. */ function LodashWrapper(value, chainAll) { this.__wrapped__ = value; this.__actions__ = []; this.__chain__ = !!chainAll; this.__index__ = 0; this.__values__ = undefined; } /** * By default, the template delimiters used by lodash are like those in * embedded Ruby (ERB). Change the following template settings to use * alternative delimiters. * * @static * @memberOf _ * @type Object */ lodash.templateSettings = { /** * Used to detect `data` property values to be HTML-escaped. * * @memberOf _.templateSettings * @type RegExp */ 'escape': reEscape, /** * Used to detect code to be evaluated. * * @memberOf _.templateSettings * @type RegExp */ 'evaluate': reEvaluate, /** * Used to detect `data` property values to inject. * * @memberOf _.templateSettings * @type RegExp */ 'interpolate': reInterpolate, /** * Used to reference the data object in the template text. * * @memberOf _.templateSettings * @type string */ 'variable': '', /** * Used to import variables into the compiled template. * * @memberOf _.templateSettings * @type Object */ 'imports': { /** * A reference to the `lodash` function. * * @memberOf _.templateSettings.imports * @type Function */ '_': lodash } }; /*------------------------------------------------------------------------*/ /** * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. * * @private * @param {*} value The value to wrap. */ function LazyWrapper(value) { this.__wrapped__ = value; this.__actions__ = []; this.__dir__ = 1; this.__filtered__ = false; this.__iteratees__ = []; this.__takeCount__ = MAX_ARRAY_LENGTH; this.__views__ = []; } /** * Creates a clone of the lazy wrapper object. * * @private * @name clone * @memberOf LazyWrapper * @returns {Object} Returns the cloned `LazyWrapper` object. */ function lazyClone() { var result = new LazyWrapper(this.__wrapped__); result.__actions__ = copyArray(this.__actions__); result.__dir__ = this.__dir__; result.__filtered__ = this.__filtered__; result.__iteratees__ = copyArray(this.__iteratees__); result.__takeCount__ = this.__takeCount__; result.__views__ = copyArray(this.__views__); return result; } /** * Reverses the direction of lazy iteration. * * @private * @name reverse * @memberOf LazyWrapper * @returns {Object} Returns the new reversed `LazyWrapper` object. */ function lazyReverse() { if (this.__filtered__) { var result = new LazyWrapper(this); result.__dir__ = -1; result.__filtered__ = true; } else { result = this.clone(); result.__dir__ *= -1; } return result; } /** * Extracts the unwrapped value from its lazy wrapper. * * @private * @name value * @memberOf LazyWrapper * @returns {*} Returns the unwrapped value. */ function lazyValue() { var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : (start - 1), iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__); if (!isArr || arrLength < LARGE_ARRAY_SIZE || (arrLength == length && takeCount == length)) { return baseWrapperValue(array, this.__actions__); } var result = []; outer: while (length-- && resIndex < takeCount) { index += dir; var iterIndex = -1, value = array[index]; while (++iterIndex < iterLength) { var data = iteratees[iterIndex], iteratee = data.iteratee, type = data.type, computed = iteratee(value); if (type == LAZY_MAP_FLAG) { value = computed; } else if (!computed) { if (type == LAZY_FILTER_FLAG) { continue outer; } else { break outer; } } } result[resIndex++] = value; } return result; } /*------------------------------------------------------------------------*/ /** * Creates an hash object. * * @private * @returns {Object} Returns the new hash object. */ function Hash() {} /** * Removes `key` and its value from the hash. * * @private * @param {Object} hash The hash to modify. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function hashDelete(hash, key) { return hashHas(hash, key) && delete hash[key]; } /** * Gets the hash value for `key`. * * @private * @param {Object} hash The hash to query. * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function hashGet(hash, key) { if (nativeCreate) { var result = hash[key]; return result === HASH_UNDEFINED ? undefined : result; } return hasOwnProperty.call(hash, key) ? hash[key] : undefined; } /** * Checks if a hash value for `key` exists. * * @private * @param {Object} hash The hash to query. * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function hashHas(hash, key) { return nativeCreate ? hash[key] !== undefined : hasOwnProperty.call(hash, key); } /** * Sets the hash `key` to `value`. * * @private * @param {Object} hash The hash to modify. * @param {string} key The key of the value to set. * @param {*} value The value to set. */ function hashSet(hash, key, value) { hash[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; } /*------------------------------------------------------------------------*/ /** * Creates a map cache object to store key-value pairs. * * @private * @param {Array} [values] The values to cache. */ function MapCache(values) { var index = -1, length = values ? values.length : 0; this.clear(); while (++index < length) { var entry = values[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the map. * * @private * @name clear * @memberOf MapCache */ function mapClear() { this.__data__ = { 'hash': new Hash, 'map': Map ? new Map : [], 'string': new Hash }; } /** * Removes `key` and its value from the map. * * @private * @name delete * @memberOf MapCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function mapDelete(key) { var data = this.__data__; if (isKeyable(key)) { return hashDelete(typeof key == 'string' ? data.string : data.hash, key); } return Map ? data.map['delete'](key) : assocDelete(data.map, key); } /** * Gets the map value for `key`. * * @private * @name get * @memberOf MapCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function mapGet(key) { var data = this.__data__; if (isKeyable(key)) { return hashGet(typeof key == 'string' ? data.string : data.hash, key); } return Map ? data.map.get(key) : assocGet(data.map, key); } /** * Checks if a map value for `key` exists. * * @private * @name has * @memberOf MapCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function mapHas(key) { var data = this.__data__; if (isKeyable(key)) { return hashHas(typeof key == 'string' ? data.string : data.hash, key); } return Map ? data.map.has(key) : assocHas(data.map, key); } /** * Sets the map `key` to `value`. * * @private * @name set * @memberOf MapCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the map cache object. */ function mapSet(key, value) { var data = this.__data__; if (isKeyable(key)) { hashSet(typeof key == 'string' ? data.string : data.hash, key, value); } else if (Map) { data.map.set(key, value); } else { assocSet(data.map, key, value); } return this; } /*------------------------------------------------------------------------*/ /** * * Creates a set cache object to store unique values. * * @private * @param {Array} [values] The values to cache. */ function SetCache(values) { var index = -1, length = values ? values.length : 0; this.__data__ = new MapCache; while (++index < length) { this.push(values[index]); } } /** * Checks if `value` is in `cache`. * * @private * @param {Object} cache The set cache to search. * @param {*} value The value to search for. * @returns {number} Returns `true` if `value` is found, else `false`. */ function cacheHas(cache, value) { var map = cache.__data__; if (isKeyable(value)) { var data = map.__data__, hash = typeof value == 'string' ? data.string : data.hash; return hash[value] === HASH_UNDEFINED; } return map.has(value); } /** * Adds `value` to the set cache. * * @private * @name push * @memberOf SetCache * @param {*} value The value to cache. */ function cachePush(value) { var map = this.__data__; if (isKeyable(value)) { var data = map.__data__, hash = typeof value == 'string' ? data.string : data.hash; hash[value] = HASH_UNDEFINED; } else { map.set(value, HASH_UNDEFINED); } } /*------------------------------------------------------------------------*/ /** * Creates a stack cache object to store key-value pairs. * * @private * @param {Array} [values] The values to cache. */ function Stack(values) { var index = -1, length = values ? values.length : 0; this.clear(); while (++index < length) { var entry = values[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the stack. * * @private * @name clear * @memberOf Stack */ function stackClear() { this.__data__ = { 'array': [], 'map': null }; } /** * Removes `key` and its value from the stack. * * @private * @name delete * @memberOf Stack * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function stackDelete(key) { var data = this.__data__, array = data.array; return array ? assocDelete(array, key) : data.map['delete'](key); } /** * Gets the stack value for `key`. * * @private * @name get * @memberOf Stack * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function stackGet(key) { var data = this.__data__, array = data.array; return array ? assocGet(array, key) : data.map.get(key); } /** * Checks if a stack value for `key` exists. * * @private * @name has * @memberOf Stack * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function stackHas(key) { var data = this.__data__, array = data.array; return array ? assocHas(array, key) : data.map.has(key); } /** * Sets the stack `key` to `value`. * * @private * @name set * @memberOf Stack * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the stack cache object. */ function stackSet(key, value) { var data = this.__data__, array = data.array; if (array) { if (array.length < (LARGE_ARRAY_SIZE - 1)) { assocSet(array, key, value); } else { data.array = null; data.map = new MapCache(array); } } var map = data.map; if (map) { map.set(key, value); } return this; } /*------------------------------------------------------------------------*/ /** * Removes `key` and its value from the associative array. * * @private * @param {Array} array The array to query. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function assocDelete(array, key) { var index = assocIndexOf(array, key); if (index < 0) { return false; } var lastIndex = array.length - 1; if (index == lastIndex) { array.pop(); } else { splice.call(array, index, 1); } return true; } /** * Gets the associative array value for `key`. * * @private * @param {Array} array The array to query. * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function assocGet(array, key) { var index = assocIndexOf(array, key); return index < 0 ? undefined : array[index][1]; } /** * Checks if an associative array value for `key` exists. * * @private * @param {Array} array The array to query. * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function assocHas(array, key) { return assocIndexOf(array, key) > -1; } /** * Gets the index at which the first occurrence of `key` is found in `array` * of key-value pairs. * * @private * @param {Array} array The array to search. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ function assocIndexOf(array, key) { var length = array.length; while (length--) { if (eq(array[length][0], key)) { return length; } } return -1; } /** * Sets the associative array `key` to `value`. * * @private * @param {Array} array The array to modify. * @param {string} key The key of the value to set. * @param {*} value The value to set. */ function assocSet(array, key, value) { var index = assocIndexOf(array, key); if (index < 0) { array.push([key, value]); } else { array[index][1] = value; } } /*------------------------------------------------------------------------*/ /** * Used by `_.defaults` to customize its `_.assignIn` use. * * @private * @param {*} objValue The destination value. * @param {*} srcValue The source value. * @param {string} key The key of the property to assign. * @param {Object} object The parent object of `objValue`. * @returns {*} Returns the value to assign. */ function assignInDefaults(objValue, srcValue, key, object) { if (objValue === undefined || (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { return srcValue; } return objValue; } /** * This function is like `assignValue` except that it doesn't assign `undefined` values. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function assignMergeValue(object, key, value) { if ((value !== undefined && !eq(object[key], value)) || (typeof key == 'number' && value === undefined && !(key in object))) { object[key] = value; } } /** * Assigns `value` to `key` of `object` if the existing value is not equivalent * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function assignValue(object, key, value) { var objValue = object[key]; if ((!eq(objValue, value) || (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) || (value === undefined && !(key in object))) { object[key] = value; } } /** * The base implementation of `_.assign` without support for multiple sources * or `customizer` functions. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @returns {Object} Returns `object`. */ function baseAssign(object, source) { return object && copyObject(source, keys(source), object); } /** * The base implementation of `_.at` without support for individual paths. * * @private * @param {Object} object The object to iterate over. * @param {string[]} paths The property paths of elements to pick. * @returns {Array} Returns the new array of picked elements. */ function baseAt(object, paths) { var index = -1, isNil = object == null, length = paths.length, result = Array(length); while (++index < length) { result[index] = isNil ? undefined : get(object, paths[index]); } return result; } /** * The base implementation of `_.clamp` which doesn't coerce arguments to numbers. * * @private * @param {number} number The number to clamp. * @param {number} [lower] The lower bound. * @param {number} upper The upper bound. * @returns {number} Returns the clamped number. */ function baseClamp(number, lower, upper) { if (number === number) { if (upper !== undefined) { number = number <= upper ? number : upper; } if (lower !== undefined) { number = number >= lower ? number : lower; } } return number; } /** * The base implementation of `_.clone` and `_.cloneDeep` which tracks * traversed objects. * * @private * @param {*} value The value to clone. * @param {boolean} [isDeep] Specify a deep clone. * @param {Function} [customizer] The function to customize cloning. * @param {string} [key] The key of `value`. * @param {Object} [object] The parent object of `value`. * @param {Object} [stack] Tracks traversed objects and their clone counterparts. * @returns {*} Returns the cloned value. */ function baseClone(value, isDeep, customizer, key, object, stack) { var result; if (customizer) { result = object ? customizer(value, key, object, stack) : customizer(value); } if (result !== undefined) { return result; } if (!isObject(value)) { return value; } var isArr = isArray(value); if (isArr) { result = initCloneArray(value); if (!isDeep) { return copyArray(value, result); } } else { var tag = getTag(value), isFunc = tag == funcTag || tag == genTag; if (tag == objectTag || tag == argsTag || (isFunc && !object)) { if (isHostObject(value)) { return object ? value : {}; } result = initCloneObject(isFunc ? {} : value); if (!isDeep) { return copySymbols(value, baseAssign(result, value)); } } else { return cloneableTags[tag] ? initCloneByTag(value, tag, isDeep) : (object ? value : {}); } } // Check for circular references and return its corresponding clone. stack || (stack = new Stack); var stacked = stack.get(value); if (stacked) { return stacked; } stack.set(value, result); // Recursively populate clone (susceptible to call stack limits). (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) { assignValue(result, key, baseClone(subValue, isDeep, customizer, key, value, stack)); }); return isArr ? result : copySymbols(value, result); } /** * The base implementation of `_.conforms` which doesn't clone `source`. * * @private * @param {Object} source The object of property predicates to conform to. * @returns {Function} Returns the new function. */ function baseConforms(source) { var props = keys(source), length = props.length; return function(object) { if (object == null) { return !length; } var index = length; while (index--) { var key = props[index], predicate = source[key], value = object[key]; if ((value === undefined && !(key in Object(object))) || !predicate(value)) { return false; } } return true; }; } /** * The base implementation of `_.create` without support for assigning * properties to the created object. * * @private * @param {Object} prototype The object to inherit from. * @returns {Object} Returns the new object. */ var baseCreate = (function() { function object() {} return function(prototype) { if (isObject(prototype)) { object.prototype = prototype; var result = new object; object.prototype = undefined; } return result || {}; }; }()); /** * The base implementation of `_.delay` and `_.defer` which accepts an array * of `func` arguments. * * @private * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay invocation. * @param {Object} args The arguments provide to `func`. * @returns {number} Returns the timer id. */ function baseDelay(func, wait, args) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } return setTimeout(function() { func.apply(undefined, args); }, wait); } /** * The base implementation of methods like `_.difference` without support for * excluding multiple arrays or iteratee shorthands. * * @private * @param {Array} array The array to inspect. * @param {Array} values The values to exclude. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of filtered values. */ function baseDifference(array, values, iteratee, comparator) { var index = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length; if (!length) { return result; } if (iteratee) { values = arrayMap(values, baseUnary(iteratee)); } if (comparator) { includes = arrayIncludesWith; isCommon = false; } else if (values.length >= LARGE_ARRAY_SIZE) { includes = cacheHas; isCommon = false; values = new SetCache(values); } outer: while (++index < length) { var value = array[index], computed = iteratee ? iteratee(value) : value; if (isCommon && computed === computed) { var valuesIndex = valuesLength; while (valuesIndex--) { if (values[valuesIndex] === computed) { continue outer; } } result.push(value); } else if (!includes(values, computed, comparator)) { result.push(value); } } return result; } /** * The base implementation of `_.forEach` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array|Object} Returns `collection`. */ var baseEach = createBaseEach(baseForOwn); /** * The base implementation of `_.forEachRight` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array|Object} Returns `collection`. */ var baseEachRight = createBaseEach(baseForOwnRight, true); /** * The base implementation of `_.every` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false` */ function baseEvery(collection, predicate) { var result = true; baseEach(collection, function(value, index, collection) { result = !!predicate(value, index, collection); return result; }); return result; } /** * The base implementation of `_.fill` without an iteratee call guard. * * @private * @param {Array} array The array to fill. * @param {*} value The value to fill `array` with. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns `array`. */ function baseFill(array, value, start, end) { var length = array.length; start = toInteger(start); if (start < 0) { start = -start > length ? 0 : (length + start); } end = (end === undefined || end > length) ? length : toInteger(end); if (end < 0) { end += length; } end = start > end ? 0 : toLength(end); while (start < end) { array[start++] = value; } return array; } /** * The base implementation of `_.filter` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function baseFilter(collection, predicate) { var result = []; baseEach(collection, function(value, index, collection) { if (predicate(value, index, collection)) { result.push(value); } }); return result; } /** * The base implementation of `_.flatten` with support for restricting flattening. * * @private * @param {Array} array The array to flatten. * @param {boolean} [isDeep] Specify a deep flatten. * @param {boolean} [isStrict] Restrict flattening to arrays-like objects. * @param {Array} [result=[]] The initial result value. * @returns {Array} Returns the new flattened array. */ function baseFlatten(array, isDeep, isStrict, result) { result || (result = []); var index = -1, length = array.length; while (++index < length) { var value = array[index]; if (isArrayLikeObject(value) && (isStrict || isArray(value) || isArguments(value))) { if (isDeep) { // Recursively flatten arrays (susceptible to call stack limits). baseFlatten(value, isDeep, isStrict, result); } else { arrayPush(result, value); } } else if (!isStrict) { result[result.length] = value; } } return result; } /** * The base implementation of `baseForIn` and `baseForOwn` which iterates * over `object` properties returned by `keysFunc` invoking `iteratee` for * each property. Iteratee functions may exit iteration early by explicitly * returning `false`. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {Function} keysFunc The function to get the keys of `object`. * @returns {Object} Returns `object`. */ var baseFor = createBaseFor(); /** * This function is like `baseFor` except that it iterates over properties * in the opposite order. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {Function} keysFunc The function to get the keys of `object`. * @returns {Object} Returns `object`. */ var baseForRight = createBaseFor(true); /** * The base implementation of `_.forIn` without support for iteratee shorthands. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Object} Returns `object`. */ function baseForIn(object, iteratee) { return object == null ? object : baseFor(object, iteratee, keysIn); } /** * The base implementation of `_.forOwn` without support for iteratee shorthands. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Object} Returns `object`. */ function baseForOwn(object, iteratee) { return object && baseFor(object, iteratee, keys); } /** * The base implementation of `_.forOwnRight` without support for iteratee shorthands. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Object} Returns `object`. */ function baseForOwnRight(object, iteratee) { return object && baseForRight(object, iteratee, keys); } /** * The base implementation of `_.functions` which creates an array of * `object` function property names filtered from those provided. * * @private * @param {Object} object The object to inspect. * @param {Array} props The property names to filter. * @returns {Array} Returns the new array of filtered property names. */ function baseFunctions(object, props) { return arrayFilter(props, function(key) { return isFunction(object[key]); }); } /** * The base implementation of `_.get` without support for default values. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @returns {*} Returns the resolved value. */ function baseGet(object, path) { path = isKey(path, object) ? [path + ''] : baseToPath(path); var index = 0, length = path.length; while (object != null && index < length) { object = object[path[index++]]; } return (index && index == length) ? object : undefined; } /** * The base implementation of `_.has` without support for deep paths. * * @private * @param {Object} object The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ function baseHas(object, key) { // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, // that are composed entirely of index properties, return `false` for // `hasOwnProperty` checks of them. return hasOwnProperty.call(object, key) || (typeof object == 'object' && key in object && getPrototypeOf(object) === null); } /** * The base implementation of `_.hasIn` without support for deep paths. * * @private * @param {Object} object The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ function baseHasIn(object, key) { return key in Object(object); } /** * The base implementation of `_.inRange` which doesn't coerce arguments to numbers. * * @private * @param {number} number The number to check. * @param {number} start The start of the range. * @param {number} end The end of the range. * @returns {boolean} Returns `true` if `number` is in the range, else `false`. */ function baseInRange(number, start, end) { return number >= nativeMin(start, end) && number < nativeMax(start, end); } /** * The base implementation of methods like `_.intersection`, without support * for iteratee shorthands, that accepts an array of arrays to inspect. * * @private * @param {Array} arrays The arrays to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of shared values. */ function baseIntersection(arrays, iteratee, comparator) { var includes = comparator ? arrayIncludesWith : arrayIncludes, othLength = arrays.length, othIndex = othLength, caches = Array(othLength), result = []; while (othIndex--) { var array = arrays[othIndex]; if (othIndex && iteratee) { array = arrayMap(array, baseUnary(iteratee)); } caches[othIndex] = !comparator && (iteratee || array.length >= 120) ? new SetCache(othIndex && array) : undefined; } array = arrays[0]; var index = -1, length = array.length, seen = caches[0]; outer: while (++index < length) { var value = array[index], computed = iteratee ? iteratee(value) : value; if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator))) { var othIndex = othLength; while (--othIndex) { var cache = caches[othIndex]; if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator))) { continue outer; } } if (seen) { seen.push(computed); } result.push(value); } } return result; } /** * The base implementation of `_.invoke` without support for individual * method arguments. * * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the method to invoke. * @param {Array} args The arguments to invoke the method with. * @returns {*} Returns the result of the invoked method. */ function baseInvoke(object, path, args) { if (!isKey(path, object)) { path = baseToPath(path); object = parent(object, path); path = last(path); } var func = object == null ? object : object[path]; return func == null ? undefined : apply(func, object, args); } /** * The base implementation of `_.isEqual` which supports partial comparisons * and tracks traversed objects. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {Function} [customizer] The function to customize comparisons. * @param {boolean} [bitmask] The bitmask of comparison flags. * The bitmask may be composed of the following flags: * 1 - Unordered comparison * 2 - Partial comparison * @param {Object} [stack] Tracks traversed `value` and `other` objects. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(value, other, customizer, bitmask, stack) { if (value === other) { return true; } if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { return value !== value && other !== other; } return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack); } /** * A specialized version of `baseIsEqual` for arrays and objects which performs * deep comparisons and tracks traversed objects enabling objects with circular * references to be compared. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} [customizer] The function to customize comparisons. * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. * @param {Object} [stack] Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { var objIsArr = isArray(object), othIsArr = isArray(other), objTag = arrayTag, othTag = arrayTag; if (!objIsArr) { objTag = getTag(object); if (objTag == argsTag) { objTag = objectTag; } else if (objTag != objectTag) { objIsArr = isTypedArray(object); } } if (!othIsArr) { othTag = getTag(other); if (othTag == argsTag) { othTag = objectTag; } else if (othTag != objectTag) { othIsArr = isTypedArray(other); } } var objIsObj = objTag == objectTag && !isHostObject(object), othIsObj = othTag == objectTag && !isHostObject(other), isSameTag = objTag == othTag; if (isSameTag && !(objIsArr || objIsObj)) { return equalByTag(object, other, objTag, equalFunc, customizer, bitmask); } var isPartial = bitmask & PARTIAL_COMPARE_FLAG; if (!isPartial) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); if (objIsWrapped || othIsWrapped) { return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, bitmask, stack); } } if (!isSameTag) { return false; } stack || (stack = new Stack); return (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, bitmask, stack); } /** * The base implementation of `_.isMatch` without support for iteratee shorthands. * * @private * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @param {Array} matchData The property names, values, and compare flags to match. * @param {Function} [customizer] The function to customize comparisons. * @returns {boolean} Returns `true` if `object` is a match, else `false`. */ function baseIsMatch(object, source, matchData, customizer) { var index = matchData.length, length = index, noCustomizer = !customizer; if (object == null) { return !length; } object = Object(object); while (index--) { var data = matchData[index]; if ((noCustomizer && data[2]) ? data[1] !== object[data[0]] : !(data[0] in object) ) { return false; } } while (++index < length) { data = matchData[index]; var key = data[0], objValue = object[key], srcValue = data[1]; if (noCustomizer && data[2]) { if (objValue === undefined && !(key in object)) { return false; } } else { var stack = new Stack, result = customizer ? customizer(objValue, srcValue, key, object, source, stack) : undefined; if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result)) { return false; } } } return true; } /** * The base implementation of `_.iteratee`. * * @private * @param {*} [value=_.identity] The value to convert to an iteratee. * @returns {Function} Returns the iteratee. */ function baseIteratee(value) { var type = typeof value; if (type == 'function') { return value; } if (value == null) { return identity; } if (type == 'object') { return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); } return property(value); } /** * The base implementation of `_.keys` which doesn't skip the constructor * property of prototypes or treat sparse arrays as dense. * * @private * @type Function * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeys(object) { return nativeKeys(Object(object)); } /** * The base implementation of `_.keysIn` which doesn't skip the constructor * property of prototypes or treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeysIn(object) { object = object == null ? object : Object(object); var result = []; for (var key in object) { result.push(key); } return result; } // Fallback for IE < 9 with es6-shim. if (enumerate && !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf')) { baseKeysIn = function(object) { return iteratorToArray(enumerate(object)); }; } /** * The base implementation of `_.map` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function baseMap(collection, iteratee) { var index = -1, result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value, key, collection) { result[++index] = iteratee(value, key, collection); }); return result; } /** * The base implementation of `_.matches` which doesn't clone `source`. * * @private * @param {Object} source The object of property values to match. * @returns {Function} Returns the new function. */ function baseMatches(source) { var matchData = getMatchData(source); if (matchData.length == 1 && matchData[0][2]) { var key = matchData[0][0], value = matchData[0][1]; return function(object) { if (object == null) { return false; } return object[key] === value && (value !== undefined || (key in Object(object))); }; } return function(object) { return object === source || baseIsMatch(object, source, matchData); }; } /** * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. * * @private * @param {string} path The path of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new function. */ function baseMatchesProperty(path, srcValue) { return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) ? hasIn(object, path) : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); }; } /** * The base implementation of `_.merge` without support for multiple sources. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {Function} [customizer] The function to customize merged values. * @param {Object} [stack] Tracks traversed source values and their merged counterparts. */ function baseMerge(object, source, customizer, stack) { if (object === source) { return; } var props = (isArray(source) || isTypedArray(source)) ? undefined : keysIn(source); arrayEach(props || source, function(srcValue, key) { if (props) { key = srcValue; srcValue = source[key]; } if (isObject(srcValue)) { stack || (stack = new Stack); baseMergeDeep(object, source, key, baseMerge, customizer, stack); } else { var newValue = customizer ? customizer(object[key], srcValue, (key + ''), object, source, stack) : undefined; if (newValue === undefined) { newValue = srcValue; } assignMergeValue(object, key, newValue); } }); } /** * A specialized version of `baseMerge` for arrays and objects which performs * deep merges and tracks traversed objects enabling objects with circular * references to be merged. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {string} key The key of the value to merge. * @param {Function} mergeFunc The function to merge values. * @param {Function} [customizer] The function to customize assigned values. * @param {Object} [stack] Tracks traversed source values and their merged counterparts. */ function baseMergeDeep(object, source, key, mergeFunc, customizer, stack) { var objValue = object[key], srcValue = source[key], stacked = stack.get(srcValue) || stack.get(objValue); if (stacked) { assignMergeValue(object, key, stacked); return; } var newValue = customizer ? customizer(objValue, srcValue, (key + ''), object, source, stack) : undefined, isCommon = newValue === undefined; if (isCommon) { newValue = srcValue; if (isArray(srcValue) || isTypedArray(srcValue)) { newValue = isArray(objValue) ? objValue : ((isArrayLikeObject(objValue)) ? copyArray(objValue) : baseClone(srcValue)); } else if (isPlainObject(srcValue) || isArguments(srcValue)) { newValue = isArguments(objValue) ? toPlainObject(objValue) : (isObject(objValue) ? objValue : baseClone(srcValue)); } else { isCommon = isFunction(srcValue); } } stack.set(srcValue, newValue); if (isCommon) { // Recursively merge objects and arrays (susceptible to call stack limits). mergeFunc(newValue, srcValue, customizer, stack); } assignMergeValue(object, key, newValue); } /** * The base implementation of `_.orderBy` without param guards. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. * @param {string[]} orders The sort orders of `iteratees`. * @returns {Array} Returns the new sorted array. */ function baseOrderBy(collection, iteratees, orders) { var index = -1, toIteratee = getIteratee(); iteratees = arrayMap(iteratees.length ? iteratees : Array(1), function(iteratee) { return toIteratee(iteratee); }); var result = baseMap(collection, function(value, key, collection) { var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); }); return { 'criteria': criteria, 'index': ++index, 'value': value }; }); return baseSortBy(result, function(object, other) { return compareMultiple(object, other, orders); }); } /** * The base implementation of `_.pick` without support for individual * property names. * * @private * @param {Object} object The source object. * @param {string[]} props The property names to pick. * @returns {Object} Returns the new object. */ function basePick(object, props) { object = Object(object); return arrayReduce(props, function(result, key) { if (key in object) { result[key] = object[key]; } return result; }, {}); } /** * The base implementation of `_.pickBy` without support for iteratee shorthands. * * @private * @param {Object} object The source object. * @param {Function} predicate The function invoked per property. * @returns {Object} Returns the new object. */ function basePickBy(object, predicate) { var result = {}; baseForIn(object, function(value, key) { if (predicate(value)) { result[key] = value; } }); return result; } /** * The base implementation of `_.property` without support for deep paths. * * @private * @param {string} key The key of the property to get. * @returns {Function} Returns the new function. */ function baseProperty(key) { return function(object) { return object == null ? undefined : object[key]; }; } /** * A specialized version of `baseProperty` which supports deep paths. * * @private * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new function. */ function basePropertyDeep(path) { return function(object) { return baseGet(object, path); }; } /** * The base implementation of `_.pullAll`. * * @private * @param {Array} array The array to modify. * @param {Array} values The values to remove. * @returns {Array} Returns `array`. */ function basePullAll(array, values) { return basePullAllBy(array, values); } /** * The base implementation of `_.pullAllBy` without support for iteratee * shorthands. * * @private * @param {Array} array The array to modify. * @param {Array} values The values to remove. * @param {Function} [iteratee] The iteratee invoked per element. * @returns {Array} Returns `array`. */ function basePullAllBy(array, values, iteratee) { var index = -1, length = values.length, seen = array; if (iteratee) { seen = arrayMap(array, function(value) { return iteratee(value); }); } while (++index < length) { var fromIndex = 0, value = values[index], computed = iteratee ? iteratee(value) : value; while ((fromIndex = baseIndexOf(seen, computed, fromIndex)) > -1) { if (seen !== array) { splice.call(seen, fromIndex, 1); } splice.call(array, fromIndex, 1); } } return array; } /** * The base implementation of `_.pullAt` without support for individual * indexes or capturing the removed elements. * * @private * @param {Array} array The array to modify. * @param {number[]} indexes The indexes of elements to remove. * @returns {Array} Returns `array`. */ function basePullAt(array, indexes) { var length = array ? indexes.length : 0, lastIndex = length - 1; while (length--) { var index = indexes[length]; if (lastIndex == length || index != previous) { var previous = index; if (isIndex(index)) { splice.call(array, index, 1); } else if (!isKey(index, array)) { var path = baseToPath(index), object = parent(array, path); if (object != null) { delete object[last(path)]; } } else { delete array[index]; } } } return array; } /** * The base implementation of `_.random` without support for returning * floating-point numbers. * * @private * @param {number} lower The lower bound. * @param {number} upper The upper bound. * @returns {number} Returns the random number. */ function baseRandom(lower, upper) { return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); } /** * The base implementation of `_.range` and `_.rangeRight` which doesn't * coerce arguments to numbers. * * @private * @param {number} start The start of the range. * @param {number} end The end of the range. * @param {number} step The value to increment or decrement by. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Array} Returns the new array of numbers. */ function baseRange(start, end, step, fromRight) { var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result = Array(length); while (length--) { result[fromRight ? length : ++index] = start; start += step; } return result; } /** * The base implementation of `_.set`. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the property to set. * @param {*} value The value to set. * @param {Function} [customizer] The function to customize path creation. * @returns {Object} Returns `object`. */ function baseSet(object, path, value, customizer) { path = isKey(path, object) ? [path + ''] : baseToPath(path); var index = -1, length = path.length, lastIndex = length - 1, nested = object; while (nested != null && ++index < length) { var key = path[index]; if (isObject(nested)) { var newValue = value; if (index != lastIndex) { var objValue = nested[key]; newValue = customizer ? customizer(objValue, key, nested) : undefined; if (newValue === undefined) { newValue = objValue == null ? (isIndex(path[index + 1]) ? [] : {}) : objValue; } } assignValue(nested, key, newValue); } nested = nested[key]; } return object; } /** * The base implementation of `setData` without support for hot loop detection. * * @private * @param {Function} func The function to associate metadata with. * @param {*} data The metadata. * @returns {Function} Returns `func`. */ var baseSetData = !metaMap ? identity : function(func, data) { metaMap.set(func, data); return func; }; /** * The base implementation of `_.slice` without an iteratee call guard. * * @private * @param {Array} array The array to slice. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns the slice of `array`. */ function baseSlice(array, start, end) { var index = -1, length = array.length; start = start == null ? 0 : toInteger(start); if (start < 0) { start = -start > length ? 0 : (length + start); } end = (end === undefined || end > length) ? length : toInteger(end); if (end < 0) { end += length; } length = start > end ? 0 : ((end - start) >>> 0); start >>>= 0; var result = Array(length); while (++index < length) { result[index] = array[index + start]; } return result; } /** * The base implementation of `_.some` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. */ function baseSome(collection, predicate) { var result; baseEach(collection, function(value, index, collection) { result = predicate(value, index, collection); return !result; }); return !!result; } /** * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which * performs a binary search of `array` to determine the index at which `value` * should be inserted into `array` in order to maintain its sort order. * * @private * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {boolean} [retHighest] Specify returning the highest qualified index. * @returns {number} Returns the index at which `value` should be inserted * into `array`. */ function baseSortedIndex(array, value, retHighest) { var low = 0, high = array ? array.length : low; if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { while (low < high) { var mid = (low + high) >>> 1, computed = array[mid]; if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) { low = mid + 1; } else { high = mid; } } return high; } return baseSortedIndexBy(array, value, identity, retHighest); } /** * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` * which invokes `iteratee` for `value` and each element of `array` to compute * their sort ranking. The iteratee is invoked with one argument; (value). * * @private * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {Function} iteratee The iteratee invoked per element. * @param {boolean} [retHighest] Specify returning the highest qualified index. * @returns {number} Returns the index at which `value` should be inserted into `array`. */ function baseSortedIndexBy(array, value, iteratee, retHighest) { value = iteratee(value); var low = 0, high = array ? array.length : 0, valIsNaN = value !== value, valIsNull = value === null, valIsUndef = value === undefined; while (low < high) { var mid = nativeFloor((low + high) / 2), computed = iteratee(array[mid]), isDef = computed !== undefined, isReflexive = computed === computed; if (valIsNaN) { var setLow = isReflexive || retHighest; } else if (valIsNull) { setLow = isReflexive && isDef && (retHighest || computed != null); } else if (valIsUndef) { setLow = isReflexive && (retHighest || isDef); } else if (computed == null) { setLow = false; } else { setLow = retHighest ? (computed <= value) : (computed < value); } if (setLow) { low = mid + 1; } else { high = mid; } } return nativeMin(high, MAX_ARRAY_INDEX); } /** * The base implementation of `_.sortedUniq`. * * @private * @param {Array} array The array to inspect. * @returns {Array} Returns the new duplicate free array. */ function baseSortedUniq(array) { return baseSortedUniqBy(array); } /** * The base implementation of `_.sortedUniqBy` without support for iteratee * shorthands. * * @private * @param {Array} array The array to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @returns {Array} Returns the new duplicate free array. */ function baseSortedUniqBy(array, iteratee) { var index = 0, length = array.length, value = array[0], computed = iteratee ? iteratee(value) : value, seen = computed, resIndex = 0, result = [value]; while (++index < length) { value = array[index], computed = iteratee ? iteratee(value) : value; if (!eq(computed, seen)) { seen = computed; result[++resIndex] = value; } } return result; } /** * The base implementation of `_.toPath` which only converts `value` to a * path if it's not one. * * @private * @param {*} value The value to process. * @returns {Array} Returns the property path array. */ function baseToPath(value) { return isArray(value) ? value : stringToPath(value); } /** * The base implementation of `_.uniqBy` without support for iteratee shorthands. * * @private * @param {Array} array The array to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new duplicate free array. */ function baseUniq(array, iteratee, comparator) { var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result; if (comparator) { isCommon = false; includes = arrayIncludesWith; } else if (length >= LARGE_ARRAY_SIZE) { var set = iteratee ? null : createSet(array); if (set) { return setToArray(set); } isCommon = false; includes = cacheHas; seen = new SetCache; } else { seen = iteratee ? [] : result; } outer: while (++index < length) { var value = array[index], computed = iteratee ? iteratee(value) : value; if (isCommon && computed === computed) { var seenIndex = seen.length; while (seenIndex--) { if (seen[seenIndex] === computed) { continue outer; } } if (iteratee) { seen.push(computed); } result.push(value); } else if (!includes(seen, computed, comparator)) { if (seen !== result) { seen.push(computed); } result.push(value); } } return result; } /** * The base implementation of `_.unset`. * * @private * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to unset. * @returns {boolean} Returns `true` if the property is deleted, else `false`. */ function baseUnset(object, path) { path = isKey(path, object) ? [path + ''] : baseToPath(path); object = parent(object, path); var key = last(path); return (object != null && has(object, key)) ? delete object[key] : true; } /** * The base implementation of methods like `_.dropWhile` and `_.takeWhile` * without support for iteratee shorthands. * * @private * @param {Array} array The array to query. * @param {Function} predicate The function invoked per iteration. * @param {boolean} [isDrop] Specify dropping elements instead of taking them. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Array} Returns the slice of `array`. */ function baseWhile(array, predicate, isDrop, fromRight) { var length = array.length, index = fromRight ? length : -1; while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {} return isDrop ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); } /** * The base implementation of `wrapperValue` which returns the result of * performing a sequence of actions on the unwrapped `value`, where each * successive action is supplied the return value of the previous. * * @private * @param {*} value The unwrapped value. * @param {Array} actions Actions to perform to resolve the unwrapped value. * @returns {*} Returns the resolved value. */ function baseWrapperValue(value, actions) { var result = value; if (result instanceof LazyWrapper) { result = result.value(); } return arrayReduce(actions, function(result, action) { return action.func.apply(action.thisArg, arrayPush([result], action.args)); }, result); } /** * The base implementation of methods like `_.xor`, without support for * iteratee shorthands, that accepts an array of arrays to inspect. * * @private * @param {Array} arrays The arrays to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of values. */ function baseXor(arrays, iteratee, comparator) { var index = -1, length = arrays.length; while (++index < length) { var result = result ? arrayPush( baseDifference(result, arrays[index], iteratee, comparator), baseDifference(arrays[index], result, iteratee, comparator) ) : arrays[index]; } return (result && result.length) ? baseUniq(result, iteratee, comparator) : []; } /** * Creates a clone of `buffer`. * * @private * @param {ArrayBuffer} buffer The array buffer to clone. * @returns {ArrayBuffer} Returns the cloned array buffer. */ function cloneBuffer(buffer) { var Ctor = buffer.constructor, result = new Ctor(buffer.byteLength), view = new Uint8Array(result); view.set(new Uint8Array(buffer)); return result; } /** * Creates a clone of `map`. * * @private * @param {Object} map The map to clone. * @returns {Object} Returns the cloned map. */ function cloneMap(map) { var Ctor = map.constructor; return arrayReduce(mapToArray(map), addMapEntry, new Ctor); } /** * Creates a clone of `regexp`. * * @private * @param {Object} regexp The regexp to clone. * @returns {Object} Returns the cloned regexp. */ function cloneRegExp(regexp) { var Ctor = regexp.constructor, result = new Ctor(regexp.source, reFlags.exec(regexp)); result.lastIndex = regexp.lastIndex; return result; } /** * Creates a clone of `set`. * * @private * @param {Object} set The set to clone. * @returns {Object} Returns the cloned set. */ function cloneSet(set) { var Ctor = set.constructor; return arrayReduce(setToArray(set), addSetEntry, new Ctor); } /** * Creates a clone of the `symbol` object. * * @private * @param {Object} symbol The symbol object to clone. * @returns {Object} Returns the cloned symbol object. */ function cloneSymbol(symbol) { return _Symbol ? Object(symbolValueOf.call(symbol)) : {}; } /** * Creates a clone of `typedArray`. * * @private * @param {Object} typedArray The typed array to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { var buffer = typedArray.buffer, Ctor = typedArray.constructor; return new Ctor(isDeep ? cloneBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length); } /** * Creates an array that is the composition of partially applied arguments, * placeholders, and provided arguments into a single array of arguments. * * @private * @param {Array|Object} args The provided arguments. * @param {Array} partials The arguments to prepend to those provided. * @param {Array} holders The `partials` placeholder indexes. * @returns {Array} Returns the new array of composed arguments. */ function composeArgs(args, partials, holders) { var holdersLength = holders.length, argsIndex = -1, argsLength = nativeMax(args.length - holdersLength, 0), leftIndex = -1, leftLength = partials.length, result = Array(leftLength + argsLength); while (++leftIndex < leftLength) { result[leftIndex] = partials[leftIndex]; } while (++argsIndex < holdersLength) { result[holders[argsIndex]] = args[argsIndex]; } while (argsLength--) { result[leftIndex++] = args[argsIndex++]; } return result; } /** * This function is like `composeArgs` except that the arguments composition * is tailored for `_.partialRight`. * * @private * @param {Array|Object} args The provided arguments. * @param {Array} partials The arguments to append to those provided. * @param {Array} holders The `partials` placeholder indexes. * @returns {Array} Returns the new array of composed arguments. */ function composeArgsRight(args, partials, holders) { var holdersIndex = -1, holdersLength = holders.length, argsIndex = -1, argsLength = nativeMax(args.length - holdersLength, 0), rightIndex = -1, rightLength = partials.length, result = Array(argsLength + rightLength); while (++argsIndex < argsLength) { result[argsIndex] = args[argsIndex]; } var offset = argsIndex; while (++rightIndex < rightLength) { result[offset + rightIndex] = partials[rightIndex]; } while (++holdersIndex < holdersLength) { result[offset + holders[holdersIndex]] = args[argsIndex++]; } return result; } /** * Copies the values of `source` to `array`. * * @private * @param {Array} source The array to copy values from. * @param {Array} [array=[]] The array to copy values to. * @returns {Array} Returns `array`. */ function copyArray(source, array) { var index = -1, length = source.length; array || (array = Array(length)); while (++index < length) { array[index] = source[index]; } return array; } /** * Copies properties of `source` to `object`. * * @private * @param {Object} source The object to copy properties from. * @param {Array} props The property names to copy. * @param {Object} [object={}] The object to copy properties to. * @returns {Object} Returns `object`. */ function copyObject(source, props, object) { return copyObjectWith(source, props, object); } /** * This function is like `copyObject` except that it accepts a function to * customize copied values. * * @private * @param {Object} source The object to copy properties from. * @param {Array} props The property names to copy. * @param {Object} [object={}] The object to copy properties to. * @param {Function} [customizer] The function to customize copied values. * @returns {Object} Returns `object`. */ function copyObjectWith(source, props, object, customizer) { object || (object = {}); var index = -1, length = props.length; while (++index < length) { var key = props[index], newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key]; assignValue(object, key, newValue); } return object; } /** * Copies own symbol properties of `source` to `object`. * * @private * @param {Object} source The object to copy symbols from. * @param {Object} [object={}] The object to copy symbols to. * @returns {Object} Returns `object`. */ function copySymbols(source, object) { return copyObject(source, getSymbols(source), object); } /** * Creates a function like `_.groupBy`. * * @private * @param {Function} setter The function to set keys and values of the accumulator object. * @param {Function} [initializer] The function to initialize the accumulator object. * @returns {Function} Returns the new aggregator function. */ function createAggregator(setter, initializer) { return function(collection, iteratee) { var result = initializer ? initializer() : {}; iteratee = getIteratee(iteratee); if (isArray(collection)) { var index = -1, length = collection.length; while (++index < length) { var value = collection[index]; setter(result, value, iteratee(value), collection); } } else { baseEach(collection, function(value, key, collection) { setter(result, value, iteratee(value), collection); }); } return result; }; } /** * Creates a function like `_.assign`. * * @private * @param {Function} assigner The function to assign values. * @returns {Function} Returns the new assigner function. */ function createAssigner(assigner) { return rest(function(object, sources) { var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined, guard = length > 2 ? sources[2] : undefined; customizer = typeof customizer == 'function' ? (length--, customizer) : undefined; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; length = 1; } object = Object(object); while (++index < length) { var source = sources[index]; if (source) { assigner(object, source, customizer); } } return object; }); } /** * Creates a `baseEach` or `baseEachRight` function. * * @private * @param {Function} eachFunc The function to iterate over a collection. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new base function. */ function createBaseEach(eachFunc, fromRight) { return function(collection, iteratee) { if (collection == null) { return collection; } if (!isArrayLike(collection)) { return eachFunc(collection, iteratee); } var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection); while ((fromRight ? index-- : ++index < length)) { if (iteratee(iterable[index], index, iterable) === false) { break; } } return collection; }; } /** * Creates a base function for methods like `_.forIn`. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new base function. */ function createBaseFor(fromRight) { return function(object, iteratee, keysFunc) { var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length; while (length--) { var key = props[fromRight ? length : ++index]; if (iteratee(iterable[key], key, iterable) === false) { break; } } return object; }; } /** * Creates a function that wraps `func` to invoke it with the optional `this` * binding of `thisArg`. * * @private * @param {Function} func The function to wrap. * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. * @param {*} [thisArg] The `this` binding of `func`. * @returns {Function} Returns the new wrapped function. */ function createBaseWrapper(func, bitmask, thisArg) { var isBind = bitmask & BIND_FLAG, Ctor = createCtorWrapper(func); function wrapper() { var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; return fn.apply(isBind ? thisArg : this, arguments); } return wrapper; } /** * Creates a function like `_.lowerFirst`. * * @private * @param {string} methodName The name of the `String` case method to use. * @returns {Function} Returns the new function. */ function createCaseFirst(methodName) { return function(string) { string = toString(string); var strSymbols = reHasComplexSymbol.test(string) ? stringToArray(string) : undefined, chr = strSymbols ? strSymbols[0] : string.charAt(0), trailing = strSymbols ? strSymbols.slice(1).join('') : string.slice(1); return chr[methodName]() + trailing; }; } /** * Creates a function like `_.camelCase`. * * @private * @param {Function} callback The function to combine each word. * @returns {Function} Returns the new compounder function. */ function createCompounder(callback) { return function(string) { return arrayReduce(words(deburr(string)), callback, ''); }; } /** * Creates a function that produces an instance of `Ctor` regardless of * whether it was invoked as part of a `new` expression or by `call` or `apply`. * * @private * @param {Function} Ctor The constructor to wrap. * @returns {Function} Returns the new wrapped function. */ function createCtorWrapper(Ctor) { return function() { // Use a `switch` statement to work with class constructors. // See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist // for more details. var args = arguments; switch (args.length) { case 0: return new Ctor; case 1: return new Ctor(args[0]); case 2: return new Ctor(args[0], args[1]); case 3: return new Ctor(args[0], args[1], args[2]); case 4: return new Ctor(args[0], args[1], args[2], args[3]); case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); } var thisBinding = baseCreate(Ctor.prototype), result = Ctor.apply(thisBinding, args); // Mimic the constructor's `return` behavior. // See https://es5.github.io/#x13.2.2 for more details. return isObject(result) ? result : thisBinding; }; } /** * Creates a function that wraps `func` to enable currying. * * @private * @param {Function} func The function to wrap. * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. * @param {number} arity The arity of `func`. * @returns {Function} Returns the new wrapped function. */ function createCurryWrapper(func, bitmask, arity) { var Ctor = createCtorWrapper(func); function wrapper() { var length = arguments.length, index = length, args = Array(length), fn = (this && this !== root && this instanceof wrapper) ? Ctor : func, placeholder = wrapper.placeholder; while (index--) { args[index] = arguments[index]; } var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) ? [] : replaceHolders(args, placeholder); length -= holders.length; return length < arity ? createRecurryWrapper(func, bitmask, createHybridWrapper, placeholder, undefined, args, holders, undefined, undefined, arity - length) : apply(fn, this, args); } return wrapper; } /** * Creates a `_.flow` or `_.flowRight` function. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new flow function. */ function createFlow(fromRight) { return rest(function(funcs) { funcs = baseFlatten(funcs); var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru; if (fromRight) { funcs.reverse(); } while (index--) { var func = funcs[index]; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } if (prereq && !wrapper && getFuncName(func) == 'wrapper') { var wrapper = new LodashWrapper([], true); } } index = wrapper ? index : length; while (++index < length) { func = funcs[index]; var funcName = getFuncName(func), data = funcName == 'wrapper' ? getData(func) : undefined; if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) { wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); } else { wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func); } } return function() { var args = arguments, value = args[0]; if (wrapper && args.length == 1 && isArray(value) && value.length >= LARGE_ARRAY_SIZE) { return wrapper.plant(value).value(); } var index = 0, result = length ? funcs[index].apply(this, args) : value; while (++index < length) { result = funcs[index].call(this, result); } return result; }; }); } /** * Creates a function that wraps `func` to invoke it with optional `this` * binding of `thisArg`, partial application, and currying. * * @private * @param {Function|string} func The function or method name to wrap. * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. * @param {*} [thisArg] The `this` binding of `func`. * @param {Array} [partials] The arguments to prepend to those provided to the new function. * @param {Array} [holders] The `partials` placeholder indexes. * @param {Array} [partialsRight] The arguments to append to those provided to the new function. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. * @param {Array} [argPos] The argument positions of the new function. * @param {number} [ary] The arity cap of `func`. * @param {number} [arity] The arity of `func`. * @returns {Function} Returns the new wrapped function. */ function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { var isAry = bitmask & ARY_FLAG, isBind = bitmask & BIND_FLAG, isBindKey = bitmask & BIND_KEY_FLAG, isCurry = bitmask & CURRY_FLAG, isCurryRight = bitmask & CURRY_RIGHT_FLAG, isFlip = bitmask & FLIP_FLAG, Ctor = isBindKey ? undefined : createCtorWrapper(func); function wrapper() { var length = arguments.length, index = length, args = Array(length); while (index--) { args[index] = arguments[index]; } if (partials) { args = composeArgs(args, partials, holders); } if (partialsRight) { args = composeArgsRight(args, partialsRight, holdersRight); } if (isCurry || isCurryRight) { var placeholder = wrapper.placeholder, argsHolders = replaceHolders(args, placeholder); length -= argsHolders.length; if (length < arity) { return createRecurryWrapper(func, bitmask, createHybridWrapper, placeholder, thisArg, args, argsHolders, argPos, ary, arity - length); } } var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func; if (argPos) { args = reorder(args, argPos); } else if (isFlip && args.length > 1) { args.reverse(); } if (isAry && ary < args.length) { args.length = ary; } if (this && this !== root && this instanceof wrapper) { fn = Ctor || createCtorWrapper(fn); } return fn.apply(thisBinding, args); } return wrapper; } /** * Creates a function like `_.over`. * * @private * @param {Function} arrayFunc The function to iterate over iteratees. * @returns {Function} Returns the new invoker function. */ function createOver(arrayFunc) { return rest(function(iteratees) { iteratees = arrayMap(baseFlatten(iteratees), getIteratee()); return rest(function(args) { var thisArg = this; return arrayFunc(iteratees, function(iteratee) { return apply(iteratee, thisArg, args); }); }); }); } /** * Creates the padding for `string` based on `length`. The `chars` string * is truncated if the number of characters exceeds `length`. * * @private * @param {string} string The string to create padding for. * @param {number} [length=0] The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padding for `string`. */ function createPadding(string, length, chars) { length = toInteger(length); var strLength = stringSize(string); if (!length || strLength >= length) { return ''; } var padLength = length - strLength; chars = chars === undefined ? ' ' : (chars + ''); var result = repeat(chars, nativeCeil(padLength / stringSize(chars))); return reHasComplexSymbol.test(chars) ? stringToArray(result).slice(0, padLength).join('') : result.slice(0, padLength); } /** * Creates a function that wraps `func` to invoke it with the optional `this` * binding of `thisArg` and the `partials` prepended to those provided to * the wrapper. * * @private * @param {Function} func The function to wrap. * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. * @param {*} thisArg The `this` binding of `func`. * @param {Array} partials The arguments to prepend to those provided to the new function. * @returns {Function} Returns the new wrapped function. */ function createPartialWrapper(func, bitmask, thisArg, partials) { var isBind = bitmask & BIND_FLAG, Ctor = createCtorWrapper(func); function wrapper() { var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array(leftLength + argsLength), fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; while (++leftIndex < leftLength) { args[leftIndex] = partials[leftIndex]; } while (argsLength--) { args[leftIndex++] = arguments[++argsIndex]; } return apply(fn, isBind ? thisArg : this, args); } return wrapper; } /** * Creates a `_.range` or `_.rangeRight` function. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new range function. */ function createRange(fromRight) { return function(start, end, step) { if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { end = step = undefined; } // Ensure the sign of `-0` is preserved. start = toNumber(start); start = start === start ? start : 0; if (end === undefined) { end = start; start = 0; } else { end = toNumber(end) || 0; } step = step === undefined ? (start < end ? 1 : -1) : (toNumber(step) || 0); return baseRange(start, end, step, fromRight); }; } /** * Creates a function that wraps `func` to continue currying. * * @private * @param {Function} func The function to wrap. * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. * @param {Function} wrapFunc The function to create the `func` wrapper. * @param {*} placeholder The placeholder to replace. * @param {*} [thisArg] The `this` binding of `func`. * @param {Array} [partials] The arguments to prepend to those provided to the new function. * @param {Array} [holders] The `partials` placeholder indexes. * @param {Array} [argPos] The argument positions of the new function. * @param {number} [ary] The arity cap of `func`. * @param {number} [arity] The arity of `func`. * @returns {Function} Returns the new wrapped function. */ function createRecurryWrapper(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { var isCurry = bitmask & CURRY_FLAG, newArgPos = argPos ? copyArray(argPos) : undefined, newsHolders = isCurry ? holders : undefined, newHoldersRight = isCurry ? undefined : holders, newPartials = isCurry ? partials : undefined, newPartialsRight = isCurry ? undefined : partials; bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG); bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG); if (!(bitmask & CURRY_BOUND_FLAG)) { bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); } var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, arity], result = wrapFunc.apply(undefined, newData); if (isLaziable(func)) { setData(result, newData); } result.placeholder = placeholder; return result; } /** * Creates a function like `_.round`. * * @private * @param {string} methodName The name of the `Math` method to use when rounding. * @returns {Function} Returns the new round function. */ function createRound(methodName) { var func = Math[methodName]; return function(number, precision) { number = toNumber(number); precision = toInteger(precision); if (precision) { // Shift with exponential notation to avoid floating-point issues. // See [MDN](https://mdn.io/round#Examples) for more details. var pair = (toString(number) + 'e').split('e'), value = func(pair[0] + 'e' + (+pair[1] + precision)); pair = (toString(value) + 'e').split('e'); return +(pair[0] + 'e' + (+pair[1] - precision)); } return func(number); }; } /** * Creates a set of `values`. * * @private * @param {Array} values The values to add to the set. * @returns {Object} Returns the new set. */ var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) { return new Set(values); }; /** * Creates a function that either curries or invokes `func` with optional * `this` binding and partially applied arguments. * * @private * @param {Function|string} func The function or method name to wrap. * @param {number} bitmask The bitmask of wrapper flags. * The bitmask may be composed of the following flags: * 1 - `_.bind` * 2 - `_.bindKey` * 4 - `_.curry` or `_.curryRight` of a bound function * 8 - `_.curry` * 16 - `_.curryRight` * 32 - `_.partial` * 64 - `_.partialRight` * 128 - `_.rearg` * 256 - `_.ary` * @param {*} [thisArg] The `this` binding of `func`. * @param {Array} [partials] The arguments to be partially applied. * @param {Array} [holders] The `partials` placeholder indexes. * @param {Array} [argPos] The argument positions of the new function. * @param {number} [ary] The arity cap of `func`. * @param {number} [arity] The arity of `func`. * @returns {Function} Returns the new wrapped function. */ function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { var isBindKey = bitmask & BIND_KEY_FLAG; if (!isBindKey && typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } var length = partials ? partials.length : 0; if (!length) { bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); partials = holders = undefined; } ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); arity = arity === undefined ? arity : toInteger(arity); length -= holders ? holders.length : 0; if (bitmask & PARTIAL_RIGHT_FLAG) { var partialsRight = partials, holdersRight = holders; partials = holders = undefined; } var data = isBindKey ? undefined : getData(func), newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity]; if (data) { mergeData(newData, data); } func = newData[0]; bitmask = newData[1]; thisArg = newData[2]; partials = newData[3]; holders = newData[4]; arity = newData[9] = newData[9] == null ? (isBindKey ? 0 : func.length) : nativeMax(newData[9] - length, 0); if (!arity && bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG)) { bitmask &= ~(CURRY_FLAG | CURRY_RIGHT_FLAG); } if (!bitmask || bitmask == BIND_FLAG) { var result = createBaseWrapper(func, bitmask, thisArg); } else if (bitmask == CURRY_FLAG || bitmask == CURRY_RIGHT_FLAG) { result = createCurryWrapper(func, bitmask, arity); } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !holders.length) { result = createPartialWrapper(func, bitmask, thisArg, partials); } else { result = createHybridWrapper.apply(undefined, newData); } var setter = data ? baseSetData : setData; return setter(result, newData); } /** * A specialized version of `baseIsEqualDeep` for arrays with support for * partial deep comparisons. * * @private * @param {Array} array The array to compare. * @param {Array} other The other array to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} [customizer] The function to customize comparisons. * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. * @param {Object} [stack] Tracks traversed `array` and `other` objects. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { var index = -1, isPartial = bitmask & PARTIAL_COMPARE_FLAG, isUnordered = bitmask & UNORDERED_COMPARE_FLAG, arrLength = array.length, othLength = other.length; if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } // Assume cyclic values are equal. var stacked = stack.get(array); if (stacked) { return stacked == other; } var result = true; stack.set(array, other); // Ignore non-index properties. while (++index < arrLength) { var arrValue = array[index], othValue = other[index]; if (customizer) { var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { continue; } result = false; break; } // Recursively compare arrays (susceptible to call stack limits). if (isUnordered) { if (!arraySome(other, function(othValue) { return arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack); })) { result = false; break; } } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { result = false; break; } } stack['delete'](array); return result; } /** * A specialized version of `baseIsEqualDeep` for comparing objects of * the same `toStringTag`. * * **Note:** This function only supports comparing values with tags of * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {string} tag The `toStringTag` of the objects to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} [customizer] The function to customize comparisons. * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalByTag(object, other, tag, equalFunc, customizer, bitmask) { switch (tag) { case arrayBufferTag: if ((object.byteLength != other.byteLength) || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { return false; } return true; case boolTag: case dateTag: // Coerce dates and booleans to numbers, dates to milliseconds and booleans // to `1` or `0` treating invalid dates coerced to `NaN` as not equal. return +object == +other; case errorTag: return object.name == other.name && object.message == other.message; case numberTag: // Treat `NaN` vs. `NaN` as equal. return (object != +object) ? other != +other : object == +other; case regexpTag: case stringTag: // Coerce regexes to strings and treat strings primitives and string // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. return object == (other + ''); case mapTag: var convert = mapToArray; case setTag: var isPartial = bitmask & PARTIAL_COMPARE_FLAG; convert || (convert = setToArray); // Recursively compare objects (susceptible to call stack limits). return (isPartial || object.size == other.size) && equalFunc(convert(object), convert(other), customizer, bitmask | UNORDERED_COMPARE_FLAG); case symbolTag: return !!_Symbol && (symbolValueOf.call(object) == symbolValueOf.call(other)); } return false; } /** * A specialized version of `baseIsEqualDeep` for objects with support for * partial deep comparisons. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} [customizer] The function to customize comparisons. * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. * @param {Object} [stack] Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { var isPartial = bitmask & PARTIAL_COMPARE_FLAG, isUnordered = bitmask & UNORDERED_COMPARE_FLAG, objProps = keys(object), objLength = objProps.length, othProps = keys(other), othLength = othProps.length; if (objLength != othLength && !isPartial) { return false; } var index = objLength; while (index--) { var key = objProps[index]; if (!(isPartial ? key in other : baseHas(other, key)) || !(isUnordered || key == othProps[index])) { return false; } } // Assume cyclic values are equal. var stacked = stack.get(object); if (stacked) { return stacked == other; } var result = true; stack.set(object, other); var skipCtor = isPartial; while (++index < objLength) { key = objProps[index]; var objValue = object[key], othValue = other[key]; if (customizer) { var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack)) : compared )) { result = false; break; } skipCtor || (skipCtor = key == 'constructor'); } if (result && !skipCtor) { var objCtor = object.constructor, othCtor = other.constructor; // Non `Object` object instances with different constructors are not equal. if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } stack['delete'](object); return result; } /** * Gets metadata for `func`. * * @private * @param {Function} func The function to query. * @returns {*} Returns the metadata for `func`. */ var getData = !metaMap ? noop : function(func) { return metaMap.get(func); }; /** * Gets the name of `func`. * * @private * @param {Function} func The function to query. * @returns {string} Returns the function name. */ function getFuncName(func) { var result = (func.name + ''), array = realNames[result], length = array ? array.length : 0; while (length--) { var data = array[length], otherFunc = data.func; if (otherFunc == null || otherFunc == func) { return data.name; } } return result; } /** * Gets the appropriate "iteratee" function. If the `_.iteratee` method is * customized this function returns the custom method, otherwise it returns * `baseIteratee`. If arguments are provided the chosen function is invoked * with them and its result is returned. * * @private * @param {*} [value] The value to convert to an iteratee. * @param {number} [arity] The arity of the created iteratee. * @returns {Function} Returns the chosen function or its result. */ function getIteratee() { var result = lodash.iteratee || iteratee; result = result === iteratee ? baseIteratee : result; return arguments.length ? result(arguments[0], arguments[1]) : result; } /** * Gets the "length" property value of `object`. * * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) * that affects Safari on at least iOS 8.1-8.3 ARM64. * * @private * @param {Object} object The object to query. * @returns {*} Returns the "length" value. */ var getLength = baseProperty('length'); /** * Gets the property names, values, and compare flags of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the match data of `object`. */ function getMatchData(object) { var result = toPairs(object), length = result.length; while (length--) { result[length][2] = isStrictComparable(result[length][1]); } return result; } /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = object == null ? undefined : object[key]; return isNative(value) ? value : undefined; } /** * Creates an array of the own symbol properties of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ var getSymbols = getOwnPropertySymbols || function() { return []; }; /** * Gets the `toStringTag` of `value`. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function getTag(value) { return objectToString.call(value); } // Fallback for IE 11 providing `toStringTag` values for maps and sets. if ((Map && getTag(new Map) != mapTag) || (Set && getTag(new Set) != setTag)) { getTag = function(value) { var result = objectToString.call(value), Ctor = result == objectTag ? value.constructor : null, ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : ''; if (ctorString) { if (ctorString == mapCtorString) { return mapTag; } if (ctorString == setCtorString) { return setTag; } } return result; }; } /** * Gets the view, applying any `transforms` to the `start` and `end` positions. * * @private * @param {number} start The start of the view. * @param {number} end The end of the view. * @param {Array} transforms The transformations to apply to the view. * @returns {Object} Returns an object containing the `start` and `end` * positions of the view. */ function getView(start, end, transforms) { var index = -1, length = transforms.length; while (++index < length) { var data = transforms[index], size = data.size; switch (data.type) { case 'drop': start += size; break; case 'dropRight': end -= size; break; case 'take': end = nativeMin(end, start + size); break; case 'takeRight': start = nativeMax(start, end - size); break; } } return { 'start': start, 'end': end }; } /** * Checks if `path` exists on `object`. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @param {Function} hasFunc The function to check properties. * @returns {boolean} Returns `true` if `path` exists, else `false`. */ function hasPath(object, path, hasFunc) { if (object == null) { return false; } var result = hasFunc(object, path); if (!result && !isKey(path)) { path = baseToPath(path); object = parent(object, path); if (object != null) { path = last(path); result = hasFunc(object, path); } } return result || (isLength(object && object.length) && isIndex(path, object.length) && (isArray(object) || isString(object) || isArguments(object))); } /** * Initializes an array clone. * * @private * @param {Array} array The array to clone. * @returns {Array} Returns the initialized clone. */ function initCloneArray(array) { var length = array.length, result = array.constructor(length); // Add properties assigned by `RegExp#exec`. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { result.index = array.index; result.input = array.input; } return result; } /** * Initializes an object clone. * * @private * @param {Object} object The object to clone. * @returns {Object} Returns the initialized clone. */ function initCloneObject(object) { var Ctor = object.constructor; return baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined); } /** * Initializes an object clone based on its `toStringTag`. * * **Note:** This function only supports cloning values with tags of * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private * @param {Object} object The object to clone. * @param {string} tag The `toStringTag` of the object to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the initialized clone. */ function initCloneByTag(object, tag, isDeep) { var Ctor = object.constructor; switch (tag) { case arrayBufferTag: return cloneBuffer(object); case boolTag: case dateTag: return new Ctor(+object); case float32Tag: case float64Tag: case int8Tag: case int16Tag: case int32Tag: case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: return cloneTypedArray(object, isDeep); case mapTag: return cloneMap(object); case numberTag: case stringTag: return new Ctor(object); case regexpTag: return cloneRegExp(object); case setTag: return cloneSet(object); case symbolTag: return cloneSymbol(object); } } /** * Creates an array of index keys for `object` values of arrays, * `arguments` objects, and strings, otherwise `null` is returned. * * @private * @param {Object} object The object to query. * @returns {Array|null} Returns index keys, else `null`. */ function indexKeys(object) { var length = object ? object.length : undefined; return (isLength(length) && (isArray(object) || isString(object) || isArguments(object))) ? baseTimes(length, String) : null; } /** * Checks if the provided arguments are from an iteratee call. * * @private * @param {*} value The potential iteratee value argument. * @param {*} index The potential iteratee index or key argument. * @param {*} object The potential iteratee object argument. * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`. */ function isIterateeCall(value, index, object) { if (!isObject(object)) { return false; } var type = typeof index; if (type == 'number' ? (isArrayLike(object) && isIndex(index, object.length)) : (type == 'string' && index in object)) { return eq(object[index], value); } return false; } /** * Checks if `value` is a property name and not a property path. * * @private * @param {*} value The value to check. * @param {Object} [object] The object to query keys on. * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { if (typeof value == 'number') { return true; } return !isArray(value) && (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object))); } /** * Checks if `value` is suitable for use as unique object key. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is suitable, else `false`. */ function isKeyable(value) { var type = typeof value; return type == 'number' || type == 'boolean' || (type == 'string' && value !== '__proto__') || value == null; } /** * Checks if `func` has a lazy counterpart. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`. */ function isLaziable(func) { var funcName = getFuncName(func), other = lodash[funcName]; if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { return false; } if (func === other) { return true; } var data = getData(other); return !!data && func === data[0]; } /** * Checks if `value` is likely a prototype object. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. */ function isPrototype(value) { var Ctor = value && value.constructor, proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; return value === proto; } /** * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` if suitable for strict * equality comparisons, else `false`. */ function isStrictComparable(value) { return value === value && !isObject(value); } /** * Merges the function metadata of `source` into `data`. * * Merging metadata reduces the number of wrappers used to invoke a function. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` * may be applied regardless of execution order. Methods like `_.ary` and `_.rearg` * modify function arguments, making the order in which they are executed important, * preventing the merging of metadata. However, we make an exception for a safe * combined case where curried functions have `_.ary` and or `_.rearg` applied. * * @private * @param {Array} data The destination metadata. * @param {Array} source The source metadata. * @returns {Array} Returns `data`. */ function mergeData(data, source) { var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (BIND_FLAG | BIND_KEY_FLAG | ARY_FLAG); var isCombo = (srcBitmask == ARY_FLAG && (bitmask == CURRY_FLAG)) || (srcBitmask == ARY_FLAG && (bitmask == REARG_FLAG) && (data[7].length <= source[8])) || (srcBitmask == (ARY_FLAG | REARG_FLAG) && (source[7].length <= source[8]) && (bitmask == CURRY_FLAG)); // Exit early if metadata can't be merged. if (!(isCommon || isCombo)) { return data; } // Use source `thisArg` if available. if (srcBitmask & BIND_FLAG) { data[2] = source[2]; // Set when currying a bound function. newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG; } // Compose partial arguments. var value = source[3]; if (value) { var partials = data[3]; data[3] = partials ? composeArgs(partials, value, source[4]) : copyArray(value); data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : copyArray(source[4]); } // Compose partial right arguments. value = source[5]; if (value) { partials = data[5]; data[5] = partials ? composeArgsRight(partials, value, source[6]) : copyArray(value); data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : copyArray(source[6]); } // Use source `argPos` if available. value = source[7]; if (value) { data[7] = copyArray(value); } // Use source `ary` if it's smaller. if (srcBitmask & ARY_FLAG) { data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); } // Use source `arity` if one is not provided. if (data[9] == null) { data[9] = source[9]; } // Use source `func` and merge bitmasks. data[0] = source[0]; data[1] = newBitmask; return data; } /** * Used by `_.defaultsDeep` to customize its `_.merge` use. * * @private * @param {*} objValue The destination value. * @param {*} srcValue The source value. * @param {string} key The key of the property to merge. * @param {Object} object The parent object of `objValue`. * @param {Object} source The parent object of `srcValue`. * @param {Object} [stack] Tracks traversed source values and their merged counterparts. * @returns {*} Returns the value to assign. */ function mergeDefaults(objValue, srcValue, key, object, source, stack) { if (isObject(objValue) && isObject(srcValue)) { stack.set(srcValue, objValue); baseMerge(objValue, srcValue, mergeDefaults, stack); } return objValue === undefined ? baseClone(srcValue) : objValue; } /** * Gets the parent value at `path` of `object`. * * @private * @param {Object} object The object to query. * @param {Array} path The path to get the parent value of. * @returns {*} Returns the parent value. */ function parent(object, path) { return path.length == 1 ? object : get(object, baseSlice(path, 0, -1)); } /** * Reorder `array` according to the specified indexes where the element at * the first index is assigned as the first element, the element at * the second index is assigned as the second element, and so on. * * @private * @param {Array} array The array to reorder. * @param {Array} indexes The arranged array indexes. * @returns {Array} Returns `array`. */ function reorder(array, indexes) { var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array); while (length--) { var index = indexes[length]; array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; } return array; } /** * Sets metadata for `func`. * * **Note:** If this function becomes hot, i.e. is invoked a lot in a short * period of time, it will trip its breaker and transition to an identity function * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070) * for more details. * * @private * @param {Function} func The function to associate metadata with. * @param {*} data The metadata. * @returns {Function} Returns `func`. */ var setData = (function() { var count = 0, lastCalled = 0; return function(key, value) { var stamp = now(), remaining = HOT_SPAN - (stamp - lastCalled); lastCalled = stamp; if (remaining > 0) { if (++count >= HOT_COUNT) { return key; } } else { count = 0; } return baseSetData(key, value); }; }()); /** * Converts `string` to a property path array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the property path array. */ function stringToPath(string) { var result = []; toString(string).replace(rePropName, function(match, number, quote, string) { result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); }); return result; } /** * Converts `value` to an array-like object if it's not one. * * @private * @param {*} value The value to process. * @returns {Array} Returns the array-like object. */ function toArrayLikeObject(value) { return isArrayLikeObject(value) ? value : []; } /** * Converts `value` to a function if it's not one. * * @private * @param {*} value The value to process. * @returns {Function} Returns the function. */ function toFunction(value) { return typeof value == 'function' ? value : identity; } /** * Creates a clone of `wrapper`. * * @private * @param {Object} wrapper The wrapper to clone. * @returns {Object} Returns the cloned wrapper. */ function wrapperClone(wrapper) { if (wrapper instanceof LazyWrapper) { return wrapper.clone(); } var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); result.__actions__ = copyArray(wrapper.__actions__); result.__index__ = wrapper.__index__; result.__values__ = wrapper.__values__; return result; } /*------------------------------------------------------------------------*/ /** * Creates an array of elements split into groups the length of `size`. * If `array` can't be split evenly, the final chunk will be the remaining * elements. * * @static * @memberOf _ * @category Array * @param {Array} array The array to process. * @param {number} [size=0] The length of each chunk. * @returns {Array} Returns the new array containing chunks. * @example * * _.chunk(['a', 'b', 'c', 'd'], 2); * // => [['a', 'b'], ['c', 'd']] * * _.chunk(['a', 'b', 'c', 'd'], 3); * // => [['a', 'b', 'c'], ['d']] */ function chunk(array, size) { size = nativeMax(toInteger(size), 0); var length = array ? array.length : 0; if (!length || size < 1) { return []; } var index = 0, resIndex = -1, result = Array(nativeCeil(length / size)); while (index < length) { result[++resIndex] = baseSlice(array, index, (index += size)); } return result; } /** * Creates an array with all falsey values removed. The values `false`, `null`, * `0`, `""`, `undefined`, and `NaN` are falsey. * * @static * @memberOf _ * @category Array * @param {Array} array The array to compact. * @returns {Array} Returns the new array of filtered values. * @example * * _.compact([0, 1, false, 2, '', 3]); * // => [1, 2, 3] */ function compact(array) { var index = -1, length = array ? array.length : 0, resIndex = -1, result = []; while (++index < length) { var value = array[index]; if (value) { result[++resIndex] = value; } } return result; } /** * Creates a new array concatenating `array` with any additional arrays * and/or values. * * @static * @memberOf _ * @category Array * @param {Array} array The array to concatenate. * @param {...*} [values] The values to concatenate. * @returns {Array} Returns the new concatenated array. * @example * * var array = [1]; * var other = _.concat(array, 2, [3], [[4]]); * * console.log(other); * // => [1, 2, 3, [4]] * * console.log(array); * // => [1] */ var concat = rest(function(array, values) { values = baseFlatten(values); return arrayConcat(isArray(array) ? array : [Object(array)], values); }); /** * Creates an array of unique `array` values not included in the other * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The values to exclude. * @returns {Array} Returns the new array of filtered values. * @example * * _.difference([3, 2, 1], [4, 2]); * // => [3, 1] */ var difference = rest(function(array, values) { return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, false, true)) : []; }); /** * This method is like `_.difference` except that it accepts `iteratee` which * is invoked for each element of `array` and `values` to generate the criterion * by which uniqueness is computed. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The values to exclude. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new array of filtered values. * @example * * _.differenceBy([3.1, 2.2, 1.3], [4.4, 2.5], Math.floor); * // => [3.1, 1.3] * * // using the `_.property` iteratee shorthand * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); * // => [{ 'x': 2 }] */ var differenceBy = rest(function(array, values) { var iteratee = last(values); if (isArrayLikeObject(iteratee)) { iteratee = undefined; } return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, false, true), getIteratee(iteratee)) : []; }); /** * This method is like `_.difference` except that it accepts `comparator` * which is invoked to compare elements of `array` to `values`. The comparator * is invoked with two arguments: (arrVal, othVal). * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The values to exclude. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of filtered values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; * * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); * // => [{ 'x': 2, 'y': 1 }] */ var differenceWith = rest(function(array, values) { var comparator = last(values); if (isArrayLikeObject(comparator)) { comparator = undefined; } return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, false, true), undefined, comparator) : []; }); /** * Creates a slice of `array` with `n` elements dropped from the beginning. * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to drop. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * * _.drop([1, 2, 3]); * // => [2, 3] * * _.drop([1, 2, 3], 2); * // => [3] * * _.drop([1, 2, 3], 5); * // => [] * * _.drop([1, 2, 3], 0); * // => [1, 2, 3] */ function drop(array, n, guard) { if (!(array && array.length)) { return []; } n = (guard || n === undefined) ? 1 : n; return baseSlice(array, n < 0 ? 0 : n); } /** * Creates a slice of `array` with `n` elements dropped from the end. * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to drop. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * * _.dropRight([1, 2, 3]); * // => [1, 2] * * _.dropRight([1, 2, 3], 2); * // => [1] * * _.dropRight([1, 2, 3], 5); * // => [] * * _.dropRight([1, 2, 3], 0); * // => [1, 2, 3] */ function dropRight(array, n, guard) { var length = array ? array.length : 0; if (!length) { return []; } n = (guard || n === undefined) ? 1 : toInteger(n); n = length - n; return baseSlice(array, 0, n < 0 ? 0 : n); } /** * Creates a slice of `array` excluding elements dropped from the end. * Elements are dropped until `predicate` returns falsey. The predicate is * invoked with three arguments: (value, index, array). * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * * var resolve = _.partial(_.map, _, 'user'); * * var users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': false } * ]; * * resolve( _.dropRightWhile(users, function(o) { return !o.active; }) ); * // => ['barney'] * * // using the `_.matches` iteratee shorthand * resolve( _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }) ); * // => ['barney', 'fred'] * * // using the `_.matchesProperty` iteratee shorthand * resolve( _.dropRightWhile(users, ['active', false]) ); * // => ['barney'] * * // using the `_.property` iteratee shorthand * resolve( _.dropRightWhile(users, 'active') ); * // => ['barney', 'fred', 'pebbles'] */ function dropRightWhile(array, predicate) { return (array && array.length) ? baseWhile(array, getIteratee(predicate, 3), true, true) : []; } /** * Creates a slice of `array` excluding elements dropped from the beginning. * Elements are dropped until `predicate` returns falsey. The predicate is * invoked with three arguments: (value, index, array). * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * * var resolve = _.partial(_.map, _, 'user'); * * var users = [ * { 'user': 'barney', 'active': false }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': true } * ]; * * resolve( _.dropWhile(users, function(o) { return !o.active; }) ); * // => ['pebbles'] * * // using the `_.matches` iteratee shorthand * resolve( _.dropWhile(users, { 'user': 'barney', 'active': false }) ); * // => ['fred', 'pebbles'] * * // using the `_.matchesProperty` iteratee shorthand * resolve( _.dropWhile(users, ['active', false]) ); * // => ['pebbles'] * * // using the `_.property` iteratee shorthand * resolve( _.dropWhile(users, 'active') ); * // => ['barney', 'fred', 'pebbles'] */ function dropWhile(array, predicate) { return (array && array.length) ? baseWhile(array, getIteratee(predicate, 3), true) : []; } /** * Fills elements of `array` with `value` from `start` up to, but not * including, `end`. * * **Note:** This method mutates `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to fill. * @param {*} value The value to fill `array` with. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns `array`. * @example * * var array = [1, 2, 3]; * * _.fill(array, 'a'); * console.log(array); * // => ['a', 'a', 'a'] * * _.fill(Array(3), 2); * // => [2, 2, 2] * * _.fill([4, 6, 8, 10], '*', 1, 3); * // => [4, '*', '*', 10] */ function fill(array, value, start, end) { var length = array ? array.length : 0; if (!length) { return []; } if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { start = 0; end = length; } return baseFill(array, value, start, end); } /** * This method is like `_.find` except that it returns the index of the first * element `predicate` returns truthy for instead of the element itself. * * @static * @memberOf _ * @category Array * @param {Array} array The array to search. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {number} Returns the index of the found element, else `-1`. * @example * * var users = [ * { 'user': 'barney', 'active': false }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': true } * ]; * * _.findIndex(users, function(o) { return o.user == 'barney'; }); * // => 0 * * // using the `_.matches` iteratee shorthand * _.findIndex(users, { 'user': 'fred', 'active': false }); * // => 1 * * // using the `_.matchesProperty` iteratee shorthand * _.findIndex(users, ['active', false]); * // => 0 * * // using the `_.property` iteratee shorthand * _.findIndex(users, 'active'); * // => 2 */ function findIndex(array, predicate) { return (array && array.length) ? baseFindIndex(array, getIteratee(predicate, 3)) : -1; } /** * This method is like `_.findIndex` except that it iterates over elements * of `collection` from right to left. * * @static * @memberOf _ * @category Array * @param {Array} array The array to search. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {number} Returns the index of the found element, else `-1`. * @example * * var users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': false } * ]; * * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); * // => 2 * * // using the `_.matches` iteratee shorthand * _.findLastIndex(users, { 'user': 'barney', 'active': true }); * // => 0 * * // using the `_.matchesProperty` iteratee shorthand * _.findLastIndex(users, ['active', false]); * // => 2 * * // using the `_.property` iteratee shorthand * _.findLastIndex(users, 'active'); * // => 0 */ function findLastIndex(array, predicate) { return (array && array.length) ? baseFindIndex(array, getIteratee(predicate, 3), true) : -1; } /** * Creates an array of flattened values by running each element in `array` * through `iteratee` and concating its result to the other mapped values. * The iteratee is invoked with three arguments: (value, index|key, array). * * @static * @memberOf _ * @category Array * @param {Array} array The array to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. * @returns {Array} Returns the new array. * @example * * function duplicate(n) { * return [n, n]; * } * * _.flatMap([1, 2], duplicate); * // => [1, 1, 2, 2] */ function flatMap(array, iteratee) { var length = array ? array.length : 0; return length ? baseFlatten(arrayMap(array, getIteratee(iteratee, 3))) : []; } /** * Flattens `array` a single level. * * @static * @memberOf _ * @category Array * @param {Array} array The array to flatten. * @returns {Array} Returns the new flattened array. * @example * * _.flatten([1, [2, 3, [4]]]); * // => [1, 2, 3, [4]] */ function flatten(array) { var length = array ? array.length : 0; return length ? baseFlatten(array) : []; } /** * This method is like `_.flatten` except that it recursively flattens `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to recursively flatten. * @returns {Array} Returns the new flattened array. * @example * * _.flattenDeep([1, [2, 3, [4]]]); * // => [1, 2, 3, 4] */ function flattenDeep(array) { var length = array ? array.length : 0; return length ? baseFlatten(array, true) : []; } /** * The inverse of `_.toPairs`; this method returns an object composed * from key-value `pairs`. * * @static * @memberOf _ * @category Array * @param {Array} pairs The key-value pairs. * @returns {Object} Returns the new object. * @example * * _.fromPairs([['fred', 30], ['barney', 40]]); * // => { 'fred': 30, 'barney': 40 } */ function fromPairs(pairs) { var index = -1, length = pairs ? pairs.length : 0, result = {}; while (++index < length) { var pair = pairs[index]; baseSet(result, pair[0], pair[1]); } return result; } /** * Gets the first element of `array`. * * @static * @memberOf _ * @alias first * @category Array * @param {Array} array The array to query. * @returns {*} Returns the first element of `array`. * @example * * _.head([1, 2, 3]); * // => 1 * * _.head([]); * // => undefined */ function head(array) { return array ? array[0] : undefined; } /** * Gets the index at which the first occurrence of `value` is found in `array` * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. If `fromIndex` is negative, it's used as the offset * from the end of `array`. If `array` is sorted providing `true` for `fromIndex` * performs a faster binary search. * * @static * @memberOf _ * @category Array * @param {Array} array The array to search. * @param {*} value The value to search for. * @param {number} [fromIndex=0] The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. * @example * * _.indexOf([1, 2, 1, 2], 2); * // => 1 * * // using `fromIndex` * _.indexOf([1, 2, 1, 2], 2, 2); * // => 3 */ function indexOf(array, value, fromIndex) { var length = array ? array.length : 0; if (!length) { return -1; } fromIndex = toInteger(fromIndex); if (fromIndex < 0) { fromIndex = nativeMax(length + fromIndex, 0); } return baseIndexOf(array, value, fromIndex); } /** * Gets all but the last element of `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @returns {Array} Returns the slice of `array`. * @example * * _.initial([1, 2, 3]); * // => [1, 2] */ function initial(array) { return dropRight(array, 1); } /** * Creates an array of unique values that are included in all of the provided * arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @returns {Array} Returns the new array of shared values. * @example * _.intersection([2, 1], [4, 2], [1, 2]); * // => [2] */ var intersection = rest(function(arrays) { var mapped = arrayMap(arrays, toArrayLikeObject); return (mapped.length && mapped[0] === arrays[0]) ? baseIntersection(mapped) : []; }); /** * This method is like `_.intersection` except that it accepts `iteratee` * which is invoked for each element of each `arrays` to generate the criterion * by which uniqueness is computed. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new array of shared values. * @example * * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); * // => [2.1] * * // using the `_.property` iteratee shorthand * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }] */ var intersectionBy = rest(function(arrays) { var iteratee = last(arrays), mapped = arrayMap(arrays, toArrayLikeObject); if (iteratee === last(mapped)) { iteratee = undefined; } else { mapped.pop(); } return (mapped.length && mapped[0] === arrays[0]) ? baseIntersection(mapped, getIteratee(iteratee)) : []; }); /** * This method is like `_.intersection` except that it accepts `comparator` * which is invoked to compare elements of `arrays`. The comparator is invoked * with two arguments: (arrVal, othVal). * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of shared values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.intersectionWith(objects, others, _.isEqual); * // => [{ 'x': 1, 'y': 2 }] */ var intersectionWith = rest(function(arrays) { var comparator = last(arrays), mapped = arrayMap(arrays, toArrayLikeObject); if (comparator === last(mapped)) { comparator = undefined; } else { mapped.pop(); } return (mapped.length && mapped[0] === arrays[0]) ? baseIntersection(mapped, undefined, comparator) : []; }); /** * Converts all elements in `array` into a string separated by `separator`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to convert. * @param {string} [separator=','] The element separator. * @returns {string} Returns the joined string. * @example * * _.join(['a', 'b', 'c'], '~'); * // => 'a~b~c' */ function join(array, separator) { return array ? nativeJoin.call(array, separator) : ''; } /** * Gets the last element of `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @returns {*} Returns the last element of `array`. * @example * * _.last([1, 2, 3]); * // => 3 */ function last(array) { var length = array ? array.length : 0; return length ? array[length - 1] : undefined; } /** * This method is like `_.indexOf` except that it iterates over elements of * `array` from right to left. * * @static * @memberOf _ * @category Array * @param {Array} array The array to search. * @param {*} value The value to search for. * @param {number} [fromIndex=array.length-1] The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. * @example * * _.lastIndexOf([1, 2, 1, 2], 2); * // => 3 * * // using `fromIndex` * _.lastIndexOf([1, 2, 1, 2], 2, 2); * // => 1 */ function lastIndexOf(array, value, fromIndex) { var length = array ? array.length : 0; if (!length) { return -1; } var index = length; if (fromIndex !== undefined) { index = toInteger(fromIndex); index = (index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1)) + 1; } if (value !== value) { return indexOfNaN(array, index, true); } while (index--) { if (array[index] === value) { return index; } } return -1; } /** * Removes all provided values from `array` using * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. * * **Note:** Unlike `_.without`, this method mutates `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to modify. * @param {...*} [values] The values to remove. * @returns {Array} Returns `array`. * @example * * var array = [1, 2, 3, 1, 2, 3]; * * _.pull(array, 2, 3); * console.log(array); * // => [1, 1] */ var pull = rest(pullAll); /** * This method is like `_.pull` except that it accepts an array of values to remove. * * **Note:** Unlike `_.difference`, this method mutates `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to modify. * @param {Array} values The values to remove. * @returns {Array} Returns `array`. * @example * * var array = [1, 2, 3, 1, 2, 3]; * * _.pull(array, [2, 3]); * console.log(array); * // => [1, 1] */ function pullAll(array, values) { return (array && array.length && values && values.length) ? basePullAll(array, values) : array; } /** * This method is like `_.pullAll` except that it accepts `iteratee` which is * invoked for each element of `array` and `values` to to generate the criterion * by which uniqueness is computed. The iteratee is invoked with one argument: (value). * * **Note:** Unlike `_.differenceBy`, this method mutates `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to modify. * @param {Array} values The values to remove. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns `array`. * @example * * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; * * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); * console.log(array); * // => [{ 'x': 2 }] */ function pullAllBy(array, values, iteratee) { return (array && array.length && values && values.length) ? basePullAllBy(array, values, getIteratee(iteratee)) : array; } /** * Removes elements from `array` corresponding to `indexes` and returns an * array of removed elements. * * **Note:** Unlike `_.at`, this method mutates `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to modify. * @param {...(number|number[])} [indexes] The indexes of elements to remove, * specified individually or in arrays. * @returns {Array} Returns the new array of removed elements. * @example * * var array = [5, 10, 15, 20]; * var evens = _.pullAt(array, 1, 3); * * console.log(array); * // => [5, 15] * * console.log(evens); * // => [10, 20] */ var pullAt = rest(function(array, indexes) { indexes = arrayMap(baseFlatten(indexes), String); var result = baseAt(array, indexes); basePullAt(array, indexes.sort(compareAscending)); return result; }); /** * Removes all elements from `array` that `predicate` returns truthy for * and returns an array of the removed elements. The predicate is invoked with * three arguments: (value, index, array). * * **Note:** Unlike `_.filter`, this method mutates `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to modify. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the new array of removed elements. * @example * * var array = [1, 2, 3, 4]; * var evens = _.remove(array, function(n) { * return n % 2 == 0; * }); * * console.log(array); * // => [1, 3] * * console.log(evens); * // => [2, 4] */ function remove(array, predicate) { var result = []; if (!(array && array.length)) { return result; } var index = -1, indexes = [], length = array.length; predicate = getIteratee(predicate, 3); while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result.push(value); indexes.push(index); } } basePullAt(array, indexes); return result; } /** * Reverses `array` so that the first element becomes the last, the second * element becomes the second to last, and so on. * * **Note:** This method mutates `array` and is based on * [`Array#reverse`](https://mdn.io/Array/reverse). * * @memberOf _ * @category Array * @returns {Array} Returns `array`. * @example * * var array = [1, 2, 3]; * * _.reverse(array); * // => [3, 2, 1] * * console.log(array); * // => [3, 2, 1] */ function reverse(array) { return array ? nativeReverse.call(array) : array; } /** * Creates a slice of `array` from `start` up to, but not including, `end`. * * **Note:** This method is used instead of [`Array#slice`](https://mdn.io/Array/slice) * to ensure dense arrays are returned. * * @static * @memberOf _ * @category Array * @param {Array} array The array to slice. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns the slice of `array`. */ function slice(array, start, end) { var length = array ? array.length : 0; if (!length) { return []; } if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { start = 0; end = length; } return baseSlice(array, start, end); } /** * Uses a binary search to determine the lowest index at which `value` should * be inserted into `array` in order to maintain its sort order. * * @static * @memberOf _ * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @returns {number} Returns the index at which `value` should be inserted into `array`. * @example * * _.sortedIndex([30, 50], 40); * // => 1 * * _.sortedIndex([4, 5], 4); * // => 0 */ function sortedIndex(array, value) { return baseSortedIndex(array, value); } /** * This method is like `_.sortedIndex` except that it accepts `iteratee` * which is invoked for `value` and each element of `array` to compute their * sort ranking. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {number} Returns the index at which `value` should be inserted into `array`. * @example * * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; * * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); * // => 1 * * // using the `_.property` iteratee shorthand * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); * // => 0 */ function sortedIndexBy(array, value, iteratee) { return baseSortedIndexBy(array, value, getIteratee(iteratee)); } /** * This method is like `_.indexOf` except that it performs a binary * search on a sorted `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to search. * @param {*} value The value to search for. * @returns {number} Returns the index of the matched value, else `-1`. * @example * * _.sortedIndexOf([1, 1, 2, 2], 2); * // => 2 */ function sortedIndexOf(array, value) { var length = array ? array.length : 0; if (length) { var index = baseSortedIndex(array, value); if (index < length && eq(array[index], value)) { return index; } } return -1; } /** * This method is like `_.sortedIndex` except that it returns the highest * index at which `value` should be inserted into `array` in order to * maintain its sort order. * * @static * @memberOf _ * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @returns {number} Returns the index at which `value` should be inserted into `array`. * @example * * _.sortedLastIndex([4, 5], 4); * // => 1 */ function sortedLastIndex(array, value) { return baseSortedIndex(array, value, true); } /** * This method is like `_.sortedLastIndex` except that it accepts `iteratee` * which is invoked for `value` and each element of `array` to compute their * sort ranking. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {number} Returns the index at which `value` should be inserted into `array`. * @example * * // using the `_.property` iteratee shorthand * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); * // => 1 */ function sortedLastIndexBy(array, value, iteratee) { return baseSortedIndexBy(array, value, getIteratee(iteratee), true); } /** * This method is like `_.lastIndexOf` except that it performs a binary * search on a sorted `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to search. * @param {*} value The value to search for. * @returns {number} Returns the index of the matched value, else `-1`. * @example * * _.sortedLastIndexOf([1, 1, 2, 2], 2); * // => 3 */ function sortedLastIndexOf(array, value) { var length = array ? array.length : 0; if (length) { var index = baseSortedIndex(array, value, true) - 1; if (eq(array[index], value)) { return index; } } return -1; } /** * This method is like `_.uniq` except that it's designed and optimized * for sorted arrays. * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @returns {Array} Returns the new duplicate free array. * @example * * _.sortedUniq([1, 1, 2]); * // => [1, 2] */ function sortedUniq(array) { return (array && array.length) ? baseSortedUniq(array) : []; } /** * This method is like `_.uniqBy` except that it's designed and optimized * for sorted arrays. * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @returns {Array} Returns the new duplicate free array. * @example * * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); * // => [1.1, 2.2] */ function sortedUniqBy(array, iteratee) { return (array && array.length) ? baseSortedUniqBy(array, getIteratee(iteratee)) : []; } /** * Gets all but the first element of `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @returns {Array} Returns the slice of `array`. * @example * * _.tail([1, 2, 3]); * // => [2, 3] */ function tail(array) { return drop(array, 1); } /** * Creates a slice of `array` with `n` elements taken from the beginning. * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to take. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * * _.take([1, 2, 3]); * // => [1] * * _.take([1, 2, 3], 2); * // => [1, 2] * * _.take([1, 2, 3], 5); * // => [1, 2, 3] * * _.take([1, 2, 3], 0); * // => [] */ function take(array, n, guard) { if (!(array && array.length)) { return []; } n = (guard || n === undefined) ? 1 : n; return baseSlice(array, 0, n < 0 ? 0 : n); } /** * Creates a slice of `array` with `n` elements taken from the end. * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to take. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * * _.takeRight([1, 2, 3]); * // => [3] * * _.takeRight([1, 2, 3], 2); * // => [2, 3] * * _.takeRight([1, 2, 3], 5); * // => [1, 2, 3] * * _.takeRight([1, 2, 3], 0); * // => [] */ function takeRight(array, n, guard) { var length = array ? array.length : 0; if (!length) { return []; } n = (guard || n === undefined) ? 1 : toInteger(n); n = length - n; return baseSlice(array, n < 0 ? 0 : n); } /** * Creates a slice of `array` with elements taken from the end. Elements are * taken until `predicate` returns falsey. The predicate is invoked with three * arguments: (value, index, array). * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * * var resolve = _.partial(_.map, _, 'user'); * * var users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': false } * ]; * * resolve( _.takeRightWhile(users, function(o) { return !o.active; }) ); * // => ['fred', 'pebbles'] * * // using the `_.matches` iteratee shorthand * resolve( _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }) ); * // => ['pebbles'] * * // using the `_.matchesProperty` iteratee shorthand * resolve( _.takeRightWhile(users, ['active', false]) ); * // => ['fred', 'pebbles'] * * // using the `_.property` iteratee shorthand * resolve( _.takeRightWhile(users, 'active') ); * // => [] */ function takeRightWhile(array, predicate) { return (array && array.length) ? baseWhile(array, getIteratee(predicate, 3), false, true) : []; } /** * Creates a slice of `array` with elements taken from the beginning. Elements * are taken until `predicate` returns falsey. The predicate is invoked with * three arguments: (value, index, array). * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * * var resolve = _.partial(_.map, _, 'user'); * * var users = [ * { 'user': 'barney', 'active': false }, * { 'user': 'fred', 'active': false}, * { 'user': 'pebbles', 'active': true } * ]; * * resolve( _.takeWhile(users, function(o) { return !o.active; }) ); * // => ['barney', 'fred'] * * // using the `_.matches` iteratee shorthand * resolve( _.takeWhile(users, { 'user': 'barney', 'active': false }) ); * // => ['barney'] * * // using the `_.matchesProperty` iteratee shorthand * resolve( _.takeWhile(users, ['active', false]) ); * // => ['barney', 'fred'] * * // using the `_.property` iteratee shorthand * resolve( _.takeWhile(users, 'active') ); * // => [] */ function takeWhile(array, predicate) { return (array && array.length) ? baseWhile(array, getIteratee(predicate, 3)) : []; } /** * Creates an array of unique values, in order, from all of the provided arrays * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @returns {Array} Returns the new array of combined values. * @example * * _.union([2, 1], [4, 2], [1, 2]); * // => [2, 1, 4] */ var union = rest(function(arrays) { return baseUniq(baseFlatten(arrays, false, true)); }); /** * This method is like `_.union` except that it accepts `iteratee` which is * invoked for each element of each `arrays` to generate the criterion by which * uniqueness is computed. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new array of combined values. * @example * * _.unionBy([2.1, 1.2], [4.3, 2.4], Math.floor); * // => [2.1, 1.2, 4.3] * * // using the `_.property` iteratee shorthand * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }, { 'x': 2 }] */ var unionBy = rest(function(arrays) { var iteratee = last(arrays); if (isArrayLikeObject(iteratee)) { iteratee = undefined; } return baseUniq(baseFlatten(arrays, false, true), getIteratee(iteratee)); }); /** * This method is like `_.union` except that it accepts `comparator` which * is invoked to compare elements of `arrays`. The comparator is invoked * with two arguments: (arrVal, othVal). * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of combined values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.unionWith(objects, others, _.isEqual); * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] */ var unionWith = rest(function(arrays) { var comparator = last(arrays); if (isArrayLikeObject(comparator)) { comparator = undefined; } return baseUniq(baseFlatten(arrays, false, true), undefined, comparator); }); /** * Creates a duplicate-free version of an array, using * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons, in which only the first occurrence of each element * is kept. * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @returns {Array} Returns the new duplicate free array. * @example * * _.uniq([2, 1, 2]); * // => [2, 1] */ function uniq(array) { return (array && array.length) ? baseUniq(array) : []; } /** * This method is like `_.uniq` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which * uniqueness is computed. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new duplicate free array. * @example * * _.uniqBy([2.1, 1.2, 2.3], Math.floor); * // => [2.1, 1.2] * * // using the `_.property` iteratee shorthand * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }, { 'x': 2 }] */ function uniqBy(array, iteratee) { return (array && array.length) ? baseUniq(array, getIteratee(iteratee)) : []; } /** * This method is like `_.uniq` except that it accepts `comparator` which * is invoked to compare elements of `array`. The comparator is invoked with * two arguments: (arrVal, othVal). * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new duplicate free array. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.uniqWith(objects, _.isEqual); * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] */ function uniqWith(array, comparator) { return (array && array.length) ? baseUniq(array, undefined, comparator) : []; } /** * This method is like `_.zip` except that it accepts an array of grouped * elements and creates an array regrouping the elements to their pre-zip * configuration. * * @static * @memberOf _ * @category Array * @param {Array} array The array of grouped elements to process. * @returns {Array} Returns the new array of regrouped elements. * @example * * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]); * // => [['fred', 30, true], ['barney', 40, false]] * * _.unzip(zipped); * // => [['fred', 'barney'], [30, 40], [true, false]] */ function unzip(array) { if (!(array && array.length)) { return []; } var length = 0; array = arrayFilter(array, function(group) { if (isArrayLikeObject(group)) { length = nativeMax(group.length, length); return true; } }); return baseTimes(length, function(index) { return arrayMap(array, baseProperty(index)); }); } /** * This method is like `_.unzip` except that it accepts `iteratee` to specify * how regrouped values should be combined. The iteratee is invoked with the * elements of each group: (...group). * * @static * @memberOf _ * @category Array * @param {Array} array The array of grouped elements to process. * @param {Function} [iteratee=_.identity] The function to combine regrouped values. * @returns {Array} Returns the new array of regrouped elements. * @example * * var zipped = _.zip([1, 2], [10, 20], [100, 200]); * // => [[1, 10, 100], [2, 20, 200]] * * _.unzipWith(zipped, _.add); * // => [3, 30, 300] */ function unzipWith(array, iteratee) { if (!(array && array.length)) { return []; } var result = unzip(array); if (iteratee == null) { return result; } return arrayMap(result, function(group) { return apply(iteratee, undefined, group); }); } /** * Creates an array excluding all provided values using * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. * * @static * @memberOf _ * @category Array * @param {Array} array The array to filter. * @param {...*} [values] The values to exclude. * @returns {Array} Returns the new array of filtered values. * @example * * _.without([1, 2, 1, 3], 1, 2); * // => [3] */ var without = rest(function(array, values) { return isArrayLikeObject(array) ? baseDifference(array, values) : []; }); /** * Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) * of the provided arrays. * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @returns {Array} Returns the new array of values. * @example * * _.xor([2, 1], [4, 2]); * // => [1, 4] */ var xor = rest(function(arrays) { return baseXor(arrayFilter(arrays, isArrayLikeObject)); }); /** * This method is like `_.xor` except that it accepts `iteratee` which is * invoked for each element of each `arrays` to generate the criterion by which * uniqueness is computed. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new array of values. * @example * * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); * // => [1.2, 4.3] * * // using the `_.property` iteratee shorthand * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 2 }] */ var xorBy = rest(function(arrays) { var iteratee = last(arrays); if (isArrayLikeObject(iteratee)) { iteratee = undefined; } return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee)); }); /** * This method is like `_.xor` except that it accepts `comparator` which is * invoked to compare elements of `arrays`. The comparator is invoked with * two arguments: (arrVal, othVal). * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.xorWith(objects, others, _.isEqual); * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] */ var xorWith = rest(function(arrays) { var comparator = last(arrays); if (isArrayLikeObject(comparator)) { comparator = undefined; } return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); }); /** * Creates an array of grouped elements, the first of which contains the first * elements of the given arrays, the second of which contains the second elements * of the given arrays, and so on. * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to process. * @returns {Array} Returns the new array of grouped elements. * @example * * _.zip(['fred', 'barney'], [30, 40], [true, false]); * // => [['fred', 30, true], ['barney', 40, false]] */ var zip = rest(unzip); /** * This method is like `_.fromPairs` except that it accepts two arrays, * one of property names and one of corresponding values. * * @static * @memberOf _ * @category Array * @param {Array} [props=[]] The property names. * @param {Array} [values=[]] The property values. * @returns {Object} Returns the new object. * @example * * _.zipObject(['fred', 'barney'], [30, 40]); * // => { 'fred': 30, 'barney': 40 } */ function zipObject(props, values) { var index = -1, length = props ? props.length : 0, valsLength = values ? values.length : 0, result = {}; while (++index < length) { baseSet(result, props[index], index < valsLength ? values[index] : undefined); } return result; } /** * This method is like `_.zip` except that it accepts `iteratee` to specify * how grouped values should be combined. The iteratee is invoked with the * elements of each group: (...group). * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to process. * @param {Function} [iteratee=_.identity] The function to combine grouped values. * @returns {Array} Returns the new array of grouped elements. * @example * * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { * return a + b + c; * }); * // => [111, 222] */ var zipWith = rest(function(arrays) { var length = arrays.length, iteratee = length > 1 ? arrays[length - 1] : undefined; iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; return unzipWith(arrays, iteratee); }); /*------------------------------------------------------------------------*/ /** * Creates a `lodash` object that wraps `value` with explicit method chaining enabled. * The result of such method chaining must be unwrapped with `_#value`. * * @static * @memberOf _ * @category Chain * @param {*} value The value to wrap. * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 }, * { 'user': 'pebbles', 'age': 1 } * ]; * * var youngest = _ * .chain(users) * .sortBy('age') * .map(function(o) { * return o.user + ' is ' + o.age; * }) * .head() * .value(); * // => 'pebbles is 1' */ function chain(value) { var result = lodash(value); result.__chain__ = true; return result; } /** * This method invokes `interceptor` and returns `value`. The interceptor is * invoked with one argument; (value). The purpose of this method is to "tap into" * a method chain in order to perform operations on intermediate results within * the chain. * * @static * @memberOf _ * @category Chain * @param {*} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. * @returns {*} Returns `value`. * @example * * _([1, 2, 3]) * .tap(function(array) { * array.pop(); * }) * .reverse() * .value(); * // => [2, 1] */ function tap(value, interceptor) { interceptor(value); return value; } /** * This method is like `_.tap` except that it returns the result of `interceptor`. * * @static * @memberOf _ * @category Chain * @param {*} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. * @returns {*} Returns the result of `interceptor`. * @example * * _(' abc ') * .chain() * .trim() * .thru(function(value) { * return [value]; * }) * .value(); * // => ['abc'] */ function thru(value, interceptor) { return interceptor(value); } /** * This method is the wrapper version of `_.at`. * * @name at * @memberOf _ * @category Chain * @param {...(string|string[])} [paths] The property paths of elements to pick, * specified individually or in arrays. * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; * * _(object).at(['a[0].b.c', 'a[1]']).value(); * // => [3, 4] * * _(['a', 'b', 'c']).at(0, 2).value(); * // => ['a', 'c'] */ var wrapperAt = rest(function(paths) { paths = baseFlatten(paths); var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) { return baseAt(object, paths); }; if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) { return this.thru(interceptor); } value = value.slice(start, +start + (length ? 1 : 0)); value.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); return new LodashWrapper(value, this.__chain__).thru(function(array) { if (length && !array.length) { array.push(undefined); } return array; }); }); /** * Enables explicit method chaining on the wrapper object. * * @name chain * @memberOf _ * @category Chain * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 } * ]; * * // without explicit chaining * _(users).head(); * // => { 'user': 'barney', 'age': 36 } * * // with explicit chaining * _(users) * .chain() * .head() * .pick('user') * .value(); * // => { 'user': 'barney' } */ function wrapperChain() { return chain(this); } /** * Executes the chained sequence and returns the wrapped result. * * @name commit * @memberOf _ * @category Chain * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * var array = [1, 2]; * var wrapped = _(array).push(3); * * console.log(array); * // => [1, 2] * * wrapped = wrapped.commit(); * console.log(array); * // => [1, 2, 3] * * wrapped.last(); * // => 3 * * console.log(array); * // => [1, 2, 3] */ function wrapperCommit() { return new LodashWrapper(this.value(), this.__chain__); } /** * This method is the wrapper version of `_.flatMap`. * * @static * @memberOf _ * @category Chain * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * function duplicate(n) { * return [n, n]; * } * * _([1, 2]).flatMap(duplicate).value(); * // => [1, 1, 2, 2] */ function wrapperFlatMap(iteratee) { return this.map(iteratee).flatten(); } /** * Gets the next value on a wrapped object following the * [iterator protocol](https://mdn.io/iteration_protocols#iterator). * * @name next * @memberOf _ * @category Chain * @returns {Object} Returns the next iterator value. * @example * * var wrapped = _([1, 2]); * * wrapped.next(); * // => { 'done': false, 'value': 1 } * * wrapped.next(); * // => { 'done': false, 'value': 2 } * * wrapped.next(); * // => { 'done': true, 'value': undefined } */ function wrapperNext() { if (this.__values__ === undefined) { this.__values__ = toArray(this.value()); } var done = this.__index__ >= this.__values__.length, value = done ? undefined : this.__values__[this.__index__++]; return { 'done': done, 'value': value }; } /** * Enables the wrapper to be iterable. * * @name Symbol.iterator * @memberOf _ * @category Chain * @returns {Object} Returns the wrapper object. * @example * * var wrapped = _([1, 2]); * * wrapped[Symbol.iterator]() === wrapped; * // => true * * Array.from(wrapped); * // => [1, 2] */ function wrapperToIterator() { return this; } /** * Creates a clone of the chained sequence planting `value` as the wrapped value. * * @name plant * @memberOf _ * @category Chain * @param {*} value The value to plant. * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * function square(n) { * return n * n; * } * * var wrapped = _([1, 2]).map(square); * var other = wrapped.plant([3, 4]); * * other.value(); * // => [9, 16] * * wrapped.value(); * // => [1, 4] */ function wrapperPlant(value) { var result, parent = this; while (parent instanceof baseLodash) { var clone = wrapperClone(parent); clone.__index__ = 0; clone.__values__ = undefined; if (result) { previous.__wrapped__ = clone; } else { result = clone; } var previous = clone; parent = parent.__wrapped__; } previous.__wrapped__ = value; return result; } /** * This method is the wrapper version of `_.reverse`. * * **Note:** This method mutates the wrapped array. * * @name reverse * @memberOf _ * @category Chain * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * var array = [1, 2, 3]; * * _(array).reverse().value() * // => [3, 2, 1] * * console.log(array); * // => [3, 2, 1] */ function wrapperReverse() { var value = this.__wrapped__; if (value instanceof LazyWrapper) { var wrapped = value; if (this.__actions__.length) { wrapped = new LazyWrapper(this); } wrapped = wrapped.reverse(); wrapped.__actions__.push({ 'func': thru, 'args': [reverse], 'thisArg': undefined }); return new LodashWrapper(wrapped, this.__chain__); } return this.thru(reverse); } /** * Executes the chained sequence to extract the unwrapped value. * * @name value * @memberOf _ * @alias run, toJSON, valueOf * @category Chain * @returns {*} Returns the resolved unwrapped value. * @example * * _([1, 2, 3]).value(); * // => [1, 2, 3] */ function wrapperValue() { return baseWrapperValue(this.__wrapped__, this.__actions__); } /*------------------------------------------------------------------------*/ /** * Creates an object composed of keys generated from the results of running * each element of `collection` through `iteratee`. The corresponding value * of each key is the number of times the key was returned by `iteratee`. * The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {Object} Returns the composed aggregate object. * @example * * _.countBy([6.1, 4.2, 6.3], Math.floor); * // => { '4': 1, '6': 2 } * * _.countBy(['one', 'two', 'three'], 'length'); * // => { '3': 2, '5': 1 } */ var countBy = createAggregator(function(result, value, key) { hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1); }); /** * Checks if `predicate` returns truthy for **all** elements of `collection`. * Iteration is stopped once `predicate` returns falsey. The predicate is * invoked with three arguments: (value, index|key, collection). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`. * @example * * _.every([true, 1, null, 'yes'], Boolean); * // => false * * var users = [ * { 'user': 'barney', 'active': false }, * { 'user': 'fred', 'active': false } * ]; * * // using the `_.matches` iteratee shorthand * _.every(users, { 'user': 'barney', 'active': false }); * // => false * * // using the `_.matchesProperty` iteratee shorthand * _.every(users, ['active', false]); * // => true * * // using the `_.property` iteratee shorthand * _.every(users, 'active'); * // => false */ function every(collection, predicate, guard) { var func = isArray(collection) ? arrayEvery : baseEvery; if (guard && isIterateeCall(collection, predicate, guard)) { predicate = undefined; } return func(collection, getIteratee(predicate, 3)); } /** * Iterates over elements of `collection`, returning an array of all elements * `predicate` returns truthy for. The predicate is invoked with three arguments: * (value, index|key, collection). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the new filtered array. * @example * * var resolve = _.partial(_.map, _, 'user'); * * var users = [ * { 'user': 'barney', 'age': 36, 'active': true }, * { 'user': 'fred', 'age': 40, 'active': false } * ]; * * resolve( _.filter(users, function(o) { return !o.active; }) ); * // => ['fred'] * * // using the `_.matches` iteratee shorthand * resolve( _.filter(users, { 'age': 36, 'active': true }) ); * // => ['barney'] * * // using the `_.matchesProperty` iteratee shorthand * resolve( _.filter(users, ['active', false]) ); * // => ['fred'] * * // using the `_.property` iteratee shorthand * resolve( _.filter(users, 'active') ); * // => ['barney'] */ function filter(collection, predicate) { var func = isArray(collection) ? arrayFilter : baseFilter; return func(collection, getIteratee(predicate, 3)); } /** * Iterates over elements of `collection`, returning the first element * `predicate` returns truthy for. The predicate is invoked with three arguments: * (value, index|key, collection). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to search. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {*} Returns the matched element, else `undefined`. * @example * * var resolve = _.partial(_.result, _, 'user'); * * var users = [ * { 'user': 'barney', 'age': 36, 'active': true }, * { 'user': 'fred', 'age': 40, 'active': false }, * { 'user': 'pebbles', 'age': 1, 'active': true } * ]; * * resolve( _.find(users, function(o) { return o.age < 40; }) ); * // => 'barney' * * // using the `_.matches` iteratee shorthand * resolve( _.find(users, { 'age': 1, 'active': true }) ); * // => 'pebbles' * * // using the `_.matchesProperty` iteratee shorthand * resolve( _.find(users, ['active', false]) ); * // => 'fred' * * // using the `_.property` iteratee shorthand * resolve( _.find(users, 'active') ); * // => 'barney' */ function find(collection, predicate) { predicate = getIteratee(predicate, 3); if (isArray(collection)) { var index = baseFindIndex(collection, predicate); return index > -1 ? collection[index] : undefined; } return baseFind(collection, predicate, baseEach); } /** * This method is like `_.find` except that it iterates over elements of * `collection` from right to left. * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to search. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {*} Returns the matched element, else `undefined`. * @example * * _.findLast([1, 2, 3, 4], function(n) { * return n % 2 == 1; * }); * // => 3 */ function findLast(collection, predicate) { predicate = getIteratee(predicate, 3); if (isArray(collection)) { var index = baseFindIndex(collection, predicate, true); return index > -1 ? collection[index] : undefined; } return baseFind(collection, predicate, baseEachRight); } /** * Iterates over elements of `collection` invoking `iteratee` for each element. * The iteratee is invoked with three arguments: (value, index|key, collection). * Iteratee functions may exit iteration early by explicitly returning `false`. * * **Note:** As with other "Collections" methods, objects with a "length" property * are iterated like arrays. To avoid this behavior use `_.forIn` or `_.forOwn` * for object iteration. * * @static * @memberOf _ * @alias each * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array|Object} Returns `collection`. * @example * * _([1, 2]).forEach(function(value) { * console.log(value); * }); * // => logs `1` then `2` * * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { * console.log(key); * }); * // => logs 'a' then 'b' (iteration order is not guaranteed) */ function forEach(collection, iteratee) { return (typeof iteratee == 'function' && isArray(collection)) ? arrayEach(collection, iteratee) : baseEach(collection, toFunction(iteratee)); } /** * This method is like `_.forEach` except that it iterates over elements of * `collection` from right to left. * * @static * @memberOf _ * @alias eachRight * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array|Object} Returns `collection`. * @example * * _.forEachRight([1, 2], function(value) { * console.log(value); * }); * // => logs `2` then `1` */ function forEachRight(collection, iteratee) { return (typeof iteratee == 'function' && isArray(collection)) ? arrayEachRight(collection, iteratee) : baseEachRight(collection, toFunction(iteratee)); } /** * Creates an object composed of keys generated from the results of running * each element of `collection` through `iteratee`. The corresponding value * of each key is an array of the elements responsible for generating the key. * The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {Object} Returns the composed aggregate object. * @example * * _.groupBy([6.1, 4.2, 6.3], Math.floor); * // => { '4': [4.2], '6': [6.1, 6.3] } * * // using the `_.property` iteratee shorthand * _.groupBy(['one', 'two', 'three'], 'length'); * // => { '3': ['one', 'two'], '5': ['three'] } */ var groupBy = createAggregator(function(result, value, key) { if (hasOwnProperty.call(result, key)) { result[key].push(value); } else { result[key] = [value]; } }); /** * Checks if `value` is in `collection`. If `collection` is a string it's checked * for a substring of `value`, otherwise [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * is used for equality comparisons. If `fromIndex` is negative, it's used as * the offset from the end of `collection`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to search. * @param {*} value The value to search for. * @param {number} [fromIndex=0] The index to search from. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. * @returns {boolean} Returns `true` if `value` is found, else `false`. * @example * * _.includes([1, 2, 3], 1); * // => true * * _.includes([1, 2, 3], 1, 2); * // => false * * _.includes({ 'user': 'fred', 'age': 40 }, 'fred'); * // => true * * _.includes('pebbles', 'eb'); * // => true */ function includes(collection, value, fromIndex, guard) { collection = isArrayLike(collection) ? collection : values(collection); fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; var length = collection.length; if (fromIndex < 0) { fromIndex = nativeMax(length + fromIndex, 0); } return isString(collection) ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) : (!!length && baseIndexOf(collection, value, fromIndex) > -1); } /** * Invokes the method at `path` of each element in `collection`, returning * an array of the results of each invoked method. Any additional arguments * are provided to each invoked method. If `methodName` is a function it's * invoked for, and `this` bound to, each element in `collection`. * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Array|Function|string} path The path of the method to invoke or * the function invoked per iteration. * @param {...*} [args] The arguments to invoke each method with. * @returns {Array} Returns the array of results. * @example * * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); * // => [[1, 5, 7], [1, 2, 3]] * * _.invokeMap([123, 456], String.prototype.split, ''); * // => [['1', '2', '3'], ['4', '5', '6']] */ var invokeMap = rest(function(collection, path, args) { var index = -1, isFunc = typeof path == 'function', isProp = isKey(path), result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value) { var func = isFunc ? path : ((isProp && value != null) ? value[path] : undefined); result[++index] = func ? apply(func, value, args) : baseInvoke(value, path, args); }); return result; }); /** * Creates an object composed of keys generated from the results of running * each element of `collection` through `iteratee`. The corresponding value * of each key is the last element responsible for generating the key. The * iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {Object} Returns the composed aggregate object. * @example * * var keyData = [ * { 'dir': 'left', 'code': 97 }, * { 'dir': 'right', 'code': 100 } * ]; * * _.keyBy(keyData, 'dir'); * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } * * _.keyBy(keyData, function(o) { * return String.fromCharCode(o.code); * }); * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } */ var keyBy = createAggregator(function(result, value, key) { result[key] = value; }); /** * Creates an array of values by running each element in `collection` through * `iteratee`. The iteratee is invoked with three arguments: * (value, index|key, collection). * * Many lodash methods are guarded to work as iteratees for methods like * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. * * The guarded methods are: * `ary`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, `fill`, * `invert`, `parseInt`, `random`, `range`, `rangeRight`, `slice`, `some`, * `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimEnd`, `trimStart`, * and `words` * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. * @returns {Array} Returns the new mapped array. * @example * * function square(n) { * return n * n; * } * * _.map([1, 2], square); * // => [3, 6] * * _.map({ 'a': 1, 'b': 2 }, square); * // => [3, 6] (iteration order is not guaranteed) * * var users = [ * { 'user': 'barney' }, * { 'user': 'fred' } * ]; * * // using the `_.property` iteratee shorthand * _.map(users, 'user'); * // => ['barney', 'fred'] */ function map(collection, iteratee) { var func = isArray(collection) ? arrayMap : baseMap; return func(collection, getIteratee(iteratee, 3)); } /** * This method is like `_.sortBy` except that it allows specifying the sort * orders of the iteratees to sort by. If `orders` is unspecified, all values * are sorted in ascending order. Otherwise, specify an order of "desc" for * descending or "asc" for ascending sort order of corresponding values. * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function[]|Object[]|string[]} [iteratees=[_.identity]] The iteratees to sort by. * @param {string[]} [orders] The sort orders of `iteratees`. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. * @returns {Array} Returns the new sorted array. * @example * * var resolve = _.partial(_.map, _, _.values); * * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 34 }, * { 'user': 'fred', 'age': 42 }, * { 'user': 'barney', 'age': 36 } * ]; * * // sort by `user` in ascending order and by `age` in descending order * resolve( _.orderBy(users, ['user', 'age'], ['asc', 'desc']) ); * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] */ function orderBy(collection, iteratees, orders, guard) { if (collection == null) { return []; } if (!isArray(iteratees)) { iteratees = iteratees == null ? [] : [iteratees]; } orders = guard ? undefined : orders; if (!isArray(orders)) { orders = orders == null ? [] : [orders]; } return baseOrderBy(collection, iteratees, orders); } /** * Creates an array of elements split into two groups, the first of which * contains elements `predicate` returns truthy for, while the second of which * contains elements `predicate` returns falsey for. The predicate is invoked * with three arguments: (value, index|key, collection). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the array of grouped elements. * @example * * var resolve = function(result) { * return _.map(result, function(array) { return _.map(array, 'user'); }); * }; * * var users = [ * { 'user': 'barney', 'age': 36, 'active': false }, * { 'user': 'fred', 'age': 40, 'active': true }, * { 'user': 'pebbles', 'age': 1, 'active': false } * ]; * * resolve( _.partition(users, function(o) { return o.active; }) ); * // => [['fred'], ['barney', 'pebbles']] * * // using the `_.matches` iteratee shorthand * resolve( _.partition(users, { 'age': 1, 'active': false }) ); * // => [['pebbles'], ['barney', 'fred']] * * // using the `_.matchesProperty` iteratee shorthand * resolve( _.partition(users, ['active', false]) ); * // => [['barney', 'pebbles'], ['fred']] * * // using the `_.property` iteratee shorthand * resolve( _.partition(users, 'active') ); * // => [['fred'], ['barney', 'pebbles']] */ var partition = createAggregator(function(result, value, key) { result[key ? 0 : 1].push(value); }, function() { return [[], []]; }); /** * Reduces `collection` to a value which is the accumulated result of running * each element in `collection` through `iteratee`, where each successive * invocation is supplied the return value of the previous. If `accumulator` * is not provided the first element of `collection` is used as the initial * value. The iteratee is invoked with four arguments: * (accumulator, value, index|key, collection). * * Many lodash methods are guarded to work as iteratees for methods like * `_.reduce`, `_.reduceRight`, and `_.transform`. * * The guarded methods are: * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, * and `sortBy` * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The initial value. * @returns {*} Returns the accumulated value. * @example * * _.reduce([1, 2], function(sum, n) { * return sum + n; * }); * // => 3 * * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { * (result[value] || (result[value] = [])).push(key); * return result; * }, {}); * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) */ function reduce(collection, iteratee, accumulator) { var func = isArray(collection) ? arrayReduce : baseReduce, initFromCollection = arguments.length < 3; return func(collection, getIteratee(iteratee, 4), accumulator, initFromCollection, baseEach); } /** * This method is like `_.reduce` except that it iterates over elements of * `collection` from right to left. * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The initial value. * @returns {*} Returns the accumulated value. * @example * * var array = [[0, 1], [2, 3], [4, 5]]; * * _.reduceRight(array, function(flattened, other) { * return flattened.concat(other); * }, []); * // => [4, 5, 2, 3, 0, 1] */ function reduceRight(collection, iteratee, accumulator) { var func = isArray(collection) ? arrayReduceRight : baseReduce, initFromCollection = arguments.length < 3; return func(collection, getIteratee(iteratee, 4), accumulator, initFromCollection, baseEachRight); } /** * The opposite of `_.filter`; this method returns the elements of `collection` * that `predicate` does **not** return truthy for. * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the new filtered array. * @example * * var resolve = _.partial(_.map, _, 'user'); * * var users = [ * { 'user': 'barney', 'age': 36, 'active': false }, * { 'user': 'fred', 'age': 40, 'active': true } * ]; * * resolve( _.reject(users, function(o) { return !o.active; }) ); * // => ['fred'] * * // using the `_.matches` iteratee shorthand * resolve( _.reject(users, { 'age': 40, 'active': true }) ); * // => ['barney'] * * // using the `_.matchesProperty` iteratee shorthand * resolve( _.reject(users, ['active', false]) ); * // => ['fred'] * * // using the `_.property` iteratee shorthand * resolve( _.reject(users, 'active') ); * // => ['barney'] */ function reject(collection, predicate) { var func = isArray(collection) ? arrayFilter : baseFilter; predicate = getIteratee(predicate, 3); return func(collection, function(value, index, collection) { return !predicate(value, index, collection); }); } /** * Gets a random element from `collection`. * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to sample. * @returns {*} Returns the random element. * @example * * _.sample([1, 2, 3, 4]); * // => 2 */ function sample(collection) { var array = isArrayLike(collection) ? collection : values(collection), length = array.length; return length > 0 ? array[baseRandom(0, length - 1)] : undefined; } /** * Gets `n` random elements from `collection`. * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to sample. * @param {number} [n=0] The number of elements to sample. * @returns {Array} Returns the random elements. * @example * * _.sampleSize([1, 2, 3, 4], 2); * // => [3, 1] */ function sampleSize(collection, n) { var index = -1, result = toArray(collection), length = result.length, lastIndex = length - 1; n = baseClamp(toInteger(n), 0, length); while (++index < n) { var rand = baseRandom(index, lastIndex), value = result[rand]; result[rand] = result[index]; result[index] = value; } result.length = n; return result; } /** * Creates an array of shuffled values, using a version of the * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to shuffle. * @returns {Array} Returns the new shuffled array. * @example * * _.shuffle([1, 2, 3, 4]); * // => [4, 1, 3, 2] */ function shuffle(collection) { return sampleSize(collection, MAX_ARRAY_LENGTH); } /** * Gets the size of `collection` by returning its length for array-like * values or the number of own enumerable properties for objects. * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to inspect. * @returns {number} Returns the collection size. * @example * * _.size([1, 2, 3]); * // => 3 * * _.size({ 'a': 1, 'b': 2 }); * // => 2 * * _.size('pebbles'); * // => 7 */ function size(collection) { if (collection == null) { return 0; } if (isArrayLike(collection)) { var result = collection.length; return (result && isString(collection)) ? stringSize(collection) : result; } return keys(collection).length; } /** * Checks if `predicate` returns truthy for **any** element of `collection`. * Iteration is stopped once `predicate` returns truthy. The predicate is * invoked with three arguments: (value, index|key, collection). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. * @example * * _.some([null, 0, 'yes', false], Boolean); * // => true * * var users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false } * ]; * * // using the `_.matches` iteratee shorthand * _.some(users, { 'user': 'barney', 'active': false }); * // => false * * // using the `_.matchesProperty` iteratee shorthand * _.some(users, ['active', false]); * // => true * * // using the `_.property` iteratee shorthand * _.some(users, 'active'); * // => true */ function some(collection, predicate, guard) { var func = isArray(collection) ? arraySome : baseSome; if (guard && isIterateeCall(collection, predicate, guard)) { predicate = undefined; } return func(collection, getIteratee(predicate, 3)); } /** * Creates an array of elements, sorted in ascending order by the results of * running each element in a collection through each iteratee. This method * performs a stable sort, that is, it preserves the original sort order of * equal elements. The iteratees are invoked with one argument: (value). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {...(Function|Function[]|Object|Object[]|string|string[])} [iteratees=[_.identity]] * The iteratees to sort by, specified individually or in arrays. * @returns {Array} Returns the new sorted array. * @example * * var resolve = _.partial(_.map, _, _.values); * * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 42 }, * { 'user': 'barney', 'age': 34 } * ]; * * resolve( _.sortBy(users, function(o) { return o.user; }) ); * // => // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] * * resolve( _.sortBy(users, ['user', 'age']) ); * // => [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] * * resolve( _.sortBy(users, 'user', function(o) { * return Math.floor(o.age / 10); * }) ); * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] */ var sortBy = rest(function(collection, iteratees) { if (collection == null) { return []; } var length = iteratees.length; if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { iteratees = []; } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { iteratees.length = 1; } return baseOrderBy(collection, baseFlatten(iteratees), []); }); /*------------------------------------------------------------------------*/ /** * Gets the timestamp of the number of milliseconds that have elapsed since * the Unix epoch (1 January 1970 00:00:00 UTC). * * @static * @memberOf _ * @type Function * @category Date * @returns {number} Returns the timestamp. * @example * * _.defer(function(stamp) { * console.log(_.now() - stamp); * }, _.now()); * // => logs the number of milliseconds it took for the deferred function to be invoked */ var now = Date.now; /*------------------------------------------------------------------------*/ /** * The opposite of `_.before`; this method creates a function that invokes * `func` once it's called `n` or more times. * * @static * @memberOf _ * @category Function * @param {number} n The number of calls before `func` is invoked. * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. * @example * * var saves = ['profile', 'settings']; * * var done = _.after(saves.length, function() { * console.log('done saving!'); * }); * * _.forEach(saves, function(type) { * asyncSave({ 'type': type, 'complete': done }); * }); * // => logs 'done saving!' after the two async saves have completed */ function after(n, func) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } n = toInteger(n); return function() { if (--n < 1) { return func.apply(this, arguments); } }; } /** * Creates a function that accepts up to `n` arguments, ignoring any * additional arguments. * * @static * @memberOf _ * @category Function * @param {Function} func The function to cap arguments for. * @param {number} [n=func.length] The arity cap. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {Function} Returns the new function. * @example * * _.map(['6', '8', '10'], _.ary(parseInt, 1)); * // => [6, 8, 10] */ function ary(func, n, guard) { n = guard ? undefined : n; n = (func && n == null) ? func.length : n; return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n); } /** * Creates a function that invokes `func`, with the `this` binding and arguments * of the created function, while it's called less than `n` times. Subsequent * calls to the created function return the result of the last `func` invocation. * * @static * @memberOf _ * @category Function * @param {number} n The number of calls at which `func` is no longer invoked. * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. * @example * * jQuery(element).on('click', _.before(5, addContactToList)); * // => allows adding up to 4 contacts to the list */ function before(n, func) { var result; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } n = toInteger(n); return function() { if (--n > 0) { result = func.apply(this, arguments); } if (n <= 1) { func = undefined; } return result; }; } /** * Creates a function that invokes `func` with the `this` binding of `thisArg` * and prepends any additional `_.bind` arguments to those provided to the * bound function. * * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, * may be used as a placeholder for partially applied arguments. * * **Note:** Unlike native `Function#bind` this method doesn't set the "length" * property of bound functions. * * @static * @memberOf _ * @category Function * @param {Function} func The function to bind. * @param {*} thisArg The `this` binding of `func`. * @param {...*} [partials] The arguments to be partially applied. * @returns {Function} Returns the new bound function. * @example * * var greet = function(greeting, punctuation) { * return greeting + ' ' + this.user + punctuation; * }; * * var object = { 'user': 'fred' }; * * var bound = _.bind(greet, object, 'hi'); * bound('!'); * // => 'hi fred!' * * // using placeholders * var bound = _.bind(greet, object, _, '!'); * bound('hi'); * // => 'hi fred!' */ var bind = rest(function(func, thisArg, partials) { var bitmask = BIND_FLAG; if (partials.length) { var holders = replaceHolders(partials, bind.placeholder); bitmask |= PARTIAL_FLAG; } return createWrapper(func, bitmask, thisArg, partials, holders); }); /** * Creates a function that invokes the method at `object[key]` and prepends * any additional `_.bindKey` arguments to those provided to the bound function. * * This method differs from `_.bind` by allowing bound functions to reference * methods that may be redefined or don't yet exist. * See [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) * for more details. * * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. * * @static * @memberOf _ * @category Function * @param {Object} object The object to invoke the method on. * @param {string} key The key of the method. * @param {...*} [partials] The arguments to be partially applied. * @returns {Function} Returns the new bound function. * @example * * var object = { * 'user': 'fred', * 'greet': function(greeting, punctuation) { * return greeting + ' ' + this.user + punctuation; * } * }; * * var bound = _.bindKey(object, 'greet', 'hi'); * bound('!'); * // => 'hi fred!' * * object.greet = function(greeting, punctuation) { * return greeting + 'ya ' + this.user + punctuation; * }; * * bound('!'); * // => 'hiya fred!' * * // using placeholders * var bound = _.bindKey(object, 'greet', _, '!'); * bound('hi'); * // => 'hiya fred!' */ var bindKey = rest(function(object, key, partials) { var bitmask = BIND_FLAG | BIND_KEY_FLAG; if (partials.length) { var holders = replaceHolders(partials, bindKey.placeholder); bitmask |= PARTIAL_FLAG; } return createWrapper(key, bitmask, object, partials, holders); }); /** * Creates a function that accepts arguments of `func` and either invokes * `func` returning its result, if at least `arity` number of arguments have * been provided, or returns a function that accepts the remaining `func` * arguments, and so on. The arity of `func` may be specified if `func.length` * is not sufficient. * * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, * may be used as a placeholder for provided arguments. * * **Note:** This method doesn't set the "length" property of curried functions. * * @static * @memberOf _ * @category Function * @param {Function} func The function to curry. * @param {number} [arity=func.length] The arity of `func`. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {Function} Returns the new curried function. * @example * * var abc = function(a, b, c) { * return [a, b, c]; * }; * * var curried = _.curry(abc); * * curried(1)(2)(3); * // => [1, 2, 3] * * curried(1, 2)(3); * // => [1, 2, 3] * * curried(1, 2, 3); * // => [1, 2, 3] * * // using placeholders * curried(1)(_, 3)(2); * // => [1, 2, 3] */ function curry(func, arity, guard) { arity = guard ? undefined : arity; var result = createWrapper(func, CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); result.placeholder = curry.placeholder; return result; } /** * This method is like `_.curry` except that arguments are applied to `func` * in the manner of `_.partialRight` instead of `_.partial`. * * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for provided arguments. * * **Note:** This method doesn't set the "length" property of curried functions. * * @static * @memberOf _ * @category Function * @param {Function} func The function to curry. * @param {number} [arity=func.length] The arity of `func`. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {Function} Returns the new curried function. * @example * * var abc = function(a, b, c) { * return [a, b, c]; * }; * * var curried = _.curryRight(abc); * * curried(3)(2)(1); * // => [1, 2, 3] * * curried(2, 3)(1); * // => [1, 2, 3] * * curried(1, 2, 3); * // => [1, 2, 3] * * // using placeholders * curried(3)(1, _)(2); * // => [1, 2, 3] */ function curryRight(func, arity, guard) { arity = guard ? undefined : arity; var result = createWrapper(func, CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); result.placeholder = curryRight.placeholder; return result; } /** * Creates a debounced function that delays invoking `func` until after `wait` * milliseconds have elapsed since the last time the debounced function was * invoked. The debounced function comes with a `cancel` method to cancel * delayed `func` invocations and a `flush` method to immediately invoke them. * Provide an options object to indicate whether `func` should be invoked on * the leading and/or trailing edge of the `wait` timeout. The `func` is invoked * with the last arguments provided to the debounced function. Subsequent calls * to the debounced function return the result of the last `func` invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked * on the trailing edge of the timeout only if the the debounced function is * invoked more than once during the `wait` timeout. * * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) * for details over the differences between `_.debounce` and `_.throttle`. * * @static * @memberOf _ * @category Function * @param {Function} func The function to debounce. * @param {number} [wait=0] The number of milliseconds to delay. * @param {Object} [options] The options object. * @param {boolean} [options.leading=false] Specify invoking on the leading * edge of the timeout. * @param {number} [options.maxWait] The maximum time `func` is allowed to be * delayed before it's invoked. * @param {boolean} [options.trailing=true] Specify invoking on the trailing * edge of the timeout. * @returns {Function} Returns the new debounced function. * @example * * // avoid costly calculations while the window size is in flux * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); * * // invoke `sendMail` when clicked, debouncing subsequent calls * jQuery(element).on('click', _.debounce(sendMail, 300, { * 'leading': true, * 'trailing': false * })); * * // ensure `batchLog` is invoked once after 1 second of debounced calls * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); * var source = new EventSource('/stream'); * jQuery(source).on('message', debounced); * * // cancel a trailing debounced invocation * jQuery(window).on('popstate', debounced.cancel); */ function debounce(func, wait, options) { var args, maxTimeoutId, result, stamp, thisArg, timeoutId, trailingCall, lastCalled = 0, leading = false, maxWait = false, trailing = true; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } wait = toNumber(wait) || 0; if (isObject(options)) { leading = !!options.leading; maxWait = 'maxWait' in options && nativeMax(toNumber(options.maxWait) || 0, wait); trailing = 'trailing' in options ? !!options.trailing : trailing; } function cancel() { if (timeoutId) { clearTimeout(timeoutId); } if (maxTimeoutId) { clearTimeout(maxTimeoutId); } lastCalled = 0; args = maxTimeoutId = thisArg = timeoutId = trailingCall = undefined; } function complete(isCalled, id) { if (id) { clearTimeout(id); } maxTimeoutId = timeoutId = trailingCall = undefined; if (isCalled) { lastCalled = now(); result = func.apply(thisArg, args); if (!timeoutId && !maxTimeoutId) { args = thisArg = undefined; } } } function delayed() { var remaining = wait - (now() - stamp); if (remaining <= 0 || remaining > wait) { complete(trailingCall, maxTimeoutId); } else { timeoutId = setTimeout(delayed, remaining); } } function flush() { if ((timeoutId && trailingCall) || (maxTimeoutId && trailing)) { result = func.apply(thisArg, args); } cancel(); return result; } function maxDelayed() { complete(trailing, timeoutId); } function debounced() { args = arguments; stamp = now(); thisArg = this; trailingCall = trailing && (timeoutId || !leading); if (maxWait === false) { var leadingCall = leading && !timeoutId; } else { if (!maxTimeoutId && !leading) { lastCalled = stamp; } var remaining = maxWait - (stamp - lastCalled), isCalled = remaining <= 0 || remaining > maxWait; if (isCalled) { if (maxTimeoutId) { maxTimeoutId = clearTimeout(maxTimeoutId); } lastCalled = stamp; result = func.apply(thisArg, args); } else if (!maxTimeoutId) { maxTimeoutId = setTimeout(maxDelayed, remaining); } } if (isCalled && timeoutId) { timeoutId = clearTimeout(timeoutId); } else if (!timeoutId && wait !== maxWait) { timeoutId = setTimeout(delayed, wait); } if (leadingCall) { isCalled = true; result = func.apply(thisArg, args); } if (isCalled && !timeoutId && !maxTimeoutId) { args = thisArg = undefined; } return result; } debounced.cancel = cancel; debounced.flush = flush; return debounced; } /** * Defers invoking the `func` until the current call stack has cleared. Any * additional arguments are provided to `func` when it's invoked. * * @static * @memberOf _ * @category Function * @param {Function} func The function to defer. * @param {...*} [args] The arguments to invoke `func` with. * @returns {number} Returns the timer id. * @example * * _.defer(function(text) { * console.log(text); * }, 'deferred'); * // logs 'deferred' after one or more milliseconds */ var defer = rest(function(func, args) { return baseDelay(func, 1, args); }); /** * Invokes `func` after `wait` milliseconds. Any additional arguments are * provided to `func` when it's invoked. * * @static * @memberOf _ * @category Function * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay invocation. * @param {...*} [args] The arguments to invoke `func` with. * @returns {number} Returns the timer id. * @example * * _.delay(function(text) { * console.log(text); * }, 1000, 'later'); * // => logs 'later' after one second */ var delay = rest(function(func, wait, args) { return baseDelay(func, toNumber(wait) || 0, args); }); /** * Creates a function that invokes `func` with arguments reversed. * * @static * @memberOf _ * @category Function * @param {Function} func The function to flip arguments for. * @returns {Function} Returns the new function. * @example * * var flipped = _.flip(function() { * return _.toArray(arguments); * }); * * flipped('a', 'b', 'c', 'd'); * // => ['d', 'c', 'b', 'a'] */ function flip(func) { return createWrapper(func, FLIP_FLAG); } /** * Creates a function that memoizes the result of `func`. If `resolver` is * provided it determines the cache key for storing the result based on the * arguments provided to the memoized function. By default, the first argument * provided to the memoized function is used as the map cache key. The `func` * is invoked with the `this` binding of the memoized function. * * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object) * method interface of `delete`, `get`, `has`, and `set`. * * @static * @memberOf _ * @category Function * @param {Function} func The function to have its output memoized. * @param {Function} [resolver] The function to resolve the cache key. * @returns {Function} Returns the new memoizing function. * @example * * var object = { 'a': 1, 'b': 2 }; * var other = { 'c': 3, 'd': 4 }; * * var values = _.memoize(_.values); * values(object); * // => [1, 2] * * values(other); * // => [3, 4] * * object.a = 2; * values(object); * // => [1, 2] * * // modifying the result cache * values.cache.set(object, ['a', 'b']); * values(object); * // => ['a', 'b'] * * // replacing `_.memoize.Cache` * _.memoize.Cache = WeakMap; */ function memoize(func, resolver) { if (typeof func != 'function' || (resolver && typeof resolver != 'function')) { throw new TypeError(FUNC_ERROR_TEXT); } var memoized = function() { var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; if (cache.has(key)) { return cache.get(key); } var result = func.apply(this, args); memoized.cache = cache.set(key, result); return result; }; memoized.cache = new memoize.Cache; return memoized; } /** * Creates a function that negates the result of the predicate `func`. The * `func` predicate is invoked with the `this` binding and arguments of the * created function. * * @static * @memberOf _ * @category Function * @param {Function} predicate The predicate to negate. * @returns {Function} Returns the new function. * @example * * function isEven(n) { * return n % 2 == 0; * } * * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); * // => [1, 3, 5] */ function negate(predicate) { if (typeof predicate != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } return function() { return !predicate.apply(this, arguments); }; } /** * Creates a function that is restricted to invoking `func` once. Repeat calls * to the function return the value of the first invocation. The `func` is * invoked with the `this` binding and arguments of the created function. * * @static * @memberOf _ * @category Function * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. * @example * * var initialize = _.once(createApplication); * initialize(); * initialize(); * // `initialize` invokes `createApplication` once */ function once(func) { return before(2, func); } /** * Creates a function that invokes `func` with arguments transformed by * corresponding `transforms`. * * @static * @memberOf _ * @category Function * @param {Function} func The function to wrap. * @param {...(Function|Function[])} [transforms] The functions to transform * arguments, specified individually or in arrays. * @returns {Function} Returns the new function. * @example * * function doubled(n) { * return n * 2; * } * * function square(n) { * return n * n; * } * * var func = _.overArgs(function(x, y) { * return [x, y]; * }, square, doubled); * * func(9, 3); * // => [81, 6] * * func(10, 5); * // => [100, 10] */ var overArgs = rest(function(func, transforms) { transforms = arrayMap(baseFlatten(transforms), getIteratee()); var funcsLength = transforms.length; return rest(function(args) { var index = -1, length = nativeMin(args.length, funcsLength); while (++index < length) { args[index] = transforms[index].call(this, args[index]); } return apply(func, this, args); }); }); /** * Creates a function that invokes `func` with `partial` arguments prepended * to those provided to the new function. This method is like `_.bind` except * it does **not** alter the `this` binding. * * The `_.partial.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. * * **Note:** This method doesn't set the "length" property of partially * applied functions. * * @static * @memberOf _ * @category Function * @param {Function} func The function to partially apply arguments to. * @param {...*} [partials] The arguments to be partially applied. * @returns {Function} Returns the new partially applied function. * @example * * var greet = function(greeting, name) { * return greeting + ' ' + name; * }; * * var sayHelloTo = _.partial(greet, 'hello'); * sayHelloTo('fred'); * // => 'hello fred' * * // using placeholders * var greetFred = _.partial(greet, _, 'fred'); * greetFred('hi'); * // => 'hi fred' */ var partial = rest(function(func, partials) { var holders = replaceHolders(partials, partial.placeholder); return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders); }); /** * This method is like `_.partial` except that partially applied arguments * are appended to those provided to the new function. * * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. * * **Note:** This method doesn't set the "length" property of partially * applied functions. * * @static * @memberOf _ * @category Function * @param {Function} func The function to partially apply arguments to. * @param {...*} [partials] The arguments to be partially applied. * @returns {Function} Returns the new partially applied function. * @example * * var greet = function(greeting, name) { * return greeting + ' ' + name; * }; * * var greetFred = _.partialRight(greet, 'fred'); * greetFred('hi'); * // => 'hi fred' * * // using placeholders * var sayHelloTo = _.partialRight(greet, 'hello', _); * sayHelloTo('fred'); * // => 'hello fred' */ var partialRight = rest(function(func, partials) { var holders = replaceHolders(partials, partialRight.placeholder); return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders); }); /** * Creates a function that invokes `func` with arguments arranged according * to the specified indexes where the argument value at the first index is * provided as the first argument, the argument value at the second index is * provided as the second argument, and so on. * * @static * @memberOf _ * @category Function * @param {Function} func The function to rearrange arguments for. * @param {...(number|number[])} indexes The arranged argument indexes, * specified individually or in arrays. * @returns {Function} Returns the new function. * @example * * var rearged = _.rearg(function(a, b, c) { * return [a, b, c]; * }, 2, 0, 1); * * rearged('b', 'c', 'a') * // => ['a', 'b', 'c'] */ var rearg = rest(function(func, indexes) { return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes)); }); /** * Creates a function that invokes `func` with the `this` binding of the * created function and arguments from `start` and beyond provided as an array. * * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters). * * @static * @memberOf _ * @category Function * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @returns {Function} Returns the new function. * @example * * var say = _.rest(function(what, names) { * return what + ' ' + _.initial(names).join(', ') + * (_.size(names) > 1 ? ', & ' : '') + _.last(names); * }); * * say('hello', 'fred', 'barney', 'pebbles'); * // => 'hello fred, barney, & pebbles' */ function rest(func, start) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0); return function() { var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length); while (++index < length) { array[index] = args[start + index]; } switch (start) { case 0: return func.call(this, array); case 1: return func.call(this, args[0], array); case 2: return func.call(this, args[0], args[1], array); } var otherArgs = Array(start + 1); index = -1; while (++index < start) { otherArgs[index] = args[index]; } otherArgs[start] = array; return apply(func, this, otherArgs); }; } /** * Creates a function that invokes `func` with the `this` binding of the created * function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3). * * **Note:** This method is based on the [spread operator](https://mdn.io/spread_operator). * * @static * @memberOf _ * @category Function * @param {Function} func The function to spread arguments over. * @returns {Function} Returns the new function. * @example * * var say = _.spread(function(who, what) { * return who + ' says ' + what; * }); * * say(['fred', 'hello']); * // => 'fred says hello' * * // with a Promise * var numbers = Promise.all([ * Promise.resolve(40), * Promise.resolve(36) * ]); * * numbers.then(_.spread(function(x, y) { * return x + y; * })); * // => a Promise of 76 */ function spread(func) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } return function(array) { return apply(func, this, array); }; } /** * Creates a throttled function that only invokes `func` at most once per * every `wait` milliseconds. The throttled function comes with a `cancel` * method to cancel delayed `func` invocations and a `flush` method to * immediately invoke them. Provide an options object to indicate whether * `func` should be invoked on the leading and/or trailing edge of the `wait` * timeout. The `func` is invoked with the last arguments provided to the * throttled function. Subsequent calls to the throttled function return the * result of the last `func` invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked * on the trailing edge of the timeout only if the the throttled function is * invoked more than once during the `wait` timeout. * * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) * for details over the differences between `_.throttle` and `_.debounce`. * * @static * @memberOf _ * @category Function * @param {Function} func The function to throttle. * @param {number} [wait=0] The number of milliseconds to throttle invocations to. * @param {Object} [options] The options object. * @param {boolean} [options.leading=true] Specify invoking on the leading * edge of the timeout. * @param {boolean} [options.trailing=true] Specify invoking on the trailing * edge of the timeout. * @returns {Function} Returns the new throttled function. * @example * * // avoid excessively updating the position while scrolling * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); * * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); * jQuery(element).on('click', throttled); * * // cancel a trailing throttled invocation * jQuery(window).on('popstate', throttled.cancel); */ function throttle(func, wait, options) { var leading = true, trailing = true; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } if (isObject(options)) { leading = 'leading' in options ? !!options.leading : leading; trailing = 'trailing' in options ? !!options.trailing : trailing; } return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing }); } /** * Creates a function that accepts up to one argument, ignoring any * additional arguments. * * @static * @memberOf _ * @category Function * @param {Function} func The function to cap arguments for. * @returns {Function} Returns the new function. * @example * * _.map(['6', '8', '10'], _.unary(parseInt)); * // => [6, 8, 10] */ function unary(func) { return ary(func, 1); } /** * Creates a function that provides `value` to the wrapper function as its * first argument. Any additional arguments provided to the function are * appended to those provided to the wrapper function. The wrapper is invoked * with the `this` binding of the created function. * * @static * @memberOf _ * @category Function * @param {*} value The value to wrap. * @param {Function} wrapper The wrapper function. * @returns {Function} Returns the new function. * @example * * var p = _.wrap(_.escape, function(func, text) { * return '<p>' + func(text) + '</p>'; * }); * * p('fred, barney, & pebbles'); * // => '<p>fred, barney, &amp; pebbles</p>' */ function wrap(value, wrapper) { wrapper = wrapper == null ? identity : wrapper; return partial(wrapper, value); } /*------------------------------------------------------------------------*/ /** * Creates a shallow clone of `value`. * * **Note:** This method is loosely based on the * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) * and supports cloning arrays, array buffers, booleans, date objects, maps, * numbers, `Object` objects, regexes, sets, strings, symbols, and typed * arrays. The own enumerable properties of `arguments` objects are cloned * as plain objects. An empty object is returned for uncloneable values such * as error objects, functions, DOM nodes, and WeakMaps. * * @static * @memberOf _ * @category Lang * @param {*} value The value to clone. * @returns {*} Returns the cloned value. * @example * * var users = [ * { 'user': 'barney' }, * { 'user': 'fred' } * ]; * * var shallow = _.clone(users); * console.log(shallow[0] === users[0]); * // => true */ function clone(value) { return baseClone(value); } /** * This method is like `_.clone` except that it accepts `customizer` which * is invoked to produce the cloned value. If `customizer` returns `undefined` * cloning is handled by the method instead. The `customizer` is invoked with * up to five arguments; (value [, index|key, object, stack]). * * @static * @memberOf _ * @category Lang * @param {*} value The value to clone. * @param {Function} [customizer] The function to customize cloning. * @returns {*} Returns the cloned value. * @example * * function customizer(value) { * if (_.isElement(value)) { * return value.cloneNode(false); * } * } * * var el = _.clone(document.body, customizer); * * console.log(el === document.body); * // => false * console.log(el.nodeName); * // => BODY * console.log(el.childNodes.length); * // => 0 */ function cloneWith(value, customizer) { return baseClone(value, false, customizer); } /** * This method is like `_.clone` except that it recursively clones `value`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to recursively clone. * @returns {*} Returns the deep cloned value. * @example * * var users = [ * { 'user': 'barney' }, * { 'user': 'fred' } * ]; * * var deep = _.cloneDeep(users); * console.log(deep[0] === users[0]); * // => false */ function cloneDeep(value) { return baseClone(value, true); } /** * This method is like `_.cloneWith` except that it recursively clones `value`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to recursively clone. * @param {Function} [customizer] The function to customize cloning. * @returns {*} Returns the deep cloned value. * @example * * function customizer(value) { * if (_.isElement(value)) { * return value.cloneNode(true); * } * } * * var el = _.cloneDeep(document.body, customizer); * * console.log(el === document.body); * // => false * console.log(el.nodeName); * // => BODY * console.log(el.childNodes.length); * // => 20 */ function cloneDeepWith(value, customizer) { return baseClone(value, true, customizer); } /** * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'user': 'fred' }; * var other = { 'user': 'fred' }; * * _.eq(object, object); * // => true * * _.eq(object, other); * // => false * * _.eq('a', 'a'); * // => true * * _.eq('a', Object('a')); * // => false * * _.eq(NaN, NaN); * // => true */ function eq(value, other) { return value === other || (value !== value && other !== other); } /** * Checks if `value` is greater than `other`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`. * @example * * _.gt(3, 1); * // => true * * _.gt(3, 3); * // => false * * _.gt(1, 3); * // => false */ function gt(value, other) { return value > other; } /** * Checks if `value` is greater than or equal to `other`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if `value` is greater than or equal to `other`, else `false`. * @example * * _.gte(3, 1); * // => true * * _.gte(3, 3); * // => true * * _.gte(1, 3); * // => false */ function gte(value, other) { return value >= other; } /** * Checks if `value` is likely an `arguments` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isArguments(function() { return arguments; }()); * // => true * * _.isArguments([1, 2, 3]); * // => false */ function isArguments(value) { // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray = Array.isArray; /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @static * @memberOf _ * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. * @example * * _.isArrayLike([1, 2, 3]); * // => true * * _.isArrayLike(document.body.children); * // => true * * _.isArrayLike('abc'); * // => true * * _.isArrayLike(_.noop); * // => false */ function isArrayLike(value) { return value != null && !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value)); } /** * This method is like `_.isArrayLike` except that it also checks if `value` * is an object. * * @static * @memberOf _ * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. * @example * * _.isArrayLikeObject([1, 2, 3]); * // => true * * _.isArrayLikeObject(document.body.children); * // => true * * _.isArrayLikeObject('abc'); * // => false * * _.isArrayLikeObject(_.noop); * // => false */ function isArrayLikeObject(value) { return isObjectLike(value) && isArrayLike(value); } /** * Checks if `value` is classified as a boolean primitive or object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isBoolean(false); * // => true * * _.isBoolean(null); * // => false */ function isBoolean(value) { return value === true || value === false || (isObjectLike(value) && objectToString.call(value) == boolTag); } /** * Checks if `value` is classified as a `Date` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isDate(new Date); * // => true * * _.isDate('Mon April 23 2012'); * // => false */ function isDate(value) { return isObjectLike(value) && objectToString.call(value) == dateTag; } /** * Checks if `value` is likely a DOM element. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. * @example * * _.isElement(document.body); * // => true * * _.isElement('<body>'); * // => false */ function isElement(value) { return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); } /** * Checks if `value` is empty. A value is considered empty unless it's an * `arguments` object, array, string, or jQuery-like collection with a length * greater than `0` or an object with own enumerable properties. * * @static * @memberOf _ * @category Lang * @param {Array|Object|string} value The value to inspect. * @returns {boolean} Returns `true` if `value` is empty, else `false`. * @example * * _.isEmpty(null); * // => true * * _.isEmpty(true); * // => true * * _.isEmpty(1); * // => true * * _.isEmpty([1, 2, 3]); * // => false * * _.isEmpty({ 'a': 1 }); * // => false */ function isEmpty(value) { return (!isObjectLike(value) || isFunction(value.splice)) ? !size(value) : !keys(value).length; } /** * Performs a deep comparison between two values to determine if they are * equivalent. * * **Note:** This method supports comparing arrays, array buffers, booleans, * date objects, error objects, maps, numbers, `Object` objects, regexes, * sets, strings, symbols, and typed arrays. `Object` objects are compared * by their own, not inherited, enumerable properties. Functions and DOM * nodes are **not** supported. * * @static * @memberOf _ * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'user': 'fred' }; * var other = { 'user': 'fred' }; * * _.isEqual(object, other); * // => true * * object === other; * // => false */ function isEqual(value, other) { return baseIsEqual(value, other); } /** * This method is like `_.isEqual` except that it accepts `customizer` which is * invoked to compare values. If `customizer` returns `undefined` comparisons are * handled by the method instead. The `customizer` is invoked with up to seven arguments: * (objValue, othValue [, index|key, object, other, stack]). * * @static * @memberOf _ * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {Function} [customizer] The function to customize comparisons. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * function isGreeting(value) { * return /^h(?:i|ello)$/.test(value); * } * * function customizer(objValue, othValue) { * if (isGreeting(objValue) && isGreeting(othValue)) { * return true; * } * } * * var array = ['hello', 'goodbye']; * var other = ['hi', 'goodbye']; * * _.isEqualWith(array, other, customizer); * // => true */ function isEqualWith(value, other, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined; var result = customizer ? customizer(value, other) : undefined; return result === undefined ? baseIsEqual(value, other, customizer) : !!result; } /** * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, * `SyntaxError`, `TypeError`, or `URIError` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an error object, else `false`. * @example * * _.isError(new Error); * // => true * * _.isError(Error); * // => false */ function isError(value) { return isObjectLike(value) && typeof value.message == 'string' && objectToString.call(value) == errorTag; } /** * Checks if `value` is a finite primitive number. * * **Note:** This method is based on [`Number.isFinite`](https://mdn.io/Number/isFinite). * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. * @example * * _.isFinite(3); * // => true * * _.isFinite(Number.MAX_VALUE); * // => true * * _.isFinite(3.14); * // => true * * _.isFinite(Infinity); * // => false */ function isFinite(value) { return typeof value == 'number' && nativeIsFinite(value); } /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 8 which returns 'object' for typed array constructors, and // PhantomJS 1.9 which returns 'function' for `NodeList` instances. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } /** * Checks if `value` is an integer. * * **Note:** This method is based on [`Number.isInteger`](https://mdn.io/Number/isInteger). * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an integer, else `false`. * @example * * _.isInteger(3); * // => true * * _.isInteger(Number.MIN_VALUE); * // => false * * _.isInteger(Infinity); * // => false * * _.isInteger('3'); * // => false */ function isInteger(value) { return typeof value == 'number' && value == toInteger(value); } /** * Checks if `value` is a valid array-like length. * * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); * // => true * * _.isLength(Number.MIN_VALUE); * // => false * * _.isLength(Infinity); * // => false * * _.isLength('3'); * // => false */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { // Avoid a V8 JIT bug in Chrome 19-20. // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. var type = typeof value; return !!value && (type == 'object' || type == 'function'); } /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return !!value && typeof value == 'object'; } /** * Performs a deep comparison between `object` and `source` to determine if * `object` contains equivalent property values. * * **Note:** This method supports comparing the same values as `_.isEqual`. * * @static * @memberOf _ * @category Lang * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @returns {boolean} Returns `true` if `object` is a match, else `false`. * @example * * var object = { 'user': 'fred', 'age': 40 }; * * _.isMatch(object, { 'age': 40 }); * // => true * * _.isMatch(object, { 'age': 36 }); * // => false */ function isMatch(object, source) { return object === source || baseIsMatch(object, source, getMatchData(source)); } /** * This method is like `_.isMatch` except that it accepts `customizer` which * is invoked to compare values. If `customizer` returns `undefined` comparisons * are handled by the method instead. The `customizer` is invoked with three * arguments: (objValue, srcValue, index|key, object, source). * * @static * @memberOf _ * @category Lang * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @param {Function} [customizer] The function to customize comparisons. * @returns {boolean} Returns `true` if `object` is a match, else `false`. * @example * * function isGreeting(value) { * return /^h(?:i|ello)$/.test(value); * } * * function customizer(objValue, srcValue) { * if (isGreeting(objValue) && isGreeting(srcValue)) { * return true; * } * } * * var object = { 'greeting': 'hello' }; * var source = { 'greeting': 'hi' }; * * _.isMatchWith(object, source, customizer); * // => true */ function isMatchWith(object, source, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined; return baseIsMatch(object, source, getMatchData(source), customizer); } /** * Checks if `value` is `NaN`. * * **Note:** This method is not the same as [`isNaN`](https://es5.github.io/#x15.1.2.4) * which returns `true` for `undefined` and other non-numeric values. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. * @example * * _.isNaN(NaN); * // => true * * _.isNaN(new Number(NaN)); * // => true * * isNaN(undefined); * // => true * * _.isNaN(undefined); * // => false */ function isNaN(value) { // An `NaN` primitive is the only value that is not equal to itself. // Perform the `toStringTag` check first to avoid errors with some ActiveX objects in IE. return isNumber(value) && value != +value; } /** * Checks if `value` is a native function. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, else `false`. * @example * * _.isNative(Array.prototype.push); * // => true * * _.isNative(_); * // => false */ function isNative(value) { if (value == null) { return false; } if (isFunction(value)) { return reIsNative.test(funcToString.call(value)); } return isObjectLike(value) && (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); } /** * Checks if `value` is `null`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `null`, else `false`. * @example * * _.isNull(null); * // => true * * _.isNull(void 0); * // => false */ function isNull(value) { return value === null; } /** * Checks if `value` is `null` or `undefined`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is nullish, else `false`. * @example * * _.isNil(null); * // => true * * _.isNil(void 0); * // => true * * _.isNil(NaN); * // => false */ function isNil(value) { return value == null; } /** * Checks if `value` is classified as a `Number` primitive or object. * * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified * as numbers, use the `_.isFinite` method. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isNumber(3); * // => true * * _.isNumber(Number.MIN_VALUE); * // => true * * _.isNumber(Infinity); * // => true * * _.isNumber('3'); * // => false */ function isNumber(value) { return typeof value == 'number' || (isObjectLike(value) && objectToString.call(value) == numberTag); } /** * Checks if `value` is a plain object, that is, an object created by the * `Object` constructor or one with a `[[Prototype]]` of `null`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. * @example * * function Foo() { * this.a = 1; * } * * _.isPlainObject(new Foo); * // => false * * _.isPlainObject([1, 2, 3]); * // => false * * _.isPlainObject({ 'x': 0, 'y': 0 }); * // => true * * _.isPlainObject(Object.create(null)); * // => true */ function isPlainObject(value) { if (!isObjectLike(value) || objectToString.call(value) != objectTag || isHostObject(value)) { return false; } var proto = objectProto; if (typeof value.constructor == 'function') { proto = getPrototypeOf(value); } if (proto === null) { return true; } var Ctor = proto.constructor; return (typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString); } /** * Checks if `value` is classified as a `RegExp` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isRegExp(/abc/); * // => true * * _.isRegExp('/abc/'); * // => false */ function isRegExp(value) { return isObject(value) && objectToString.call(value) == regexpTag; } /** * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 * double precision number which isn't the result of a rounded unsafe integer. * * **Note:** This method is based on [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. * @example * * _.isSafeInteger(3); * // => true * * _.isSafeInteger(Number.MIN_VALUE); * // => false * * _.isSafeInteger(Infinity); * // => false * * _.isSafeInteger('3'); * // => false */ function isSafeInteger(value) { return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is classified as a `String` primitive or object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isString('abc'); * // => true * * _.isString(1); * // => false */ function isString(value) { return typeof value == 'string' || (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); } /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol(value) { return typeof value == 'symbol' || (isObjectLike(value) && objectToString.call(value) == symbolTag); } /** * Checks if `value` is classified as a typed array. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isTypedArray(new Uint8Array); * // => true * * _.isTypedArray([]); * // => false */ function isTypedArray(value) { return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; } /** * Checks if `value` is `undefined`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. * @example * * _.isUndefined(void 0); * // => true * * _.isUndefined(null); * // => false */ function isUndefined(value) { return value === undefined; } /** * Checks if `value` is less than `other`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if `value` is less than `other`, else `false`. * @example * * _.lt(1, 3); * // => true * * _.lt(3, 3); * // => false * * _.lt(3, 1); * // => false */ function lt(value, other) { return value < other; } /** * Checks if `value` is less than or equal to `other`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if `value` is less than or equal to `other`, else `false`. * @example * * _.lte(1, 3); * // => true * * _.lte(3, 3); * // => true * * _.lte(3, 1); * // => false */ function lte(value, other) { return value <= other; } /** * Converts `value` to an array. * * @static * @memberOf _ * @category Lang * @param {*} value The value to convert. * @returns {Array} Returns the converted array. * @example * * (function() { * return _.toArray(arguments).slice(1); * }(1, 2, 3)); * // => [2, 3] */ function toArray(value) { if (!value) { return []; } if (isArrayLike(value)) { return isString(value) ? stringToArray(value) : copyArray(value); } if (iteratorSymbol && value[iteratorSymbol]) { return iteratorToArray(value[iteratorSymbol]()); } var tag = getTag(value), func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); return func(value); } /** * Converts `value` to an integer. * * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). * * @static * @memberOf _ * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. * @example * * _.toInteger(3); * // => 3 * * _.toInteger(Number.MIN_VALUE); * // => 0 * * _.toInteger(Infinity); * // => 1.7976931348623157e+308 * * _.toInteger('3'); * // => 3 */ function toInteger(value) { if (!value) { return value === 0 ? value : 0; } value = toNumber(value); if (value === INFINITY || value === -INFINITY) { var sign = (value < 0 ? -1 : 1); return sign * MAX_INTEGER; } var remainder = value % 1; return value === value ? (remainder ? value - remainder : value) : 0; } /** * Converts `value` to an integer suitable for use as the length of an * array-like object. * * **Note:** This method is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @static * @memberOf _ * @category Lang * @param {*} value The value to convert. * @return {number} Returns the converted integer. * @example * * _.toLength(3); * // => 3 * * _.toLength(Number.MIN_VALUE); * // => 0 * * _.toLength(Infinity); * // => 4294967295 * * _.toLength('3'); * // => 3 */ function toLength(value) { return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; } /** * Converts `value` to a number. * * @static * @memberOf _ * @category Lang * @param {*} value The value to process. * @returns {number} Returns the number. * @example * * _.toNumber(3); * // => 3 * * _.toNumber(Number.MIN_VALUE); * // => 5e-324 * * _.toNumber(Infinity); * // => Infinity * * _.toNumber('3'); * // => 3 */ function toNumber(value) { if (isObject(value)) { var other = isFunction(value.valueOf) ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; } if (typeof value != 'string') { return value === 0 ? value : +value; } value = value.replace(reTrim, ''); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : (reIsBadHex.test(value) ? NAN : +value); } /** * Converts `value` to a plain object flattening inherited enumerable * properties of `value` to own properties of the plain object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to convert. * @returns {Object} Returns the converted plain object. * @example * * function Foo() { * this.b = 2; * } * * Foo.prototype.c = 3; * * _.assign({ 'a': 1 }, new Foo); * // => { 'a': 1, 'b': 2 } * * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); * // => { 'a': 1, 'b': 2, 'c': 3 } */ function toPlainObject(value) { return copyObject(value, keysIn(value)); } /** * Converts `value` to a safe integer. A safe integer can be compared and * represented correctly. * * @static * @memberOf _ * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. * @example * * _.toSafeInteger(3); * // => 3 * * _.toSafeInteger(Number.MIN_VALUE); * // => 0 * * _.toSafeInteger(Infinity); * // => 9007199254740991 * * _.toSafeInteger('3'); * // => 3 */ function toSafeInteger(value) { return baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER); } /** * Converts `value` to a string if it's not one. An empty string is returned * for `null` and `undefined` values. The sign of `-0` is preserved. * * @static * @memberOf _ * @category Lang * @param {*} value The value to process. * @returns {string} Returns the string. * @example * * _.toString(null); * // => '' * * _.toString(-0); * // => '-0' * * _.toString([1, 2, 3]); * // => '1,2,3' */ function toString(value) { // Exit early for strings to avoid a performance hit in some environments. if (typeof value == 'string') { return value; } if (value == null) { return ''; } if (isSymbol(value)) { return _Symbol ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /*------------------------------------------------------------------------*/ /** * Assigns own enumerable properties of source objects to the destination * object. Source objects are applied from left to right. Subsequent sources * overwrite property assignments of previous sources. * * **Note:** This method mutates `object` and is loosely based on * [`Object.assign`](https://mdn.io/Object/assign). * * @static * @memberOf _ * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @example * * function Foo() { * this.c = 3; * } * * function Bar() { * this.e = 5; * } * * Foo.prototype.d = 4; * Bar.prototype.f = 6; * * _.assign({ 'a': 1 }, new Foo, new Bar); * // => { 'a': 1, 'c': 3, 'e': 5 } */ var assign = createAssigner(function(object, source) { copyObject(source, keys(source), object); }); /** * This method is like `_.assign` except that it iterates over own and * inherited source properties. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @alias extend * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @example * * function Foo() { * this.b = 2; * } * * function Bar() { * this.d = 4; * } * * Foo.prototype.c = 3; * Bar.prototype.e = 5; * * _.assignIn({ 'a': 1 }, new Foo, new Bar); * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 } */ var assignIn = createAssigner(function(object, source) { copyObject(source, keysIn(source), object); }); /** * This method is like `_.assignIn` except that it accepts `customizer` which * is invoked to produce the assigned values. If `customizer` returns `undefined` * assignment is handled by the method instead. The `customizer` is invoked * with five arguments: (objValue, srcValue, key, object, source). * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @alias extendWith * @category Object * @param {Object} object The destination object. * @param {...Object} sources The source objects. * @param {Function} [customizer] The function to customize assigned values. * @returns {Object} Returns `object`. * @example * * function customizer(objValue, srcValue) { * return _.isUndefined(objValue) ? srcValue : objValue; * } * * var defaults = _.partialRight(_.assignInWith, customizer); * * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); * // => { 'a': 1, 'b': 2 } */ var assignInWith = createAssigner(function(object, source, customizer) { copyObjectWith(source, keysIn(source), object, customizer); }); /** * This method is like `_.assign` except that it accepts `customizer` which * is invoked to produce the assigned values. If `customizer` returns `undefined` * assignment is handled by the method instead. The `customizer` is invoked * with five arguments: (objValue, srcValue, key, object, source). * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The destination object. * @param {...Object} sources The source objects. * @param {Function} [customizer] The function to customize assigned values. * @returns {Object} Returns `object`. * @example * * function customizer(objValue, srcValue) { * return _.isUndefined(objValue) ? srcValue : objValue; * } * * var defaults = _.partialRight(_.assignWith, customizer); * * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); * // => { 'a': 1, 'b': 2 } */ var assignWith = createAssigner(function(object, source, customizer) { copyObjectWith(source, keys(source), object, customizer); }); /** * Creates an array of values corresponding to `paths` of `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to iterate over. * @param {...(string|string[])} [paths] The property paths of elements to pick, * specified individually or in arrays. * @returns {Array} Returns the new array of picked elements. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; * * _.at(object, ['a[0].b.c', 'a[1]']); * // => [3, 4] * * _.at(['a', 'b', 'c'], 0, 2); * // => ['a', 'c'] */ var at = rest(function(object, paths) { return baseAt(object, baseFlatten(paths)); }); /** * Creates an object that inherits from the `prototype` object. If a `properties` * object is provided its own enumerable properties are assigned to the created object. * * @static * @memberOf _ * @category Object * @param {Object} prototype The object to inherit from. * @param {Object} [properties] The properties to assign to the object. * @returns {Object} Returns the new object. * @example * * function Shape() { * this.x = 0; * this.y = 0; * } * * function Circle() { * Shape.call(this); * } * * Circle.prototype = _.create(Shape.prototype, { * 'constructor': Circle * }); * * var circle = new Circle; * circle instanceof Circle; * // => true * * circle instanceof Shape; * // => true */ function create(prototype, properties) { var result = baseCreate(prototype); return properties ? baseAssign(result, properties) : result; } /** * Assigns own and inherited enumerable properties of source objects to the * destination object for all destination properties that resolve to `undefined`. * Source objects are applied from left to right. Once a property is set, * additional values of the same property are ignored. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @example * * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); * // => { 'user': 'barney', 'age': 36 } */ var defaults = rest(function(args) { args.push(undefined, assignInDefaults); return apply(assignInWith, undefined, args); }); /** * This method is like `_.defaults` except that it recursively assigns * default properties. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @example * * _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } }); * // => { 'user': { 'name': 'barney', 'age': 36 } } * */ var defaultsDeep = rest(function(args) { args.push(undefined, mergeDefaults); return apply(mergeWith, undefined, args); }); /** * This method is like `_.find` except that it returns the key of the first * element `predicate` returns truthy for instead of the element itself. * * @static * @memberOf _ * @category Object * @param {Object} object The object to search. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {string|undefined} Returns the key of the matched element, else `undefined`. * @example * * var users = { * 'barney': { 'age': 36, 'active': true }, * 'fred': { 'age': 40, 'active': false }, * 'pebbles': { 'age': 1, 'active': true } * }; * * _.findKey(users, function(o) { return o.age < 40; }); * // => 'barney' (iteration order is not guaranteed) * * // using the `_.matches` iteratee shorthand * _.findKey(users, { 'age': 1, 'active': true }); * // => 'pebbles' * * // using the `_.matchesProperty` iteratee shorthand * _.findKey(users, ['active', false]); * // => 'fred' * * // using the `_.property` iteratee shorthand * _.findKey(users, 'active'); * // => 'barney' */ function findKey(object, predicate) { return baseFind(object, getIteratee(predicate, 3), baseForOwn, true); } /** * This method is like `_.findKey` except that it iterates over elements of * a collection in the opposite order. * * @static * @memberOf _ * @category Object * @param {Object} object The object to search. * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. * @returns {string|undefined} Returns the key of the matched element, else `undefined`. * @example * * var users = { * 'barney': { 'age': 36, 'active': true }, * 'fred': { 'age': 40, 'active': false }, * 'pebbles': { 'age': 1, 'active': true } * }; * * _.findLastKey(users, function(o) { return o.age < 40; }); * // => returns 'pebbles' assuming `_.findKey` returns 'barney' * * // using the `_.matches` iteratee shorthand * _.findLastKey(users, { 'age': 36, 'active': true }); * // => 'barney' * * // using the `_.matchesProperty` iteratee shorthand * _.findLastKey(users, ['active', false]); * // => 'fred' * * // using the `_.property` iteratee shorthand * _.findLastKey(users, 'active'); * // => 'pebbles' */ function findLastKey(object, predicate) { return baseFind(object, getIteratee(predicate, 3), baseForOwnRight, true); } /** * Iterates over own and inherited enumerable properties of an object invoking * `iteratee` for each property. The iteratee is invoked with three arguments: * (value, key, object). Iteratee functions may exit iteration early by explicitly * returning `false`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns `object`. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.forIn(new Foo, function(value, key) { * console.log(key); * }); * // => logs 'a', 'b', then 'c' (iteration order is not guaranteed) */ function forIn(object, iteratee) { return object == null ? object : baseFor(object, toFunction(iteratee), keysIn); } /** * This method is like `_.forIn` except that it iterates over properties of * `object` in the opposite order. * * @static * @memberOf _ * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns `object`. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.forInRight(new Foo, function(value, key) { * console.log(key); * }); * // => logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c' */ function forInRight(object, iteratee) { return object == null ? object : baseForRight(object, toFunction(iteratee), keysIn); } /** * Iterates over own enumerable properties of an object invoking `iteratee` * for each property. The iteratee is invoked with three arguments: * (value, key, object). Iteratee functions may exit iteration early by * explicitly returning `false`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns `object`. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.forOwn(new Foo, function(value, key) { * console.log(key); * }); * // => logs 'a' then 'b' (iteration order is not guaranteed) */ function forOwn(object, iteratee) { return object && baseForOwn(object, toFunction(iteratee)); } /** * This method is like `_.forOwn` except that it iterates over properties of * `object` in the opposite order. * * @static * @memberOf _ * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns `object`. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.forOwnRight(new Foo, function(value, key) { * console.log(key); * }); * // => logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b' */ function forOwnRight(object, iteratee) { return object && baseForOwnRight(object, toFunction(iteratee)); } /** * Creates an array of function property names from own enumerable properties * of `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to inspect. * @returns {Array} Returns the new array of property names. * @example * * function Foo() { * this.a = _.constant('a'); * this.b = _.constant('b'); * } * * Foo.prototype.c = _.constant('c'); * * _.functions(new Foo); * // => ['a', 'b'] */ function functions(object) { return object == null ? [] : baseFunctions(object, keys(object)); } /** * Creates an array of function property names from own and inherited * enumerable properties of `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to inspect. * @returns {Array} Returns the new array of property names. * @example * * function Foo() { * this.a = _.constant('a'); * this.b = _.constant('b'); * } * * Foo.prototype.c = _.constant('c'); * * _.functionsIn(new Foo); * // => ['a', 'b', 'c'] */ function functionsIn(object) { return object == null ? [] : baseFunctions(object, keysIn(object)); } /** * Gets the value at `path` of `object`. If the resolved value is * `undefined` the `defaultValue` is used in its place. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. * @returns {*} Returns the resolved value. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.get(object, 'a[0].b.c'); * // => 3 * * _.get(object, ['a', '0', 'b', 'c']); * // => 3 * * _.get(object, 'a.b.c', 'default'); * // => 'default' */ function get(object, path, defaultValue) { var result = object == null ? undefined : baseGet(object, path); return result === undefined ? defaultValue : result; } /** * Checks if `path` is a direct property of `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * * var object = { 'a': { 'b': { 'c': 3 } } }; * var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); * * _.has(object, 'a'); * // => true * * _.has(object, 'a.b.c'); * // => true * * _.has(object, ['a', 'b', 'c']); * // => true * * _.has(other, 'a'); * // => false */ function has(object, path) { return hasPath(object, path, baseHas); } /** * Checks if `path` is a direct or inherited property of `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * * var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); * * _.hasIn(object, 'a'); * // => true * * _.hasIn(object, 'a.b.c'); * // => true * * _.hasIn(object, ['a', 'b', 'c']); * // => true * * _.hasIn(object, 'b'); * // => false */ function hasIn(object, path) { return hasPath(object, path, baseHasIn); } /** * Creates an object composed of the inverted keys and values of `object`. * If `object` contains duplicate values, subsequent values overwrite property * assignments of previous values unless `multiVal` is `true`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to invert. * @param {boolean} [multiVal] Allow multiple values per key. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {Object} Returns the new inverted object. * @example * * var object = { 'a': 1, 'b': 2, 'c': 1 }; * * _.invert(object); * // => { '1': 'c', '2': 'b' } * * // with `multiVal` * _.invert(object, true); * // => { '1': ['a', 'c'], '2': ['b'] } */ function invert(object, multiVal, guard) { return arrayReduce(keys(object), function(result, key) { var value = object[key]; if (multiVal && !guard) { if (hasOwnProperty.call(result, value)) { result[value].push(key); } else { result[value] = [key]; } } else { result[value] = key; } return result; }, {}); } /** * Invokes the method at `path` of `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the method to invoke. * @param {...*} [args] The arguments to invoke the method with. * @returns {*} Returns the result of the invoked method. * @example * * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; * * _.invoke(object, 'a[0].b.c.slice', 1, 3); * // => [2, 3] */ var invoke = rest(baseInvoke); /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) * for more details. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keys(new Foo); * // => ['a', 'b'] (iteration order is not guaranteed) * * _.keys('hi'); * // => ['0', '1'] */ function keys(object) { var isProto = isPrototype(object); if (!(isProto || isArrayLike(object))) { return baseKeys(object); } var indexes = indexKeys(object), skipIndexes = !!indexes, result = indexes || [], length = result.length; for (var key in object) { if (baseHas(object, key) && !(skipIndexes && (key == 'length' || isIndex(key, length))) && !(isProto && key == 'constructor')) { result.push(key); } } return result; } /** * Creates an array of the own and inherited enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keysIn(new Foo); * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ function keysIn(object) { var index = -1, isProto = isPrototype(object), props = baseKeysIn(object), propsLength = props.length, indexes = indexKeys(object), skipIndexes = !!indexes, result = indexes || [], length = result.length; while (++index < propsLength) { var key = props[index]; if (!(skipIndexes && (key == 'length' || isIndex(key, length))) && !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { result.push(key); } } return result; } /** * The opposite of `_.mapValues`; this method creates an object with the * same values as `object` and keys generated by running each own enumerable * property of `object` through `iteratee`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns the new mapped object. * @example * * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { * return key + value; * }); * // => { 'a1': 1, 'b2': 2 } */ function mapKeys(object, iteratee) { var result = {}; iteratee = getIteratee(iteratee, 3); baseForOwn(object, function(value, key, object) { result[iteratee(value, key, object)] = value; }); return result; } /** * Creates an object with the same keys as `object` and values generated by * running each own enumerable property of `object` through `iteratee`. The * iteratee function is invoked with three arguments: (value, key, object). * * @static * @memberOf _ * @category Object * @param {Object} object The object to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns the new mapped object. * @example * * var users = { * 'fred': { 'user': 'fred', 'age': 40 }, * 'pebbles': { 'user': 'pebbles', 'age': 1 } * }; * * _.mapValues(users, function(o) { return o.age; }); * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) * * // using the `_.property` iteratee shorthand * _.mapValues(users, 'age'); * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) */ function mapValues(object, iteratee) { var result = {}; iteratee = getIteratee(iteratee, 3); baseForOwn(object, function(value, key, object) { result[key] = iteratee(value, key, object); }); return result; } /** * Recursively merges own and inherited enumerable properties of source * objects into the destination object, skipping source properties that resolve * to `undefined`. Array and plain object properties are merged recursively. * Other objects and value types are overridden by assignment. Source objects * are applied from left to right. Subsequent sources overwrite property * assignments of previous sources. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @example * * var users = { * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] * }; * * var ages = { * 'data': [{ 'age': 36 }, { 'age': 40 }] * }; * * _.merge(users, ages); * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } */ var merge = createAssigner(function(object, source) { baseMerge(object, source); }); /** * This method is like `_.merge` except that it accepts `customizer` which * is invoked to produce the merged values of the destination and source * properties. If `customizer` returns `undefined` merging is handled by the * method instead. The `customizer` is invoked with seven arguments: * (objValue, srcValue, key, object, source, stack). * * @static * @memberOf _ * @category Object * @param {Object} object The destination object. * @param {...Object} sources The source objects. * @param {Function} customizer The function to customize assigned values. * @returns {Object} Returns `object`. * @example * * function customizer(objValue, srcValue) { * if (_.isArray(objValue)) { * return objValue.concat(srcValue); * } * } * * var object = { * 'fruits': ['apple'], * 'vegetables': ['beet'] * }; * * var other = { * 'fruits': ['banana'], * 'vegetables': ['carrot'] * }; * * _.mergeWith(object, other, customizer); * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } */ var mergeWith = createAssigner(function(object, source, customizer) { baseMerge(object, source, customizer); }); /** * The opposite of `_.pick`; this method creates an object composed of the * own and inherited enumerable properties of `object` that are not omitted. * * @static * @memberOf _ * @category Object * @param {Object} object The source object. * @param {...(string|string[])} [props] The property names to omit, specified * individually or in arrays.. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': 2, 'c': 3 }; * * _.omit(object, ['a', 'c']); * // => { 'b': 2 } */ var omit = rest(function(object, props) { if (object == null) { return {}; } props = arrayMap(baseFlatten(props), String); return basePick(object, baseDifference(keysIn(object), props)); }); /** * The opposite of `_.pickBy`; this method creates an object composed of the * own and inherited enumerable properties of `object` that `predicate` * doesn't return truthy for. * * @static * @memberOf _ * @category Object * @param {Object} object The source object. * @param {Function|Object|string} [predicate=_.identity] The function invoked per property. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2' }; * * _.omitBy(object, _.isNumber); * // => { 'b': '2' } */ function omitBy(object, predicate) { predicate = getIteratee(predicate); return basePickBy(object, function(value) { return !predicate(value); }); } /** * Creates an object composed of the picked `object` properties. * * @static * @memberOf _ * @category Object * @param {Object} object The source object. * @param {...(string|string[])} [props] The property names to pick, specified * individually or in arrays. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': 2, 'c': 3 }; * * _.pick(object, ['a', 'c']); * // => { 'a': 1, 'c': 3 } */ var pick = rest(function(object, props) { return object == null ? {} : basePick(object, baseFlatten(props)); }); /** * Creates an object composed of the `object` properties `predicate` returns * truthy for. The predicate is invoked with one argument: (value). * * @static * @memberOf _ * @category Object * @param {Object} object The source object. * @param {Function|Object|string} [predicate=_.identity] The function invoked per property. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2' }; * * _.pickBy(object, _.isNumber); * // => { 'a': 1 } */ function pickBy(object, predicate) { return object == null ? {} : basePickBy(object, getIteratee(predicate)); } /** * This method is like `_.get` except that if the resolved value is a function * it's invoked with the `this` binding of its parent object and its result * is returned. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to resolve. * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. * @returns {*} Returns the resolved value. * @example * * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; * * _.result(object, 'a[0].b.c1'); * // => 3 * * _.result(object, 'a[0].b.c2'); * // => 4 * * _.result(object, 'a[0].b.c3', 'default'); * // => 'default' * * _.result(object, 'a[0].b.c3', _.constant('default')); * // => 'default' */ function result(object, path, defaultValue) { if (!isKey(path, object)) { path = baseToPath(path); var result = get(object, path); object = parent(object, path); } else { result = object == null ? undefined : object[path]; } if (result === undefined) { result = defaultValue; } return isFunction(result) ? result.call(object) : result; } /** * Sets the value at `path` of `object`. If a portion of `path` doesn't exist * it's created. Arrays are created for missing index properties while objects * are created for all other missing properties. Use `_.setWith` to customize * `path` creation. * * @static * @memberOf _ * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {*} value The value to set. * @returns {Object} Returns `object`. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.set(object, 'a[0].b.c', 4); * console.log(object.a[0].b.c); * // => 4 * * _.set(object, 'x[0].y.z', 5); * console.log(object.x[0].y.z); * // => 5 */ function set(object, path, value) { return object == null ? object : baseSet(object, path, value); } /** * This method is like `_.set` except that it accepts `customizer` which is * invoked to produce the objects of `path`. If `customizer` returns `undefined` * path creation is handled by the method instead. The `customizer` is invoked * with three arguments: (nsValue, key, nsObject). * * @static * @memberOf _ * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {*} value The value to set. * @param {Function} [customizer] The function to customize assigned values. * @returns {Object} Returns `object`. * @example * * _.setWith({ '0': { 'length': 2 } }, '[0][1][2]', 3, Object); * // => { '0': { '1': { '2': 3 }, 'length': 2 } } */ function setWith(object, path, value, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined; return object == null ? object : baseSet(object, path, value, customizer); } /** * Creates an array of own enumerable key-value pairs for `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the new array of key-value pairs. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.toPairs(new Foo); * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) */ function toPairs(object) { return baseToPairs(object, keys(object)); } /** * Creates an array of own and inherited enumerable key-value pairs for `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the new array of key-value pairs. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.toPairsIn(new Foo); * // => [['a', 1], ['b', 2], ['c', 1]] (iteration order is not guaranteed) */ function toPairsIn(object) { return baseToPairs(object, keysIn(object)); } /** * An alternative to `_.reduce`; this method transforms `object` to a new * `accumulator` object which is the result of running each of its own enumerable * properties through `iteratee`, with each invocation potentially mutating * the `accumulator` object. The iteratee is invoked with four arguments: * (accumulator, value, key, object). Iteratee functions may exit iteration * early by explicitly returning `false`. * * @static * @memberOf _ * @category Object * @param {Array|Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The custom accumulator value. * @returns {*} Returns the accumulated value. * @example * * _.transform([2, 3, 4], function(result, n) { * result.push(n *= n); * return n % 2 == 0; * }); * // => [4, 9] * * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { * (result[value] || (result[value] = [])).push(key); * }); * // => { '1': ['a', 'c'], '2': ['b'] } */ function transform(object, iteratee, accumulator) { var isArr = isArray(object) || isTypedArray(object); iteratee = getIteratee(iteratee, 4); if (accumulator == null) { if (isArr || isObject(object)) { var Ctor = object.constructor; if (isArr) { accumulator = isArray(object) ? new Ctor : []; } else { accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined); } } else { accumulator = {}; } } (isArr ? arrayEach : baseForOwn)(object, function(value, index, object) { return iteratee(accumulator, value, index, object); }); return accumulator; } /** * Removes the property at `path` of `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to unset. * @returns {boolean} Returns `true` if the property is deleted, else `false`. * @example * * var object = { 'a': [{ 'b': { 'c': 7 } }] }; * _.unset(object, 'a[0].b.c'); * // => true * * console.log(object); * // => { 'a': [{ 'b': {} }] }; * * _.unset(object, 'a[0].b.c'); * // => true * * console.log(object); * // => { 'a': [{ 'b': {} }] }; */ function unset(object, path) { return object == null ? true : baseUnset(object, path); } /** * Creates an array of the own enumerable property values of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property values. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.values(new Foo); * // => [1, 2] (iteration order is not guaranteed) * * _.values('hi'); * // => ['h', 'i'] */ function values(object) { return object ? baseValues(object, keys(object)) : []; } /** * Creates an array of the own and inherited enumerable property values of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property values. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.valuesIn(new Foo); * // => [1, 2, 3] (iteration order is not guaranteed) */ function valuesIn(object) { return object == null ? baseValues(object, keysIn(object)) : []; } /*------------------------------------------------------------------------*/ /** * Clamps `number` within the inclusive `lower` and `upper` bounds. * * @static * @memberOf _ * @category Number * @param {number} number The number to clamp. * @param {number} [lower] The lower bound. * @param {number} upper The upper bound. * @returns {number} Returns the clamped number. * @example * * _.clamp(-10, -5, 5); * // => -5 * * _.clamp(10, -5, 5); * // => 5 */ function clamp(number, lower, upper) { if (upper === undefined) { upper = lower; lower = undefined; } if (upper !== undefined) { upper = toNumber(upper); upper = upper === upper ? upper : 0; } if (lower !== undefined) { lower = toNumber(lower); lower = lower === lower ? lower : 0; } return baseClamp(toNumber(number), lower, upper); } /** * Checks if `n` is between `start` and up to but not including, `end`. If * `end` is not specified it's set to `start` with `start` then set to `0`. * If `start` is greater than `end` the params are swapped to support * negative ranges. * * @static * @memberOf _ * @category Number * @param {number} number The number to check. * @param {number} [start=0] The start of the range. * @param {number} end The end of the range. * @returns {boolean} Returns `true` if `number` is in the range, else `false`. * @example * * _.inRange(3, 2, 4); * // => true * * _.inRange(4, 8); * // => true * * _.inRange(4, 2); * // => false * * _.inRange(2, 2); * // => false * * _.inRange(1.2, 2); * // => true * * _.inRange(5.2, 4); * // => false * * _.inRange(-3, -2, -6); * // => true */ function inRange(number, start, end) { start = toNumber(start) || 0; if (end === undefined) { end = start; start = 0; } else { end = toNumber(end) || 0; } number = toNumber(number); return baseInRange(number, start, end); } /** * Produces a random number between the inclusive `lower` and `upper` bounds. * If only one argument is provided a number between `0` and the given number * is returned. If `floating` is `true`, or either `lower` or `upper` are floats, * a floating-point number is returned instead of an integer. * * **Note:** JavaScript follows the IEEE-754 standard for resolving * floating-point values which can produce unexpected results. * * @static * @memberOf _ * @category Number * @param {number} [lower=0] The lower bound. * @param {number} [upper=1] The upper bound. * @param {boolean} [floating] Specify returning a floating-point number. * @returns {number} Returns the random number. * @example * * _.random(0, 5); * // => an integer between 0 and 5 * * _.random(5); * // => also an integer between 0 and 5 * * _.random(5, true); * // => a floating-point number between 0 and 5 * * _.random(1.2, 5.2); * // => a floating-point number between 1.2 and 5.2 */ function random(lower, upper, floating) { if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { upper = floating = undefined; } if (floating === undefined) { if (typeof upper == 'boolean') { floating = upper; upper = undefined; } else if (typeof lower == 'boolean') { floating = lower; lower = undefined; } } if (lower === undefined && upper === undefined) { lower = 0; upper = 1; } else { lower = toNumber(lower) || 0; if (upper === undefined) { upper = lower; lower = 0; } else { upper = toNumber(upper) || 0; } } if (lower > upper) { var temp = lower; lower = upper; upper = temp; } if (floating || lower % 1 || upper % 1) { var rand = nativeRandom(); return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); } return baseRandom(lower, upper); } /*------------------------------------------------------------------------*/ /** * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the camel cased string. * @example * * _.camelCase('Foo Bar'); * // => 'fooBar' * * _.camelCase('--foo-bar'); * // => 'fooBar' * * _.camelCase('__foo_bar__'); * // => 'fooBar' */ var camelCase = createCompounder(function(result, word, index) { word = word.toLowerCase(); return result + (index ? capitalize(word) : word); }); /** * Converts the first character of `string` to upper case and the remaining * to lower case. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to capitalize. * @returns {string} Returns the capitalized string. * @example * * _.capitalize('FRED'); * // => 'Fred' */ function capitalize(string) { return upperFirst(toString(string).toLowerCase()); } /** * Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) * to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to deburr. * @returns {string} Returns the deburred string. * @example * * _.deburr('déjà vu'); * // => 'deja vu' */ function deburr(string) { string = toString(string); return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, ''); } /** * Checks if `string` ends with the given target string. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to search. * @param {string} [target] The string to search for. * @param {number} [position=string.length] The position to search from. * @returns {boolean} Returns `true` if `string` ends with `target`, else `false`. * @example * * _.endsWith('abc', 'c'); * // => true * * _.endsWith('abc', 'b'); * // => false * * _.endsWith('abc', 'b', 2); * // => true */ function endsWith(string, target, position) { string = toString(string); target = typeof target == 'string' ? target : (target + ''); var length = string.length; position = position === undefined ? length : baseClamp(toInteger(position), 0, length); position -= target.length; return position >= 0 && string.indexOf(target, position) == position; } /** * Converts the characters "&", "<", ">", '"', "'", and "\`" in `string` to * their corresponding HTML entities. * * **Note:** No other characters are escaped. To escape additional * characters use a third-party library like [_he_](https://mths.be/he). * * Though the ">" character is escaped for symmetry, characters like * ">" and "/" don't need escaping in HTML and have no special meaning * unless they're part of a tag or unquoted attribute value. * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) * (under "semi-related fun fact") for more details. * * Backticks are escaped because in IE < 9, they can break out of * attribute values or HTML comments. See [#59](https://html5sec.org/#59), * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and * [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/) * for more details. * * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping) * to reduce XSS vectors. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to escape. * @returns {string} Returns the escaped string. * @example * * _.escape('fred, barney, & pebbles'); * // => 'fred, barney, &amp; pebbles' */ function escape(string) { string = toString(string); return (string && reHasUnescapedHtml.test(string)) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string; } /** * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to escape. * @returns {string} Returns the escaped string. * @example * * _.escapeRegExp('[lodash](https://lodash.com/)'); * // => '\[lodash\]\(https://lodash\.com/\)' */ function escapeRegExp(string) { string = toString(string); return (string && reHasRegExpChar.test(string)) ? string.replace(reRegExpChar, '\\$&') : string; } /** * Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the kebab cased string. * @example * * _.kebabCase('Foo Bar'); * // => 'foo-bar' * * _.kebabCase('fooBar'); * // => 'foo-bar' * * _.kebabCase('__foo_bar__'); * // => 'foo-bar' */ var kebabCase = createCompounder(function(result, word, index) { return result + (index ? '-' : '') + word.toLowerCase(); }); /** * Converts `string`, as space separated words, to lower case. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the lower cased string. * @example * * _.lowerCase('--Foo-Bar'); * // => 'foo bar' * * _.lowerCase('fooBar'); * // => 'foo bar' * * _.lowerCase('__FOO_BAR__'); * // => 'foo bar' */ var lowerCase = createCompounder(function(result, word, index) { return result + (index ? ' ' : '') + word.toLowerCase(); }); /** * Converts the first character of `string` to lower case. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the converted string. * @example * * _.lowerFirst('Fred'); * // => 'fred' * * _.lowerFirst('FRED'); * // => 'fRED' */ var lowerFirst = createCaseFirst('toLowerCase'); /** * Converts the first character of `string` to upper case. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the converted string. * @example * * _.upperFirst('fred'); * // => 'Fred' * * _.upperFirst('FRED'); * // => 'FRED' */ var upperFirst = createCaseFirst('toUpperCase'); /** * Pads `string` on the left and right sides if it's shorter than `length`. * Padding characters are truncated if they can't be evenly divided by `length`. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padded string. * @example * * _.pad('abc', 8); * // => ' abc ' * * _.pad('abc', 8, '_-'); * // => '_-abc_-_' * * _.pad('abc', 3); * // => 'abc' */ function pad(string, length, chars) { string = toString(string); length = toInteger(length); var strLength = stringSize(string); if (!length || strLength >= length) { return string; } var mid = (length - strLength) / 2, leftLength = nativeFloor(mid), rightLength = nativeCeil(mid); return createPadding('', leftLength, chars) + string + createPadding('', rightLength, chars); } /** * Pads `string` on the right side if it's shorter than `length`. Padding * characters are truncated if they exceed `length`. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padded string. * @example * * _.padEnd('abc', 6); * // => 'abc ' * * _.padEnd('abc', 6, '_-'); * // => 'abc_-_' * * _.padEnd('abc', 3); * // => 'abc' */ function padEnd(string, length, chars) { string = toString(string); return string + createPadding(string, length, chars); } /** * Pads `string` on the left side if it's shorter than `length`. Padding * characters are truncated if they exceed `length`. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padded string. * @example * * _.padStart('abc', 6); * // => ' abc' * * _.padStart('abc', 6, '_-'); * // => '_-_abc' * * _.padStart('abc', 3); * // => 'abc' */ function padStart(string, length, chars) { string = toString(string); return createPadding(string, length, chars) + string; } /** * Converts `string` to an integer of the specified radix. If `radix` is * `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal, * in which case a `radix` of `16` is used. * * **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#E) * of `parseInt`. * * @static * @memberOf _ * @category String * @param {string} string The string to convert. * @param {number} [radix] The radix to interpret `value` by. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {number} Returns the converted integer. * @example * * _.parseInt('08'); * // => 8 * * _.map(['6', '08', '10'], _.parseInt); * // => [6, 8, 10] */ function parseInt(string, radix, guard) { // Chrome fails to trim leading <BOM> whitespace characters. // See https://code.google.com/p/v8/issues/detail?id=3109 for more details. if (guard || radix == null) { radix = 0; } else if (radix) { radix = +radix; } string = toString(string).replace(reTrim, ''); return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10)); } /** * Repeats the given string `n` times. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to repeat. * @param {number} [n=0] The number of times to repeat the string. * @returns {string} Returns the repeated string. * @example * * _.repeat('*', 3); * // => '***' * * _.repeat('abc', 2); * // => 'abcabc' * * _.repeat('abc', 0); * // => '' */ function repeat(string, n) { string = toString(string); n = toInteger(n); var result = ''; if (!string || n < 1 || n > MAX_SAFE_INTEGER) { return result; } // Leverage the exponentiation by squaring algorithm for a faster repeat. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. do { if (n % 2) { result += string; } n = nativeFloor(n / 2); string += string; } while (n); return result; } /** * Replaces matches for `pattern` in `string` with `replacement`. * * **Note:** This method is based on [`String#replace`](https://mdn.io/String/replace). * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to modify. * @param {RegExp|string} pattern The pattern to replace. * @param {Function|string} replacement The match replacement. * @returns {string} Returns the modified string. * @example * * _.replace('Hi Fred', 'Fred', 'Barney'); * // => 'Hi Barney' */ function replace() { var args = arguments, string = toString(args[0]); return args.length < 3 ? string : string.replace(args[1], args[2]); } /** * Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case). * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the snake cased string. * @example * * _.snakeCase('Foo Bar'); * // => 'foo_bar' * * _.snakeCase('fooBar'); * // => 'foo_bar' * * _.snakeCase('--foo-bar'); * // => 'foo_bar' */ var snakeCase = createCompounder(function(result, word, index) { return result + (index ? '_' : '') + word.toLowerCase(); }); /** * Splits `string` by `separator`. * * **Note:** This method is based on [`String#split`](https://mdn.io/String/split). * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to split. * @param {RegExp|string} separator The separator pattern to split by. * @param {number} [limit] The length to truncate results to. * @returns {Array} Returns the new array of string segments. * @example * * _.split('a-b-c', '-', 2); * // => ['a', 'b'] */ function split(string, separator, limit) { return toString(string).split(separator, limit); } /** * Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the start cased string. * @example * * _.startCase('--foo-bar'); * // => 'Foo Bar' * * _.startCase('fooBar'); * // => 'Foo Bar' * * _.startCase('__foo_bar__'); * // => 'Foo Bar' */ var startCase = createCompounder(function(result, word, index) { return result + (index ? ' ' : '') + capitalize(word); }); /** * Checks if `string` starts with the given target string. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to search. * @param {string} [target] The string to search for. * @param {number} [position=0] The position to search from. * @returns {boolean} Returns `true` if `string` starts with `target`, else `false`. * @example * * _.startsWith('abc', 'a'); * // => true * * _.startsWith('abc', 'b'); * // => false * * _.startsWith('abc', 'b', 1); * // => true */ function startsWith(string, target, position) { string = toString(string); position = baseClamp(toInteger(position), 0, string.length); return string.lastIndexOf(target, position) == position; } /** * Creates a compiled template function that can interpolate data properties * in "interpolate" delimiters, HTML-escape interpolated data properties in * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data * properties may be accessed as free variables in the template. If a setting * object is provided it takes precedence over `_.templateSettings` values. * * **Note:** In the development build `_.template` utilizes * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) * for easier debugging. * * For more information on precompiling templates see * [lodash's custom builds documentation](https://lodash.com/custom-builds). * * For more information on Chrome extension sandboxes see * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). * * @static * @memberOf _ * @category String * @param {string} [string=''] The template string. * @param {Object} [options] The options object. * @param {RegExp} [options.escape] The HTML "escape" delimiter. * @param {RegExp} [options.evaluate] The "evaluate" delimiter. * @param {Object} [options.imports] An object to import into the template as free variables. * @param {RegExp} [options.interpolate] The "interpolate" delimiter. * @param {string} [options.sourceURL] The sourceURL of the template's compiled source. * @param {string} [options.variable] The data object variable name. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {Function} Returns the compiled template function. * @example * * // using the "interpolate" delimiter to create a compiled template * var compiled = _.template('hello <%= user %>!'); * compiled({ 'user': 'fred' }); * // => 'hello fred!' * * // using the HTML "escape" delimiter to escape data property values * var compiled = _.template('<b><%- value %></b>'); * compiled({ 'value': '<script>' }); * // => '<b>&lt;script&gt;</b>' * * // using the "evaluate" delimiter to execute JavaScript and generate HTML * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>'); * compiled({ 'users': ['fred', 'barney'] }); * // => '<li>fred</li><li>barney</li>' * * // using the internal `print` function in "evaluate" delimiters * var compiled = _.template('<% print("hello " + user); %>!'); * compiled({ 'user': 'barney' }); * // => 'hello barney!' * * // using the ES delimiter as an alternative to the default "interpolate" delimiter * var compiled = _.template('hello ${ user }!'); * compiled({ 'user': 'pebbles' }); * // => 'hello pebbles!' * * // using custom template delimiters * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g; * var compiled = _.template('hello {{ user }}!'); * compiled({ 'user': 'mustache' }); * // => 'hello mustache!' * * // using backslashes to treat delimiters as plain text * var compiled = _.template('<%= "\\<%- value %\\>" %>'); * compiled({ 'value': 'ignored' }); * // => '<%- value %>' * * // using the `imports` option to import `jQuery` as `jq` * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>'; * var compiled = _.template(text, { 'imports': { 'jq': jQuery } }); * compiled({ 'users': ['fred', 'barney'] }); * // => '<li>fred</li><li>barney</li>' * * // using the `sourceURL` option to specify a custom sourceURL for the template * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' }); * compiled(data); * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector * * // using the `variable` option to ensure a with-statement isn't used in the compiled template * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' }); * compiled.source; * // => function(data) { * // var __t, __p = ''; * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!'; * // return __p; * // } * * // using the `source` property to inline compiled templates for meaningful * // line numbers in error messages and a stack trace * fs.writeFileSync(path.join(cwd, 'jst.js'), '\ * var JST = {\ * "main": ' + _.template(mainText).source + '\ * };\ * '); */ function template(string, options, guard) { // Based on John Resig's `tmpl` implementation (http://ejohn.org/blog/javascript-micro-templating/) // and Laura Doktorova's doT.js (https://github.com/olado/doT). var settings = lodash.templateSettings; if (guard && isIterateeCall(string, options, guard)) { options = undefined; } string = toString(string); options = assignInWith({}, options, settings, assignInDefaults); var imports = assignInWith({}, options.imports, settings.imports, assignInDefaults), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys); var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '"; // Compile the regexp to match each delimiter. var reDelimiters = RegExp( (options.escape || reNoMatch).source + '|' + interpolate.source + '|' + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' + (options.evaluate || reNoMatch).source + '|$' , 'g'); // Use a sourceURL for easier debugging. var sourceURL = '//# sourceURL=' + ('sourceURL' in options ? options.sourceURL : ('lodash.templateSources[' + (++templateCounter) + ']') ) + '\n'; string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { interpolateValue || (interpolateValue = esTemplateValue); // Escape characters that can't be included in string literals. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar); // Replace delimiters with snippets. if (escapeValue) { isEscaping = true; source += "' +\n__e(" + escapeValue + ") +\n'"; } if (evaluateValue) { isEvaluating = true; source += "';\n" + evaluateValue + ";\n__p += '"; } if (interpolateValue) { source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; } index = offset + match.length; // The JS engine embedded in Adobe products needs `match` returned in // order to produce the correct `offset` value. return match; }); source += "';\n"; // If `variable` is not specified wrap a with-statement around the generated // code to add the data object to the top of the scope chain. var variable = options.variable; if (!variable) { source = 'with (obj) {\n' + source + '\n}\n'; } // Cleanup code by stripping empty strings. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source) .replace(reEmptyStringMiddle, '$1') .replace(reEmptyStringTrailing, '$1;'); // Frame code as the function body. source = 'function(' + (variable || 'obj') + ') {\n' + (variable ? '' : 'obj || (obj = {});\n' ) + "var __t, __p = ''" + (isEscaping ? ', __e = _.escape' : '' ) + (isEvaluating ? ', __j = Array.prototype.join;\n' + "function print() { __p += __j.call(arguments, '') }\n" : ';\n' ) + source + 'return __p\n}'; var result = attempt(function() { return Function(importsKeys, sourceURL + 'return ' + source).apply(undefined, importsValues); }); // Provide the compiled function's source by its `toString` method or // the `source` property as a convenience for inlining compiled templates. result.source = source; if (isError(result)) { throw result; } return result; } /** * Converts `string`, as a whole, to lower case. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the lower cased string. * @example * * _.toLower('--Foo-Bar'); * // => '--foo-bar' * * _.toLower('fooBar'); * // => 'foobar' * * _.toLower('__FOO_BAR__'); * // => '__foo_bar__' */ function toLower(value) { return toString(value).toLowerCase(); } /** * Converts `string`, as a whole, to upper case. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the upper cased string. * @example * * _.toUpper('--foo-bar'); * // => '--FOO-BAR' * * _.toUpper('fooBar'); * // => 'FOOBAR' * * _.toUpper('__foo_bar__'); * // => '__FOO_BAR__' */ function toUpper(value) { return toString(value).toUpperCase(); } /** * Removes leading and trailing whitespace or specified characters from `string`. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {string} Returns the trimmed string. * @example * * _.trim(' abc '); * // => 'abc' * * _.trim('-_-abc-_-', '_-'); * // => 'abc' * * _.map([' foo ', ' bar '], _.trim); * // => ['foo', 'bar'] */ function trim(string, chars, guard) { string = toString(string); if (!string) { return string; } if (guard || chars === undefined) { return string.replace(reTrim, ''); } chars = (chars + ''); if (!chars) { return string; } var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars); return strSymbols.slice(charsStartIndex(strSymbols, chrSymbols), charsEndIndex(strSymbols, chrSymbols) + 1).join(''); } /** * Removes trailing whitespace or specified characters from `string`. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {string} Returns the trimmed string. * @example * * _.trimEnd(' abc '); * // => ' abc' * * _.trimEnd('-_-abc-_-', '_-'); * // => '-_-abc' */ function trimEnd(string, chars, guard) { string = toString(string); if (!string) { return string; } if (guard || chars === undefined) { return string.replace(reTrimEnd, ''); } chars = (chars + ''); if (!chars) { return string; } var strSymbols = stringToArray(string); return strSymbols.slice(0, charsEndIndex(strSymbols, stringToArray(chars)) + 1).join(''); } /** * Removes leading whitespace or specified characters from `string`. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {string} Returns the trimmed string. * @example * * _.trimStart(' abc '); * // => 'abc ' * * _.trimStart('-_-abc-_-', '_-'); * // => 'abc-_-' */ function trimStart(string, chars, guard) { string = toString(string); if (!string) { return string; } if (guard || chars === undefined) { return string.replace(reTrimStart, ''); } chars = (chars + ''); if (!chars) { return string; } var strSymbols = stringToArray(string); return strSymbols.slice(charsStartIndex(strSymbols, stringToArray(chars))).join(''); } /** * Truncates `string` if it's longer than the given maximum string length. * The last characters of the truncated string are replaced with the omission * string which defaults to "...". * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to truncate. * @param {Object} [options] The options object. * @param {number} [options.length=30] The maximum string length. * @param {string} [options.omission='...'] The string to indicate text is omitted. * @param {RegExp|string} [options.separator] The separator pattern to truncate to. * @returns {string} Returns the truncated string. * @example * * _.truncate('hi-diddly-ho there, neighborino'); * // => 'hi-diddly-ho there, neighbo...' * * _.truncate('hi-diddly-ho there, neighborino', { * 'length': 24, * 'separator': ' ' * }); * // => 'hi-diddly-ho there,...' * * _.truncate('hi-diddly-ho there, neighborino', { * 'length': 24, * 'separator': /,? +/ * }); * // => 'hi-diddly-ho there...' * * _.truncate('hi-diddly-ho there, neighborino', { * 'omission': ' [...]' * }); * // => 'hi-diddly-ho there, neig [...]' */ function truncate(string, options) { var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION; if (isObject(options)) { var separator = 'separator' in options ? options.separator : separator; length = 'length' in options ? toInteger(options.length) : length; omission = 'omission' in options ? toString(options.omission) : omission; } string = toString(string); var strLength = string.length; if (reHasComplexSymbol.test(string)) { var strSymbols = stringToArray(string); strLength = strSymbols.length; } if (length >= strLength) { return string; } var end = length - stringSize(omission); if (end < 1) { return omission; } var result = strSymbols ? strSymbols.slice(0, end).join('') : string.slice(0, end); if (separator === undefined) { return result + omission; } if (strSymbols) { end += (result.length - end); } if (isRegExp(separator)) { if (string.slice(end).search(separator)) { var match, substring = result; if (!separator.global) { separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g'); } separator.lastIndex = 0; while ((match = separator.exec(substring))) { var newEnd = match.index; } result = result.slice(0, newEnd === undefined ? end : newEnd); } } else if (string.indexOf(separator, end) != end) { var index = result.lastIndexOf(separator); if (index > -1) { result = result.slice(0, index); } } return result + omission; } /** * The inverse of `_.escape`; this method converts the HTML entities * `&amp;`, `&lt;`, `&gt;`, `&quot;`, `&#39;`, and `&#96;` in `string` to their * corresponding characters. * * **Note:** No other HTML entities are unescaped. To unescape additional HTML * entities use a third-party library like [_he_](https://mths.be/he). * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to unescape. * @returns {string} Returns the unescaped string. * @example * * _.unescape('fred, barney, &amp; pebbles'); * // => 'fred, barney, & pebbles' */ function unescape(string) { string = toString(string); return (string && reHasEscapedHtml.test(string)) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string; } /** * Converts `string`, as space separated words, to upper case. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the upper cased string. * @example * * _.upperCase('--foo-bar'); * // => 'FOO BAR' * * _.upperCase('fooBar'); * // => 'FOO BAR' * * _.upperCase('__foo_bar__'); * // => 'FOO BAR' */ var upperCase = createCompounder(function(result, word, index) { return result + (index ? ' ' : '') + word.toUpperCase(); }); /** * Splits `string` into an array of its words. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to inspect. * @param {RegExp|string} [pattern] The pattern to match words. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {Array} Returns the words of `string`. * @example * * _.words('fred, barney, & pebbles'); * // => ['fred', 'barney', 'pebbles'] * * _.words('fred, barney, & pebbles', /[^, ]+/g); * // => ['fred', 'barney', '&', 'pebbles'] */ function words(string, pattern, guard) { string = toString(string); pattern = guard ? undefined : pattern; if (pattern === undefined) { pattern = reHasComplexWord.test(string) ? reComplexWord : reBasicWord; } return string.match(pattern) || []; } /*------------------------------------------------------------------------*/ /** * Attempts to invoke `func`, returning either the result or the caught error * object. Any additional arguments are provided to `func` when it's invoked. * * @static * @memberOf _ * @category Utility * @param {Function} func The function to attempt. * @returns {*} Returns the `func` result or error object. * @example * * // avoid throwing errors for invalid selectors * var elements = _.attempt(function(selector) { * return document.querySelectorAll(selector); * }, '>_>'); * * if (_.isError(elements)) { * elements = []; * } */ var attempt = rest(function(func, args) { try { return apply(func, undefined, args); } catch (e) { return isError(e) ? e : new Error(e); } }); /** * Binds methods of an object to the object itself, overwriting the existing * method. * * **Note:** This method doesn't set the "length" property of bound functions. * * @static * @memberOf _ * @category Utility * @param {Object} object The object to bind and assign the bound methods to. * @param {...(string|string[])} methodNames The object method names to bind, * specified individually or in arrays. * @returns {Object} Returns `object`. * @example * * var view = { * 'label': 'docs', * 'onClick': function() { * console.log('clicked ' + this.label); * } * }; * * _.bindAll(view, 'onClick'); * jQuery(element).on('click', view.onClick); * // => logs 'clicked docs' when clicked */ var bindAll = rest(function(object, methodNames) { arrayEach(baseFlatten(methodNames), function(key) { object[key] = bind(object[key], object); }); return object; }); /** * Creates a function that iterates over `pairs` invoking the corresponding * function of the first predicate to return truthy. The predicate-function * pairs are invoked with the `this` binding and arguments of the created * function. * * @static * @memberOf _ * @category Utility * @param {Array} pairs The predicate-function pairs. * @returns {Function} Returns the new function. * @example * * var func = _.cond([ * [_.matches({ 'a': 1 }), _.constant('matches A')], * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')], * [_.constant(true), _.constant('no match')] * ]) * * func({ 'a': 1, 'b': 2 }); * // => 'matches A' * * func({ 'a': 0, 'b': 1 }); * // => 'matches B' * * func({ 'a': '1', 'b': '2' }); * // => 'no match' */ function cond(pairs) { var length = pairs ? pairs.length : 0, toIteratee = getIteratee(); pairs = !length ? [] : arrayMap(pairs, function(pair) { if (typeof pair[1] != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } return [toIteratee(pair[0]), pair[1]]; }); return rest(function(args) { var index = -1; while (++index < length) { var pair = pairs[index]; if (apply(pair[0], this, args)) { return apply(pair[1], this, args); } } }); } /** * Creates a function that invokes the predicate properties of `source` with * the corresponding property values of a given object, returning `true` if * all predicates return truthy, else `false`. * * @static * @memberOf _ * @category Utility * @param {Object} source The object of property predicates to conform to. * @returns {Function} Returns the new function. * @example * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 } * ]; * * _.filter(users, _.conforms({ 'age': _.partial(_.gt, _, 38) })); * // => [{ 'user': 'fred', 'age': 40 }] */ function conforms(source) { return baseConforms(baseClone(source, true)); } /** * Creates a function that returns `value`. * * @static * @memberOf _ * @category Utility * @param {*} value The value to return from the new function. * @returns {Function} Returns the new function. * @example * * var object = { 'user': 'fred' }; * var getter = _.constant(object); * * getter() === object; * // => true */ function constant(value) { return function() { return value; }; } /** * Creates a function that returns the result of invoking the provided * functions with the `this` binding of the created function, where each * successive invocation is supplied the return value of the previous. * * @static * @memberOf _ * @category Utility * @param {...(Function|Function[])} [funcs] Functions to invoke. * @returns {Function} Returns the new function. * @example * * function square(n) { * return n * n; * } * * var addSquare = _.flow(_.add, square); * addSquare(1, 2); * // => 9 */ var flow = createFlow(); /** * This method is like `_.flow` except that it creates a function that * invokes the provided functions from right to left. * * @static * @memberOf _ * @category Utility * @param {...(Function|Function[])} [funcs] Functions to invoke. * @returns {Function} Returns the new function. * @example * * function square(n) { * return n * n; * } * * var addSquare = _.flowRight(square, _.add); * addSquare(1, 2); * // => 9 */ var flowRight = createFlow(true); /** * This method returns the first argument provided to it. * * @static * @memberOf _ * @category Utility * @param {*} value Any value. * @returns {*} Returns `value`. * @example * * var object = { 'user': 'fred' }; * * _.identity(object) === object; * // => true */ function identity(value) { return value; } /** * Creates a function that invokes `func` with the arguments of the created * function. If `func` is a property name the created callback returns the * property value for a given element. If `func` is an object the created * callback returns `true` for elements that contain the equivalent object properties, otherwise it returns `false`. * * @static * @memberOf _ * @category Utility * @param {*} [func=_.identity] The value to convert to a callback. * @returns {Function} Returns the callback. * @example * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 } * ]; * * // wrap to create custom iteratee shorthands * _.iteratee = _.wrap(_.iteratee, function(callback, func, thisArg) { * var match = /^(.+?)__([gl]t)(.+)$/.exec(func); * if (!match) { * return callback(func, thisArg); * } * return function(object) { * return match[2] == 'gt' * ? object[match[1]] > match[3] * : object[match[1]] < match[3]; * }; * }); * * _.filter(users, 'age__gt36'); * // => [{ 'user': 'fred', 'age': 40 }] */ function iteratee(func) { return (isObjectLike(func) && !isArray(func)) ? matches(func) : baseIteratee(func); } /** * Creates a function that performs a deep partial comparison between a given * object and `source`, returning `true` if the given object has equivalent * property values, else `false`. * * **Note:** This method supports comparing the same values as `_.isEqual`. * * @static * @memberOf _ * @category Utility * @param {Object} source The object of property values to match. * @returns {Function} Returns the new function. * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'active': true }, * { 'user': 'fred', 'age': 40, 'active': false } * ]; * * _.filter(users, _.matches({ 'age': 40, 'active': false })); * // => [{ 'user': 'fred', 'age': 40, 'active': false }] */ function matches(source) { return baseMatches(baseClone(source, true)); } /** * Creates a function that performs a deep partial comparison between the * value at `path` of a given object to `srcValue`, returning `true` if the * object value is equivalent, else `false`. * * **Note:** This method supports comparing the same values as `_.isEqual`. * * @static * @memberOf _ * @category Utility * @param {Array|string} path The path of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new function. * @example * * var users = [ * { 'user': 'barney' }, * { 'user': 'fred' } * ]; * * _.find(users, _.matchesProperty('user', 'fred')); * // => { 'user': 'fred' } */ function matchesProperty(path, srcValue) { return baseMatchesProperty(path, baseClone(srcValue, true)); } /** * Creates a function that invokes the method at `path` of a given object. * Any additional arguments are provided to the invoked method. * * @static * @memberOf _ * @category Utility * @param {Array|string} path The path of the method to invoke. * @param {...*} [args] The arguments to invoke the method with. * @returns {Function} Returns the new function. * @example * * var objects = [ * { 'a': { 'b': { 'c': _.constant(2) } } }, * { 'a': { 'b': { 'c': _.constant(1) } } } * ]; * * _.map(objects, _.method('a.b.c')); * // => [2, 1] * * _.invokeMap(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c'); * // => [1, 2] */ var method = rest(function(path, args) { return function(object) { return baseInvoke(object, path, args); }; }); /** * The opposite of `_.method`; this method creates a function that invokes * the method at a given path of `object`. Any additional arguments are * provided to the invoked method. * * @static * @memberOf _ * @category Utility * @param {Object} object The object to query. * @param {...*} [args] The arguments to invoke the method with. * @returns {Function} Returns the new function. * @example * * var array = _.times(3, _.constant), * object = { 'a': array, 'b': array, 'c': array }; * * _.map(['a[2]', 'c[0]'], _.methodOf(object)); * // => [2, 0] * * _.map([['a', '2'], ['c', '0']], _.methodOf(object)); * // => [2, 0] */ var methodOf = rest(function(object, args) { return function(path) { return baseInvoke(object, path, args); }; }); /** * Adds all own enumerable function properties of a source object to the * destination object. If `object` is a function then methods are added to * its prototype as well. * * **Note:** Use `_.runInContext` to create a pristine `lodash` function to * avoid conflicts caused by modifying the original. * * @static * @memberOf _ * @category Utility * @param {Function|Object} [object=lodash] The destination object. * @param {Object} source The object of functions to add. * @param {Object} [options] The options object. * @param {boolean} [options.chain=true] Specify whether the functions added * are chainable. * @returns {Function|Object} Returns `object`. * @example * * function vowels(string) { * return _.filter(string, function(v) { * return /[aeiou]/i.test(v); * }); * } * * _.mixin({ 'vowels': vowels }); * _.vowels('fred'); * // => ['e'] * * _('fred').vowels().value(); * // => ['e'] * * _.mixin({ 'vowels': vowels }, { 'chain': false }); * _('fred').vowels(); * // => ['e'] */ function mixin(object, source, options) { var props = keys(source), methodNames = baseFunctions(source, props); if (options == null && !(isObject(source) && (methodNames.length || !props.length))) { options = source; source = object; object = this; methodNames = baseFunctions(source, keys(source)); } var chain = (isObject(options) && 'chain' in options) ? options.chain : true, isFunc = isFunction(object); arrayEach(methodNames, function(methodName) { var func = source[methodName]; object[methodName] = func; if (isFunc) { object.prototype[methodName] = function() { var chainAll = this.__chain__; if (chain || chainAll) { var result = object(this.__wrapped__), actions = result.__actions__ = copyArray(this.__actions__); actions.push({ 'func': func, 'args': arguments, 'thisArg': object }); result.__chain__ = chainAll; return result; } return func.apply(object, arrayPush([this.value()], arguments)); }; } }); return object; } /** * Reverts the `_` variable to its previous value and returns a reference to * the `lodash` function. * * @static * @memberOf _ * @category Utility * @returns {Function} Returns the `lodash` function. * @example * * var lodash = _.noConflict(); */ function noConflict() { root._ = oldDash; return this; } /** * A no-operation function that returns `undefined` regardless of the * arguments it receives. * * @static * @memberOf _ * @category Utility * @example * * var object = { 'user': 'fred' }; * * _.noop(object) === undefined; * // => true */ function noop() { // No operation performed. } /** * Creates a function that returns its nth argument. * * @static * @memberOf _ * @category Utility * @param {number} [n=0] The index of the argument to return. * @returns {Function} Returns the new function. * @example * * var func = _.nthArg(1); * * func('a', 'b', 'c'); * // => 'b' */ function nthArg(n) { n = toInteger(n); return function() { return arguments[n]; }; } /** * Creates a function that invokes `iteratees` with the arguments provided * to the created function and returns their results. * * @static * @memberOf _ * @category Utility * @param {...(Function|Function[])} iteratees The iteratees to invoke. * @returns {Function} Returns the new function. * @example * * var func = _.over(Math.max, Math.min); * * func(1, 2, 3, 4); * // => [4, 1] */ var over = createOver(arrayMap); /** * Creates a function that checks if **all** of the `predicates` return * truthy when invoked with the arguments provided to the created function. * * @static * @memberOf _ * @category Utility * @param {...(Function|Function[])} predicates The predicates to check. * @returns {Function} Returns the new function. * @example * * var func = _.overEvery(Boolean, isFinite); * * func('1'); * // => true * * func(null); * // => false * * func(NaN); * // => false */ var overEvery = createOver(arrayEvery); /** * Creates a function that checks if **any** of the `predicates` return * truthy when invoked with the arguments provided to the created function. * * @static * @memberOf _ * @category Utility * @param {...(Function|Function[])} predicates The predicates to check. * @returns {Function} Returns the new function. * @example * * var func = _.overSome(Boolean, isFinite); * * func('1'); * // => true * * func(null); * // => true * * func(NaN); * // => false */ var overSome = createOver(arraySome); /** * Creates a function that returns the value at `path` of a given object. * * @static * @memberOf _ * @category Utility * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new function. * @example * * var objects = [ * { 'a': { 'b': { 'c': 2 } } }, * { 'a': { 'b': { 'c': 1 } } } * ]; * * _.map(objects, _.property('a.b.c')); * // => [2, 1] * * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); * // => [1, 2] */ function property(path) { return isKey(path) ? baseProperty(path) : basePropertyDeep(path); } /** * The opposite of `_.property`; this method creates a function that returns * the value at a given path of `object`. * * @static * @memberOf _ * @category Utility * @param {Object} object The object to query. * @returns {Function} Returns the new function. * @example * * var array = [0, 1, 2], * object = { 'a': array, 'b': array, 'c': array }; * * _.map(['a[2]', 'c[0]'], _.propertyOf(object)); * // => [2, 0] * * _.map([['a', '2'], ['c', '0']], _.propertyOf(object)); * // => [2, 0] */ function propertyOf(object) { return function(path) { return object == null ? undefined : baseGet(object, path); }; } /** * Creates an array of numbers (positive and/or negative) progressing from * `start` up to, but not including, `end`. A step of `-1` is used if a negative * `start` is specified without an `end` or `step`. If `end` is not specified * it's set to `start` with `start` then set to `0`. If `end` is less than * `start` a zero-length range is created unless a negative `step` is specified. * * **Note:** JavaScript follows the IEEE-754 standard for resolving * floating-point values which can produce unexpected results. * * @static * @memberOf _ * @category Utility * @param {number} [start=0] The start of the range. * @param {number} end The end of the range. * @param {number} [step=1] The value to increment or decrement by. * @returns {Array} Returns the new array of numbers. * @example * * _.range(4); * // => [0, 1, 2, 3] * * _.range(-4); * // => [0, -1, -2, -3] * * _.range(1, 5); * // => [1, 2, 3, 4] * * _.range(0, 20, 5); * // => [0, 5, 10, 15] * * _.range(0, -4, -1); * // => [0, -1, -2, -3] * * _.range(1, 4, 0); * // => [1, 1, 1] * * _.range(0); * // => [] */ var range = createRange(); /** * This method is like `_.range` except that it populates values in * descending order. * * @static * @memberOf _ * @category Utility * @param {number} [start=0] The start of the range. * @param {number} end The end of the range. * @param {number} [step=1] The value to increment or decrement by. * @returns {Array} Returns the new array of numbers. * @example * * _.rangeRight(4); * // => [3, 2, 1, 0] * * _.rangeRight(-4); * // => [-3, -2, -1, 0] * * _.rangeRight(1, 5); * // => [4, 3, 2, 1] * * _.rangeRight(0, 20, 5); * // => [15, 10, 5, 0] * * _.rangeRight(0, -4, -1); * // => [-3, -2, -1, 0] * * _.rangeRight(1, 4, 0); * // => [1, 1, 1] * * _.rangeRight(0); * // => [] */ var rangeRight = createRange(true); /** * Invokes the iteratee function `n` times, returning an array of the results * of each invocation. The iteratee is invoked with one argument; (index). * * @static * @memberOf _ * @category Utility * @param {number} n The number of times to invoke `iteratee`. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array} Returns the array of results. * @example * * _.times(3, String); * // => ['0', '1', '2'] * * _.times(4, _.constant(true)); * // => [true, true, true, true] */ function times(n, iteratee) { n = toInteger(n); if (n < 1 || n > MAX_SAFE_INTEGER) { return []; } var index = MAX_ARRAY_LENGTH, length = nativeMin(n, MAX_ARRAY_LENGTH); iteratee = toFunction(iteratee); n -= MAX_ARRAY_LENGTH; var result = baseTimes(length, iteratee); while (++index < n) { iteratee(index); } return result; } /** * Converts `value` to a property path array. * * @static * @memberOf _ * @category Utility * @param {*} value The value to convert. * @returns {Array} Returns the new property path array. * @example * * _.toPath('a.b.c'); * // => ['a', 'b', 'c'] * * _.toPath('a[0].b.c'); * // => ['a', '0', 'b', 'c'] * * var path = ['a', 'b', 'c'], * newPath = _.toPath(path); * * console.log(newPath); * // => ['a', 'b', 'c'] * * console.log(path === newPath); * // => false */ function toPath(value) { return isArray(value) ? arrayMap(value, String) : stringToPath(value); } /** * Generates a unique ID. If `prefix` is provided the ID is appended to it. * * @static * @memberOf _ * @category Utility * @param {string} [prefix] The value to prefix the ID with. * @returns {string} Returns the unique ID. * @example * * _.uniqueId('contact_'); * // => 'contact_104' * * _.uniqueId(); * // => '105' */ function uniqueId(prefix) { var id = ++idCounter; return toString(prefix) + id; } /*------------------------------------------------------------------------*/ /** * Adds two numbers. * * @static * @memberOf _ * @category Math * @param {number} augend The first number in an addition. * @param {number} addend The second number in an addition. * @returns {number} Returns the total. * @example * * _.add(6, 4); * // => 10 */ function add(augend, addend) { var result; if (augend !== undefined) { result = augend; } if (addend !== undefined) { result = result === undefined ? addend : (result + addend); } return result; } /** * Computes `number` rounded up to `precision`. * * @static * @memberOf _ * @category Math * @param {number} number The number to round up. * @param {number} [precision=0] The precision to round up to. * @returns {number} Returns the rounded up number. * @example * * _.ceil(4.006); * // => 5 * * _.ceil(6.004, 2); * // => 6.01 * * _.ceil(6040, -2); * // => 6100 */ var ceil = createRound('ceil'); /** * Computes `number` rounded down to `precision`. * * @static * @memberOf _ * @category Math * @param {number} number The number to round down. * @param {number} [precision=0] The precision to round down to. * @returns {number} Returns the rounded down number. * @example * * _.floor(4.006); * // => 4 * * _.floor(0.046, 2); * // => 0.04 * * _.floor(4060, -2); * // => 4000 */ var floor = createRound('floor'); /** * Computes the maximum value of `array`. If `array` is empty or falsey * `undefined` is returned. * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @returns {*} Returns the maximum value. * @example * * _.max([4, 2, 8, 6]); * // => 8 * * _.max([]); * // => undefined */ function max(array) { return (array && array.length) ? baseExtremum(array, identity, gt) : undefined; } /** * This method is like `_.max` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which * the value is ranked. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {*} Returns the maximum value. * @example * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 } * ]; * * _.maxBy(users, function(o) { return o.age; }); * // => { 'user': 'fred', 'age': 40 } * * // using the `_.property` iteratee shorthand * _.maxBy(users, 'age'); * // => { 'user': 'fred', 'age': 40 } */ function maxBy(array, iteratee) { return (array && array.length) ? baseExtremum(array, getIteratee(iteratee), gt) : undefined; } /** * Computes the mean of the values in `array`. * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @returns {number} Returns the mean. * @example * * _.mean([4, 2, 8, 6]); * // => 5 */ function mean(array) { return sum(array) / (array ? array.length : 0); } /** * Computes the minimum value of `array`. If `array` is empty or falsey * `undefined` is returned. * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @returns {*} Returns the minimum value. * @example * * _.min([4, 2, 8, 6]); * // => 2 * * _.min([]); * // => undefined */ function min(array) { return (array && array.length) ? baseExtremum(array, identity, lt) : undefined; } /** * This method is like `_.min` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which * the value is ranked. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {*} Returns the minimum value. * @example * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 } * ]; * * _.minBy(users, function(o) { return o.age; }); * // => { 'user': 'barney', 'age': 36 } * * // using the `_.property` iteratee shorthand * _.minBy(users, 'age'); * // => { 'user': 'barney', 'age': 36 } */ function minBy(array, iteratee) { return (array && array.length) ? baseExtremum(array, getIteratee(iteratee), lt) : undefined; } /** * Computes `number` rounded to `precision`. * * @static * @memberOf _ * @category Math * @param {number} number The number to round. * @param {number} [precision=0] The precision to round to. * @returns {number} Returns the rounded number. * @example * * _.round(4.006); * // => 4 * * _.round(4.006, 2); * // => 4.01 * * _.round(4060, -2); * // => 4100 */ var round = createRound('round'); /** * Subtract two numbers. * * @static * @memberOf _ * @category Math * @param {number} minuend The first number in a subtraction. * @param {number} subtrahend The second number in a subtraction. * @returns {number} Returns the difference. * @example * * _.subtract(6, 4); * // => 2 */ function subtract(minuend, subtrahend) { var result; if (minuend !== undefined) { result = minuend; } if (subtrahend !== undefined) { result = result === undefined ? subtrahend : (result - subtrahend); } return result; } /** * Computes the sum of the values in `array`. * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @returns {number} Returns the sum. * @example * * _.sum([4, 2, 8, 6]); * // => 20 */ function sum(array) { return (array && array.length) ? baseSum(array, identity) : undefined; } /** * This method is like `_.sum` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the value to be summed. * The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {number} Returns the sum. * @example * * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; * * _.sumBy(objects, function(o) { return o.n; }); * // => 20 * * // using the `_.property` iteratee shorthand * _.sumBy(objects, 'n'); * // => 20 */ function sumBy(array, iteratee) { return (array && array.length) ? baseSum(array, getIteratee(iteratee)) : undefined; } /*------------------------------------------------------------------------*/ // Ensure wrappers are instances of `baseLodash`. lodash.prototype = baseLodash.prototype; LodashWrapper.prototype = baseCreate(baseLodash.prototype); LodashWrapper.prototype.constructor = LodashWrapper; LazyWrapper.prototype = baseCreate(baseLodash.prototype); LazyWrapper.prototype.constructor = LazyWrapper; // Avoid inheriting from `Object.prototype` when possible. Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto; // Add functions to the `MapCache`. MapCache.prototype.clear = mapClear; MapCache.prototype['delete'] = mapDelete; MapCache.prototype.get = mapGet; MapCache.prototype.has = mapHas; MapCache.prototype.set = mapSet; // Add functions to the `SetCache`. SetCache.prototype.push = cachePush; // Add functions to the `Stack` cache. Stack.prototype.clear = stackClear; Stack.prototype['delete'] = stackDelete; Stack.prototype.get = stackGet; Stack.prototype.has = stackHas; Stack.prototype.set = stackSet; // Assign cache to `_.memoize`. memoize.Cache = MapCache; // Add functions that return wrapped values when chaining. lodash.after = after; lodash.ary = ary; lodash.assign = assign; lodash.assignIn = assignIn; lodash.assignInWith = assignInWith; lodash.assignWith = assignWith; lodash.at = at; lodash.before = before; lodash.bind = bind; lodash.bindAll = bindAll; lodash.bindKey = bindKey; lodash.chain = chain; lodash.chunk = chunk; lodash.compact = compact; lodash.concat = concat; lodash.cond = cond; lodash.conforms = conforms; lodash.constant = constant; lodash.countBy = countBy; lodash.create = create; lodash.curry = curry; lodash.curryRight = curryRight; lodash.debounce = debounce; lodash.defaults = defaults; lodash.defaultsDeep = defaultsDeep; lodash.defer = defer; lodash.delay = delay; lodash.difference = difference; lodash.differenceBy = differenceBy; lodash.differenceWith = differenceWith; lodash.drop = drop; lodash.dropRight = dropRight; lodash.dropRightWhile = dropRightWhile; lodash.dropWhile = dropWhile; lodash.fill = fill; lodash.filter = filter; lodash.flatMap = flatMap; lodash.flatten = flatten; lodash.flattenDeep = flattenDeep; lodash.flip = flip; lodash.flow = flow; lodash.flowRight = flowRight; lodash.fromPairs = fromPairs; lodash.functions = functions; lodash.functionsIn = functionsIn; lodash.groupBy = groupBy; lodash.initial = initial; lodash.intersection = intersection; lodash.intersectionBy = intersectionBy; lodash.intersectionWith = intersectionWith; lodash.invert = invert; lodash.invokeMap = invokeMap; lodash.iteratee = iteratee; lodash.keyBy = keyBy; lodash.keys = keys; lodash.keysIn = keysIn; lodash.map = map; lodash.mapKeys = mapKeys; lodash.mapValues = mapValues; lodash.matches = matches; lodash.matchesProperty = matchesProperty; lodash.memoize = memoize; lodash.merge = merge; lodash.mergeWith = mergeWith; lodash.method = method; lodash.methodOf = methodOf; lodash.mixin = mixin; lodash.negate = negate; lodash.nthArg = nthArg; lodash.omit = omit; lodash.omitBy = omitBy; lodash.once = once; lodash.orderBy = orderBy; lodash.over = over; lodash.overArgs = overArgs; lodash.overEvery = overEvery; lodash.overSome = overSome; lodash.partial = partial; lodash.partialRight = partialRight; lodash.partition = partition; lodash.pick = pick; lodash.pickBy = pickBy; lodash.property = property; lodash.propertyOf = propertyOf; lodash.pull = pull; lodash.pullAll = pullAll; lodash.pullAllBy = pullAllBy; lodash.pullAt = pullAt; lodash.range = range; lodash.rangeRight = rangeRight; lodash.rearg = rearg; lodash.reject = reject; lodash.remove = remove; lodash.rest = rest; lodash.reverse = reverse; lodash.sampleSize = sampleSize; lodash.set = set; lodash.setWith = setWith; lodash.shuffle = shuffle; lodash.slice = slice; lodash.sortBy = sortBy; lodash.sortedUniq = sortedUniq; lodash.sortedUniqBy = sortedUniqBy; lodash.split = split; lodash.spread = spread; lodash.tail = tail; lodash.take = take; lodash.takeRight = takeRight; lodash.takeRightWhile = takeRightWhile; lodash.takeWhile = takeWhile; lodash.tap = tap; lodash.throttle = throttle; lodash.thru = thru; lodash.toArray = toArray; lodash.toPairs = toPairs; lodash.toPairsIn = toPairsIn; lodash.toPath = toPath; lodash.toPlainObject = toPlainObject; lodash.transform = transform; lodash.unary = unary; lodash.union = union; lodash.unionBy = unionBy; lodash.unionWith = unionWith; lodash.uniq = uniq; lodash.uniqBy = uniqBy; lodash.uniqWith = uniqWith; lodash.unset = unset; lodash.unzip = unzip; lodash.unzipWith = unzipWith; lodash.values = values; lodash.valuesIn = valuesIn; lodash.without = without; lodash.words = words; lodash.wrap = wrap; lodash.xor = xor; lodash.xorBy = xorBy; lodash.xorWith = xorWith; lodash.zip = zip; lodash.zipObject = zipObject; lodash.zipWith = zipWith; // Add aliases. lodash.each = forEach; lodash.eachRight = forEachRight; lodash.extend = assignIn; lodash.extendWith = assignInWith; // Add functions to `lodash.prototype`. mixin(lodash, lodash); /*------------------------------------------------------------------------*/ // Add functions that return unwrapped values when chaining. lodash.add = add; lodash.attempt = attempt; lodash.camelCase = camelCase; lodash.capitalize = capitalize; lodash.ceil = ceil; lodash.clamp = clamp; lodash.clone = clone; lodash.cloneDeep = cloneDeep; lodash.cloneDeepWith = cloneDeepWith; lodash.cloneWith = cloneWith; lodash.deburr = deburr; lodash.endsWith = endsWith; lodash.eq = eq; lodash.escape = escape; lodash.escapeRegExp = escapeRegExp; lodash.every = every; lodash.find = find; lodash.findIndex = findIndex; lodash.findKey = findKey; lodash.findLast = findLast; lodash.findLastIndex = findLastIndex; lodash.findLastKey = findLastKey; lodash.floor = floor; lodash.forEach = forEach; lodash.forEachRight = forEachRight; lodash.forIn = forIn; lodash.forInRight = forInRight; lodash.forOwn = forOwn; lodash.forOwnRight = forOwnRight; lodash.get = get; lodash.gt = gt; lodash.gte = gte; lodash.has = has; lodash.hasIn = hasIn; lodash.head = head; lodash.identity = identity; lodash.includes = includes; lodash.indexOf = indexOf; lodash.inRange = inRange; lodash.invoke = invoke; lodash.isArguments = isArguments; lodash.isArray = isArray; lodash.isArrayLike = isArrayLike; lodash.isArrayLikeObject = isArrayLikeObject; lodash.isBoolean = isBoolean; lodash.isDate = isDate; lodash.isElement = isElement; lodash.isEmpty = isEmpty; lodash.isEqual = isEqual; lodash.isEqualWith = isEqualWith; lodash.isError = isError; lodash.isFinite = isFinite; lodash.isFunction = isFunction; lodash.isInteger = isInteger; lodash.isLength = isLength; lodash.isMatch = isMatch; lodash.isMatchWith = isMatchWith; lodash.isNaN = isNaN; lodash.isNative = isNative; lodash.isNil = isNil; lodash.isNull = isNull; lodash.isNumber = isNumber; lodash.isObject = isObject; lodash.isObjectLike = isObjectLike; lodash.isPlainObject = isPlainObject; lodash.isRegExp = isRegExp; lodash.isSafeInteger = isSafeInteger; lodash.isString = isString; lodash.isSymbol = isSymbol; lodash.isTypedArray = isTypedArray; lodash.isUndefined = isUndefined; lodash.join = join; lodash.kebabCase = kebabCase; lodash.last = last; lodash.lastIndexOf = lastIndexOf; lodash.lowerCase = lowerCase; lodash.lowerFirst = lowerFirst; lodash.lt = lt; lodash.lte = lte; lodash.max = max; lodash.maxBy = maxBy; lodash.mean = mean; lodash.min = min; lodash.minBy = minBy; lodash.noConflict = noConflict; lodash.noop = noop; lodash.now = now; lodash.pad = pad; lodash.padEnd = padEnd; lodash.padStart = padStart; lodash.parseInt = parseInt; lodash.random = random; lodash.reduce = reduce; lodash.reduceRight = reduceRight; lodash.repeat = repeat; lodash.replace = replace; lodash.result = result; lodash.round = round; lodash.runInContext = runInContext; lodash.sample = sample; lodash.size = size; lodash.snakeCase = snakeCase; lodash.some = some; lodash.sortedIndex = sortedIndex; lodash.sortedIndexBy = sortedIndexBy; lodash.sortedIndexOf = sortedIndexOf; lodash.sortedLastIndex = sortedLastIndex; lodash.sortedLastIndexBy = sortedLastIndexBy; lodash.sortedLastIndexOf = sortedLastIndexOf; lodash.startCase = startCase; lodash.startsWith = startsWith; lodash.subtract = subtract; lodash.sum = sum; lodash.sumBy = sumBy; lodash.template = template; lodash.times = times; lodash.toInteger = toInteger; lodash.toLength = toLength; lodash.toLower = toLower; lodash.toNumber = toNumber; lodash.toSafeInteger = toSafeInteger; lodash.toString = toString; lodash.toUpper = toUpper; lodash.trim = trim; lodash.trimEnd = trimEnd; lodash.trimStart = trimStart; lodash.truncate = truncate; lodash.unescape = unescape; lodash.uniqueId = uniqueId; lodash.upperCase = upperCase; lodash.upperFirst = upperFirst; // Add aliases. lodash.first = head; mixin(lodash, (function() { var source = {}; baseForOwn(lodash, function(func, methodName) { if (!hasOwnProperty.call(lodash.prototype, methodName)) { source[methodName] = func; } }); return source; }()), { 'chain': false }); /*------------------------------------------------------------------------*/ /** * The semantic version number. * * @static * @memberOf _ * @type string */ lodash.VERSION = VERSION; // Assign default placeholders. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) { lodash[methodName].placeholder = lodash; }); // Add `LazyWrapper` methods for `_.drop` and `_.take` variants. arrayEach(['drop', 'take'], function(methodName, index) { LazyWrapper.prototype[methodName] = function(n) { var filtered = this.__filtered__; if (filtered && !index) { return new LazyWrapper(this); } n = n === undefined ? 1 : nativeMax(toInteger(n), 0); var result = this.clone(); if (filtered) { result.__takeCount__ = nativeMin(n, result.__takeCount__); } else { result.__views__.push({ 'size': nativeMin(n, MAX_ARRAY_LENGTH), 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') }); } return result; }; LazyWrapper.prototype[methodName + 'Right'] = function(n) { return this.reverse()[methodName](n).reverse(); }; }); // Add `LazyWrapper` methods that accept an `iteratee` value. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) { var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; LazyWrapper.prototype[methodName] = function(iteratee) { var result = this.clone(); result.__iteratees__.push({ 'iteratee': getIteratee(iteratee, 3), 'type': type }); result.__filtered__ = result.__filtered__ || isFilter; return result; }; }); // Add `LazyWrapper` methods for `_.head` and `_.last`. arrayEach(['head', 'last'], function(methodName, index) { var takeName = 'take' + (index ? 'Right' : ''); LazyWrapper.prototype[methodName] = function() { return this[takeName](1).value()[0]; }; }); // Add `LazyWrapper` methods for `_.initial` and `_.tail`. arrayEach(['initial', 'tail'], function(methodName, index) { var dropName = 'drop' + (index ? '' : 'Right'); LazyWrapper.prototype[methodName] = function() { return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); }; }); LazyWrapper.prototype.compact = function() { return this.filter(identity); }; LazyWrapper.prototype.find = function(predicate) { return this.filter(predicate).head(); }; LazyWrapper.prototype.findLast = function(predicate) { return this.reverse().find(predicate); }; LazyWrapper.prototype.invokeMap = rest(function(path, args) { if (typeof path == 'function') { return new LazyWrapper(this); } return this.map(function(value) { return baseInvoke(value, path, args); }); }); LazyWrapper.prototype.reject = function(predicate) { predicate = getIteratee(predicate, 3); return this.filter(function(value) { return !predicate(value); }); }; LazyWrapper.prototype.slice = function(start, end) { start = toInteger(start); var result = this; if (result.__filtered__ && (start > 0 || end < 0)) { return new LazyWrapper(result); } if (start < 0) { result = result.takeRight(-start); } else if (start) { result = result.drop(start); } if (end !== undefined) { end = toInteger(end); result = end < 0 ? result.dropRight(-end) : result.take(end - start); } return result; }; LazyWrapper.prototype.takeRightWhile = function(predicate) { return this.reverse().takeWhile(predicate).reverse(); }; LazyWrapper.prototype.toArray = function() { return this.take(MAX_ARRAY_LENGTH); }; // Add `LazyWrapper` methods to `lodash.prototype`. baseForOwn(LazyWrapper.prototype, function(func, methodName) { var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName], retUnwrapped = isTaker || /^find/.test(methodName); if (!lodashFunc) { return; } lodash.prototype[methodName] = function() { var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee = args[0], useLazy = isLazy || isArray(value); var interceptor = function(value) { var result = lodashFunc.apply(lodash, arrayPush([value], args)); return (isTaker && chainAll) ? result[0] : result; }; if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) { // Avoid lazy use if the iteratee has a "length" value other than `1`. isLazy = useLazy = false; } var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid; if (!retUnwrapped && useLazy) { value = onlyLazy ? value : new LazyWrapper(this); var result = func.apply(value, args); result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); return new LodashWrapper(result, chainAll); } if (isUnwrapped && onlyLazy) { return func.apply(this, args); } result = this.thru(interceptor); return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result; }; }); // Add `Array` and `String` methods to `lodash.prototype`. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', retUnwrapped = /^(?:pop|shift)$/.test(methodName); lodash.prototype[methodName] = function() { var args = arguments; if (retUnwrapped && !this.__chain__) { return func.apply(this.value(), args); } return this[chainName](function(value) { return func.apply(value, args); }); }; }); // Map minified function names to their real names. baseForOwn(LazyWrapper.prototype, function(func, methodName) { var lodashFunc = lodash[methodName]; if (lodashFunc) { var key = (lodashFunc.name + ''), names = realNames[key] || (realNames[key] = []); names.push({ 'name': methodName, 'func': lodashFunc }); } }); realNames[createHybridWrapper(undefined, BIND_KEY_FLAG).name] = [{ 'name': 'wrapper', 'func': undefined }]; // Add functions to the lazy wrapper. LazyWrapper.prototype.clone = lazyClone; LazyWrapper.prototype.reverse = lazyReverse; LazyWrapper.prototype.value = lazyValue; // Add chaining functions to the `lodash` wrapper. lodash.prototype.at = wrapperAt; lodash.prototype.chain = wrapperChain; lodash.prototype.commit = wrapperCommit; lodash.prototype.flatMap = wrapperFlatMap; lodash.prototype.next = wrapperNext; lodash.prototype.plant = wrapperPlant; lodash.prototype.reverse = wrapperReverse; lodash.prototype.run = lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; if (iteratorSymbol) { lodash.prototype[iteratorSymbol] = wrapperToIterator; } return lodash; } /*--------------------------------------------------------------------------*/ // Export lodash. var _ = runInContext(); // Expose lodash on the free variable `window` or `self` when available. This // prevents errors in cases where lodash is loaded by a script tag in the presence // of an AMD loader. See http://requirejs.org/docs/errors.html#mismatch for more details. (freeWindow || freeSelf || {})._ = _; // Some AMD build optimizers like r.js check for condition patterns like the following: if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { // Define as an anonymous module so, through path mapping, it can be // referenced as the "underscore" module. define(function() { return _; }); } // Check for `exports` after `define` in case a build optimizer adds an `exports` object. else if (freeExports && freeModule) { // Export for Node.js. if (moduleExports) { (freeModule.exports = _)._ = _; } // Export for CommonJS support. freeExports._ = _; } else { // Export to the global object. root._ = _; } }.call(this));
/* * spa.shell.js * Shell module for SPA */ /*jslint browser : true, continue : true, devel : true, indent : 2, maxerr : 50, newcap : true, nomen : true, plusplus : true, regexp : true, sloppy : true, vars : false, white : true */ /*global $, spa */ spa.shell = (function () { 'use strict'; //---------------- BEGIN MODULE SCOPE VARIABLES -------------- var configMap = { anchor_schema_map : { chat : { opened : true, closed : true } }, resize_interval : 200, main_html : String() + '<div class="spa-shell-head">' + '<div class="spa-shell-head-logo">' + '<h1>SPA</h1>' + '<p>javascript end to end</p>' + '</div>' + '<div class="spa-shell-head-acct"></div>' + '</div>' + '<div class="spa-shell-main">' + '<div class="spa-shell-main-nav"></div>' + '<div class="spa-shell-main-content"></div>' + '</div>' + '<div class="spa-shell-foot"></div>' + '<div class="spa-shell-modal"></div>' }, stateMap = { $container : undefined, anchor_map : {}, resize_idto : undefined }, jqueryMap = {}, copyAnchorMap, setJqueryMap, changeAnchorPart, onResize, onHashchange, onTapAcct, onLogin, onLogout, setChatAnchor, initModule; //----------------- END MODULE SCOPE VARIABLES --------------- //------------------- BEGIN UTILITY METHODS ------------------ // Returns copy of stored anchor map; minimizes overhead copyAnchorMap = function () { return $.extend( true, {}, stateMap.anchor_map ); }; //-------------------- END UTILITY METHODS ------------------- //--------------------- BEGIN DOM METHODS -------------------- // Begin DOM method /setJqueryMap/ setJqueryMap = function () { var $container = stateMap.$container; jqueryMap = { $container : $container, $acct : $container.find('.spa-shell-head-acct'), $nav : $container.find('.spa-shell-main-nav') }; }; // End DOM method /setJqueryMap/ // Begin DOM method /changeAnchorPart/ // Purpose : Changes part of the URI anchor component // Arguments : // * arg_map - The map describing what part of the URI anchor // we want changed. // Returns : // * true - the Anchor portion of the URI was updated // * false - the Anchor portion of the URI could not be updated // Actions : // The current anchor rep stored in stateMap.anchor_map. // See uriAnchor for a discussion of encoding. // This method // * Creates a copy of this map using copyAnchorMap(). // * Modifies the key-values using arg_map. // * Manages the distinction between independent // and dependent values in the encoding. // * Attempts to change the URI using uriAnchor. // * Returns true on success, and false on failure. // changeAnchorPart = function ( arg_map ) { var anchor_map_revise = copyAnchorMap(), bool_return = true, key_name, key_name_dep; // Begin merge changes into anchor map KEYVAL: for ( key_name in arg_map ) { if ( arg_map.hasOwnProperty( key_name ) ) { // skip dependent keys during iteration if ( key_name.indexOf( '_' ) === 0 ) { continue KEYVAL; } // update independent key value anchor_map_revise[key_name] = arg_map[key_name]; // update matching dependent key key_name_dep = '_' + key_name; if ( arg_map[key_name_dep] ) { anchor_map_revise[key_name_dep] = arg_map[key_name_dep]; } else { delete anchor_map_revise[key_name_dep]; delete anchor_map_revise['_s' + key_name_dep]; } } } // End merge changes into anchor map // Begin attempt to update URI; revert if not successful try { $.uriAnchor.setAnchor( anchor_map_revise ); } catch ( error ) { // replace URI with existing state $.uriAnchor.setAnchor( stateMap.anchor_map,null,true ); bool_return = false; } // End attempt to update URI... return bool_return; }; // End DOM method /changeAnchorPart/ //--------------------- END DOM METHODS ---------------------- //------------------- BEGIN EVENT HANDLERS ------------------- // Begin Event handler /onHashchange/ // Purpose : Handles the hashchange event // Arguments : // * event - jQuery event object. // Settings : none // Returns : false // Actions : // * Parses the URI anchor component // * Compares proposed application state with current // * Adjust the application only where proposed state // differs from existing and is allowed by anchor schema // onHashchange = function ( event ) { var _s_chat_previous, _s_chat_proposed, s_chat_proposed, anchor_map_proposed, is_ok = true, anchor_map_previous = copyAnchorMap(); // attempt to parse anchor try { anchor_map_proposed = $.uriAnchor.makeAnchorMap(); } catch ( error ) { $.uriAnchor.setAnchor( anchor_map_previous, null, true ); return false; } stateMap.anchor_map = anchor_map_proposed; // convenience vars _s_chat_previous = anchor_map_previous._s_chat; _s_chat_proposed = anchor_map_proposed._s_chat; // Begin adjust chat component if changed if ( ! anchor_map_previous || _s_chat_previous !== _s_chat_proposed ) { s_chat_proposed = anchor_map_proposed.chat; switch ( s_chat_proposed ) { case 'opened' : is_ok = spa.chat.setSliderPosition( 'opened' ); break; case 'closed' : is_ok = spa.chat.setSliderPosition( 'closed' ); break; default : spa.chat.setSliderPosition( 'closed' ); delete anchor_map_proposed.chat; $.uriAnchor.setAnchor( anchor_map_proposed, null, true ); } } // End adjust chat component if changed // Begin revert anchor if slider change denied if ( ! is_ok ) { if ( anchor_map_previous ) { $.uriAnchor.setAnchor( anchor_map_previous, null, true ); stateMap.anchor_map = anchor_map_previous; } else { delete anchor_map_proposed.chat; $.uriAnchor.setAnchor( anchor_map_proposed, null, true ); } } // End revert anchor if slider change denied return false; }; // End Event handler /onHashchange/ // Begin Event handler /onResize/ onResize = function () { if ( stateMap.resize_idto ) { return true; } spa.chat.handleResize(); stateMap.resize_idto = setTimeout( function () { stateMap.resize_idto = undefined; }, configMap.resize_interval ); return true; }; // End Event handler /onResize/ onTapAcct = function ( event ) { var acct_text, user_name, user = spa.model.people.get_user(); if ( user.get_is_anon() ) { user_name = prompt( 'Please sign-in' ); spa.model.people.login( user_name ); jqueryMap.$acct.text( '... processing ...' ); } else { spa.model.people.logout(); } return false; }; onLogin = function ( event, login_user ) { jqueryMap.$acct.text( login_user.name ); }; onLogout = function ( event, logout_user ) { jqueryMap.$acct.text( 'Please sign-in' ); }; //-------------------- END EVENT HANDLERS -------------------- //---------------------- BEGIN CALLBACKS --------------------- // Begin callback method /setChatAnchor/ // Example : setChatAnchor( 'closed' ); // Purpose : Change the chat component of the anchor // Arguments: // * position_type - may be 'closed' or 'opened' // Action : // Changes the URI anchor parameter 'chat' to the requested // value if possible. // Returns : // * true - requested anchor part was updated // * false - requested anchor part was not updated // Throws : none // setChatAnchor = function ( position_type ) { return changeAnchorPart({ chat : position_type }); }; // End callback method /setChatAnchor/ //----------------------- END CALLBACKS ---------------------- //------------------- BEGIN PUBLIC METHODS ------------------- // Begin Public method /initModule/ // Example : spa.shell.initModule( $('#app_div_id') ); // Purpose : // Directs the Shell to offer its capability to the user // Arguments : // * $container (example: $('#app_div_id')). // A jQuery collection that should represent // a single DOM container // Action : // Populates $container with the shell of the UI // and then configures and initializes feature modules. // The Shell is also responsible for browser-wide issues // such as URI anchor and cookie management // Returns : none // Throws : none // initModule = function ( $container ) { // load HTML and map jQuery collections stateMap.$container = $container; $container.html( configMap.main_html ); setJqueryMap(); // configure uriAnchor to use our schema $.uriAnchor.configModule({ schema_map : configMap.anchor_schema_map }); // configure and initialize feature modules spa.chat.configModule({ set_chat_anchor : setChatAnchor, chat_model : spa.model.chat, people_model : spa.model.people }); spa.chat.initModule( jqueryMap.$container ); spa.avtr.configModule({ chat_model : spa.model.chat, people_model : spa.model.people }); spa.avtr.initModule( jqueryMap.$nav ); // Handle URI anchor change events. // This is done /after/ all feature modules are configured // and initialized, otherwise they will not be ready to handle // the trigger event, which is used to ensure the anchor // is considered on-load // $(window) .bind( 'resize', onResize ) .bind( 'hashchange', onHashchange ) .trigger( 'hashchange' ); $.gevent.subscribe( $container, 'spa-login', onLogin ); $.gevent.subscribe( $container, 'spa-logout', onLogout ); jqueryMap.$acct .text( 'Please sign-in') .bind( 'utap', onTapAcct ); }; // End PUBLIC method /initModule/ return { initModule : initModule }; //------------------- END PUBLIC METHODS --------------------- }());
/*! * CanJS - 2.0.4 * http://canjs.us/ * Copyright (c) 2013 Bitovi * Mon, 23 Dec 2013 19:49:14 GMT * Licensed MIT * Includes: CanJS default build * Download from: http://canjs.us/ */ steal('can/util','can/construct', function( can ) { // ## control.js // `can.Control` // _Controller_ // Binds an element, returns a function that unbinds. var bind = function( el, ev, callback ) { can.bind.call( el, ev, callback ); return function() { can.unbind.call(el, ev, callback); }; }, isFunction = can.isFunction, extend = can.extend, each = can.each, slice = [].slice, paramReplacer = /\{([^\}]+)\}/g, special = can.getObject("$.event.special", [can]) || {}, // Binds an element, returns a function that unbinds. delegate = function( el, selector, ev, callback ) { can.delegate.call(el, selector, ev, callback); return function() { can.undelegate.call(el, selector, ev, callback); }; }, // Calls bind or unbind depending if there is a selector. binder = function( el, ev, callback, selector ) { return selector ? delegate( el, can.trim( selector ), ev, callback ) : bind( el, ev, callback ); }, basicProcessor; var Control = can.Control = can.Construct( /** * @add can.Control */ // /** * @static */ { // Setup pre-processes which methods are event listeners. /** * @hide * * Setup pre-process which methods are event listeners. * */ setup: function() { // Allow contollers to inherit "defaults" from super-classes as it // done in `can.Construct` can.Construct.setup.apply( this, arguments ); // If you didn't provide a name, or are `control`, don't do anything. if ( can.Control ) { // Cache the underscored names. var control = this, funcName; // Calculate and cache actions. control.actions = {}; for ( funcName in control.prototype ) { if ( control._isAction(funcName) ) { control.actions[funcName] = control._action(funcName); } } } }, // Moves `this` to the first argument, wraps it with `jQuery` if it's an element _shifter : function( context, name ) { var method = typeof name == "string" ? context[name] : name; if ( ! isFunction( method )) { method = context[ method ]; } return function() { context.called = name; return method.apply(context, [this.nodeName ? can.$(this) : this].concat( slice.call(arguments, 0))); }; }, // Return `true` if is an action. /** * @hide * @param {String} methodName a prototype function * @return {Boolean} truthy if an action or not */ _isAction: function( methodName ) { var val = this.prototype[methodName], type = typeof val; // if not the constructor return (methodName !== 'constructor') && // and is a function or links to a function ( type == "function" || (type == "string" && isFunction(this.prototype[val] ) ) ) && // and is in special, a processor, or has a funny character !! ( special[methodName] || processors[methodName] || /[^\w]/.test(methodName) ); }, // Takes a method name and the options passed to a control // and tries to return the data necessary to pass to a processor // (something that binds things). /** * @hide * Takes a method name and the options passed to a control * and tries to return the data necessary to pass to a processor * (something that binds things). * * For performance reasons, this called twice. First, it is called when * the Control class is created. If the methodName is templated * like: "{window} foo", it returns null. If it is not templated * it returns event binding data. * * The resulting data is added to this.actions. * * When a control instance is created, _action is called again, but only * on templated actions. * * @param {Object} methodName the method that will be bound * @param {Object} [options] first param merged with class default options * @return {Object} null or the processor and pre-split parts. * The processor is what does the binding/subscribing. */ _action: function( methodName, options ) { // If we don't have options (a `control` instance), we'll run this // later. paramReplacer.lastIndex = 0; if ( options || ! paramReplacer.test( methodName )) { // If we have options, run sub to replace templates `{}` with a // value from the options or the window var convertedName = options ? can.sub(methodName, this._lookup(options)) : methodName; if(!convertedName) { return null; } // If a `{}` template resolves to an object, `convertedName` will be // an array var arr = can.isArray(convertedName), // Get the name name = arr ? convertedName[1] : convertedName, // Grab the event off the end parts = name.split(/\s+/g), event = parts.pop(); return { processor: processors[event] || basicProcessor, parts: [name, parts.join(" "), event], delegate : arr ? convertedName[0] : undefined }; } }, _lookup: function(options){ return [options, window] }, // An object of `{eventName : function}` pairs that Control uses to // hook up events auto-magically. /** * @property {Object.<can.Control.processor>} can.Control.processors processors * @parent can.Control.static * * @description A collection of hookups for custom events on Controls. * * @body * `processors` is an object that allows you to add new events to bind * to on a control, or to change how existent events are bound. Each * key-value pair of `processors` is a specification that pertains to * an event where the key is the name of the event, and the value is * a function that processes calls to bind to the event. * * The processor function takes five arguments: * * - _el_: The Control's element. * - _event_: The event type. * - _selector_: The selector preceding the event in the binding used on the Control. * - _callback_: The callback function being bound. * - _control_: The Control the event is bound on. * * Inside your processor function, you should bind _callback_ to the event, and * return a function for can.Control to call when _callback_ needs to be unbound. * (If _selector_ is defined, you will likely want to use some form of delegation * to bind the event.) * * Here is a Control with a custom event processor set and two callbacks bound * to that event: * * @codestart * can.Control.processors.birthday = function(el, ev, selector, callback, control) { * if(selector) { * myFramework.delegate(ev, el, selector, callback); * return function() { myFramework.undelegate(ev, el, selector, callback); }; * } else { * myFramework.bind(ev, el, callback); * return function() { myFramework.unbind(ev, el, callback); }; * } * }; * * can.Control("EventTarget", { }, { * 'birthday': function(el, ev) { * // do something appropriate for the occasion * }, * '.grandchild birthday': function(el, ev) { * // do something appropriate for the occasion * } * }); * * var target = new EventTarget('#person'); * @codeend * * When `target` is initialized, can.Control will call `can.Control.processors.birthday` * twice (because there are two event hookups for the _birthday_ event). The first * time it's called, the arguments will be: * * - _el_: A NodeList that wraps the element with id 'person'. * - _ev_: `'birthday'` * - _selector_: `''` * - _callback_: The function assigned to `' birthday'` in the prototype section of `EventTarget`'s * definition. * - _control_: `target` itself. * * The second time, the arguments are slightly different: * * - _el_: A NodeList that wraps the element with id 'person'. * - _ev_: `'birthday'` * - _selector_: `'.grandchild'` * - _callback_: The function assigned to `'.grandchild birthday'` in the prototype section of `EventTarget`'s * definition. * - _control_: `target` itself. * * can.Control already has processors for these events: * * - change * - click * - contextmenu * - dblclick * - focusin * - focusout * - keydown * - keyup * - keypress * - mousedown * - mouseenter * - mouseleave * - mousemove * - mouseout * - mouseover * - mouseup * - reset * - resize * - scroll * - select * - submit */ processors: {}, // A object of name-value pairs that act as default values for a // control instance defaults: {} /** * @property {Object} can.Control.defaults defaults * @parent can.Control.static * @description Default values for the Control's options. * * @body * `defaults` provides default values for a Control's options. * Options passed into the constructor function will be shallowly merged * into the values from defaults in [can.Control::setup], and * the result will be stored in [can.Control::options this.options]. * * Message = can.Control.extend({ * defaults: { * message: "Hello World" * } * }, { * init: function(){ * this.element.text( this.options.message ); * } * }); * * new Message( "#el1" ); //writes "Hello World" * new Message( "#el12", { message: "hi" } ); //writes hi */ }, { /** * @prototype */ // Sets `this.element`, saves the control in `data, binds event // handlers. /** * @property {NodeList} can.Control.prototype.element element * @parent can.Control.prototype * @description The element associated with this control. * * @body * The library-wrapped element this control is associated with, * as passed into the constructor. If you want to change the element * that a Control will attach to, you should do it in [can.Control::setup setup]. * If you change the element later, make sure to call [can.Control::on on] * to rebind all the bindings. * * If `element` is removed from the DOM, [can.Control::destroy] will * be called and the Control will be destroyed. */ // /** * @function can.Control.prototype.setup setup * @parent can.Control.prototype * @description Perform pre-initialization logic. * @signature `control.setup(element, options)` * @param {HTMLElement|NodeList|String} element The element as passed to the constructor. * @param {Object} [options] option values for the control. These get added to * this.options and merged with [can.Control.static.defaults defaults]. * @return {undefined|Array} return an array if you want to change what init is called with. By * default it is called with the element and options passed to the control. * * @body * Setup is where most of control's magic happens. It does the following: * * ### Sets this.element * * The first parameter passed to new Control( el, options ) is expected to be * an element. This gets converted to a Wrapped NodeList element and set as * [can.Control.prototype.element this.element]. * * ### Adds the control's name to the element's className * * Control adds it's plugin name to the element's className for easier * debugging. For example, if your Control is named "Foo.Bar", it adds * "foo_bar" to the className. * * ### Saves the control in $.data * * A reference to the control instance is saved in $.data. You can find * instances of "Foo.Bar" like: * * $( '#el' ).data( 'controls' )[ 'foo_bar' ] * * ### Merges Options * Merges the default options with optional user-supplied ones. * Additionally, default values are exposed in the static [can.Control.static.defaults defaults] * so that users can change them. * * ### Binds event handlers * * Setup does the event binding described in [can.Control]. */ setup: function( element, options ) { var cls = this.constructor, pluginname = cls.pluginName || cls._fullName, arr; // Want the raw element here. this.element = can.$(element) if ( pluginname && pluginname !== 'can_control') { // Set element and `className` on element. this.element.addClass(pluginname); } (arr = can.data(this.element,"controls")) || can.data(this.element,"controls",arr = []); arr.push(this); // Option merging. /** * @property {Object} can.Control.prototype.options options * @parent can.Control.prototype * * @description * * Options used to configure a control. * * @body * * The `this.options` property is an Object that contains * configuration data passed to a control when it is * created (`new can.Control(element, options)`). * * In the following example, an options object with * a message is passed to a `Greeting` control. The * `Greeting` control changes the text of its [can.Control::element element] * to the options' message value. * * var Greeting = can.Control.extend({ * init: function(){ * this.element.text( this.options.message ) * } * }) * * new Greeting("#greeting",{message: "I understand this.options"}) * * The options argument passed when creating the control * is merged with [can.Control.defaults defaults] in * [can.Control.prototype.setup setup]. * * In the following example, if no message property is provided, * the defaults' message property is used. * * var Greeting = can.Control.extend({ * defaults: { * message: "Defaults merged into this.options" * } * },{ * init: function(){ * this.element.text( this.options.message ) * } * }) * * new Greeting("#greeting") * */ this.options = extend({}, cls.defaults, options); // Bind all event handlers. this.on(); // Gets passed into `init`. /** * @property {can.NodeList} can.Control.prototype.element element * * @description The element the Control is associated with. * * @parent can.Control.prototype * * @body * * The control instance's HTMLElement (or window) wrapped by the * util library for ease of use. It is set by the first * parameter to `new can.Construct( element, options )` * in [can.Control::setup]. By default, a control listens to events on `this.element`. * * ### Quick Example * * The following `HelloWorld` control sets the control`s text to "Hello World": * * HelloWorld = can.Control({ * init: function(){ * this.element.text( 'Hello World' ); * } * }); * * // create the controller on the element * new HelloWorld( document.getElementById( '#helloworld' ) ); * * ## Wrapped NodeList * * `this.element` is a wrapped NodeList of one HTMLELement (or window). This * is for convenience in libraries like jQuery where all methods operate only on a * NodeList. To get the raw HTMLElement, write: * * this.element[0] //-> HTMLElement * * The following details the NodeList used by each library with * an example of updating its text: * * __jQuery__ `jQuery( HTMLElement )` * * this.element.text("Hello World") * * __Zepto__ `Zepto( HTMLElement )` * * this.element.text("Hello World") * * __Dojo__ `new dojo.NodeList( HTMLElement )` * * this.element.text("Hello World") * * __Mootools__ `$$( HTMLElement )` * * this.element.empty().appendText("Hello World") * * __YUI__ * * this.element.set("text", "Hello World") * * * ## Changing `this.element` * * Sometimes you don't want what's passed to `new can.Control` * to be this.element. You can change this by overwriting * setup or by unbinding, setting this.element, and rebinding. * * ### Overwriting Setup * * The following Combobox overwrites setup to wrap a * select element with a div. That div is used * as `this.element`. Notice how `destroy` sets back the * original element. * * Combobox = can.Control({ * setup: function( el, options ) { * this.oldElement = $( el ); * var newEl = $( '<div/>' ); * this.oldElement.wrap( newEl ); * can.Control.prototype.setup.call( this, newEl, options ); * }, * init: function() { * this.element //-> the div * }, * ".option click": function() { * // event handler bound on the div * }, * destroy: function() { * var div = this.element; //save reference * can.Control.prototype.destroy.call( this ); * div.replaceWith( this.oldElement ); * } * }); * * ### unbinding, setting, and rebinding. * * You could also change this.element by calling * [can.Control::off], setting this.element, and * then calling [can.Control::on] like: * * move: function( newElement ) { * this.off(); * this.element = $( newElement ); * this.on(); * } */ return [this.element, this.options]; }, /** * @function can.Control.prototype.on on * @parent can.Control.prototype * * @description Bind an event handler to a Control, or rebind all event handlers on a Control. * * @signature `control.on([el,] selector, eventName, func)` * @param {HTMLElement|jQuery collection|Object} [el=this.element] * The element to be bound. If no element is provided, the control's element is used instead. * @param {CSSSelectorString} selector A css selector for event delegation. * @param {String} eventName The event to listen for. * @param {Function|String} func A callback function or the String name of a control function. If a control * function name is given, the control function is called back with the bound element and event as the first * and second parameter. Otherwise the function is called back like a normal bind. * @return {Number} The id of the binding in this._bindings * * @body * `on(el, selector, eventName, func)` binds an event handler for an event to a selector under the scope of the given element. * * @signature `control.on()` * * Rebind all of a control's event handlers. * * @return {Number} The number of handlers bound to this Control. * * @body * `this.on()` is used to rebind * all event handlers when [can.Control::options this.options] has changed. It * can also be used to bind or delegate from other elements or objects. * * ## Rebinding * * By using templated event handlers, a control can listen to objects outside * `this.element`. This is extremely common in MVC programming. For example, * the following control might listen to a task model's `completed` property and * toggle a strike className like: * * TaskStriker = can.Control({ * "{task} completed": function(){ * this.update(); * }, * update: function(){ * if ( this.options.task.completed ) { * this.element.addClass( 'strike' ); * } else { * this.element.removeClass( 'strike' ); * } * } * }); * * var taskstriker = new TaskStriker({ * task: new Task({ completed: 'true' }) * }); * * To update the `taskstriker`'s task, add a task method that updates * this.options and rebinds the event handlers for the new task like: * * TaskStriker = can.Control({ * "{task} completed": function(){ * this.update(); * }, * update: function() { * if ( this.options.task.completed ) { * this.element.addClass( 'strike' ); * } else { * this.element.removeClass( 'strike' ); * } * }, * task: function( newTask ) { * this.options.task = newTask; * this.on(); * this.update(); * } * }); * * var taskstriker = new TaskStriker({ * task: new Task({ completed: true }) * }); * taskstriker.task( new TaskStriker({ * task: new Task({ completed: false }) * })); * * ## Adding new events * * If events need to be bound to outside of the control and templated event handlers * are not sufficient, you can call this.on to bind or delegate programmatically: * * init: function() { * // calls somethingClicked( el, ev ) * this.on( 'click', 'somethingClicked' ); * * // calls function when the window is clicked * this.on( window, 'click', function( ev ) { * //do something * }); * }, * somethingClicked: function( el, ev ) { * * } */ on: function( el, selector, eventName, func ) { if ( ! el ) { // Adds bindings. this.off(); // Go through the cached list of actions and use the processor // to bind var cls = this.constructor, bindings = this._bindings, actions = cls.actions, element = this.element, destroyCB = can.Control._shifter(this,"destroy"), funcName, ready; for ( funcName in actions ) { // Only push if we have the action and no option is `undefined` if ( actions.hasOwnProperty( funcName ) && (ready = actions[funcName] || cls._action(funcName, this.options))) { bindings.push(ready.processor(ready.delegate || element, ready.parts[2], ready.parts[1], funcName, this)); } } // Setup to be destroyed... // don't bind because we don't want to remove it. can.bind.call(element,"removed", destroyCB); bindings.push(function( el ) { can.unbind.call(el,"removed", destroyCB); }); return bindings.length; } if ( typeof el == 'string' ) { func = eventName; eventName = selector; selector = el; el = this.element; } if(func === undefined) { func = eventName; eventName = selector; selector = null; } if ( typeof func == 'string' ) { func = can.Control._shifter(this,func); } this._bindings.push( binder( el, eventName, func, selector )); return this._bindings.length; }, // Unbinds all event handlers on the controller. /** * @hide * Unbinds all event handlers on the controller. You should never * be calling this unless in use with [can.Control::on]. */ off : function(){ var el = this.element[0]; each(this._bindings || [], function( value ) { value(el); }); // Adds bindings. this._bindings = []; }, // Prepares a `control` for garbage collection /** * @description Remove a Control from an element and clean up the Control. * @signature `control.destroy()` * * Prepares a control for garbage collection and is a place to * reset any changes the control has made. * * @function can.Control.prototype.destroy destroy * @parent can.Control.prototype * * @body * * * ## Allowing Garbage Collection * * Destroy is called whenever a control's element is removed from the page using * the library's standard HTML modifier methods. This means that you * don't have to call destroy yourself and it * will be called automatically when appropriate. * * The following `Clicker` widget listens on the window for clicks and updates * its element's innerHTML. If we remove the element, the window's event handler * is removed auto-magically: * * * Clickr = can.Control({ * "{window} click": function() { * this.element.html( this.count ? * this.count++ : this.count = 0 ); * } * }); * * // create a clicker on an element * new Clicker( "#clickme" ); * * // remove the element * $( '#clickme' ).remove(); * * * The methods you can use that will destroy controls automatically by library: * * __jQuery and Zepto__ * * - $.fn.remove * - $.fn.html * - $.fn.replaceWith * - $.fn.empty * * __Dojo__ * * - dojo.destroy * - dojo.empty * - dojo.place (with the replace option) * * __Mootools__ * * - Element.prototype.destroy * * __YUI__ * * - Y.Node.prototype.remove * - Y.Node.prototype.destroy * * * ## Teardown in Destroy * * Sometimes, you want to reset a controlled element back to its * original state when the control is destroyed. Overwriting destroy * lets you write teardown code of this manner. __When overwriting * destroy, make sure you call Control's base functionality__. * * The following example changes an element's text when the control is * created and sets it back when the control is removed: * * Changer = can.Control.extend({ * init: function() { * this.oldText = this.element.text(); * this.element.text( "Changed!!!" ); * }, * destroy: function() { * this.element.text( this.oldText ); * can.Control.prototype.destroy.call( this ); * } * }); * * // create a changer which changes #myel's text * var changer = new Changer( '#myel' ); * * // destroy changer which will reset it * changer.destroy(); * * ## Base Functionality * * Control prepares the control for garbage collection by: * * - unbinding all event handlers * - clearing references to this.element and this.options * - clearing the element's reference to the control * - removing it's [can.Control.pluginName] from the element's className * */ destroy: function() { //Control already destroyed if(this.element === null) { //!steal-remove-start steal.dev.warn("Control.js - Control already destroyed"); //!steal-remove-end return; } var Class = this.constructor, pluginName = Class.pluginName || Class._fullName, controls; // Unbind bindings. this.off(); if(pluginName && pluginName !== 'can_control'){ // Remove the `className`. this.element.removeClass(pluginName); } // Remove from `data`. controls = can.data(this.element,"controls"); controls.splice(can.inArray(this, controls),1); can.trigger( this, "destroyed"); // In case we want to know if the `control` is removed. this.element = null; } }); var processors = can.Control.processors, // Processors do the binding. // They return a function that unbinds when called. // // The basic processor that binds events. basicProcessor = function( el, event, selector, methodName, control ) { return binder( el, event, can.Control._shifter(control, methodName), selector); }; // Set common events to be processed as a `basicProcessor` each(["change", "click", "contextmenu", "dblclick", "keydown", "keyup", "keypress", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "reset", "resize", "scroll", "select", "submit", "focusin", "focusout", "mouseenter", "mouseleave", // #104 - Add touch events as default processors // TOOD feature detect? "touchstart", "touchmove", "touchcancel", "touchend", "touchleave" ], function( v ) { processors[v] = basicProcessor; }); return Control; });
import { moduleForComponent, test } from 'ember-qunit'; import hbs from 'htmlbars-inline-precompile'; import pageComponent from 'code-corps-ember/tests/pages/components/submittable-textarea'; import PageObject from 'ember-cli-page-object'; let page = PageObject.create(pageComponent); function setHandler(context, modifiedSubmitHandler = () => {}) { context.set('modifiedSubmitHandler', modifiedSubmitHandler); } moduleForComponent('submittable-textarea', 'Integration | Component | submittable textarea', { integration: true, beforeEach() { page.setContext(this); setHandler(this); }, afterEach() { page.removeContext(); } }); // This test is necessary because a new line after yield in the file will // cause a new line in the textarea itself test('it has no extra content when created', function(assert) { this.render(hbs`{{submittable-textarea modifiedSubmit=modifiedSubmitHandler}}`); assert.equal(page.value, '', 'Element is blank.'); }); test('it sends the modifiedSubmit action on command/ctrl + enter', function(assert) { assert.expect(1); setHandler(this, () => { assert.equal(page.value, '', 'Action was called. Input content was unchanged.'); }); this.render(hbs`{{submittable-textarea modifiedSubmit=modifiedSubmitHandler}}`); page.keySubmit(); });
"use strict"; var patient = (function () { function patient() { } return patient; }()); exports.patient = patient; //# sourceMappingURL=character.model.js.map
/** * @author Chong-U Lim <me@chongdashu.com> * @copyright 2015 Chong-U Lim * @module Core */ this.chongdashu = this.chongdashu||{}; (function() { "use strict"; /** * System represents a System of the Entity-Component-System Design * paradigm. * * @class Core.System * @constructor **/ var System = function(nodeType) { this.init(nodeType); }; var p = System.prototype; System.prototype.constructor = System; /** * Indicates if the system is currently enabled or not. * If not enabled, no system or node updates will be performed. * @property enabled * * @type boolean * @default true */ p.enabled = false; /** * The priority of the current system. This is used by the * {{#crossLink "Core.Engine"}}{{/crossLink}} to order the sequence of systems * that it processes. Lower priority numbers are executed first. * * @property priority * @type {integer} * @default 0 */ p.priority = 0; /** * An array of {{#crossLink "Core.Node"}}{{/crossLink}} objects that * this system manages based on the {{#crossLink "Core.Node/Core.Node.TYPE:property"}}{{/crossLink}} * @property nodes * @type {Array} */ p.nodes = null; /** * The {{#crossLink "Core.Node/Core.Node.TYPE:property"}}{{/crossLink}} that this system * will be responsible for. * @property String * @type Core.Node.TYPE */ p.nodeType = null; p.engine = null; /** * The initialization method is called when the object is constructor. * * @method init * @param {string} nodeType The type of the node. See {{#crossLink "Core.Node/Core.Node.TYPE:property"}}{{/crossLink}}. */ p.init = function(nodeType) { // console.log("[System], init()"); this.priority = 0; this.enabled = true; this.nodeType = nodeType; }; /** * The update loop of this system, as called by a given * {{#crossLink "Core.Engine"}}{{/crossLink}}'s update loop. * All related {{#crossLink "Core.Node"}}{{/crossLink}} objects are * updated. Handling of each node individually can be performed * by overriding the {{#crossLink "Core.System/updateNode:method"}}{{/crossLink}} method. * * * @method update */ p.update = function(elapsed) { var nodes = this.engine.getNodes(this.nodeType); if (nodes) { for (var i=0; i < nodes.length; i++) { this.updateNode(nodes[i], elapsed); } } }; /** * @method updateNode * @param {Core.Node} node The node to be updated */ p.updateNode = function(node) { }; /** * Callback method when this system is added to the engine. * * @method onEngineAdd * @param {Core.Engine} engine reference to the {{#crossLink "Core.Engine"}}{{/crossLink}} object. */ p.onEngineAdd = function(engine) { this.engine = engine; }; /** * Callback method when this system is removed from the engine. * * @method onEngineRemove * @param {Core.Engine} engine reference to the {{#crossLink "Core.Engine"}}{{/crossLink}} object. */ p.onEngineRemove = function(engine) { this.engine = null; }; p.getType = function() { return this.constructor.name; }; // Link // ---- chongdashu.System = System; }());
import {Seq, Map, List} from "immutable"; import { LOAD_PROJECT, NEW_PROJECT, OPEN_CATALOG, MODE_VIEWING_CATALOG, MODE_CONFIGURING_PROJECT, SELECT_TOOL_EDIT, MODE_IDLE, UNSELECT_ALL, SET_PROPERTIES, SET_ITEMS_ATTRIBUTES, SET_LINES_ATTRIBUTES, SET_HOLES_ATTRIBUTES, REMOVE, UNDO, ROLLBACK, SET_PROJECT_PROPERTIES, OPEN_PROJECT_CONFIGURATOR, INIT_CATALOG, UPDATE_MOUSE_COORDS, UPDATE_ZOOM_SCALE, TOGGLE_SNAP, CHANGE_CATALOG_PAGE, GO_BACK_TO_CATALOG_PAGE, THROW_ERROR, THROW_WARNING, COPY_PROPERTIES, PASTE_PROPERTIES } from '../constants'; import {State, Scene, Guide, Catalog} from "../models"; import { removeLine, removeHole, detectAndUpdateAreas, setProperties as setPropertiesOp, setItemsAttributes as setItemsAttributesOp, setLinesAttributes as setLinesAttributesOp, setHolesAttributes as setHolesAttributesOp, select, unselect, unselectAll as unselectAllOp, removeItem, loadLayerFromJSON, setPropertiesOnSelected, updatePropertiesOnSelected, setAttributesOnSelected } from '../utils/layer-operations'; export default function (state, action) { switch (action.type) { case NEW_PROJECT: return newProject(state); case LOAD_PROJECT: return loadProject(state, action.sceneJSON); case OPEN_CATALOG: return openCatalog(state); case CHANGE_CATALOG_PAGE: return state.setIn(['catalog', 'page'], action.newPage) .updateIn(['catalog', 'path'], path => path.push(action.oldPage)); case GO_BACK_TO_CATALOG_PAGE: let path = state.catalog.path; let pageIndex = state.catalog.path.findIndex(page => page === action.newPage); return state.setIn(['catalog', 'page'], action.newPage) .updateIn(['catalog', 'path'], path => path.take(pageIndex)); case SELECT_TOOL_EDIT: return state.set('mode', MODE_IDLE); case UNSELECT_ALL: return unselectAll(state); case SET_PROPERTIES: return setProperties(state, action.properties); case SET_ITEMS_ATTRIBUTES: return setItemsAttributes(state, action.itemsAttributes); case SET_LINES_ATTRIBUTES: return setLinesAttributes(state, action.linesAttributes); case SET_HOLES_ATTRIBUTES: return setHolesAttributes(state, action.holesAttributes); case REMOVE: return remove(state); case UNDO: return undo(state); case ROLLBACK: return rollback(state); case SET_PROJECT_PROPERTIES: return setProjectProperties(state, action.properties); case OPEN_PROJECT_CONFIGURATOR: return openProjectConfigurator(state); case INIT_CATALOG: return initCatalog(state, action.catalog); case UPDATE_MOUSE_COORDS: return updateMouseCoord(state, action.coords); case UPDATE_ZOOM_SCALE: return updateZoomScale(state, action.scale); case TOGGLE_SNAP: return toggleSnap(state, action.mask); case THROW_ERROR: return throwError(state, action.error); case THROW_WARNING: return throwWarning(state, action.warning); case COPY_PROPERTIES: return copyProperties(state, action.properties); case PASTE_PROPERTIES: return pasteProperties(state); default: return state; } } function openCatalog(state) { return rollback(state) .set('mode', MODE_VIEWING_CATALOG); } function newProject(state) { return new State(); } function loadProject(state, sceneJSON) { return new State({scene: sceneJSON, catalog: state.catalog.toJS()}); } function setProperties(state, properties) { let scene = state.scene; scene = scene.set('layers', scene.layers.map(layer => setPropertiesOnSelected(layer, properties))); return state.merge({ scene, sceneHistory: state.sceneHistory.push(scene) }) } function updateProperties(state, properties) { let scene = state.scene; scene = scene.set('layers', scene.layers.map(layer => updatePropertiesOnSelected(layer, properties))); return state.merge({ scene, sceneHistory: state.sceneHistory.push(scene) }) } function setItemsAttributes(state, attributes) { let scene = state.scene; scene = scene.set('layers', scene.layers.map(layer => setAttributesOnSelected(layer, attributes, state.catalog))); return state.merge({ scene, sceneHistory: state.sceneHistory.push(scene) }); } function setLinesAttributes(state, attributes) { let scene = state.scene; scene = scene.set('layers', scene.layers.map(layer => setAttributesOnSelected(layer, attributes, state.catalog))); return state.merge({ scene, sceneHistory: state.sceneHistory.push(scene) }); } function setHolesAttributes(state, attributes) { let scene = state.scene; scene = scene.set('layers', scene.layers.map(layer => setAttributesOnSelected(layer, attributes, state.catalog))); return state.merge({ scene, sceneHistory: state.sceneHistory.push(scene) }); } function unselectAll(state) { let scene = state.scene; scene = scene.update('layers', layer => layer.map(unselectAllOp)); return state.merge({ scene, sceneHistory: state.sceneHistory.push(scene) }) } function remove(state) { let scene = state.scene; let catalog = state.catalog; scene = scene.updateIn(['layers', scene.selectedLayer], layer => layer.withMutations(layer => { let {lines: selectedLines, holes: selectedHoles, items: selectedItems} = layer.selected; unselectAllOp(layer); selectedLines.forEach(lineID => removeLine(layer, lineID)); selectedHoles.forEach(holeID => removeHole(layer, holeID)); selectedItems.forEach(itemID => removeItem(layer, itemID)); detectAndUpdateAreas(layer, catalog); })); return state.merge({ scene, sceneHistory: state.sceneHistory.push(scene) }) } function undo(state) { let sceneHistory = state.sceneHistory; if (state.scene === sceneHistory.last() && !sceneHistory.size > 1) sceneHistory = sceneHistory.pop(); switch (sceneHistory.size) { case 0: return state; case 1: return state.merge({ mode: MODE_IDLE, scene: sceneHistory.last(), }); default: return state.merge({ mode: MODE_IDLE, scene: sceneHistory.last(), sceneHistory: sceneHistory.pop() }); } } export function rollback(state) { let sceneHistory = state.sceneHistory; if (sceneHistory.isEmpty()) return state; let scene = sceneHistory .last() .update('layers', layer => layer.map(unselectAllOp)); return state.merge({ mode: MODE_IDLE, scene, sceneHistory: state.sceneHistory.push(scene), snapElements: new List(), activeSnapElement: null, drawingSupport: new Map(), draggingSupport: new Map(), rotatingSupport: new Map(), }); } function setProjectProperties(state, properties) { let scene = state.scene.merge(properties); return state.merge({ mode: MODE_IDLE, scene, sceneHistory: state.sceneHistory.push(scene) }); } function openProjectConfigurator(state) { return state.merge({ mode: MODE_CONFIGURING_PROJECT, }); } function initCatalog(state, catalog) { return state.set('catalog', new Catalog(catalog)); } function updateMouseCoord(state, coords) { return state.set('mouse', new Map(coords)); } function updateZoomScale(state, scale) { return state.set('zoom', scale); } function toggleSnap(state, mask) { return state.set('snapMask', mask); } function throwError(state, error) { return state.set('errors', state.get('errors').push({ date: Date.now(), error })); } const throwWarning = (state, warning) => state.set('warnings', state.get('warnings').push({ date: Date.now(), warning })); const copyProperties = (state, properties) => state.set('clipboardProperties', properties.toJS()); const pasteProperties = (state) => updateProperties(state, state.get('clipboardProperties'));
var CoreObject = require('core-object'); var Promise = require('ember-cli/lib/ext/promise'); var SilentError = require('silent-error'); var chalk = require('chalk'); var white = chalk.white; var green = chalk.green; var EXPIRE_IN_2030 = new Date('2030'); var TWO_YEAR_CACHE_PERIOD_IN_SEC = 60 * 60 * 24 * 365 * 2; module.exports = CoreObject.extend({ init: function() { if (!this.config) { return Promise.reject(new SilentError('You have to pass a config!')); } this.s3 = this.s3 || require('s3'); this.client = this.s3.createClient({ maxAsyncS3: 1, s3Options: this.config.assets }); }, upload: function() { var client = this.client; var _this = this; if (!this.ui) { var message = 'You have to pass a UI to an adapter.'; return Promise.reject(new SilentError(message)); } this.ui.pleasantProgress.start(green('Uploading assets'), green('.')); return new Promise(function(resolve, reject) { var uploader = client.uploadDir(_this.getUploadParams()); uploader.on('error', _this.logUploadError.bind(_this, reject)); uploader.on('end', _this.logUploadSuccess.bind(_this, resolve)); uploader.on('fileUploadStart', _this.logFileUpload.bind(_this)); uploader.on('fileUploadEnd', _this.logFileUploadEnd.bind(_this, resolve)); }); }, getUploadParams: function() { return { localDir: 'tmp/assets-sync', s3Params: { ACL: 'public-read', Bucket: this.config.assets.bucket, Prefix: this.config.assets.prefix || '', CacheControl: 'max-age='+TWO_YEAR_CACHE_PERIOD_IN_SEC+', public', Expires: EXPIRE_IN_2030 }, getS3Params: this.getS3Params.bind(this) } }, getS3Params: function(localFile, stat, callback) { if (this.config.assets.gzip === false) { return callback(null, {}); } var gzipExtensions = this.config.assets.gzipExtensions ? this.config.assets.gzipExtensions : ['js', 'css', 'svg']; var ext = localFile.replace(/.*[\.\/\\]/, '').toLowerCase(); var isGzippedContent = gzipExtensions.indexOf(ext) != -1; var additionalParams = isGzippedContent ? { ContentEncoding: 'gzip' } : {}; callback(null, additionalParams); }, logFileUpload: function(fullPath, _) { var fileNameMatches = fullPath.match(/\/((\w*[-]\w*||\w*)[.]\w*)/); if (fileNameMatches) { this.ui.writeLine('Uploading: ' + green(fileNameMatches[1])); } this.fileUploadPending = true; }, logFileUploadEnd: function(resolve, localFilePath, _s3Key) { this.fileUploadPending = false; if (this.s3ThinksWeAreFinished) { this.printEndMessage(); resolve(); } }, logUploadError: function(reject, error) { var errorMessage = 'Unable to sync: ' + error.stack; reject(new SilentError(errorMessage)); }, logUploadSuccess: function(resolve) { if (this.fileUploadPending) { // s3 screws up some times when only uploading one image this.s3ThinksWeAreFinished = true; } else { this.printEndMessage(); resolve(); } }, printEndMessage: function() { this.ui.writeLine('Assets upload successful. Done uploading.'); this.ui.pleasantProgress.stop(); } });
'use strict'; exports.xmlns = 'http://www.w3.org/2000/xmlns/'; exports.svg = 'http://www.w3.org/2000/svg'; exports.xlink = 'http://www.w3.org/1999/xlink'; // the 'old' d3 quirk got fix in v3.5.7 // https://github.com/mbostock/d3/commit/a6f66e9dd37f764403fc7c1f26be09ab4af24fed exports.svgAttrs = { xmlns: exports.svg, 'xmlns:xlink': exports.xlink };
import { window, document } from 'ssr-window'; import $ from '../../utils/dom'; import Utils from '../../utils/utils'; const HashNavigation = { onHashCange() { const swiper = this; const newHash = document.location.hash.replace('#', ''); const activeSlideHash = swiper.slides.eq(swiper.activeIndex).attr('data-hash'); if (newHash !== activeSlideHash) { const newIndex = swiper.$wrapperEl.children(`.${swiper.params.slideClass}[data-hash="${newHash}"]`).index(); if (typeof newIndex === 'undefined') return; swiper.slideTo(newIndex); } }, setHash() { const swiper = this; if (!swiper.hashNavigation.initialized || !swiper.params.hashNavigation.enabled) return; if (swiper.params.hashNavigation.replaceState && window.history && window.history.replaceState) { window.history.replaceState(null, null, (`#${swiper.slides.eq(swiper.activeIndex).attr('data-hash')}` || '')); } else { const slide = swiper.slides.eq(swiper.activeIndex); const hash = slide.attr('data-hash') || slide.attr('data-history'); document.location.hash = hash || ''; } }, init() { const swiper = this; if (!swiper.params.hashNavigation.enabled || (swiper.params.history && swiper.params.history.enabled)) return; swiper.hashNavigation.initialized = true; const hash = document.location.hash.replace('#', ''); if (hash) { const speed = 0; for (let i = 0, length = swiper.slides.length; i < length; i += 1) { const slide = swiper.slides.eq(i); const slideHash = slide.attr('data-hash') || slide.attr('data-history'); if (slideHash === hash && !slide.hasClass(swiper.params.slideDuplicateClass)) { const index = slide.index(); swiper.slideTo(index, speed, swiper.params.runCallbacksOnInit, true); } } } if (swiper.params.hashNavigation.watchState) { $(window).on('hashchange', swiper.hashNavigation.onHashCange); } }, destroy() { const swiper = this; if (swiper.params.hashNavigation.watchState) { $(window).off('hashchange', swiper.hashNavigation.onHashCange); } }, }; export default { name: 'hash-navigation', params: { hashNavigation: { enabled: false, replaceState: false, watchState: false, }, }, create() { const swiper = this; Utils.extend(swiper, { hashNavigation: { initialized: false, init: HashNavigation.init.bind(swiper), destroy: HashNavigation.destroy.bind(swiper), setHash: HashNavigation.setHash.bind(swiper), onHashCange: HashNavigation.onHashCange.bind(swiper), }, }); }, on: { init() { const swiper = this; if (swiper.params.hashNavigation.enabled) { swiper.hashNavigation.init(); } }, destroy() { const swiper = this; if (swiper.params.hashNavigation.enabled) { swiper.hashNavigation.destroy(); } }, transitionEnd() { const swiper = this; if (swiper.hashNavigation.initialized) { swiper.hashNavigation.setHash(); } }, }, };
'use strict'; describe("Schema.SchemaDefinition", function () { var SchemaDefinition = Divhide.SubModules.Schema.SchemaDefinition; beforeEach(function () { jasmine.addMatchers(window.JasmineCustomMatchers); }); it(".ctor(Array)", function () { var c = new SchemaDefinition({ schema : [ 1, 2 ], default: [], required: true, repeatable: false }); var schema = new SchemaDefinition({ schema : [ new SchemaDefinition({ schema: 2, required: true }), new SchemaDefinition({ schema: 1, required: true }) ], default: [], required: true, repeatable: false }); expect(schema).equals(c); }); it(".ctor(Object)", function () { var c = new SchemaDefinition({ schema : { one: 1, two: 2 }, required: true, repeatable: false }); var schema = new SchemaDefinition({ schema : { "one": new SchemaDefinition({ schema: 0, required: true }), "two": new SchemaDefinition({ schema: 0, required: true }) }, required: true, repeatable: false }); expect(schema).equals(c); }); it(".ctor(String)", function () { var expected = new SchemaDefinition({ schema : '', required: true, repeatable: false }); var schema = new SchemaDefinition({ schema: '0' }); expect(schema).equals(expected); }); it(".ctor(Number)", function () { var expected = new SchemaDefinition({ schema : 0, required: true, repeatable: false }); var schema = new SchemaDefinition({ schema: 1 }); expect(schema).equals(expected); }); });
'use strict'; const gulp = require('gulp'); const gulpif = require('gulp-if'); const jscs = require('gulp-jscs'); const stylish = require('jscs-stylish'); module.exports = (src, opts) => { opts = Object.assign({ configPath: './node_modules/habanero-code-style/js/.jscsrc', reporter: stylish.path, watch: false }, opts); return gulp.src(src) .pipe(jscs(opts)) .pipe(jscs.reporter()) .pipe(gulpif(!opts.watch, jscs.reporter('fail'))); };
$(document).ready(function() { vis.createBreadcrumbs($(".container.full").first()); }); // namespace var vis = {}; /** * Adds a breadcrumb as first child to the specified container. * * @author felixhayashi */ vis.createBreadcrumbs = function(container) { // use the url to infer the path var crumbs = location.pathname.split('/'); // number of ancestor directories var stepbackIndex = crumbs.length-1; var breadcrumbs = $.map(crumbs, function(crumb, i) { // first and last element of the split if(!crumb) return; stepbackIndex--; if(/\.html$/.test(crumb)) { // strip the .html to make it look prettier return "<span>" + crumb.replace(/\.html$/, "") + "</span>"; } else { // calculate the relative url for(var ref=crumb+"/", j=0; j<stepbackIndex; j++, ref="../"+ref); return "<a href='" + ref + "'>" + crumb + "</a>"; } }).join("") || "Home"; // insert into the container at the beginning. $(container).prepend("<div id=\"breadcrumbs\">" + breadcrumbs + "</div>"); };
import React, { memo, useMemo } from 'react'; import PropTypes from 'prop-types'; import { useIntl } from 'react-intl'; import get from 'lodash/get'; import omit from 'lodash/omit'; import take from 'lodash/take'; import isEqual from 'react-fast-compare'; import { GenericInput, NotAllowedInput, useLibrary } from '@strapi/helper-plugin'; import { useContentTypeLayout } from '../../hooks'; import { getFieldName } from '../../utils'; import Wysiwyg from '../Wysiwyg'; import InputJSON from '../InputJSON'; import InputUID from '../InputUID'; import SelectWrapper from '../SelectWrapper'; import { connect, generateOptions, getInputType, getStep, select, VALIDATIONS_TO_OMIT, } from './utils'; function Inputs({ allowedFields, fieldSchema, formErrors, isCreatingEntry, keys, labelAction, metadatas, onChange, readableFields, shouldNotRunValidations, queryInfos, value, }) { const { fields } = useLibrary(); const { formatMessage } = useIntl(); const { contentType: currentContentTypeLayout } = useContentTypeLayout(); const disabled = useMemo(() => !get(metadatas, 'editable', true), [metadatas]); const type = fieldSchema.type; const errorId = useMemo(() => { return get(formErrors, [keys, 'id'], null); }, [formErrors, keys]); const fieldName = useMemo(() => { return getFieldName(keys); }, [keys]); const validations = useMemo(() => { const inputValidations = omit( fieldSchema, shouldNotRunValidations ? [...VALIDATIONS_TO_OMIT, 'required', 'minLength'] : VALIDATIONS_TO_OMIT ); const regexpString = fieldSchema.regex || null; if (regexpString) { const regexp = new RegExp(regexpString); if (regexp) { inputValidations.regex = regexp; } } return inputValidations; }, [fieldSchema, shouldNotRunValidations]); const isRequired = useMemo(() => get(validations, ['required'], false), [validations]); const isChildOfDynamicZone = useMemo(() => { const attributes = get(currentContentTypeLayout, ['attributes'], {}); const foundAttributeType = get(attributes, [fieldName[0], 'type'], null); return foundAttributeType === 'dynamiczone'; }, [currentContentTypeLayout, fieldName]); const inputType = useMemo(() => { return getInputType(type); }, [type]); const inputValue = useMemo(() => { // Fix for input file multipe if (type === 'media' && !value) { return []; } return value; }, [type, value]); const step = useMemo(() => { return getStep(type); }, [type]); const isUserAllowedToEditField = useMemo(() => { const joinedName = fieldName.join('.'); if (allowedFields.includes(joinedName)) { return true; } if (isChildOfDynamicZone) { return allowedFields.includes(fieldName[0]); } const isChildOfComponent = fieldName.length > 1; if (isChildOfComponent) { const parentFieldName = take(fieldName, fieldName.length - 1).join('.'); return allowedFields.includes(parentFieldName); } return false; }, [allowedFields, fieldName, isChildOfDynamicZone]); const isUserAllowedToReadField = useMemo(() => { const joinedName = fieldName.join('.'); if (readableFields.includes(joinedName)) { return true; } if (isChildOfDynamicZone) { return readableFields.includes(fieldName[0]); } const isChildOfComponent = fieldName.length > 1; if (isChildOfComponent) { const parentFieldName = take(fieldName, fieldName.length - 1).join('.'); return readableFields.includes(parentFieldName); } return false; }, [readableFields, fieldName, isChildOfDynamicZone]); const shouldDisplayNotAllowedInput = useMemo(() => { return isUserAllowedToReadField || isUserAllowedToEditField; }, [isUserAllowedToEditField, isUserAllowedToReadField]); const shouldDisableField = useMemo(() => { if (!isCreatingEntry) { const doesNotHaveRight = isUserAllowedToReadField && !isUserAllowedToEditField; if (doesNotHaveRight) { return true; } return disabled; } return disabled; }, [disabled, isCreatingEntry, isUserAllowedToEditField, isUserAllowedToReadField]); const options = useMemo(() => generateOptions(fieldSchema.enum || [], isRequired), [ fieldSchema, isRequired, ]); const { label, description, placeholder, visible } = metadatas; if (visible === false) { return null; } if (!shouldDisplayNotAllowedInput) { return ( <NotAllowedInput description={description ? { id: description, defaultMessage: description } : null} intlLabel={{ id: label, defaultMessage: label }} labelAction={labelAction} error={errorId} name={keys} required={isRequired} /> ); } if (type === 'relation') { return ( <SelectWrapper {...metadatas} {...fieldSchema} description={ metadatas.description ? formatMessage({ id: metadatas.description, defaultMessage: metadatas.description, }) : undefined } intlLabel={{ id: metadatas.label, defaultMessage: metadatas.label, }} labelAction={labelAction} isUserAllowedToEditField={isUserAllowedToEditField} isUserAllowedToReadField={isUserAllowedToReadField} name={keys} placeholder={ metadatas.placeholder ? { id: metadatas.placeholder, defaultMessage: metadatas.placeholder, } : null } queryInfos={queryInfos} value={value} /> ); } return ( <GenericInput attribute={fieldSchema} autoComplete="new-password" intlLabel={{ id: label, defaultMessage: label }} description={description ? { id: description, defaultMessage: description } : null} disabled={shouldDisableField} error={errorId} labelAction={labelAction} contentTypeUID={currentContentTypeLayout.uid} customInputs={{ json: InputJSON, uid: InputUID, media: fields.media, wysiwyg: Wysiwyg, ...fields, }} multiple={fieldSchema.multiple || false} name={keys} onChange={onChange} options={options} placeholder={placeholder ? { id: placeholder, defaultMessage: placeholder } : null} required={fieldSchema.required || false} step={step} type={inputType} // validations={validations} value={inputValue} withDefaultValue={false} /> ); } Inputs.defaultProps = { formErrors: {}, labelAction: undefined, queryInfos: {}, value: null, }; Inputs.propTypes = { allowedFields: PropTypes.array.isRequired, fieldSchema: PropTypes.object.isRequired, formErrors: PropTypes.object, keys: PropTypes.string.isRequired, isCreatingEntry: PropTypes.bool.isRequired, labelAction: PropTypes.element, metadatas: PropTypes.object.isRequired, onChange: PropTypes.func.isRequired, readableFields: PropTypes.array.isRequired, shouldNotRunValidations: PropTypes.bool.isRequired, queryInfos: PropTypes.shape({ containsKey: PropTypes.string, defaultParams: PropTypes.object, endPoint: PropTypes.string, }), value: PropTypes.any, }; const Memoized = memo(Inputs, isEqual); export default connect( Memoized, select );
import React, { Component, PropTypes } from 'react' import { connect } from 'react-redux' import { addUserRequest, getUserRequest, updateUserRequest } from 'App/actions/users' import { USER_TYPE_USER } from 'Server/constants' import EditView from '../components/EditView' class EditContainer extends Component { static propTypes = { addUserRequest: PropTypes.func.isRequired, updateUserRequest: PropTypes.func.isRequired, getUserRequest: PropTypes.func.isRequired, user: PropTypes.object.isRequired, params: PropTypes.object.isRequired, } constructor(props) { super(props) this.isAdding = props.params.id === undefined this.handleSubmit = this.handleSubmit.bind(this) } componentDidMount() { if (!this.isAdding) { this.props.getUserRequest(this.props.params.id) } } handleSubmit(user) { if (this.isAdding) { this.props.addUserRequest(user) } else { this.props.updateUserRequest(this.props.params.id, user) } } render() { const { user } = this.props return ( <div> <div className="page-header"> <h2> {this.isAdding ? 'Add New User' : `Edit User - ${user.username}`} </h2> </div> <EditView isAdding={this.isAdding} user={user} onSubmit={this.handleSubmit} /> </div> ) } } const mapStateToProps = (state, ownProps) => { let user if (ownProps.params.id === undefined) { user = { username: '', password: '', type: USER_TYPE_USER, } } else { user = state.users.find(_user => _user._id === ownProps.params.id) user.password = '' } return { user, } } const mapDispatchToProps = { addUserRequest, updateUserRequest, getUserRequest, } export default connect(mapStateToProps, mapDispatchToProps)(EditContainer)
import { Universal } from '../../../src/types'; const { Set } = Universal; const emptySet = new Set(); export default emptySet;
$(document).ready(function () { /* $('.sign-up-submit').click(function(e) { var $button = $(e.target); var $input = $button.closest(".sign-up-form").find(".mdl-textfield__input"); var $warning = $button.closest(".sign-up-form").find(".warning-message"); buttonAnimate($button, $input, $warning); }); $('.sign-up-form .mdl-textfield__input').keypress(function(e) { if (e.which === 13) { var $input = $(e.target); var $button = $input.closest(".sign-up-form").find(".mdl-button"); var $warning = $button.closest(".sign-up-form").find(".warning-message"); buttonAnimate($button, $input, $warning); } }); */ var envSlug = getEnvironmentSlug(); intercomLauncher(envSlug, true, '#intercom-launcher'); initializeGoogleAnalytics(envSlug); }); // returns true if email contains an @ that is not at either end of the string function simpleEmailCheck(email) { var atSignLocation = email.indexOf("@"); return (atSignLocation > 0) && (atSignLocation < (email.length - 1)); } function buttonAnimate($button, $input, $warning) { var email = $input.val(); var $area = $input.closest(".sign-up-area"); if (simpleEmailCheck(email)) { $warning.css("visibility", "hidden"); $area.removeClass("warning"); $button.animate({ opacity: 0.7, }); $button.attr("disabled", "disabled"); $input.animate({ opacity: 0.5, }); $input.attr("disabled", "disabled"); setTimeout(function() { $button.text("Email Sent!"); }, 200); } else { $warning.css("visibility", "visible"); $area.addClass("warning"); } }
import styled from 'styled-components'; export const Wrapper = styled.section` margin: 0 auto; width: 100%; max-width: 1170px; `; export const VerticalListView = styled.ul` margin: var(--topbar-height) 0; padding: 0; list-style-type: none; `; export const VerticalListSection = styled.li` margin-bottom: var(--padding); &:last-child { position: relative; padding-bottom: calc(var(--topbar-height) * 1.5); } h4, ul:not(.slider-list) { padding-left: var(--padding); } `; export const HorizontalListView = styled.ul` margin: 0; padding: var(--padding); padding-left: 0; display: flex; flex-flow: row no-wrap; list-style-type: none; overflow-x: auto; align-items: center; `; export const HorizontalListItem = styled.li` margin-right: var(--padding); &:last-child { position: relative; padding-right: calc(var(--topbar-height) * 0.5); } `; export const TagButton = styled.button` padding: calc(var(--padding) * 0.5) calc(var(--padding) * 2); background: var(--primary-accent-color); color: var(--background-color); border-radius: 50px; white-space: nowrap; `; export const FacilityButton = styled.button` background: var(--foreground-color); color: var(--background-color); padding: var(--padding); border-radius: 4px; white-space: nowrap; `; export const FacilityIcon = styled.img` display: block; margin: 0 auto; height: 24px; margin-bottom: calc(var(--padding) / 2); `; export const SearchContainer = styled.section` position: relative; margin: auto; width: 100%; max-width: 1170px; display: flex; align-items: center; `; export const SearchLabel = styled.label` // padding: calc(var(--padding) / 1); padding-left: calc(var(--padding) / 2); border-radius: 4px 0 0 4px; `; export const SearchBox = styled.input` display: block; flex: 2; // padding: calc(var(--padding) / 1); font-size: 16px; &:focus { outline: 0; } `; export const List = styled.ul` margin: var(--topbar-height) 0 calc(var(--topbar-height) * 1.5) 0; padding: 0; list-style-type: 0; `; export const Item = styled.li` border-bottom: 1px solid var(--light-gray); `; export const SlideList = styled.section` padding: var(--padding); `;
var hub = require('..') , cluster = require('cluster') , assert = require('assert') , WORKERS = 2 if (cluster.isMaster) { var workers = []; for (var i = 0; i < WORKERS; i++) { workers.push(cluster.fork()); } var n = WORKERS; hub.on('imready', function() { if (--n === 0) hub.emit('allready'); }); describe('Master', function() { it('Waits for workers to exit', function(done) { var n = WORKERS; function exit() { if (--n === 0) done(); } cluster.on('exit', exit); }); }); } else { describe('Worker', function() { describe('Emit message to other worker', function() { it('Respond when all workers are listening', function(done) { hub.on('fromworker', done); hub.on('allready', function() { hub.emitRemote('fromworker'); }); hub.emit('imready'); }); }); describe('Calls hub method', function() { it('Data should be shared amongst workers', function(done) { var n = 0; hub.on('incr work', function() { if (++n === WORKERS) { done(); } }); hub.ready(function() { setTimeout(function() { hub.incr('work'); }, 100); }); }); }); }); }
import addOptionsToOrdinalScale from 'ember-d3-helpers/utils/add-options-to-ordinal-scale'; import { module, test } from 'qunit'; module('Unit | Utility | add options to ordinal scale'); // Replace this with your real tests. test('works supporting paddingInner/Outer', function(assert) { let callCounts = {}; let lastArgs = {}; let scale = ['align', 'padding', 'paddingInner', 'paddingOuter'].reduce((hash, prop) => { callCounts[prop] = 0; lastArgs[prop] = []; hash[prop] = (...args) => { lastArgs[prop] = args; callCounts[prop]++; }; return hash; }, { domain() {}, range() {}, rangeRound() {} }); addOptionsToOrdinalScale(scale, [], [], {}); assert.deepEqual(callCounts, { align: 0, padding: 0, paddingInner: 0, paddingOuter: 0 }); assert.deepEqual(lastArgs, { align: [], padding: [], paddingInner: [], paddingOuter: [] }); addOptionsToOrdinalScale(scale, [], [], { padding: 10 }); assert.deepEqual(callCounts, { align: 0, padding: 1, paddingInner: 0, paddingOuter: 0 }); assert.deepEqual(lastArgs, { align: [], padding: [10], paddingInner: [], paddingOuter: [] }); addOptionsToOrdinalScale(scale, [], [], { 'padding-inner': 10 }); assert.deepEqual(callCounts, { align: 0, padding: 1, paddingInner: 1, paddingOuter: 0 }); assert.deepEqual(lastArgs, { align: [], padding: [10], paddingInner: [10], paddingOuter: [] }); addOptionsToOrdinalScale(scale, [], [], { 'padding-outer': 10 }); assert.deepEqual(callCounts, { align: 0, padding: 1, paddingInner: 1, paddingOuter: 1 }); assert.deepEqual(lastArgs, { align: [], padding: [10], paddingInner: [10], paddingOuter: [10] }); addOptionsToOrdinalScale(scale, [], [], { align: 0 }); assert.deepEqual(callCounts, { align: 1, padding: 1, paddingInner: 1, paddingOuter: 1 }); assert.deepEqual(lastArgs, { align: [0], padding: [10], paddingInner: [10], paddingOuter: [10] }); }); test('works without supporting paddingInner/Outer', function(assert) { let callCounts = {}; let lastArgs = {}; let scale = ['align', 'padding'].reduce((hash, prop) => { callCounts[prop] = 0; lastArgs[prop] = []; hash[prop] = (...args) => { lastArgs[prop] = args; callCounts[prop]++; }; return hash; }, {}); assert.throws(() => { addOptionsToOrdinalScale(scale, { 'padding-inner': 10 }); }, 'padding inner without support throws'); assert.deepEqual(callCounts, { align: 0, padding: 0 }); assert.deepEqual(lastArgs, { align: [], padding: [] }); assert.throws(() => { addOptionsToOrdinalScale(scale, { 'padding-outer': 10 }); }, 'padding outer without support throws'); assert.deepEqual(callCounts, { align: 0, padding: 0 }); assert.deepEqual(lastArgs, { align: [], padding: [] }); });
/** * UserController * * @description :: Server-side logic for managing users * @help :: See http://links.sailsjs.org/docs/controllers */ module.exports = { notes: function(req, res) { EvernoteService.listNotes(function(err, notes) { if(err){ console.log(err); return res.serverError(err); } return res.json({ notes: notes }); }); }, notebooks: function (req, res) { EvernoteService.listNotebooks(function(err, notes) { if(err){ console.log(err); return res.serverError(err); } return res.json({ notebooks: notes }); }); } };
/** * @todo same issue as in movement.js - which profile takes precedence? */ on("change:repeating_profiles:attacks", async (e) => { console.log("change:repeating_profiles:attacks", e); const movementIds = await getSectionIDsAsync("movement"); const attrNames = movementIds.map( (id) => `repeating_movement_${id}_ft_melee` ); const attrs = {}; const a = await getAttrsAsync(attrNames.concat(["run_ft_melee"])); attrs.run_ft_attack = Math.round(a.run_ft_melee / e.newValue); movementIds.forEach((id) => { const row = `repeating_movement_${id}`; const feetPerMelee = a[`${row}_ft_melee`] || 0; if (feetPerMelee) { attrs[`${row}_ft_attack`] = Math.round(feetPerMelee / e.newValue); } }); await setAttrsAsync(attrs); }); async function addStrikeRangeToCombinedAsync(rowPrefix) { console.log("addStrikeRangeToCombinedAsync", rowPrefix); const a = await getAttrsAsync([ `${rowPrefix}_strike_range`, `${rowPrefix}_strike_range_single`, `${rowPrefix}_strike_range_burst`, `${rowPrefix}_strike_range_aimed`, `${rowPrefix}_strike_range_called`, ]); const strikeRangeSingle = +a[`${rowPrefix}_strike_range`] + +a[`${rowPrefix}_strike_range_single`]; const strikeRangeBurst = +a[`${rowPrefix}_strike_range`] + +a[`${rowPrefix}_strike_range_burst`]; const strikeRangeAimedSingle = strikeRangeSingle + +a[`${rowPrefix}_strike_range_aimed`] + 2; const strikeRangeAimedPulse = Math.floor(strikeRangeAimedSingle / 2); const strikeRangeCalledSingle = strikeRangeSingle + a[`${rowPrefix}_strike_range_called`]; const strikeRangeCalledPulse = Math.floor(strikeRangeCalledSingle / 2); const strikeRangeAimedCalledSingle = strikeRangeAimedSingle + +a[`${rowPrefix}_strike_range_called`]; const strikeRangeAimedCalledPulse = Math.floor( strikeRangeAimedCalledSingle / 2 ); const attrs = { [`${rowPrefix}_strike_range_single`]: strikeRangeSingle, [`${rowPrefix}_strike_range_burst`]: strikeRangeBurst, [`${rowPrefix}_strike_range_aimed_single`]: strikeRangeAimedSingle, [`${rowPrefix}_strike_range_aimed_pulse`]: strikeRangeAimedPulse, [`${rowPrefix}_strike_range_called_single`]: strikeRangeCalledSingle, [`${rowPrefix}_strike_range_called_pulse`]: strikeRangeCalledPulse, [`${rowPrefix}_strike_range_aimed_called_single`]: strikeRangeAimedCalledSingle, [`${rowPrefix}_strike_range_aimed_called_pulse`]: strikeRangeAimedCalledPulse, }; console.log(attrs); await setAttrsAsync(attrs); } async function repeatingAbsoluteAttributes(rowIds, destinationPrefix) { console.log("repeatingAbsoluteAttributes", rowIds, destinationPrefix); const fields = [ "iq", "me", "ma", "ps", "pp", "pe", "pb", "spd", "spdfly", "hf", "spellstrength", "trust", "intimidate", "charmimpress", ]; const fieldNames = rowIds.reduce((acc, rowId) => { const absFieldNames = fields.map( (f) => `repeating_bonuses_${rowId}_${f}_abs` ); const attFieldNames = fields.map( (f) => `repeating_bonuses_${rowId}_mod_${f}` ); return acc.concat(absFieldNames, attFieldNames); }, []); const a = await getAttrsAsync(fieldNames); fields.forEach(async (field) => { let fieldAbsValue = null; rowIds.forEach((rowId) => { const rowFieldAbs = a[`repeating_bonuses_${rowId}_${field}_abs`]; if (Boolean(Number(rowFieldAbs)) == true) { rowFieldValue = a[`repeating_bonuses_${rowId}_mod_${field}`]; fieldAbsValue = fieldAbsValue > rowFieldValue ? fieldAbsValue : rowFieldValue; } }); if (fieldAbsValue) { // compare the modified absolute value against the original attribute const coreValue = (await getAttrsAsync([field]))[field]; const newValue = coreValue > fieldAbsValue ? coreValue : fieldAbsValue; const attr = { [`${destinationPrefix}_mod_${field}`]: newValue, }; await setAttrsAsync(attr); } else { // repeatingSum const rsaDestinations = [`${destinationPrefix}_mod_${field}`]; const rsaFields = [`mod_${field}`]; let base = field; if (field == "trust" || field == "intimidate") { base = `${destinationPrefix}_mod_ma_bonus`; } else if (field == "charmimpress") { base = `${destinationPrefix}_mod_pb_bonus`; } await repeatingSumAsync( rsaDestinations, "bonuses", rsaFields, `filter:${rowIds.toString()}`, base ); } }); } async function combineBonuses(rowIds, destinationPrefix) { // we need to combine the values of each repeated attribute within // each of the sectionIds and aggregate them in the combined combat section // +PP +PS, and add a saving throws section with +ME +PE console.log("combineBonuses", rowIds, destinationPrefix); const options = await getAttrsAsync(["opt_pp_extras"]); const optPpExtras = Boolean(+options["opt_pp_extras"]); await repeatingAbsoluteAttributes(rowIds, destinationPrefix); await repeatingStringConcatAsync({ destinations: [ `${destinationPrefix}_damage`, `${destinationPrefix}_damage_paired`, `${destinationPrefix}_damage_mainhand`, `${destinationPrefix}_damage_offhand`, `${destinationPrefix}_damage_range`, `${destinationPrefix}_damage_range_single`, `${destinationPrefix}_damage_range_burst`, ], section: "bonuses", fields: [ "damage", "damage_paired", "damage_mainhand", "damage_offhand", "damage_range", "damage_range_single", "damage_range_burst", ], filter: rowIds, }); const pickBestFieldsBase = [ "ar", "critical", "knockout", "deathblow", "mod_character_ps_type", "mod_liftcarry_weight_multiplier", "mod_liftcarry_duration_multiplier", ]; const pickBestDestinations = pickBestFieldsBase.map( (field) => `${destinationPrefix}_${field}` ); const pickBestFields = pickBestFieldsBase; const core = await getAttrsAsync(["character_ps_type"]); await repeatingPickBestAsync({ destinations: pickBestDestinations, section: "bonuses", fields: pickBestFields, defaultValues: [0, 20, 0, 0, core.character_ps_type, 1, 1], ranks: ["high", "low", "low", "low", "high", "high", "high", "high"], filter: rowIds, }); let noAttributeBonusFields = [ "attacks", "initiative", "pull", "roll", "strike_range", "strike_range_single", "strike_range_burst", "strike_range_aimed", "strike_range_called", "disarm_range", ]; let ppBonusFields = [ "strike", "parry", "dodge", "throw", "dodge_flight", "dodge_auto", "dodge_teleport", "dodge_motion", "dodge_underwater", "flipthrow", ]; const ppExtras = ["disarm", "entangle"]; if (optPpExtras) { ppBonusFields = ppBonusFields.concat(ppExtras); } else { noAttributeBonusFields = noAttributeBonusFields.concat(ppExtras); } // No attribute bonuses. await repeatingSumAsync( noAttributeBonusFields.map((field) => `${destinationPrefix}_${field}`), "bonuses", noAttributeBonusFields, `filter:${rowIds.toString()}` ); await addStrikeRangeToCombinedAsync(destinationPrefix); await repeatingSumAsync( [`${destinationPrefix}_hp`], "bonuses", ["hp"], `filter:${rowIds.toString()}`, "character_hp" ); await repeatingSumAsync( [`${destinationPrefix}_sdc`], "bonuses", ["sdc"], `filter:${rowIds.toString()}`, "character_sdc" ); await repeatingSumAsync( [`${destinationPrefix}_mdc`], "bonuses", ["mdc"], `filter:${rowIds.toString()}`, "character_mdc" ); await repeatingSumAsync( [`${destinationPrefix}_ppe`], "bonuses", ["ppe"], `filter:${rowIds.toString()}`, "character_ppe" ); await repeatingSumAsync( [`${destinationPrefix}_isp`], "bonuses", ["isp"], `filter:${rowIds.toString()}`, "character_isp" ); await repeatingSumAsync( [`${destinationPrefix}_mod_skillbonus`], "bonuses", ["mod_skillbonus"], `filter:${rowIds.toString()}` ); await repeatingSumAsync( ppBonusFields.map((field) => `${destinationPrefix}_${field}`), "bonuses", ppBonusFields, `filter:${rowIds.toString()}`, `${destinationPrefix}_mod_pp_bonus` ); // Saving Throws Object.entries(SAVE_KEYS_ATTRIBUTE_BONUSES).forEach( async ([attributeBonus, saves]) => { const destinations = saves.map((save) => `${destinationPrefix}_${save}`); const section = "bonuses"; const fields = saves; await repeatingSumAsync( destinations, section, fields, `filter:${rowIds.toString()}`, `${destinationPrefix}_mod_${attributeBonus}` ); } ); } async function removeBonusSelectionsRowAsync(bonusRowId) { const a = await getAttrsAsync([ `repeating_bonuses_${bonusRowId}_selection_id`, ]); removeRepeatingRow( `repeating_bonusselections_${ a[`repeating_bonuses_${bonusRowId}_selection_id`] }` ); } async function removeBonusRowsAsync(bonusRowId) { await removeBonusSelectionsRowAsync(bonusRowId); removeRepeatingRow(`repeating_bonuses_${bonusRowId}`); } on("remove:repeating_wp remove:repeating_wpmodern", async (e) => { console.log("remove wp", e); // const [r, section, rowId] = e.sourceAttribute.split('_'); const bonusRowId = e.removedInfo[`${e.sourceAttribute}_bonus_id`]; await removeBonusRowsAsync(bonusRowId); }); async function outputSelectedBonusIds() { const bonusselectionsIds = await getSectionIDsAsync("bonusselections"); const checkboxNames = bonusselectionsIds.map( (id) => `repeating_bonusselections_${id}_enabled` ); const bonusIdNames = bonusselectionsIds.map( (id) => `repeating_bonusselections_${id}_bonus_id` ); const attrNames = checkboxNames.concat(bonusIdNames); const a = await getAttrsAsync(attrNames); const bonusRowIds = bonusselectionsIds.reduce((acc, id) => { const prefix = `repeating_bonusselections_${id}`; if (Boolean(Number(a[`${prefix}_enabled`])) == true) { acc.push(a[`${prefix}_bonus_id`]); } return acc; }, []); await setAttrsAsync({ bonus_ids_output: bonusRowIds.toString() }); } on("change:repeating_bonusselections:enabled", async (e) => { console.log("change:repeating_bonusselections:enabled", e); await outputSelectedBonusIds(); }); async function insertSelection(name, bonusRowId) { console.log("insertSelection", name, bonusRowId); const selectionRowId = generateRowID(); const attrs = {}; attrs[`repeating_bonusselections_${selectionRowId}_bonus_id`] = bonusRowId; attrs[`repeating_bonusselections_${selectionRowId}_name`] = name; attrs[`repeating_bonuses_${bonusRowId}_selection_id`] = selectionRowId; console.log(attrs); await setAttrsAsync(attrs); } async function updateSelection(name, selectionRowId) { console.log("updateSelection", name, selectionRowId); const attrs = {}; attrs[`repeating_bonusselections_${selectionRowId}_name`] = name; await setAttrsAsync(attrs); } on("change:repeating_bonuses:name", async (e) => { console.log("change:repeating_bonuses:name", e); const [r, section, rowId] = e.sourceAttribute.split("_"); const selectionIdKey = `repeating_bonuses_${rowId}_selection_id`; const a = await getAttrsAsync([selectionIdKey]); console.log(a); if (a[selectionIdKey]) { await updateSelection(e.newValue, a[selectionIdKey]); } else { await insertSelection(e.newValue, rowId); } }); on("change:repeating_profiles:name", async (e) => { console.log("change:repeating_profiles:name", e); const [r, section, rowId] = e.sourceAttribute.split("_"); await setAttrsAsync({ repeating_profiles_rowid: `${r}_${section}_${rowId}_`, }); await setDefaultRepeatingRow(section, null, "is_default", "default_profile"); }); on("change:repeating_profiles:mod_iq", async (e) => { console.log("change:repeating_profiles:mod_iq", e); const [r, section, rowId] = e.sourceAttribute.split("_"); await iqBonus(e.newValue, `${r}_${section}_${rowId}_mod_`); }); on( "change:repeating_profiles:mod_me \ change:repeating_profiles:mod_pp \ change:repeating_profiles:mod_pe", async (e) => { await mePpPeBonus(e.sourceAttribute, e.newValue); } ); on("change:repeating_profiles:mod_ma", async (e) => { console.log("change:repeating_profiles:mod_ma", e); const [r, section, rowId] = e.sourceAttribute.split("_"); await maBonus(e.newValue, `${r}_${section}_${rowId}_mod_`); }); on( "change:repeating_profiles:mod_ps \ change:repeating_profiles:mod_character_ps_type \ change:repeating_profiles:mod_liftcarry_weight_multiplier \ change:repeating_profiles:mod_liftcarry_duration_multiplier", async (e) => { console.log("change:repeating_profiles:mod_ps", e); const [r, section, rowId] = e.sourceAttribute.split("_"); await psBonusComplete(`${r}_${section}_${rowId}_mod_`); } ); on("change:repeating_profiles:mod_pb", async (e) => { console.log("change:repeating_profiles:mod_pb", e); const [r, section, rowId] = e.sourceAttribute.split("_"); await pbBonus(e.newValue, `${r}_${section}_${rowId}_mod_`); });
import React from 'react'; import PropTypes from 'prop-types'; import { FetchedData, Param } from '../fetched'; import * as globals from '../globals'; import { ObjectPicker } from '../inputs'; const ItemBlockView = (props) => { const ViewComponent = globals.contentViews.lookup(props.context); return <ViewComponent {...props} />; }; ItemBlockView.propTypes = { context: PropTypes.object, }; ItemBlockView.defaultProps = { context: null, }; export default ItemBlockView; class FetchedItemBlockView extends React.Component { shouldComponentUpdate(nextProps) { return (nextProps.value.item !== this.props.value.item); } render() { const context = this.props.value.item; if (typeof context === 'object') { return <ItemBlockView context={context} />; } if (typeof context === 'string') { return ( <FetchedData> <Param name="context" url={context} /> <ItemBlockView /> </FetchedData> ); } return null; } } FetchedItemBlockView.propTypes = { value: PropTypes.object, }; FetchedItemBlockView.defaultProps = { value: null, }; globals.blocks.register({ label: 'item block', icon: 'icon icon-paperclip', schema: { type: 'object', properties: { item: { title: 'Item', type: 'string', formInput: <ObjectPicker />, }, className: { title: 'CSS Class', type: 'string', }, }, }, view: FetchedItemBlockView, }, 'itemblock');
var assert = require('assert'); var createTestConfig = require('./test-util').createTestConfig; var createTestServicesWithStubs = require('./test-util').createTestServicesWithStubs; var FileServer = require('../braid-file-server').FileServer; var request = require('request'); var fs = require('fs'); var path = require('path'); var config1; var config2; var services1; var services2; var fileServer1; var fileServer2; describe('file-server:', function() { before(function(done) { config1 = createTestConfig('test.26111', 'test1', 26101, 26111); createTestServicesWithStubs(config1, function(err, svcs) { assert(!err, err); services1 = svcs; fileServer1 = new FileServer(); fileServer1.initialize(config1, services1); config2 = createTestConfig('test.26211', 'test2', 26201, 26211); createTestServicesWithStubs(config2, function(err, svcs) { assert(!err, err); services2 = svcs; fileServer2 = new FileServer(); fileServer2.initialize(config2, services2); done(); }); }); }); after(function(done) { fileServer1.close(); fileServer2.close(); services1.braidDb.close(done); services2.braidDb.close(done); }); it('put and retrieve file', function(done) { fs.createReadStream(path.join(__dirname, 'braid.png')).pipe(request.put({ uri : 'http://localhost:26121', headers : [ { name : 'Content-Type', value : 'image/png' } ] }, function(error, response, body) { assert.equal(response.statusCode, 200); var details = JSON.parse(body); assert.equal(details.domain, 'test.26111'); assert.equal(details.contentType, 'image/png'); request.get({ uri : 'http://localhost:26121/' + details.domain + "/" + details.fileId, encoding : null }, function(error, response, body) { assert.equal(response.body.length, 65048) assert.equal(response.headers['content-type'], 'image/png'); assert.equal(response.statusCode, 200); done(); }); }).on('error', function(err) { throw err; })); }); it('using encryption', function(done) { fs.createReadStream(path.join(__dirname, 'braid.png')).pipe(request.put({ uri : 'http://localhost:26121?encrypt=true', headers : [ { name : 'Content-Type', value : 'image/png' } ] }, function(error, response, body) { assert.equal(response.statusCode, 200); var details = JSON.parse(body); assert.equal(details.domain, 'test.26111'); assert.equal(details.contentType, 'image/png'); assert(details.encryptionKey !== null); request.get({ uri : 'http://localhost:26121/' + details.domain + "/" + details.fileId + "?decrypt=true&key=" + details.encryptionKey, encoding : null }, function(error, response, body) { assert.equal(response.body.length, 65048) assert.equal(response.headers['content-type'], 'image/png'); assert.equal(response.statusCode, 200); done(); }); }).on('error', function(err) { throw err; })); }); it('files on remote domains', function(done) { fs.createReadStream(path.join(__dirname, 'braid.png')).pipe(request.put({ uri : 'http://localhost:26221', headers : [ { name : 'Content-Type', value : 'image/png' } ] }, function(error, response, body) { assert.equal(response.statusCode, 200); var details = JSON.parse(body); assert.equal(details.domain, 'test.26211'); assert.equal(details.contentType, 'image/png'); request.get({ uri : 'http://localhost:26121/' + details.domain + "/" + details.fileId, encoding : null }, function(error, response, body) { assert.equal(response.statusCode, 200); assert.equal(response.headers['content-type'], 'image/png'); assert.equal(response.body.length, 65048) done(); }); }).on('error', function(err) { throw err; })); }); });
version https://git-lfs.github.com/spec/v1 oid sha256:7f9cbfb4555e04b948aae3356d710f479a41b7a1c0b5a605beeefce843edd9e6 size 2675
define([ 'angular', '../module', '../service', 'common/services/bootstrap', ], function(angular, lazyModule, service, bootstrapService) { 'use strict'; /** * [homeController description] * @param {[type]} $scope [description] * @param {[type]} homeService [description] * @return {[type]} [description] */ lazyModule.controller('ContentController', ['$scope', '$modal', '$rootScope', 'HomeService', 'ModalService', function($scope, $modal, $rootScope, homeService, modalService) { var self = this; $rootScope.pageTitle = 'home'; /** * [pageLoad description] * @return {[type]} [description] */ self.pageLoad = function() { homeService.getData().success(function(response) { $scope.awesomeThings = response.data; }); }; self.pageLoad(); } ]); });
(function() { var Sherpa; var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; root.Sherpa = Sherpa = (function() { var Glob, Lookup, Node, Path, PathRequest, RegexMatcher, RegexPath, Request, RequestMatcher, Response, Route, SpanningRegexMatcher, Variable; function Sherpa(callback) { this.callback = callback; this.root = new Node(); this.routes = {}; } Sherpa.prototype.match = function(httpRequest, httpResponse) { var request; request = (httpRequest.url != null) ? new Request(httpRequest) : new PathRequest(httpRequest); this.root.match(request); if (request.destinations.length > 0) { return new Response(request, httpResponse).invoke(); } else if (this.callback != null) { return this.callback(request.underlyingRequest); } }; Sherpa.prototype.findSubparts = function(part) { var match, subparts; subparts = []; while (match = part.match(/\\.|[:*][a-z0-9_]+|[^:*\\]+/)) { part = part.slice(match.index, part.length); subparts.push(part.slice(0, match[0].length)); part = part.slice(match[0].length, part.length); } return subparts; }; Sherpa.prototype.generatePaths = function(path) { var add, c, charIndex, chars, endIndex, pathIndex, paths, startIndex, _ref, _ref2; _ref = [[''], path.split(''), 0, 1], paths = _ref[0], chars = _ref[1], startIndex = _ref[2], endIndex = _ref[3]; for (charIndex = 0, _ref2 = chars.length; 0 <= _ref2 ? charIndex < _ref2 : charIndex > _ref2; 0 <= _ref2 ? charIndex++ : charIndex--) { c = chars[charIndex]; switch (c) { case '\\': charIndex++; add = chars[charIndex] === ')' || chars[charIndex] === '(' ? chars[charIndex] : "\\" + chars[charIndex]; for (pathIndex = startIndex; startIndex <= endIndex ? pathIndex < endIndex : pathIndex > endIndex; startIndex <= endIndex ? pathIndex++ : pathIndex--) { paths[pathIndex] += add; } break; case '(': for (pathIndex = startIndex; startIndex <= endIndex ? pathIndex < endIndex : pathIndex > endIndex; startIndex <= endIndex ? pathIndex++ : pathIndex--) { paths.push(paths[pathIndex]); } startIndex = endIndex; endIndex = paths.length; break; case ')': startIndex -= endIndex - startIndex; break; default: for (pathIndex = startIndex; startIndex <= endIndex ? pathIndex < endIndex : pathIndex > endIndex; startIndex <= endIndex ? pathIndex++ : pathIndex--) { paths[pathIndex] += c; } } } paths.reverse(); return paths; }; Sherpa.prototype.url = function(name, params) { var _ref; return (_ref = this.routes[name]) != null ? _ref.url(params) : void 0; }; Sherpa.prototype.addComplexPart = function(subparts, compiledPath, matchesWith, variableNames) { var captures, capturingIndicies, escapeRegexp, name, part, regexSubparts, regexp, spans, splittingIndicies, _ref; escapeRegexp = function(str) { return str.replace(/([\.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); }; _ref = [[], [], 0, false], capturingIndicies = _ref[0], splittingIndicies = _ref[1], captures = _ref[2], spans = _ref[3]; regexSubparts = (function() { var _i, _len, _results; _results = []; for (_i = 0, _len = subparts.length; _i < _len; _i++) { part = subparts[_i]; _results.push((function() { var _ref2; switch (part[0]) { case '\\': compiledPath.push("'" + part[1] + "'"); return escapeRegexp(part[1]); case ':': case '*': if (part[0] === '*') { spans = true; } captures += 1; name = part.slice(1, part.length); variableNames.push(name); if (part[0] === '*') { splittingIndicies.push(captures); compiledPath.push("params['" + name + "'].join('/')"); } else { capturingIndicies.push(captures); compiledPath.push("params['" + name + "']"); } if (spans) { if (matchesWith[name] != null) { return "((?:" + matchesWith[name].source + "\\/?)+)"; } else { return '(.*?)'; } } else { return "(" + (((_ref2 = matchesWith[name]) != null ? _ref2.source : void 0) || '[^/]*?') + ")"; } break; default: compiledPath.push("'" + part + "'"); return escapeRegexp(part); } })()); } return _results; })(); regexp = new RegExp("" + (regexSubparts.join('')) + "$"); if (spans) { return new SpanningRegexMatcher(regexp, capturingIndicies, splittingIndicies); } else { return new RegexMatcher(regexp, capturingIndicies, splittingIndicies); } }; Sherpa.prototype.addSimplePart = function(subparts, compiledPath, matchesWith, variableNames) { var part, variableName; part = subparts[0]; switch (part[0]) { case ':': variableName = part.slice(1, part.length); compiledPath.push("params['" + variableName + "']"); variableNames.push(variableName); if (matchesWith[variableName] != null) { return new SpanningRegexMatcher(matchesWith[variableName], [0], []); } else { return new Variable(); } break; case '*': compiledPath.push("params['" + variableName + "'].join('/')"); variableName = part.slice(1, part.length); variableNames.push(variableName); return new Glob(matchesWith[variableName]); default: compiledPath.push("'" + part + "'"); return new Lookup(part); } }; Sherpa.prototype.add = function(rawPath, opts) { var compiledPath, defaults, matchesWith, nextNodeFn, node, part, partiallyMatch, parts, path, pathSet, route, routeName, subparts, variableNames; matchesWith = (opts != null ? opts.matchesWith : void 0) || {}; defaults = (opts != null ? opts["default"] : void 0) || {}; routeName = opts != null ? opts.name : void 0; partiallyMatch = false; route = rawPath.exec != null ? new Route([this.root.add(new RegexPath(this.root, rawPath))]) : (rawPath.substring(rawPath.length - 1) === '*' ? (rawPath = rawPath.substring(0, rawPath.length - 1), partiallyMatch = true) : void 0, pathSet = (function() { var _i, _j, _len, _len2, _ref, _results; _ref = this.generatePaths(rawPath); _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { path = _ref[_i]; node = this.root; variableNames = []; parts = path.split('/'); compiledPath = []; for (_j = 0, _len2 = parts.length; _j < _len2; _j++) { part = parts[_j]; if (part !== '') { compiledPath.push("'/'"); subparts = this.findSubparts(part); nextNodeFn = subparts.length === 1 ? this.addSimplePart : this.addComplexPart; node = node.add(nextNodeFn(subparts, compiledPath, matchesWith, variableNames)); } } if ((opts != null ? opts.conditions : void 0) != null) { node = node.add(new RequestMatcher(opts.conditions)); } path = new Path(node, variableNames); path.partial = partiallyMatch; path.compiled = compiledPath.length === 0 ? "'/'" : compiledPath.join('+'); _results.push(path); } return _results; }).call(this), new Route(pathSet, matchesWith)); route["default"] = defaults; route.name = routeName; if (routeName != null) { this.routes[routeName] = route; } return route; }; Response = (function() { function Response(request, httpResponse, position) { this.request = request; this.httpResponse = httpResponse; this.position = position; this.position || (this.position = 0); } Response.prototype.next = function() { if (this.position === this.destinations.length - 1) { return false; } else { return new Response(this.request, this.httpResponse, this.position + 1).invoke(); } }; Response.prototype.invoke = function() { var req; req = typeof this.request.underlyingRequest === 'string' ? {} : this.request.underlyingRequest; req.params = this.request.destinations[this.position].params; req.route = this.request.destinations[this.position].route; req.pathInfo = this.request.destinations[this.position].pathInfo; return this.request.destinations[this.position].route.destination(req, this.httpResponse); }; return Response; })(); Node = (function() { function Node() { this.type || (this.type = 'node'); this.matchers = []; } Node.prototype.add = function(n) { var _ref; if (!((_ref = this.matchers[this.matchers.length - 1]) != null ? _ref.usable(n) : void 0)) { this.matchers.push(n); } return this.matchers[this.matchers.length - 1].use(n); }; Node.prototype.usable = function(n) { return n.type === this.type; }; Node.prototype.match = function(request) { var m, _i, _len, _ref, _results; _ref = this.matchers; _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { m = _ref[_i]; _results.push(m.match(request)); } return _results; }; Node.prototype.superMatch = Node.prototype.match; Node.prototype.use = function(n) { return this; }; return Node; })(); Lookup = (function() { __extends(Lookup, Node); function Lookup(part) { this.part = part; this.type = 'lookup'; this.map = {}; Lookup.__super__.constructor.apply(this, arguments); } Lookup.prototype.match = function(request) { var part; if (this.map[request.path[0]] != null) { request = request.clone(); part = request.path.shift(); return this.map[part].match(request); } }; Lookup.prototype.use = function(n) { var _base, _name; (_base = this.map)[_name = n.part] || (_base[_name] = new Node()); return this.map[n.part]; }; return Lookup; })(); Variable = (function() { __extends(Variable, Node); function Variable() { this.type || (this.type = 'variable'); Variable.__super__.constructor.apply(this, arguments); } Variable.prototype.match = function(request) { if (request.path.length > 0) { request = request.clone(); request.variables.push(request.path.shift()); return Variable.__super__.match.call(this, request); } }; return Variable; })(); Glob = (function() { __extends(Glob, Variable); function Glob(regexp) { this.regexp = regexp; this.type = 'glob'; Glob.__super__.constructor.apply(this, arguments); } Glob.prototype.match = function(request) { var cloned_path, i, match, original_request, _ref, _results; if (request.path.length > 0) { original_request = request; cloned_path = request.path.slice(0, request.path); _results = []; for (i = 1, _ref = original_request.path.length; 1 <= _ref ? i <= _ref : i >= _ref; 1 <= _ref ? i++ : i--) { request = original_request.clone(); if (this.regexp != null) { match = request.path[i - 1].match(this.regexp); } if ((this.regexp != null) && (!(match != null) || match[0].length !== request.path[i - 1].length)) { return; } request.variables.push(request.path.slice(0, i)); request.path = request.path.slice(i, request.path.length); _results.push(this.superMatch(request)); } return _results; } }; return Glob; })(); RegexMatcher = (function() { __extends(RegexMatcher, Node); function RegexMatcher(regexp, capturingIndicies, splittingIndicies) { var i, _i, _j, _len, _len2, _ref, _ref2; this.regexp = regexp; this.capturingIndicies = capturingIndicies; this.splittingIndicies = splittingIndicies; this.type || (this.type = 'regex'); this.varIndicies = []; _ref = this.splittingIndicies; for (_i = 0, _len = _ref.length; _i < _len; _i++) { i = _ref[_i]; this.varIndicies[i] = [i, 'split']; } _ref2 = this.capturingIndicies; for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { i = _ref2[_j]; this.varIndicies[i] = [i, 'capture']; } this.varIndicies.sort(function(a, b) { return a[0] - b[0]; }); RegexMatcher.__super__.constructor.apply(this, arguments); } RegexMatcher.prototype.match = function(request) { var match; if ((request.path[0] != null) && (match = request.path[0].match(this.regexp))) { if (match[0].length !== request.path[0].length) { return; } request = request.clone(); this.addVariables(request, match); request.path.shift(); return RegexMatcher.__super__.match.call(this, request); } }; RegexMatcher.prototype.addVariables = function(request, match) { var idx, type, v, _i, _len, _ref, _results; _ref = this.varIndicies; _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { v = _ref[_i]; if (v != null) { idx = v[0]; type = v[1]; _results.push((function() { switch (type) { case 'split': return request.variables.push(match[idx].split('/')); case 'capture': return request.variables.push(match[idx]); } })()); } } return _results; }; RegexMatcher.prototype.usable = function(n) { return n.type === this.type && n.regexp === this.regexp && n.capturingIndicies === this.capturingIndicies && n.splittingIndicies === this.splittingIndicies; }; return RegexMatcher; })(); SpanningRegexMatcher = (function() { __extends(SpanningRegexMatcher, RegexMatcher); function SpanningRegexMatcher(regexp, capturingIndicies, splittingIndicies) { this.regexp = regexp; this.capturingIndicies = capturingIndicies; this.splittingIndicies = splittingIndicies; this.type = 'spanning'; SpanningRegexMatcher.__super__.constructor.apply(this, arguments); } SpanningRegexMatcher.prototype.match = function(request) { var match, wholePath; if (request.path.length > 0) { wholePath = request.wholePath(); if (match = wholePath.match(this.regexp)) { if (match.index !== 0) { return; } request = request.clone(); this.addVariables(request, match); request.path = request.splitPath(wholePath.slice(match.index + match[0].length, wholePath.length)); return this.superMatch(request); } } }; return SpanningRegexMatcher; })(); RequestMatcher = (function() { __extends(RequestMatcher, Node); function RequestMatcher(conditions) { this.conditions = conditions; this.type = 'request'; RequestMatcher.__super__.constructor.apply(this, arguments); } RequestMatcher.prototype.match = function(request) { var conditionCount, matcher, matching, satisfiedConditionCount, type, v, val, _ref; conditionCount = 0; satisfiedConditionCount = 0; _ref = this.conditions; for (type in _ref) { matcher = _ref[type]; val = request.underlyingRequest[type]; conditionCount++; v = matcher instanceof Array ? (matching = function() { var cond, _i, _len; for (_i = 0, _len = matcher.length; _i < _len; _i++) { cond = matcher[_i]; if (cond.exec != null) { if (matcher.exec(val)) { return true; } } else { if (cond === val) { return true; } } } return false; }, matching()) : matcher.exec != null ? matcher.exec(val) : matcher === val; if (v) { satisfiedConditionCount++; } } if (conditionCount === satisfiedConditionCount) { return RequestMatcher.__super__.match.call(this, request); } }; RequestMatcher.prototype.usable = function(n) { return n.type === this.type && n.conditions === this.conditions; }; return RequestMatcher; })(); Path = (function() { __extends(Path, Node); function Path(parent, variableNames) { this.parent = parent; this.variableNames = variableNames; this.type = 'path'; this.partial = false; } Path.prototype.addDestination = function(request) { return request.destinations.push({ route: this.route, request: request, params: this.constructParams(request) }); }; Path.prototype.match = function(request) { if (this.partial || request.path.length === 0) { this.addDestination(request); if (this.partial) { return request.destinations[request.destinations.length - 1].pathInfo = "/" + (request.wholePath()); } } }; Path.prototype.constructParams = function(request) { var i, params, _ref; params = {}; for (i = 0, _ref = this.variableNames.length; 0 <= _ref ? i < _ref : i > _ref; 0 <= _ref ? i++ : i--) { params[this.variableNames[i]] = request.variables[i]; } return params; }; Path.prototype.url = function(rawParams) { var key, match, name, params, path, _i, _j, _k, _len, _len2, _len3, _ref, _ref2, _ref3; if (rawParams == null) { rawParams = {}; } params = {}; _ref = this.variableNames; for (_i = 0, _len = _ref.length; _i < _len; _i++) { key = _ref[_i]; params[key] = this.route["default"] != null ? rawParams[key] || this.route["default"][key] : rawParams[key]; if (!(params[key] != null)) { return; } } _ref2 = this.variableNames; for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { name = _ref2[_j]; if (this.route.matchesWith[name] != null) { match = params[name].match(this.route.matchesWith[name]); if (!((match != null) && match[0].length === params[name].length)) { return; } } } path = this.compiled === '' ? '' : eval(this.compiled); if (path != null) { _ref3 = this.variableNames; for (_k = 0, _len3 = _ref3.length; _k < _len3; _k++) { name = _ref3[_k]; delete rawParams[name]; } return path; } }; return Path; })(); RegexPath = (function() { __extends(RegexPath, Path); function RegexPath(parent, regexp) { this.parent = parent; this.regexp = regexp; this.type = 'regexp_route'; RegexPath.__super__.constructor.apply(this, arguments); } RegexPath.prototype.match = function(request) { request.regexpRouteMatch = this.regexp.exec(request.decodedPath()); if ((request.regexpRouteMatch != null) && request.regexpRouteMatch[0].length === request.decodedPath().length) { request = request.clone(); request.path = []; return RegexPath.__super__.match.call(this, request); } }; RegexPath.prototype.constructParams = function(request) { return request.regexpRouteMatch; }; RegexPath.prototype.url = function(rawParams) { throw "This route cannot be generated"; }; return RegexPath; })(); Route = (function() { function Route(pathSet, matchesWith) { var path, _i, _len, _ref; this.pathSet = pathSet; this.matchesWith = matchesWith; _ref = this.pathSet; for (_i = 0, _len = _ref.length; _i < _len; _i++) { path = _ref[_i]; path.route = this; } } Route.prototype.to = function(destination) { var path, _i, _len, _ref, _results; this.destination = destination; _ref = this.pathSet; _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { path = _ref[_i]; _results.push(path.parent.add(path)); } return _results; }; Route.prototype.generateQuery = function(params, base, query) { var idx, k, v, _ref; query = ""; base || (base = ""); if (params != null) { if (params instanceof Array) { for (idx = 0, _ref = params.length; 0 <= _ref ? idx < _ref : idx > _ref; 0 <= _ref ? idx++ : idx--) { query += this.generateQuery(params[idx], "" + base + "[]"); } } else if (params instanceof Object) { for (k in params) { v = params[k]; query += this.generateQuery(v, base === '' ? k : "" + base + "[" + k + "]"); } } else { query += encodeURIComponent(base).replace(/%20/g, '+'); query += '='; query += encodeURIComponent(params).replace(/%20/g, '+'); query += '&'; } } return query; }; Route.prototype.url = function(params) { var joiner, path, pathObj, query, _i, _len, _ref; path = void 0; _ref = this.pathSet; for (_i = 0, _len = _ref.length; _i < _len; _i++) { pathObj = _ref[_i]; path = pathObj.url(params); if (path != null) { break; } } if (path != null) { query = this.generateQuery(params); joiner = query !== '' ? '?' : ''; return "" + (encodeURI(path)) + joiner + (query.substr(0, query.length - 1)); } else { return; } }; return Route; })(); Request = (function() { function Request(underlyingRequest, callback) { this.underlyingRequest = underlyingRequest; this.callback = callback; this.variables = []; this.destinations = []; if (this.underlyingRequest != null) { this.path = this.splitPath(); } } Request.prototype.toString = function() { return "<Request path: /" + (this.path.join('/')) + " " + this.path.length + ">"; }; Request.prototype.wholePath = function() { return this.path.join('/'); }; Request.prototype.decodedPath = function(path) { if (path == null) { path = require('url').parse(this.underlyingRequest.url).pathname; } return decodeURI(path); }; Request.prototype.splitPath = function(path) { var decodedPath, splitPath; decodedPath = this.decodedPath(path); splitPath = decodedPath === '/' ? [] : decodedPath.split('/'); if (splitPath[0] === '') { splitPath.shift(); } return splitPath; }; Request.prototype.clone = function() { var c; c = new Request(); c.path = this.path.slice(0, this.path.length); c.variables = this.variables.slice(0, this.variables.length); c.underlyingRequest = this.underlyingRequest; c.callback = this.callback; c.destinations = this.destinations; return c; }; return Request; })(); PathRequest = (function() { __extends(PathRequest, Request); function PathRequest() { PathRequest.__super__.constructor.apply(this, arguments); } PathRequest.prototype.decodedPath = function(path) { if (path == null) { path = this.underlyingRequest; } return decodeURI(path); }; return PathRequest; })(); return Sherpa; })(); }).call(this);
var fs = require('fs'); var path = require('path'); var gulp = require('gulp'); var plugins = require('gulp-load-plugins')(); // Load all gulp plugins // automatically and attach // them to the `plugins` object var runSequence = require('run-sequence'); // Temporary solution until gulp 4 // https://github.com/gulpjs/gulp/issues/355 var pkg = require('./package.json'); var dirs = pkg['h5bp-configs'].directories; // --------------------------------------------------------------------- // | Helper tasks | // --------------------------------------------------------------------- gulp.task('archive:create_archive_dir', function () { fs.mkdirSync(path.resolve(dirs.archive), '0755'); }); gulp.task('archive:zip', function (done) { var archiveName = path.resolve(dirs.archive, pkg.name + '_v' + pkg.version + '.zip'); var archiver = require('archiver')('zip'); var files = require('glob').sync('**/*.*', { 'cwd': dirs.dist, 'dot': true // include hidden files }); var output = fs.createWriteStream(archiveName); archiver.on('error', function (error) { done(); throw error; }); output.on('close', done); files.forEach(function (file) { var filePath = path.resolve(dirs.dist, file); // `archiver.bulk` does not maintain the file // permissions, so we need to add files individually archiver.append(fs.createReadStream(filePath), { 'name': file, 'mode': fs.statSync(filePath) }); }); archiver.pipe(output); archiver.finalize(); }); gulp.task('clean', function (done) { require('del')([ dirs.archive, dirs.dist ], done); }); gulp.task('copy', [ 'copy:.htaccess', 'copy:index.html', 'copy:jquery', 'copy:license', 'copy:main.css', 'copy:misc', 'copy:normalize' ]); gulp.task('copy:.htaccess', function () { return gulp.src('node_modules/apache-server-configs/dist/.htaccess') .pipe(plugins.replace(/# ErrorDocument/g, 'ErrorDocument')) .pipe(gulp.dest(dirs.dist)); }); gulp.task('copy:index.html', function () { return gulp.src(dirs.src + '/index.html') .pipe(plugins.replace(/{{JQUERY_VERSION}}/g, pkg.devDependencies.jquery)) .pipe(gulp.dest(dirs.dist)); }); gulp.task('copy:jquery', function () { return gulp.src(['node_modules/jquery/dist/jquery.min.js']) .pipe(plugins.rename('jquery-' + pkg.devDependencies.jquery + '.min.js')) .pipe(gulp.dest(dirs.dist + '/js/vendor')); }); gulp.task('copy:license', function () { return gulp.src('LICENSE.txt') .pipe(gulp.dest(dirs.dist)); }); gulp.task('copy:main.css', function () { var banner = '/*! HTML5 Boilerplate v' + pkg.version + ' | ' + pkg.license.type + ' License' + ' | ' + pkg.homepage + ' */\n\n'; return gulp.src(dirs.src + '/css/main.css') .pipe(plugins.header(banner)) .pipe(plugins.autoprefixer({ browsers: ['last 2 versions', 'ie >= 8', '> 1%'], cascade: false })) .pipe(gulp.dest(dirs.dist + '/css')); }); gulp.task('copy:misc', function () { return gulp.src([ // Copy all files dirs.src + '/**/*', // Exclude the following files // (other tasks will handle the copying of these files) '!' + dirs.src + '/css/main.css', '!' + dirs.src + '/index.html' ], { // Include hidden files by default dot: true }).pipe(gulp.dest(dirs.dist)); }); gulp.task('copy:normalize', function () { return gulp.src('node_modules/normalize.css/normalize.css') .pipe(gulp.dest(dirs.dist + '/css')); }); gulp.task('lint:js', function () { return gulp.src([ 'gulpfile.js', dirs.src + '/js/*.js', dirs.test + '/*.js' ]).pipe(plugins.jscs()) .pipe(plugins.jshint()) .pipe(plugins.jshint.reporter('jshint-stylish')) .pipe(plugins.jshint.reporter('fail')); }); // --------------------------------------------------------------------- // | Main tasks | // --------------------------------------------------------------------- gulp.task('archive', function (done) { runSequence( 'build', 'archive:create_archive_dir', 'archive:zip', done); }); gulp.task('build', function (done) { runSequence( ['clean', 'lint:js'], 'copy', done); }); gulp.task('default', ['build']); gulp.task('autoprefixer', function () { var postcss = require('gulp-postcss'); var autoprefixer = require('autoprefixer'); return gulp.src('./src/css/*.css') .pipe(postcss([ autoprefixer({ browsers: ['last 2 versions'] }) ])) .pipe(gulp.dest('./dest')); });
(function () { ko.bindingHandlers = {}; ko.bindingContext = function(dataItem, parentBindingContext, dataItemAlias) { if (parentBindingContext) { ko.utils.extend(this, parentBindingContext); // Inherit $root and any custom properties this['$parentContext'] = parentBindingContext; this['$parent'] = parentBindingContext['$data']; this['$parents'] = (parentBindingContext['$parents'] || []).slice(0); this['$parents'].unshift(this['$parent']); } else { this['$parents'] = []; this['$root'] = dataItem; // Export 'ko' in the binding context so it will be available in bindings and templates // even if 'ko' isn't exported as a global, such as when using an AMD loader. // See https://github.com/SteveSanderson/knockout/issues/490 this['ko'] = ko; } this['$data'] = dataItem; if (dataItemAlias) this[dataItemAlias] = dataItem; } ko.bindingContext.prototype['createChildContext'] = function (dataItem, dataItemAlias) { return new ko.bindingContext(dataItem, this, dataItemAlias); }; ko.bindingContext.prototype['extend'] = function(properties) { var clone = ko.utils.extend(new ko.bindingContext(), this); return ko.utils.extend(clone, properties); }; function validateThatBindingIsAllowedForVirtualElements(bindingName) { var validator = ko.virtualElements.allowedBindings[bindingName]; if (!validator) throw new Error("The binding '" + bindingName + "' cannot be used with virtual elements") } function applyBindingsToDescendantsInternal (viewModel, elementOrVirtualElement, bindingContextsMayDifferFromDomParentElement) { var currentChild, nextInQueue = ko.virtualElements.firstChild(elementOrVirtualElement); while (currentChild = nextInQueue) { // Keep a record of the next child *before* applying bindings, in case the binding removes the current child from its position nextInQueue = ko.virtualElements.nextSibling(currentChild); applyBindingsToNodeAndDescendantsInternal(viewModel, currentChild, bindingContextsMayDifferFromDomParentElement); } } function applyBindingsToNodeAndDescendantsInternal (viewModel, nodeVerified, bindingContextMayDifferFromDomParentElement) { var shouldBindDescendants = true; // Perf optimisation: Apply bindings only if... // (1) We need to store the binding context on this node (because it may differ from the DOM parent node's binding context) // Note that we can't store binding contexts on non-elements (e.g., text nodes), as IE doesn't allow expando properties for those // (2) It might have bindings (e.g., it has a data-bind attribute, or it's a marker for a containerless template) var isElement = (nodeVerified.nodeType === 1); if (isElement) // Workaround IE <= 8 HTML parsing weirdness ko.virtualElements.normaliseVirtualElementDomStructure(nodeVerified); var shouldApplyBindings = (isElement && bindingContextMayDifferFromDomParentElement) // Case (1) || ko.bindingProvider['instance']['nodeHasBindings'](nodeVerified); // Case (2) if (shouldApplyBindings) shouldBindDescendants = applyBindingsToNodeInternal(nodeVerified, null, viewModel, bindingContextMayDifferFromDomParentElement).shouldBindDescendants; if (shouldBindDescendants) { // We're recursing automatically into (real or virtual) child nodes without changing binding contexts. So, // * For children of a *real* element, the binding context is certainly the same as on their DOM .parentNode, // hence bindingContextsMayDifferFromDomParentElement is false // * For children of a *virtual* element, we can't be sure. Evaluating .parentNode on those children may // skip over any number of intermediate virtual elements, any of which might define a custom binding context, // hence bindingContextsMayDifferFromDomParentElement is true applyBindingsToDescendantsInternal(viewModel, nodeVerified, /* bindingContextsMayDifferFromDomParentElement: */ !isElement); } } var boundElementDomDataKey = '__ko_boundElement'; function applyBindingsToNodeInternal (node, bindings, viewModelOrBindingContext, bindingContextMayDifferFromDomParentElement) { // Need to be sure that inits are only run once, and updates never run until all the inits have been run var initPhase = 0; // 0 = before all inits, 1 = during inits, 2 = after all inits // Each time the dependentObservable is evaluated (after data changes), // the binding attribute is reparsed so that it can pick out the correct // model properties in the context of the changed data. // DOM event callbacks need to be able to access this changed data, // so we need a single parsedBindings variable (shared by all callbacks // associated with this node's bindings) that all the closures can access. var parsedBindings; function makeValueAccessor(bindingKey) { return function () { return parsedBindings[bindingKey] } } function parsedBindingsAccessor() { return parsedBindings; } var bindingHandlerThatControlsDescendantBindings; // Prevent multiple applyBindings calls for the same node, except when a binding value is specified var alreadyBound = ko.utils.domData.get(node, boundElementDomDataKey); if (!bindings) { if (alreadyBound) { throw Error("You cannot apply bindings multiple times to the same element."); } ko.utils.domData.set(node, boundElementDomDataKey, true); } ko.dependentObservable( function () { // Ensure we have a nonnull binding context to work with var bindingContextInstance = viewModelOrBindingContext && (viewModelOrBindingContext instanceof ko.bindingContext) ? viewModelOrBindingContext : new ko.bindingContext(ko.utils.unwrapObservable(viewModelOrBindingContext)); var viewModel = bindingContextInstance['$data']; // Optimization: Don't store the binding context on this node if it's definitely the same as on node.parentNode, because // we can easily recover it just by scanning up the node's ancestors in the DOM // (note: here, parent node means "real DOM parent" not "virtual parent", as there's no O(1) way to find the virtual parent) if (!alreadyBound && bindingContextMayDifferFromDomParentElement) ko.storedBindingContextForNode(node, bindingContextInstance); // Use evaluatedBindings if given, otherwise fall back on asking the bindings provider to give us some bindings var evaluatedBindings = (typeof bindings == "function") ? bindings(bindingContextInstance, node) : bindings; parsedBindings = evaluatedBindings || ko.bindingProvider['instance']['getBindings'](node, bindingContextInstance); if (parsedBindings) { // First run all the inits, so bindings can register for notification on changes if (initPhase === 0) { initPhase = 1; ko.utils.objectForEach(parsedBindings, function(bindingKey) { var binding = ko.bindingHandlers[bindingKey]; if (binding && node.nodeType === 8) validateThatBindingIsAllowedForVirtualElements(bindingKey); if (binding && typeof binding["init"] == "function") { var handlerInitFn = binding["init"]; var initResult = handlerInitFn(node, makeValueAccessor(bindingKey), parsedBindingsAccessor, viewModel, bindingContextInstance); // If this binding handler claims to control descendant bindings, make a note of this if (initResult && initResult['controlsDescendantBindings']) { if (bindingHandlerThatControlsDescendantBindings !== undefined) throw new Error("Multiple bindings (" + bindingHandlerThatControlsDescendantBindings + " and " + bindingKey + ") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element."); bindingHandlerThatControlsDescendantBindings = bindingKey; } } }); initPhase = 2; } // ... then run all the updates, which might trigger changes even on the first evaluation if (initPhase === 2) { ko.utils.objectForEach(parsedBindings, function(bindingKey) { var binding = ko.bindingHandlers[bindingKey]; if (binding && typeof binding["update"] == "function") { var handlerUpdateFn = binding["update"]; handlerUpdateFn(node, makeValueAccessor(bindingKey), parsedBindingsAccessor, viewModel, bindingContextInstance); } }); } } }, null, { disposeWhenNodeIsRemoved : node } ); return { shouldBindDescendants: bindingHandlerThatControlsDescendantBindings === undefined }; }; var storedBindingContextDomDataKey = "__ko_bindingContext__"; ko.storedBindingContextForNode = function (node, bindingContext) { if (arguments.length == 2) ko.utils.domData.set(node, storedBindingContextDomDataKey, bindingContext); else return ko.utils.domData.get(node, storedBindingContextDomDataKey); } ko.applyBindingsToNode = function (node, bindings, viewModel) { if (node.nodeType === 1) // If it's an element, workaround IE <= 8 HTML parsing weirdness ko.virtualElements.normaliseVirtualElementDomStructure(node); return applyBindingsToNodeInternal(node, bindings, viewModel, true); }; ko.applyBindingsToDescendants = function(viewModel, rootNode) { if (rootNode.nodeType === 1 || rootNode.nodeType === 8) applyBindingsToDescendantsInternal(viewModel, rootNode, true); }; ko.applyBindings = function (viewModel, rootNode) { if (rootNode && (rootNode.nodeType !== 1) && (rootNode.nodeType !== 8)) throw new Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node"); rootNode = rootNode || window.document.body; // Make "rootNode" parameter optional applyBindingsToNodeAndDescendantsInternal(viewModel, rootNode, true); }; // Retrieving binding context from arbitrary nodes ko.contextFor = function(node) { // We can only do something meaningful for elements and comment nodes (in particular, not text nodes, as IE can't store domdata for them) switch (node.nodeType) { case 1: case 8: var context = ko.storedBindingContextForNode(node); if (context) return context; if (node.parentNode) return ko.contextFor(node.parentNode); break; } return undefined; }; ko.dataFor = function(node) { var context = ko.contextFor(node); return context ? context['$data'] : undefined; }; ko.exportSymbol('bindingHandlers', ko.bindingHandlers); ko.exportSymbol('applyBindings', ko.applyBindings); ko.exportSymbol('applyBindingsToDescendants', ko.applyBindingsToDescendants); ko.exportSymbol('applyBindingsToNode', ko.applyBindingsToNode); ko.exportSymbol('contextFor', ko.contextFor); ko.exportSymbol('dataFor', ko.dataFor); })();
module.exports = function(config) { config.set({ // base path, that will be used to resolve files and exclude basePath: 'src/main/javascript/app', frameworks: ['jasmine'], files: [ 'lib/lodash/dist/lodash.js', 'lib/angular/angular.js', 'lib/angular-resource/angular-resource.js', 'lib/restangular/dist/restangular.js' ], // list of files / patterns to exclude exclude: [], plugins: [ 'karma-jasmine', 'karma-coverage', 'karma-chrome-launcher', 'karma-phantomjs-launcher' ], // test results reporter to use // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' reporters: ['progress', 'coverage'], // level of logging // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG logLevel: config.LOG_INFO, // enable / disable watching file and executing tests whenever any file changes autoWatch: false, // Start these browsers, currently available: // - Chrome // - ChromeCanary // - Firefox // - Opera // - Safari (only Mac) // - PhantomJS // - IE (only Windows) browsers: ['PhantomJS'], // Continuous Integration mode // if true, it capture browsers, run tests and exit singleRun: false, // Coverage reporter generates the coverage coverageReporter: { reporters: [ { type: 'lcov', dir: 'build/coverage/' }, { type: 'text-summary', dir: 'build/coverage/' } ] } }); };
/* pO\ 6 /\ /OO\ /OOOO\ /OOOOOOOO\ ((OOOOOOOO)) \:~=++=~:/ ChocolateChip-UI ChUI.js Copyright 2014 Sourcebits www.sourcebits.com License: MIT Version: 3.5.2 */ (function($) { 'use strict'; $.extend({ /////////////// // Create Uuid: /////////////// Uuid : function() { return Date.now().toString(36); }, /////////////////////////// // Concat array of strings: /////////////////////////// concat : function ( args ) { return (args instanceof Array) ? args.join('') : [].slice.apply(arguments).join(''); }, //////////////////////////// // Version of each that uses // regular paramater order: //////////////////////////// forEach : function ( obj, callback, args ) { function isArraylike( obj ) { var length = obj.length, type = jQuery.type( obj ); if ( type === "function" || jQuery.isWindow( obj ) ) { return false; } if ( obj.nodeType === 1 && length ) { return true; } return type === "array" || length === 0 || typeof length === "number" && length > 0 && ( length - 1 ) in obj; } var value, i = 0, length = obj.length, isArray = isArraylike( obj ); if ( args ) { if ( isArray ) { for ( ; i < length; i++ ) { value = callback.apply( obj[ i ], args ); if ( value === false ) { break; } } } else { for ( i in obj ) { value = callback.apply( obj[ i ], args ); if ( value === false ) { break; } } } // A special, fast, case for the most common use of each } else { if ( isArray ) { for ( ; i < length; i++ ) { value = callback.call( obj[ i ], obj[ i ], i ); if ( value === false ) { break; } } } else { for ( i in obj ) { value = callback.call( obj[ i ], obj[ i ], i ); if ( value === false ) { break; } } } } } }); $.fn.extend({ ////////////////////// // Return element that // matches selector: ////////////////////// iz : function ( selector ) { var ret = $(); this.forEach(function(ctx) { if ($(ctx).is(selector)) { ret.push(ctx); } }); return ret; }, ////////////////////////////// // Return element that doesn't // match selector: ////////////////////////////// iznt : function ( selector ) { return this.not(selector); }, /////////////////////////////////// // Return element whose descendants // match selector: /////////////////////////////////// haz : function ( selector ) { return this.has(selector); }, /////////////////////////////////// // Return element whose descendants // don't match selector: /////////////////////////////////// haznt : function ( selector ) { var ret = $(); this.forEach(function(ctx) { if (!$(ctx).has(selector)[0]) { ret.push(ctx); } }); return ret; }, ////////////////////////////////////// // Return element that has class name: ////////////////////////////////////// hazClass : function ( className ) { var ret = $(); this.forEach(function(ctx) { if ($(ctx).hasClass(className)) { ret.push(ctx); } }); return ret; }, ////////////////////////////// // Return element that doesn't // have class name: ////////////////////////////// hazntClass : function ( className ) { var ret = $(); this.forEach(function(ctx) { if (!$(ctx).hasClass(className)) { ret.push(ctx); } }); return ret; }, ///////////////////////////////////// // Return element that has attribute: ///////////////////////////////////// hazAttr : function ( property ) { var ret = $(); this.forEach(function(ctx){ if ($(ctx).attr(property)) { ret.push(ctx); } }); return ret; }, ////////////////////////// // Return element that // doesn't have attribute: ////////////////////////// hazntAttr : function ( property ) { var ret = $(); this.forEach(function(ctx){ if (!$(ctx).attr(property)) { ret.push(ctx); } }); return ret; }, //////////////////////////// // Version of each that uses // regular paramater order: //////////////////////////// forEach : function ( callback, args ) { return $.forEach( this, callback, args ); } }); $.extend({ eventStart : null, eventEnd : null, eventMove : null, eventCancel : null, // Define min-length for gesture detection: gestureLength : 30 }); $(function() { ////////////////////////// // Setup Event Variables: ////////////////////////// // Pointer events for IE10 and WP8: if (window.navigator.pointerEnabled) { $.eventStart = 'pointerdown'; $.eventEnd = 'pointerup'; $.eventMove = 'pointermove'; $.eventCancel = 'pointercancel'; // Pointer events for IE10 and WP8: } else if (window.navigator.msPointerEnabled) { $.eventStart = 'MSPointerDown'; $.eventEnd = 'MSPointerUp'; $.eventMove = 'MSPointerMove'; $.eventCancel = 'MSPointerCancel'; // Touch events for iOS & Android: } else if ('ontouchstart' in window) { $.eventStart = 'touchstart'; $.eventEnd = 'touchend'; $.eventMove = 'touchmove'; $.eventCancel = 'touchcancel'; // Mouse events for desktop: } else { $.eventStart = 'mousedown'; $.eventEnd = 'click'; $.eventMove = 'mousemove'; $.eventCancel = 'mouseout'; } }); $.extend({ isiPhone : /iphone/img.test(navigator.userAgent), isiPad : /ipad/img.test(navigator.userAgent), isiPod : /ipod/img.test(navigator.userAgent), isiOS : /ip(hone|od|ad)/img.test(navigator.userAgent), isAndroid : (/android/img.test(navigator.userAgent) && !/trident/img.test(navigator.userAgent)), isWebOS : /webos/img.test(navigator.userAgent), isBlackberry : /blackberry/img.test(navigator.userAgent), isTouchEnabled : ('createTouch' in document), isOnline : navigator.onLine, isStandalone : navigator.standalone, isiOS6 : navigator.userAgent.match(/OS 6/i), isiOS7 : navigator.userAgent.match(/OS 7/i), isWin : /trident/img.test(navigator.userAgent), isWinPhone : (/trident/img.test(navigator.userAgent) && /mobile/img.test(navigator.userAgent)), isIE10 : navigator.userAgent.match(/msie 10/i), isIE11 : navigator.userAgent.match(/msie 11/i), isWebkit : navigator.userAgent.match(/webkit/), isMobile : /mobile/img.test(navigator.userAgent), isDesktop : !(/mobile/img.test(navigator.userAgent)), isSafari : (!/Chrome/img.test(navigator.userAgent) && /Safari/img.test(navigator.userAgent) && !/android/img.test(navigator.userAgent)), isChrome : /Chrome/img.test(navigator.userAgent), isNativeAndroid : (/android/i.test(navigator.userAgent) && /webkit/i.test(navigator.userAgent) && !/chrome/i.test(navigator.userAgent)) }); ////////////////////////////////////////////////////// // Swipe Gestures for ChocolateChip-UI. // Includes mouse gestures for desktop compatibility. ////////////////////////////////////////////////////// var touch = {}; var touchTimeout; var swipeTimeout; var tapTimeout; var longTapDelay = 750; var singleTapDelay = 150; var longTapTimeout; function parentIfText(node) { return 'tagName' in node ? node : node.parentNode; } function swipeDirection(x1, x2, y1, y2) { return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'left' : 'right') : (y1 - y2 > 0 ? 'up' : 'down'); } function longTap() { longTapTimeout = null; if (touch.last) { try { if (touch && touch.el) { touch.el.trigger('longtap'); touch = {}; } } catch(err) { } } } function cancelLongTap() { if (longTapTimeout) clearTimeout(longTapTimeout); longTapTimeout = null; } function cancelAll() { if (touchTimeout) clearTimeout(touchTimeout); if (tapTimeout) clearTimeout(tapTimeout); if (swipeTimeout) clearTimeout(swipeTimeout); if (longTapTimeout) clearTimeout(longTapTimeout); touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null; touch = {}; } $(function(){ var now; var delta; var body = $(document.body); var twoTouches = false; body.on($.eventStart, function(e) { now = Date.now(); delta = now - (touch.last || now); if (e.originalEvent) e = e.originalEvent; // Handle MSPointer Events: if (window.navigator.msPointerEnabled || window.navigator.pointerEnabled) { if (window && window.jQuery && $ === window.jQuery) { if (e.originalEvent && !e.originalEvent.isPrimary) return; } else { if (!e.isPrimary) return; } e = e.originalEvent ? e.originalEvent : e; body.on('MSHoldVisual', function (e) { e.preventDefault(); }); touch.el = $(parentIfText(e.target)); touchTimeout && clearTimeout(touchTimeout); touch.x1 = e.pageX; touch.y1 = e.pageY; twoTouches = false; } else { if ($.eventStart === 'mousedown') { touch.el = $(parentIfText(e.target)); touchTimeout && clearTimeout(touchTimeout); touch.x1 = e.pageX; touch.y1 = e.pageY; twoTouches = false; } else { // User to detect two or more finger gestures: if (e.touches.length === 1) { touch.el = $(parentIfText(e.touches[0].target)); touchTimeout && clearTimeout(touchTimeout); touch.x1 = e.touches[0].pageX; touch.y1 = e.touches[0].pageY; if (e.targetTouches.length === 2) { twoTouches = true; } else { twoTouches = false; } } } } if (delta > 0 && delta <= 250) { touch.isDoubleTap = true; } touch.last = now; longTapTimeout = setTimeout(longTap, longTapDelay); }); body.on($.eventMove, function(e) { if (e.originalEvent) e = e.originalEvent; if (window.navigator.msPointerEnabled) { if (window && window.jQuery && $ === window.jQuery) { if (e.originalEvent && !e.originalEvent.isPrimary) return; } else { if (!e.isPrimary) return; } e = e.originalEvent ? e.originalEvent : e; cancelLongTap(); touch.x2 = e.pageX; touch.y2 = e.pageY; } else { cancelLongTap(); if ($.eventMove === 'mousemove') { touch.x2 = e.pageX; touch.y2 = e.pageY; } else { // One finger gesture: if (e.touches.length === 1) { touch.x2 = e.touches[0].pageX; touch.y2 = e.touches[0].pageY; } } } if ($.isAndroid) { $.gestureLength = 10; if (!!touch.el) { // Swipe detection: if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > $.gestureLength) || (touch.y2 && Math.abs(touch.y1 - touch.y2) > $.gestureLength)) { swipeTimeout = setTimeout(function() { e.preventDefault(); if (touch && touch.el) { touch.el.trigger('swipe'); touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2))); touch = {}; } }, 0); // Normal tap: } else if ('last' in touch) { // Delay by one tick so we can cancel the 'tap' event if 'scroll' fires: tapTimeout = setTimeout(function() { // Trigger universal 'tap' with the option to cancelTouch(): if (touch && touch.el) { touch.el.trigger('tap'); } // Trigger double tap immediately: if (touch && touch.isDoubleTap) { if (touch && touch.el) { touch.el.trigger('doubletap'); touch = {}; } } else { // Trigger single tap after singleTapDelay: touchTimeout = setTimeout(function(){ touchTimeout = null; if (touch && touch.el) { touch.el.trigger('singletap'); touch = {}; return false; } }, singleTapDelay); } }, 0); } } else { return; } } }); body.on($.eventEnd, function(e) { if (window.navigator.msPointerEnabled) { if (window && window.jQuery && $ === window.jQuery) { if (e.originalEvent && !e.originalEvent.isPrimary) return; } else { if (!e.isPrimary) return; } } cancelLongTap(); if (!!touch.el) { // Swipe detection: if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > $.gestureLength) || (touch.y2 && Math.abs(touch.y1 - touch.y2) > $.gestureLength)) { swipeTimeout = setTimeout(function() { if (touch && touch.el) { touch.el.trigger('swipe'); touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2))); touch = {}; } }, 0); // Normal tap: } else if ('last' in touch) { // Delay by one tick so we can cancel the 'tap' event if 'scroll' fires: tapTimeout = setTimeout(function() { // Trigger universal 'tap' with the option to cancelTouch(): if (touch && touch.el) { touch.el.trigger('tap'); } // Trigger double tap immediately: if (touch && touch.isDoubleTap) { if (touch && touch.el) { touch.el.trigger('doubletap'); touch = {}; } } else { // Trigger single tap after singleTapDelay: touchTimeout = setTimeout(function(){ touchTimeout = null; if (touch && touch.el) { touch.el.trigger('singletap'); touch = {}; return false; } }, singleTapDelay); } }, 0); } } else { return; } }); body.on('touchcancel', cancelAll); }); ['swipe', 'swipeleft', 'swiperight', 'swipeup', 'swipedown', 'doubletap', 'tap', 'singletap', 'longtap'].forEach(function(method){ // Add gesture events to ChocolateChipJS: $.fn.extend({ method : function(callback){ return this.on(method, callback); } }); }); ///////////////////////////////////////// // Set classes for desktop compatibility: ///////////////////////////////////////// $.extend({ UIDesktopCompat : function ( ) { if ($.isDesktop && $.isSafari) { $('body').addClass('isiOS').addClass('isDesktopSafari'); } else if ($.isDesktop && $.isChrome) { $('body').addClass('isAndroid').addClass('isDesktopChrome'); } } }); //////////////////////////////// // Determine browser version: //////////////////////////////// $.extend({ browserVersion : function ( ) { var n = navigator.appName; var ua = navigator.userAgent; var temp; var m = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i); if (m && (temp = ua.match(/version\/([\.\d]+)/i))!== null) m[2]= temp[1]; m = m ? [m[1], m[2]]: [n, navigator.appVersion, '-?']; return m[1]; } }); $(function() { //////////////////////////////// // Added classes for client side // os-specific styles: //////////////////////////////// $.body = $('body'); if ($.isWin) { $.body.addClass('isWindows'); } else if ($.isiOS) { $.body.addClass('isiOS'); } else if ($.isAndroid) { $.body.addClass('isAndroid'); } if ($.isSafari && parseInt($.browserVersion(), 10) === 6) { $.body.addClass('isSafari6'); } $.UIDesktopCompat(); }); $(function() { $.body = $('body'); ////////////////////// // Add the global nav: ////////////////////// if (!$.body[0].classList.contains('splitlayout')) { $('body').prepend("<nav id='global-nav'></nav>"); } ///////////////////////////////////////////////// // Fix Split Layout to display properly on phone: ///////////////////////////////////////////////// if ($.body[0].classList.contains('splitlayout')) { if (window.innerWidth < 768) { $('meta[name=viewport]').attr('content','width=device-width, initial-scale=0.45, maximum-scale=2, user-scalable=yes'); } } ///////////////////////////////////////////////////////// // Add class to nav when button on right. // This allows us to adjust the nav h1 for small screens. ///////////////////////////////////////////////////////// $('h1').each(function(idx, ctx) { if (ctx.nextElementSibling && ctx.nextElementSibling.nodeName === 'A') { ctx.classList.add('buttonOnRight'); } }); ////////////////////////////////////////// // Get any toolbars and adjust the bottom // of their corresponding articles: ////////////////////////////////////////// $('.toolbar').prev('article').addClass('has-toolbar'); }); $.extend({ subscriptions : {}, // Topic: string defining topic: /some/topic // Data: a string, number, array or object. subscribe : function (topic, callback) { if (!$.subscriptions[topic]) { $.subscriptions[topic] = []; } var token = ($.Uuid()); $.subscriptions[topic].push({ token: token, callback: callback }); return token; }, unsubscribe : function ( token ) { setTimeout(function() { for (var m in $.subscriptions) { if ($.subscriptions[m]) { for (var i = 0, len = $.subscriptions[m].length; i < len; i++) { if ($.subscriptions[m][i].token === token) { $.subscriptions[m].splice(i, 1); return token; } } } } return false; }); }, publish : function ( topic, args ) { if (!$.subscriptions[topic]) { return false; } setTimeout(function () { var len = $.subscriptions[topic] ? $.subscriptions[topic].length : 0; while (len--) { $.subscriptions[topic][len].callback(topic, args); } return true; }); return true; } }); //////////////////////////////////// // Create custom navigationend event //////////////////////////////////// function triggerNavigationEvent(target) { var transition; var tansitionDuration; if ('transition' in document.body.style) { transition = 'transition-duration'; } else if ('-webkit-transition' in document.body.style){ transition = '-webkit-transition-duration'; } function determineDurationType (duration) { if (/m/.test(duration)) { return parseFloat(duration); } else if (/s/.test(duration)) { return parseFloat(duration) * 100; } } tansitionDuration = determineDurationType($('article').eq(0).css(transition)); setTimeout(function() { $(target).trigger({type: 'navigationend'}); }, tansitionDuration); } $.extend({ //////////////////////////////////////////////// // Manage location.hash for client side routing: //////////////////////////////////////////////// UITrackHashNavigation : function ( url, delimeter ) { url = url || true; $.UISetHashOnUrl($.UINavigationHistory[$.UINavigationHistory.length-1], delimeter); }, ///////////////////////////////////////////////////// // Set the hash according to where the user is going: ///////////////////////////////////////////////////// UISetHashOnUrl : function ( url, delimiter ) { delimiter = delimiter || '#/'; var hash; if (/^#/.test(url)) { hash = delimiter + (url.split('#')[1]); } else { hash = delimiter + url; } if ($.isAndroid) { if (/#/.test(url)) { url = url.split('#')[1]; } if (/\//.test(url)) { url = url.split('/')[1]; } window.location.hash = '#/' + url; } else { window.history.replaceState('Object', 'Title', hash); } }, ////////////////////////////////////// // Navigate Back to Non-linear Article ////////////////////////////////////// UIGoBackToArticle : function ( articleID ) { var historyIndex = $.UINavigationHistory.indexOf(articleID); var currentArticle = $('article.current'); var destination = $(articleID); var currentToolbar; var destinationToolbar; if ($.UINavigationHistory.length === 0) { destination = $('article:first-of-type'); $.UINavigationHistory.push('#' + destination[0].id); } var prevArticles; if ($.UINavigationHistory.length > 1) { prevArticles = $.UINavigationHistory.splice(historyIndex+1); } else { prevArticles = $('article.previous'); } $.publish('chui/navigateBack/leave', currentArticle[0].id); $.publish('chui/navigateBack/enter', destination[0].id); currentArticle[0].scrollTop = 0; destination[0].scrollTop = 0; if (prevArticles.length) { $.each(prevArticles, function(_, ctx) { $(ctx).removeClass('previous').addClass('next'); $(ctx).prev().removeClass('previous').addClass('next'); }); } currentToolbar = currentArticle.next().hazClass('toolbar'); destinationToolbar = destination.next().hazClass('toolbar'); destination.removeClass('previous next').addClass('current'); destination.prev().removeClass('previous next').addClass('current'); destinationToolbar.removeClass('previous next').addClass('current'); currentArticle.removeClass('current').addClass('next'); currentArticle.prev().removeClass('current').addClass('next'); currentToolbar.removeClass('current').addClass('next'); $('.toolbar.previous').removeClass('previous').addClass('next'); $.UISetHashOnUrl($.UINavigationHistory[$.UINavigationHistory.length-1]); triggerNavigationEvent(destination); }, //////////////////////////////////// // Navigate Back to Previous Article //////////////////////////////////// UIGoBack : function () { var histLen = $.UINavigationHistory.length; var currentArticle = $('article.current'); var destination = $($.UINavigationHistory[histLen-2]); var currentToolbar; var destinationToolbar; if (histLen === 0) { destination = $('article:first-of-type'); $.UINavigationHistory.push('#' + destination[0].id); } $.publish('chui/navigateBack/leave', currentArticle[0].id); $.publish('chui/navigateBack/enter', destination[0].id); currentArticle[0].scrollTop = 0; destination[0].scrollTop = 0; currentToolbar = currentArticle.next().hazClass('toolbar'); destinationToolbar = destination.next().hazClass('toolbar'); destination.removeClass('previous').addClass('current'); destination.prev().removeClass('previous').addClass('current'); destinationToolbar.removeClass('previous').addClass('current'); currentArticle.removeClass('current').addClass('next'); currentArticle.prev().removeClass('current').addClass('next'); currentToolbar.removeClass('current').addClass('next'); $.UISetHashOnUrl($.UINavigationHistory[histLen-2]); if ($.UINavigationHistory.length === 1) return; $.UINavigationHistory.pop(); }, isNavigating : false, /////////////////////////////// // Navigate to Specific Article /////////////////////////////// UIGoToArticle : function ( destination ) { if ($.isNavigating) return; $.isNavigating = true; var current = $('article.current'); var currentNav = current.prev(); destination = $(destination); var destinationID = '#' + destination[0].id; var destinationNav = destination.prev(); var currentToolbar; var destinationToolbar; var navigationClass = 'next previous'; $.publish('chui/navigate/leave', current[0].id); $.UINavigationHistory.push(destinationID); $.publish('chui/navigate/enter', destination[0].id); current[0].scrollTop = 0; destination[0].scrollTop = 0; currentToolbar = current.next().hazClass('toolbar'); destinationToolbar = destination.next().hazClass('toolbar'); current.removeClass('current').addClass('previous'); currentNav.removeClass('current').addClass('previous'); currentToolbar.removeClass('current').addClass('previous'); destination.removeClass(navigationClass).addClass('current'); destinationNav.removeClass(navigationClass).addClass('current'); destinationToolbar.removeClass(navigationClass).addClass('current'); $.UISetHashOnUrl(destination[0].id); setTimeout(function() { $.isNavigating = false; }, 500); triggerNavigationEvent(destination); } }); /////////////////// // Init navigation: /////////////////// $(function() { ////////////////////////////////////////// // Set first value for navigation history: ////////////////////////////////////////// $.extend({ UINavigationHistory : ["#" + $('article').eq(0).attr('id')] }); /////////////////////////////////////////////////////////// // Make sure that navs and articles have navigation states: /////////////////////////////////////////////////////////// $('nav:not(#global-nav)').each(function(idx, ctx) { // Prevent if splitlayout for tablets: if ($('body')[0].classList.contains('splitlayout')) return; if (idx === 0) { ctx.classList.add('current'); } else { ctx.classList.add('next'); } }); $('article').each(function(idx, ctx) { // Prevent if splitlayout for tablets: if ($('body')[0].classList.contains('splitlayout')) return; if ($('body')[0].classList.contains('slide-out-app')) return; if (idx === 0) { ctx.classList.add('current'); } else { ctx.classList.add('next'); } }); /////////////////////////// // Initialize Back Buttons: /////////////////////////// $('body').on('singletap', 'a.back', function() { if (this.classList.contains('back')) { $.UIGoBack(); } }); //////////////////////////////// // Handle navigation list items: //////////////////////////////// $('body').on('singletap doubletap', 'li', function() { if ($.isNavigating) return; if (!this.hasAttribute('data-goto')) return; if (!this.getAttribute('data-goto')) return; if (!document.getElementById(this.getAttribute('data-goto'))) return; if ($(this).parent()[0].classList.contains('deletable')) return; var destinationHref = '#' + this.getAttribute('data-goto'); $(destinationHref).addClass('navigable'); var destination = $(destinationHref); $.UIGoToArticle(destination); }); $('li[data-goto]').each(function(idx, ctx) { $(ctx).closest('article').addClass('navigable'); var navigable = '#' + ctx.getAttribute('data-goto'); $(navigable).addClass('navigable'); }); ///////////////////////////////////// // Init navigation url hash tracking: ///////////////////////////////////// // If there's more than one article: if ($('article').eq(1)[0]) { $.UISetHashOnUrl($('article').eq(0)[0].id); } ///////////////////////////////////////////////////////// // Stop rubber banding when dragging down on nav: ///////////////////////////////////////////////////////// $('nav').on($.eventStart, function(e) { e.preventDefault(); }); }); $(function() { /////////////////////////////////// // Initialize singletap on buttons: /////////////////////////////////// $('body').on('singletap', '.button', function() { var $this = $(this); if ($this.parent('.segmented')[0]) return; if ($this.parent('.tabbar')[0]) return; $this.addClass('selected'); setTimeout(function() { $this.removeClass('selected'); }, 500); }); }); $.fn.extend({ ///////////////////////// // Block Screen with Mask ///////////////////////// UIBlock : function ( opacity ) { opacity = opacity ? " style='opacity:" + opacity + "'" : " style='opacity: .5;'"; $(this).before("<div class='mask'" + opacity + "></div>"); $('article.current').attr('aria-hidden',true); return this; }, ////////////////////////// // Remove Mask from Screen ////////////////////////// UIUnblock : function ( ) { $('.mask').remove(); $('article.current').removeAttr('aria-hidden'); return this; } }); $.fn.extend({ ////////////////////////////// // Center an Element on Screen ////////////////////////////// UICenter : function ( ) { if (!this[0]) return; var $this = $(this); var parent = $this.parent(); var position; if ($this.css('position') !== 'absolute') position = 'relative'; else position = 'absolute'; var height, width, parentHeight, parentWidth; if (position === 'absolute') { height = $this[0].clientHeight; width = $this[0].clientWidth; parentHeight = parent[0].clientHeight; parentWidth = parent[0].clientWidth; } else { height = parseInt($this.css('height'),10); width = parseInt($this.css('width'),10); parentHeight = parseInt(parent.css('height'),10); parentWidth = parseInt(parent.css('width'),10); } var tmpTop, tmpLeft; if (parent[0].nodeName === 'body') { tmpTop = ((window.innerHeight /2) + window.pageYOffset) - height /2 + 'px'; tmpLeft = ((window.innerWidth / 2) - (width / 2) + 'px'); } else { tmpTop = (parentHeight /2) - (height /2) + 'px'; tmpLeft = (parentWidth / 2) - (width / 2) + 'px'; } if (position !== 'absolute') tmpLeft = 0; // if (parseInt(tmpLeft,10) <= 0) tmpLeft = '10px'; $this.css({left: tmpLeft, top: tmpTop}); } }); $.fn.extend({ //////////////////////// // Create Busy indicator //////////////////////// /* var options = { color: 'red', size: '80px', position: 'right' } */ UIBusy : function ( options ) { options = options || {}; var $this = this; var color = options.color || '#000'; var size = options.size || '80px'; var position = (options && options.position === 'right') ? 'align-flush' : null; var duration = options.duration || '2s'; var spinner; // For iOS: var iOSBusy = function() { var webkitAnim = {'-webkit-animation-duration': duration}; spinner = $('<span class="busy"></span>'); $(spinner).css({'background-color': color, 'height': size, 'width': size}); $(spinner).css(webkitAnim); $(spinner).attr('role','progressbar'); if (position) $(spinner).addClass(position); $this.append(spinner); return this; }; // For Android: var androidBusy = function() { var webkitAnim = {'-webkit-animation-duration': duration}; spinner = $('<div class="busy"><div></div><div></div></div>'); $(spinner).css({'height': size, 'width': size, "background-image": 'url(' + '"data:image/svg+xml;utf8,<svg xmlns:svg=' + "'http://www.w3.org/2000/svg' xmlns='http://www.w3.org/2000/svg' version='1.1' x='0px' y='0px' width='400px' height='400px' viewBox='0 0 400 400' enable-background='new 0 0 400 400' xml:space='preserve'><circle fill='none' stroke='" + color + "' stroke-width='20' stroke-miterlimit='10' cx='199' cy='199' r='174'/>" + '</svg>"' + ')'}); $(spinner).css(webkitAnim); $(spinner).attr('role','progressbar'); $(spinner).innerHTML = "<div></div><div></div>"; if (position) $(spinner).addClass('align-' + position); $this.append(spinner); return this; }; // For Windows 8/WP8: var winBusy = function() { spinner = $('<progress class="busy"></progress>'); $(spinner).css({ 'color': color }); $(spinner).attr('role','progressbar'); $(spinner).addClass('win-ring'); if (position) $(spinner).addClass('align-' + position); $this.append(spinner); return this; }; // Create Busy control for appropriate OS: if ($.isWin) { winBusy(options); } else if ($.isAndroid || $.isChrome) { androidBusy(options); } else if ($.isiOS || $.isSafari) { iOSBusy(options); } } }); $.extend({ /////////////// // Create Popup /////////////// UIPopup : function( options ) { /* options { id: 'alertID', title: 'Alert', message: 'This is a message from me to you.', cancelButton: 'Cancel', continueButton: 'Go Ahead', callback: function() { // do nothing } } */ if (!options) return; var id = options.id || $.Uuid(); var title = options.title ? '<header><h1>' + options.title + '</h1></header>' : ''; var message = options.message ? '<p role="note">' + options.message + '</p>' : ''; var cancelButton = options.cancelButton ? '<a href="javascript:void(null)" class="button cancel" role="button">' + options.cancelButton + '</a>' : ''; var continueButton = options.continueButton ? '<a href="javascript:void(null)" class="button continue" role="button">' + options.continueButton + '</a>' : ''; var callback = options.callback || $.noop; var padding = options.empty ? ' style="padding: 40px 0;" ' : ''; var panelOpen, panelClose; if (options.empty) { panelOpen = ''; panelClose = ''; } else { panelOpen = '<div class="panel">'; panelClose = '</div>'; } var popup = '<div class="popup closed" role="alertdialog" id="' + id + '"' + padding + '>' + panelOpen + title + message + '<footer>' + cancelButton + continueButton + '</footer>' + panelClose + '</div>'; $('body').append(popup); if (callback && continueButton) { $('.popup').find('.continue').on($.eventStart, function() { $('.popup').UIPopupClose(); callback.call(callback); }); } $.UICenterPopup(); setTimeout(function() { $('body').find('.popup').removeClass('closed'); }, 200); $('body').find('.popup').UIBlock('0.5'); var events = $.eventStart + ' singletap ' + $.eventEnd; $('.mask').on(events, function(e) { e.stopPropagation(); }); }, ////////////////////////////////////////// // Center Popups When Orientation Changes: ////////////////////////////////////////// UICenterPopup : function ( ) { var popup = $('.popup'); if (!popup[0]) return; var tmpTop = ((window.innerHeight /2) + window.pageYOffset) - (popup[0].clientHeight /2) + 'px'; var tmpLeft; if (window.innerWidth === 320) { tmpLeft = '10px'; } else { tmpLeft = Math.floor((window.innerWidth - 318) /2) + 'px'; } if ($.isWin) { popup.css({top: tmpTop}); } else { popup.css({left: tmpLeft, top: tmpTop}); } } }); $.fn.extend({ ////////////// // Close Popup ////////////// UIPopupClose : function ( ) { if (!this && !this.classList.contains('popup')) return; $(this).UIUnblock(); $(this).remove(); } }); $(function() { ////////////////////////// // Handle Closing Popups: ////////////////////////// $('body').on($.eventStart, '.cancel', function() { if ($(this).closest('.popup')[0]) { $(this).closest('.popup').UIPopupClose(); } }); ///////////////////////////////////////////////// // Reposition popups on window resize: ///////////////////////////////////////////////// window.onresize = function() { $.UICenterPopup(); }; }); $.fn.extend({ ///////////////// // Create Popover ///////////////// /* id: myUniqueID, title: 'Great', callback: myCallback */ UIPopover : function ( options ) { if (!options) return []; var triggerEl = $(this); var triggerID; if (this[0].id) { triggerID = this[0].id; } else { triggerID = $.Uuid(); triggerEl.attr('id', triggerID); } var id = options.id ? options.id : $.Uuid(); var header = options.title ? ('<header><h1>' + options.title + '</h1></header>') : ''; var callback = options.callback ? options.callback : $.noop; var popover = '<div class="popover" id="' + id + '">' + header + '<section></section></div>'; // Calculate position of popover relative to the button that opened it: var _calcPopPos = function (element) { var offset = $(element).offset(); var left = offset.left; var calcLeft; var calcTop; var popover = $('.popover'); var popoverOffset = popover.offset(); calcLeft = popoverOffset.left; calcTop = offset.top + $(element)[0].clientHeight; if ((popover.width() + offset.left) > window.innerWidth) { popover.css({ 'left': ((window.innerWidth - popover.width())-20) + 'px', 'top': (calcTop + 20) + 'px' }); } else { popover.css({'left': left + 'px', 'top': (calcTop + 20) + 'px'}); } }; $(this).on($.eventStart, function() { var $this = this; $(this).addClass('selected'); setTimeout(function() { $($this).removeClass('selected'); }, 1000); $('body').append(popover); $('.popover').UIBlock('.5'); var event = 'singletap'; if ($.isWin && $.isDesktop) { event = $.eventStart + ' singletap ' + $.eventEnd; } $('.mask').on(event, function(e) { e.preventDefault(); e.stopPropagation(); }); $('.popover').data('triggerEl', triggerID); if ($.isWin) { _calcPopPos($this); $('.popover').addClass('open'); } else { $('.popover').addClass('open'); setTimeout(function () { _calcPopPos($this); }); } callback.call(callback, $this); }); } }); $.extend({ /////////////////////////////////////// // Align the Popover Before Showing it: /////////////////////////////////////// UIAlignPopover : function () { var popover = $('.popover'); if (!popover.length) return; var triggerID = popover.data('triggerEl'); var offset = $('#'+triggerID).offset(); var left = offset.left; if (($(popover).width() + offset.left) > window.innerWidth) { popover.css({ 'left': ((window.innerWidth - $(popover).width())-20) + 'px' }); } else { popover.css({'left': left + 'px'}); } } }); $.extend({ UIPopoverClose : function ( ) { $('body').UIUnblock(); $('.popover').css('visibility','hidden'); setTimeout(function() { $('.popover').remove(); },10); } }); $(function() { ///////////////////////////////////////////////// // Reposition popovers on window resize: ///////////////////////////////////////////////// window.onresize = function() { $.UIAlignPopover(); }; var events = $.eventStart + ' singletap ' + $.eventEnd; $('body').on(events, '.mask', function(e) { if (!$('.popover')[0]) { if (e && e.nodeType === 1) return; e.stopPropogation(); } else { $.UIPopoverClose(); } }); }); $.fn.extend({ /////////////////////////////// // Initialize Segmented Control /////////////////////////////// UISegmented : function ( options ) { if (this.hasClass('paging')) return; var callback = (options && options.callback) ? options.callback : $.noop; var selected; if (options && options.selected) selected = options.selected; if (options && options.callback) { callback = options.callback; } this.find('a').each(function(idx, ctx) { $(ctx).find('a').attr('role','radio'); if (selected === 0 && idx === 0) { ctx.setAttribute('aria-checked', 'true'); ctx.classList.add('selected'); } if (idx === selected) { ctx.setAttribute('aria-checked', 'true'); ctx.classList.add('selected'); } }); if (!selected) { if (!this.find('.selected')[0]) { this.children().eq(0).addClass('selected'); } } this.on('singletap', '.button', function(e) { var $this = $(this); if (this.parentNode.classList.contains('paging')) return; $this.siblings('a').removeClass('selected'); $this.siblings('a').removeAttr('aria-checked'); $this.addClass('selected'); $this.attr('aria-checked', true); callback.call(this, e); }); } }); $.extend({ /////////////////////////// // Create Segmented Control /////////////////////////// UICreateSegmented : function ( options ) { /* options = { id : '#myId', className : 'special' || '', labels : ['first','second','third'], selected : 0 based number of selected button } */ var className = (options && options.className) ? options.className : ''; var labels = (options && options.labels) ? options.labels : []; var selected = (options && options.selected) ? options.selected : 0; var _segmented = ['<div class="segmented']; if (className) _segmented.push(' ' + className); _segmented.push('">'); labels.forEach(function(ctx, idx) { _segmented.push('<a role="radio" class="button'); if (selected === idx) { _segmented.push(' selected" aria-checked="true"'); } else { _segmented.push('"'); } _segmented.push('>'); _segmented.push(ctx); _segmented.push('</a>'); }); _segmented.push('</div>'); return _segmented.join(''); } }); $(function() { ///////////////////////////////////// // Handle Existing Segmented Buttons: ///////////////////////////////////// $('.segmented').UISegmented(); }); $.fn.extend({ //////////////////////////////////////////// // Allow Segmented Control to toggle panels //////////////////////////////////////////// UIPanelToggle : function ( panel, callback ) { var panels; var selected = 0; selected = this.children().hazClass('selected').index() || 0; if (panel instanceof Array) { panels = panel.children('div'); } else if (typeof panel === 'string') { panels = $(panel).children('div'); } panels.eq(selected).siblings().css({display: 'none'}); if (callback) callback.apply(this, arguments); this.on($.eventEnd, 'a', function() { panels.eq($(this).index()).css({display:'block'}) .siblings().css('display','none'); }); this.on('singletap', '.button', function() { var $this = $(this); if (this.parentNode.classList.contains('paging')) return; $this.siblings('a').removeClass('selected'); $this.siblings('a').removeAttr('aria-checked'); $this.addClass('selected'); $this.attr('aria-checked', true); }); } }); $.extend({ /////////////////////// // Setup Paging Control /////////////////////// UIPaging : function ( ) { var currentArticle = $('.segmented.paging').closest('nav').next(); if (window && window.jQuery && $ === window.jQuery) { if ($('.segmented.paging').hasClass('horizontal')) { currentArticle.addClass('horizontal'); } else if ($('.segmented.paging').hasClass('vertical')) { currentArticle.addClass('vertical'); } } else { if ($('.segmented.paging').hasClass('horizontal')[0]) { currentArticle.addClass('horizontal'); } else if ($('.segmented.paging').hasClass('vertical')[0]) { currentArticle.addClass('vertical'); } } currentArticle.children().eq(0).addClass('current'); currentArticle.children().eq(0).siblings().addClass('next'); var sections = function() { return currentArticle.children().length; }; $('.segmented.paging').on($.eventStart, '.button:first-of-type', function() { if (sections() === 1) return; var $this = $(this); $this.next().removeClass('selected'); $this.addClass('selected'); var currentSection; currentSection = $('section.current'); if (currentSection.index() === 0) { currentSection.removeClass('current'); currentArticle.children().eq(sections() - 1).addClass('current').removeClass('next'); currentArticle.children().eq(sections() - 1).siblings().removeClass('next').addClass('previous'); } else { currentSection.removeClass('current').addClass('next'); currentSection.prev().removeClass('previous').addClass('current'); } setTimeout(function() { $this.removeClass('selected'); }, 250); }); $('.segmented.paging').on($.eventStart, '.button:last-of-type', function() { if (sections() === 1) return; var $this = $(this); $this.prev().removeClass('selected'); $this.addClass('selected'); var currentSection; if (this.classList.contains('disabled')) return; currentSection = $('section.current'); if (currentSection.index() === sections() - 1) { // start again! currentSection.removeClass('current'); currentArticle.children().eq(0).addClass('current').removeClass('previous'); currentArticle.children().eq(0).siblings().removeClass('previous').addClass('next'); } else { currentSection.removeClass('current').addClass('previous'); currentSection.next().removeClass('next').addClass('current'); } setTimeout(function() { $this.removeClass('selected'); }, 250); }); } }); $.extend({ //////////////////////////// // Initialize Deletable List //////////////////////////// UIDeletable : function ( options ) { /* options = { list: selector, editLabel : labelName || Edit, doneLabel : labelName || Done, deleteLabel : labelName || Delete, placement: left || right, callback : callback } */ if (!options || !options.list || !options instanceof Array) { return; } var list = $(options.list); var editLabel = options.editLabel || 'Edit'; var doneLabel = options.doneLabel || 'Done'; var deleteLabel = options.deleteLabel || 'Delete'; var placement = options.placement || 'right'; var callback = options.callback || $.noop; var deleteButton; var editButton; var deletionIndicator; var button; var swipe = 'swiperight'; if ($('html').attr('dir') === 'rtl') swipe = 'swipeleft'; // Windows uses an icon for the delete button: if ($.isWin) deleteLabel = ''; if (list[0].classList.contains('deletable')) return; var height = $('li').eq(1)[0].clientHeight; deleteButton = $.concat('<a href="javascript:void(null)" class="button delete">', deleteLabel, '</a>'); editButton = $.concat('<a href="javascript:void(null)" class="button edit">', editLabel, '</a>'); deletionIndicator = '<span class="deletion-indicator"></span>'; if (placement === 'left') { list.closest('article').prev().prepend(editButton); } else { list.closest('article').prev().append(editButton); list.closest('article').prev().find('h1').addClass('buttonOnRight'); list.closest('article').prev().find('.edit').addClass('align-flush'); button = list.closest('article').prev().find('.edit'); } list.find('li').prepend(deletionIndicator); list.find('li').append(deleteButton); var setupDeletability = function(callback, list, button) { var deleteSlide; if ($.isiOS) { deleteSlide = '100px'; } else if ($.isAndroid) { deleteSlide = '140px'; } $(function() { button.on('singletap', function() { var $this = this; if (this.classList.contains('edit')) { list.addClass('deletable'); setTimeout(function() { $this.classList.remove('edit'); $this.classList.add('done'); $($this).text(doneLabel); $(list).addClass('showIndicators'); }); } else if (this.classList.contains('done')) { list.removeClass('deletable'); setTimeout(function() { $this.classList.remove('done'); $this.classList.add('edit'); $($this).text(editLabel); $(list).removeClass('showIndicators'); $(list).find('li').removeClass('selected'); }); } }); $(list).on('singletap', '.deletion-indicator', function() { if ($(this).parent('li').hasClass('selected')) { $(this).parent('li').removeClass('selected'); return; } else { $(this).parent('li').addClass('selected'); } }); if ($.isiOS || $.isSafari) { $(list).on(swipe, 'li', function() { $(this).removeClass('selected'); }); } $(list).on('singletap', '.delete', function() { var $this = this; var direction = '-1000%'; if ($('html').attr('dir') === 'rtl') direction = '1000%'; $(this).siblings().css({'-webkit-transform': 'translate3d(' + direction + ',0,0)', '-webkit-transition': 'all 1s ease-out'}); setTimeout(function() { callback.call(callback, $this); $($this).parent().remove(); }, 500); }); }); }; return setupDeletability(callback, list, button); //return list; } }); $.fn.extend({ ///////////////////////// // Initialize Select List ///////////////////////// /* // For default selection use zero-based integer: options = { name : name // used on radio buttons as group name, defaults to uuid. selected : integer, callback : callback // callback example: function () { // this is the selected list item: console.log($(this).text()); } } */ UISelectList : function (options) { var name = (options && options.name) ? options.name : $.Uuid(); var list = this[0]; if (list && !$(list).hasClass('select')) { this.addClass('select'); } if (!list) return []; list.classList.add('select'); $(list).find('li').forEach(function(ctx, idx) { ctx.setAttribute('role', 'radio'); if (options && options.selected === idx) { ctx.setAttribute('aria-checked', 'true'); ctx.classList.add('selected'); if (!$(ctx).find('input')[0]) { $(ctx).append('<input type="radio" checked="checked" name="' + name + '">'); } else { $(ctx).find('input').attr('checked','checked'); } } else { if (!$(ctx).find('input')[0]) { $(ctx).append('<input type="radio" name="' + name + '">'); } } }); $(list).on('singletap', 'li', function() { var item = this; $(item).siblings('li').removeClass('selected'); $(item).siblings('li').removeAttr('aria-checked'); $(item).siblings('li').find('input').removeAttr('checked'); $(item).addClass('selected'); item.setAttribute('aria-checked', true); $(item).find('input').attr('checked','checked'); if (options && options.callback) { options.callback.apply(this, arguments); } }); } }); $.extend({ /////////////////////////////////////////////// // UISheet: Create an Overlay for Buttons, etc. /////////////////////////////////////////////// /* var options { id : 'starTrek', listClass :'enterprise', background: 'transparent', } */ UISheet : function ( options ) { var id = $.Uuid(); var listClass = ''; var background = ''; if (options) { id = options.id ? options.id : id; listClass = options.listClass ? ' ' + options.listClass : ''; background = ' style="background-color:' + options.background + ';" ' || ''; } var sheet = '<div id="' + id + '" class="sheet' + listClass + '"><div class="handle"></div><section class="scroller-vertical"></section></div>'; $('body').append(sheet); $('.sheet .handle').on($.eventStart, function() { $.UIHideSheet(); }); }, UIShowSheet : function ( ) { $('article.current').addClass('blurred'); if ($.isAndroid || $.isChrome) { $('.sheet').css('display','block'); setTimeout(function() { $('.sheet').addClass('opened'); }, 20); } else { $('.sheet').addClass('opened'); } }, UIHideSheet : function ( ) { $('.sheet').removeClass('opened'); $('article.current').addClass('removeBlurSlow'); setTimeout(function() { $('article').removeClass('blurred'); $('article').removeClass('removeBlurSlow'); },500); } }); $.extend({ //////////////////////////////////////////////// // Create Slideout with toggle button. // Use $.UISlideout.populate to polate slideout. // See widget-factor.js for details. //////////////////////////////////////////////// UISlideout : function ( position ) { var slideoutButton = $("<a class='button slide-out-button' href='javascript:void(null)'></a>"); var slideOut = '<div class="slide-out"><section></section></div>'; $('article').removeClass('next'); $('article').removeClass('current'); $('article').prev().removeClass('next'); $('article').prev().removeClass('current'); position = position || 'left'; $('body').append(slideOut); $('body').addClass('slide-out-app'); $('article:first-of-type').addClass('show'); $('article:first-of-type').prev().addClass('show'); $('#global-nav').append(slideoutButton); $('.slide-out-button').on($.eventStart, function() { $('.slide-out').toggleClass('open'); }); $('.slide-out').on('singletap', 'li', function() { var whichArticle = '#' + $(this).attr('data-show-article'); $.UINavigationHistory[0] = whichArticle; $.UISetHashOnUrl(whichArticle); $.publish('chui/navigate/leave', $('article.show')[0].id); $.publish('chui/navigate/enter', whichArticle); $('.slide-out').removeClass('open'); $('article').removeClass('show'); $('article').prev().removeClass('show'); $(whichArticle).addClass('show'); $(whichArticle).prev().addClass('show'); }); } }); $.extend($.UISlideout, { ///////////////////////////////////////////////////////////////// // Method to populate a slideout with actionable items. // The argument is an array of objects consisting of a key/value. // The key will be the id of the article to be shown. // The value is the title for the list item. // [{music:'Music'},{docs:'Documents'},{recipes:'Recipes'}] ///////////////////////////////////////////////////////////////// populate: function( args ) { var slideout = $('.slide-out'); if (!slideout[0]) return; if (!$.isArray(args)) { return; } else { slideout.find('section').append('<ul class="list"></ul>'); var list = slideout.find('ul'); args.forEach(function(ctx) { for (var key in ctx) { if (key === 'header') { list.append('<li class="slideout-header"><h2>'+ctx[key]+'</h2></li>'); } else { list.append('<li data-show-article="' + key + '"><h3>' + ctx[key] + '</h3></li>'); } } }); } } }); $.fn.extend({ ///////////////// // Create stepper ///////////////// /* var options = { start: 0, end: 10, defaultValue: 3 } */ UIStepper : function (options) { if (!options) return []; if (!options.start) return []; if (!options.end) return []; var stepper = $(this); var start = options.start; var end = options.end; var defaultValue = options.defaultValue ? options.defaultValue : options.start; var increaseSymbol = '+'; var decreaseSymbol = '-'; if ($.isWin) { increaseSymbol = ''; decreaseSymbol = ''; } var decreaseButton = '<a href="javascript:void(null)" class="button decrease">' + decreaseSymbol + '</a>'; var label = '<label>' + defaultValue + '</label><input type="text" value="' + defaultValue + '">'; var increaseButton = '<a href="javascript:void(null)" class="button increase">' + increaseSymbol + '</a>'; stepper.append(decreaseButton + label + increaseButton); stepper.data('ui-value', {start: start, end: end, defaultValue: defaultValue}); var decreaseStepperValue = function() { var currentValue = stepper.find('input').val(); var value = stepper.data('ui-value'); var start = value.start; var newValue; if (currentValue <= start) { $(this).addClass('disabled'); } else { newValue = Number(currentValue) - 1; stepper.find('.button:last-of-type').removeClass('disabled'); stepper.find('label').text(newValue); stepper.find('input')[0].value = newValue; if (currentValue === start) { $(this).addClass('disabled'); } } }; var increaseStepperValue = function() { var currentValue = stepper.find('input').val(); var value = stepper.data('ui-value'); var end = value.end; var newValue; if (currentValue >= end) { $(this).addClass('disabled'); } else { newValue = Number(currentValue) + 1; stepper.find('.button:first-of-type').removeClass('disabled'); stepper.find('label').text(newValue); stepper.find('input')[0].value = newValue; if (currentValue === end) { $(this).addClass('disabled'); } } }; stepper.find('.button:first-of-type').on('singletap', function() { decreaseStepperValue.call(this, stepper); }); stepper.find('.button:last-of-type').on('singletap', function() { increaseStepperValue.call(this, stepper); }); } }); $.extend({ /////////////////////////////////////////// // Pass the id of the stepper to reset. // It's value will be reset to the default. /////////////////////////////////////////// // Pass it the id of the stepper: UIResetStepper : function ( stepper ) { var defaultValue = stepper.data('ui-value').defaultValue; stepper.find('label').html(defaultValue); stepper.find('input')[0].value = defaultValue; } }); $.fn.extend({ //////////////////////////// // Initialize Switch Control //////////////////////////// UISwitch : function ( ) { var hasThumb = false; this.forEach(function(ctx, idx) { ctx.setAttribute('role','checkbox'); if ($(ctx).data('ui-setup') === true) return; if (!ctx.querySelector('input')) { ctx.insertAdjacentHTML('afterBegin', '<input type="checkbox">'); } if (ctx.classList.contains('on')) { ctx.querySelector('input').setAttribute('checked', 'checked'); } if (ctx.querySelector('em')) hasThumb = true; if (!hasThumb) { ctx.insertAdjacentHTML('afterBegin', '<em></em>'); } $(ctx).on('singletap', function() { var checkbox = ctx.querySelector('input'); if (ctx.classList.contains('on')) { ctx.classList.remove('on'); ctx.removeAttribute('aria-checked'); checkbox.removeAttribute('checked'); } else { ctx.classList.add('on'); checkbox.setAttribute('checked', 'checked'); ctx.setAttribute('aria-checked', true); } }); $(ctx).on('swipeleft', function() { var checkbox = ctx.querySelector('input'); if (ctx.classList.contains('on')) { ctx.classList.remove('on'); ctx.removeAttribute('aria-checked'); checkbox.removeAttribute('checked'); } }); $(ctx).on('swiperight', function() { var checkbox = ctx.querySelector('input'); if (!ctx.classList.contains('on')) { ctx.classList.add('on'); checkbox.setAttribute('checked', 'checked'); ctx.setAttribute('aria-checked', true); } }); $(ctx).data('ui-setup', true); }); } }); $.extend({ //////////////////////// // Create Switch Control //////////////////////// UICreateSwitch : function ( options ) { /* options = { id : '#myId', name: 'fruit.mango' state : 'on' || 'off' //(off is default), value : 'Mango' || '', callback : callback } */ var id = options ? options.id : $.Uuid(); var name = options && options.name ? (' name="' + options.name + '"') : ''; var value= options && options.value ? (' value="' + options.value + '"') : ''; var state = (options && options.state === 'on') ? (' ' + options.state) : ''; var checked = (options && options.state === 'on') ? ' checked="checked"' : ''; var _switch = $.concat('<span class="switch', state, '" id="', id, '"><em></em>','<input type="checkbox"', name, checked, value, '></span>'); return $(_switch); } }); $(function() { ////////////////////////// // Handle Existing Switches: ////////////////////////// $('.switch').UISwitch(); }); document.addEventListener('touchstart', function (e) { var parent = e.target, i = 0; for (i = 0; i < 10; i += 1) { if (parent !== null) { if (parent.className !== undefined) { if (parent.className.match('navigable')) { if (parent.scrollTop === 0) { parent.scrollTop = 1; } else if ((parent.scrollTop + parent.offsetHeight) === parent.scrollHeight) { parent.scrollTop = parent.scrollTop - 1; } } } parent = parent.parentNode; } } }); $.extend({ /////////////////////////////////////////// // Creates a Tab Bar for Toggling Articles: /////////////////////////////////////////// UITabbar : function ( options ) { /* var options = { id: 'mySpecialTabbar', tabs: 4, labels: ["Refresh", "Add", "Info", "Downloads", "Favorite"], icons: ["refresh", "add", "info", "downloads", "favorite"], selected: 2 } */ if (!options) return; $('body').addClass('hasTabBar'); if ($.isiOS6) $('body').addClass('isiOS6'); var id = options.id || $.Uuid(); var selected = options.selected || ''; var tabbar = '<div class="tabbar" id="' + id + '">'; var icon = ($.isiOS || $.isSafari) ? '<span class="icon"></span>' : ''; for (var i = 0; i < options.tabs; i++) { tabbar += '<a class="button ' + options.icons[i]; if (selected === i+1) { tabbar += ' selected'; } tabbar += '">' + icon + '<label>' + options.labels[i] + '</label></a>'; } tabbar += '</div>'; $('body').append(tabbar); $('nav').removeClass('current').addClass('next'); $('nav').eq(selected).removeClass('next').addClass('current'); $('article').removeClass('current').addClass('next'); $('article').eq(selected-1).removeClass('next').addClass('current'); $('body').find('.tabbar').on('singletap', '.button', function() { var $this = this; var index; var id; $.publish('chui/navigate/leave', $('article.current')[0].id); $this.classList.add('selected'); $(this).siblings('a').removeClass('selected'); index = $(this).index(); $('article.previous').removeClass('previous').addClass('next'); $('nav.previous').removeClass('previous').addClass('next'); $('article.current').removeClass('current').addClass('next'); $('nav.current').removeClass('current').addClass('next'); id = $('article').eq(index)[0].id; $.publish('chui/navigate/enter', id); if (window && window.jQuery) { $('article').each(function(idx, ctx) { $(ctx).scrollTop(0); }); } else { $('article').eq(index).siblings('article').forEach(function(ctx) { ctx.scrollTop = 0; }); } $.UISetHashOnUrl('#'+id); if ($.UINavigationHistory[0] === ('#' + id)) { $.UINavigationHistory = [$.UINavigationHistory[0]]; } else if ($.UINavigationHistory.length === 1) { if ($.UINavigationHistory[0] !== ('#' + id)) { $.UINavigationHistory.push('#'+id); } } else if($.UINavigationHistory.length === 3) { $.UINavigationHistory.pop(); } else { $.UINavigationHistory[1] = '#'+id; } $('article').eq(index).removeClass('next').addClass('current'); $('nav').eq(index+1).removeClass('next').addClass('current'); }); } }); $.extend({ ///////////////////////////// // Templating: ///////////////////////////// templates : {}, template : function ( tmpl, variable ) { var regex; variable = variable || 'data'; regex = /\[\[=([\s\S]+?)\]\]/g; var template = new Function(variable, "var p=[];" + "p.push('" + tmpl .replace(/[\r\t\n]/g, " ") .split("'").join("\\'") .replace(regex,"',$1,'") .split('[[').join("');") .split(']]').join("p.push('") + "');" + "return p.join('');"); return template; } }); ///////////////////////// // Create a search input: ///////////////////////// /* $.UISearch({ articleId: '#products', id: 'productSearch', placeholder: 'Find a product', results: 5 }) */ $.extend({ UISearch : function(options) { var article = options && options.articleId || $('article').eq(0); var searchID = options && options.id || $.Uuid(); var placeholder = options && options.placeholder || 'search'; var results = options && options.results || 1; var widget = '<div class="searchBar"><input placeholder="' + placeholder +'" type="search" results="' + results + '" id="'+ searchID + '"></div>'; $(article).find('section').prepend(widget); if ($.isWin) { $(article).prev().append(widget); $('#' + searchID).parent().append('<span class="searchGlyph">&#xe11A;</span>'); } } }); })(window.jQuery);
/* eslint-disable react/no-array-index-key */ /* @flow */ import React from 'react'; import type { Node } from 'react'; import cn from 'classnames'; import { Dropdown, DropdownOption } from '../../Dropdown'; import type { FontFamilyConfig } from '../../../core/config'; export type Props = { expanded: boolean, onExpandEvent: Function, doExpand: Function, doCollapse: Function, onChange: Function, config: FontFamilyConfig, currentState: any, }; type State = { defaultFontFamily: string, }; class FontFamilyLayout extends React.Component<Props, State> { state = { defaultFontFamily: undefined, }; componentDidMount(): void { const editorElm = document.getElementsByClassName('DraftEditor-root'); if (editorElm && editorElm.length > 0) { const styles = window.getComputedStyle(editorElm[0]); const defaultFontFamily = styles.getPropertyValue('font-family'); this.setDefaultFam(defaultFontFamily); } } setDefaultFam = defaultFont => { this.setState({ defaultFontFamily: defaultFont, }); }; props: Props; render(): Node { const { defaultFontFamily } = this.state; const { config: { options, title }, onChange, expanded, doCollapse, onExpandEvent, doExpand, } = this.props; let { currentState: { fontFamily: currentFontFamily } } = this.props; currentFontFamily = currentFontFamily || (options && defaultFontFamily && options.some(opt => opt.toLowerCase() === defaultFontFamily.toLowerCase()) && defaultFontFamily); return ( <div className={cn('be-ctrl__group')} aria-label="be-fontfamily-control"> <Dropdown onChange={onChange} expanded={expanded} doExpand={doExpand} ariaLabel="be-dropdown-fontfamily-control" doCollapse={doCollapse} onExpandEvent={onExpandEvent} title={title}> <span className={cn('be-fontfamily__ph')}>{currentFontFamily || 'Font Family'}</span> {options.map((family, index) => ( <DropdownOption active={currentFontFamily === family} value={family} key={index}> {family} </DropdownOption> ))} </Dropdown> </div> ); } } export default FontFamilyLayout;
// Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. var common = require('../common'); var assert = require('assert'); console.log('process.pid: ' + process.pid); var first = 0, second = 0; var sighup = false; process.addListener('SIGUSR1', function() { console.log('Interrupted by SIGUSR1'); first += 1; }); process.addListener('SIGUSR1', function() { second += 1; setTimeout(function() { console.log('End.'); process.exit(0); }, 5); }); var i = 0; setInterval(function() { console.log('running process...' + ++i); if (i == 5) { process.kill(process.pid, 'SIGUSR1'); } }, 1); // Test addListener condition where a watcher for SIGNAL // has been previously registered, and `process.listeners(SIGNAL).length === 1` process.addListener('SIGHUP', function () {}); process.removeAllListeners('SIGHUP'); process.addListener('SIGHUP', function () { sighup = true }); process.kill(process.pid, 'SIGHUP'); process.addListener('exit', function() { assert.equal(1, first); assert.equal(1, second); assert.equal(true, sighup); });
import Logger, { configure, levels } from '..'; import ConsoleHandler from 'nightingale-console'; import errorProcessor from 'nightingale-error-processor'; configure([ { processors: [errorProcessor], handlers: [new ConsoleHandler(levels.ALL)], }, ]); const logger = new Logger('app'); logger.error(new Error('test')); logger.error('test', { error: new Error('test') });
/*global module, require*/ 'use strict'; function FtpMock() { this.actions = {}; } FtpMock.prototype.on = function (action, fn) { this.actions[action] = fn; }; FtpMock.prototype.connect = function (params) { if (params.host !== 'rozklady.ztm.waw.pl') { this.actions.error(new Error('Wrong address')); } else { this.actions.ready(); } }; FtpMock.prototype.list = function (callback) { callback(null, [{date: new Date(), name: 'RA123456.7z'}]); }; FtpMock.prototype.end = function () { }; module.exports = FtpMock;
'use strict' /** * Protobuf interface * from go-ipfs/pin/internal/pb/header.proto */ module.exports = ` syntax = "proto2"; package ipfs.pin; option go_package = "pb"; message Set { optional uint32 version = 1; optional uint32 fanout = 2; optional fixed32 seed = 3; } `
'use strict'; module.exports = require('./CodeSlide');
/*! umbraco * https://github.com/umbraco/umbraco-cms/ * Copyright (c) 2016 Umbraco HQ; * Licensed */ (function() { angular.module("umbraco.directives", ["umbraco.directives.editors", "umbraco.directives.html", "umbraco.directives.validation", "ui.sortable"]); angular.module("umbraco.directives.editors", []); angular.module("umbraco.directives.html", []); angular.module("umbraco.directives.validation", []); /** * @ngdoc directive * @name umbraco.directives.directive:autoScale * @element div * @deprecated * We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use. * @function * @description * Resize div's automatically to fit to the bottom of the screen, as an optional parameter an y-axis offset can be set * So if you only want to scale the div to 70 pixels from the bottom you pass "70" * @example * <example module="umbraco.directives"> * <file name="index.html"> * <div auto-scale="70" class="input-block-level"></div> * </file> * </example> **/ angular.module("umbraco.directives") .directive('autoScale', function ($window) { return function (scope, el, attrs) { var totalOffset = 0; var offsety = parseInt(attrs.autoScale, 10); var window = angular.element($window); if (offsety !== undefined){ totalOffset += offsety; } setTimeout(function () { el.height(window.height() - (el.offset().top + totalOffset)); }, 500); window.bind("resize", function () { el.height(window.height() - (el.offset().top + totalOffset)); }); }; }); /** * @ngdoc directive * @name umbraco.directives.directive:detectFold * @deprecated * We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use. * @description This is used for the editor buttons to ensure they are displayed correctly if the horizontal overflow of the editor * exceeds the height of the window **/ angular.module("umbraco.directives.html") .directive('detectFold', function ($timeout, $log, windowResizeListener) { return { require: "^?umbTabs", restrict: 'A', link: function (scope, el, attrs, tabsCtrl) { var firstRun = false; var parent = $(".umb-panel-body"); var winHeight = $(window).height(); var calculate = function () { if (el && el.is(":visible") && !el.hasClass("umb-bottom-bar")) { //now that the element is visible, set the flag in a couple of seconds, // this will ensure that loading time of a current tab get's completed and that // we eventually stop watching to save on CPU time $timeout(function() { firstRun = true; }, 4000); //var parent = el.parent(); var hasOverflow = parent.innerHeight() < parent[0].scrollHeight; //var belowFold = (el.offset().top + el.height()) > winHeight; if (hasOverflow) { el.addClass("umb-bottom-bar"); //I wish we didn't have to put this logic here but unfortunately we // do. This needs to calculate the left offest to place the bottom bar // depending on if the left column splitter has been moved by the user // (based on the nav-resize directive) var wrapper = $("#mainwrapper"); var contentPanel = $("#leftcolumn").next(); var contentPanelLeftPx = contentPanel.css("left"); el.css({ left: contentPanelLeftPx }); } } return firstRun; }; var resizeCallback = function(size) { winHeight = size.height; el.removeClass("umb-bottom-bar"); calculate(); }; windowResizeListener.register(resizeCallback); //Only execute the watcher if this tab is the active (first) tab on load, otherwise there's no reason to execute // the watcher since it will be recalculated when the tab changes! if (el.closest(".umb-tab-pane").index() === 0) { //run a watcher to ensure that the calculation occurs until it's firstRun but ensure // the calculations are throttled to save a bit of CPU var listener = scope.$watch(_.throttle(calculate, 1000), function (newVal, oldVal) { if (newVal !== oldVal) { listener(); } }); } //listen for tab changes if (tabsCtrl != null) { tabsCtrl.onTabShown(function (args) { calculate(); }); } //ensure to unregister scope.$on('$destroy', function() { windowResizeListener.unregister(resizeCallback); }); } }; }); /** * @ngdoc directive * @name umbraco.directives.directive:umbItemSorter * @deprecated * We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use. * @function * @element ANY * @restrict E * @description A re-usable directive for sorting items **/ function umbItemSorter(angularHelper) { return { scope: { model: "=" }, restrict: "E", // restrict to an element replace: true, // replace the html element with the template templateUrl: 'views/directives/_obsolete/umb-item-sorter.html', link: function(scope, element, attrs, ctrl) { var defaultModel = { okButton: "Ok", successMsg: "Sorting successful", complete: false }; //assign user vals to default angular.extend(defaultModel, scope.model); //re-assign merged to user scope.model = defaultModel; scope.performSort = function() { scope.$emit("umbItemSorter.sorting", { sortedItems: scope.model.itemsToSort }); }; scope.handleCancel = function () { scope.$emit("umbItemSorter.cancel"); }; scope.handleOk = function() { scope.$emit("umbItemSorter.ok"); }; //defines the options for the jquery sortable scope.sortableOptions = { axis: 'y', cursor: "move", placeholder: "ui-sortable-placeholder", update: function (ev, ui) { //highlight the item when the position is changed $(ui.item).effect("highlight", { color: "#049cdb" }, 500); }, stop: function (ev, ui) { //the ui-sortable directive already ensures that our list is re-sorted, so now we just // need to update the sortOrder to the index of each item angularHelper.safeApply(scope, function () { angular.forEach(scope.itemsToSort, function (val, index) { val.sortOrder = index + 1; }); }); } }; } }; } angular.module('umbraco.directives').directive("umbItemSorter", umbItemSorter); /** * @ngdoc directive * @name umbraco.directives.directive:umbContentName * @deprecated * We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use. * @restrict E * @function * @description * Used by editors that require naming an entity. Shows a textbox/headline with a required validator within it's own form. **/ angular.module("umbraco.directives") .directive('umbContentName', function ($timeout, localizationService) { return { require: "ngModel", restrict: 'E', replace: true, templateUrl: 'views/directives/_obsolete/umb-content-name.html', scope: { placeholder: '@placeholder', model: '=ngModel', ngDisabled: '=' }, link: function(scope, element, attrs, ngModel) { var inputElement = element.find("input"); if(scope.placeholder && scope.placeholder[0] === "@"){ localizationService.localize(scope.placeholder.substring(1)) .then(function(value){ scope.placeholder = value; }); } var mX, mY, distance; function calculateDistance(elem, mouseX, mouseY) { var cx = Math.max(Math.min(mouseX, elem.offset().left + elem.width()), elem.offset().left); var cy = Math.max(Math.min(mouseY, elem.offset().top + elem.height()), elem.offset().top); return Math.sqrt((mouseX - cx) * (mouseX - cx) + (mouseY - cy) * (mouseY - cy)); } var mouseMoveDebounce = _.throttle(function (e) { mX = e.pageX; mY = e.pageY; // not focused and not over element if (!inputElement.is(":focus") && !inputElement.hasClass("ng-invalid")) { // on page if (mX >= inputElement.offset().left) { distance = calculateDistance(inputElement, mX, mY); if (distance <= 155) { distance = 1 - (100 / 150 * distance / 100); inputElement.css("border", "1px solid rgba(175,175,175, " + distance + ")"); inputElement.css("background-color", "rgba(255,255,255, " + distance + ")"); } } } }, 15); $(document).bind("mousemove", mouseMoveDebounce); $timeout(function(){ if(!scope.model){ scope.goEdit(); } }, 100, false); scope.goEdit = function(){ scope.editMode = true; $timeout(function () { inputElement.focus(); }, 100, false); }; scope.exitEdit = function(){ if(scope.model && scope.model !== ""){ scope.editMode = false; } }; //unbind doc event! scope.$on('$destroy', function () { $(document).unbind("mousemove", mouseMoveDebounce); }); } }; }); /** * @ngdoc directive * @name umbraco.directives.directive:umbHeader * @deprecated * We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use. * @restrict E * @function * @description * The header on an editor that contains tabs using bootstrap tabs - THIS IS OBSOLETE, use umbTabHeader instead **/ angular.module("umbraco.directives") .directive('umbHeader', function ($parse, $timeout) { return { restrict: 'E', replace: true, transclude: 'true', templateUrl: 'views/directives/_obsolete/umb-header.html', //create a new isolated scope assigning a tabs property from the attribute 'tabs' //which is bound to the parent scope property passed in scope: { tabs: "=" }, link: function (scope, iElement, iAttrs) { scope.showTabs = iAttrs.tabs ? true : false; scope.visibleTabs = []; //since tabs are loaded async, we need to put a watch on them to determine // when they are loaded, then we can close the watch var tabWatch = scope.$watch("tabs", function (newValue, oldValue) { angular.forEach(newValue, function(val, index){ var tab = {id: val.id, label: val.label}; scope.visibleTabs.push(tab); }); //don't process if we cannot or have already done so if (!newValue) {return;} if (!newValue.length || newValue.length === 0){return;} //we need to do a timeout here so that the current sync operation can complete // and update the UI, then this will fire and the UI elements will be available. $timeout(function () { //use bootstrap tabs API to show the first one iElement.find(".nav-tabs a:first").tab('show'); //enable the tab drop iElement.find('.nav-pills, .nav-tabs').tabdrop(); //ensure to destroy tabdrop (unbinds window resize listeners) scope.$on('$destroy', function () { iElement.find('.nav-pills, .nav-tabs').tabdrop("destroy"); }); //stop watching now tabWatch(); }, 200); }); } }; }); /** * @ngdoc directive * @name umbraco.directives.directive:umbLogin * @deprecated * We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use. * @function * @element ANY * @restrict E **/ function loginDirective() { return { restrict: "E", // restrict to an element replace: true, // replace the html element with the template templateUrl: 'views/directives/_obsolete/umb-login.html' }; } angular.module('umbraco.directives').directive("umbLogin", loginDirective); /** * @ngdoc directive * @name umbraco.directives.directive:umbOptionsMenu * @deprecated * We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use. * @function * @element ANY * @restrict E **/ angular.module("umbraco.directives") .directive('umbOptionsMenu', function ($injector, treeService, navigationService, umbModelMapper, appState) { return { scope: { currentSection: "@", currentNode: "=" }, restrict: 'E', replace: true, templateUrl: 'views/directives/_obsolete/umb-optionsmenu.html', link: function (scope, element, attrs, ctrl) { //adds a handler to the context menu item click, we need to handle this differently //depending on what the menu item is supposed to do. scope.executeMenuItem = function (action) { navigationService.executeMenuAction(action, scope.currentNode, scope.currentSection); }; //callback method to go and get the options async scope.getOptions = function () { if (!scope.currentNode) { return; } //when the options item is selected, we need to set the current menu item in appState (since this is synonymous with a menu) appState.setMenuState("currentNode", scope.currentNode); if (!scope.actions) { treeService.getMenu({ treeNode: scope.currentNode }) .then(function (data) { scope.actions = data.menuItems; }); } }; } }; }); /** * @ngdoc directive * @name umbraco.directives.directive:umbPhotoFolder * @deprecated * We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use. * @restrict E **/ angular.module("umbraco.directives.html") .directive('umbPhotoFolder', function($compile, $log, $timeout, $filter, umbPhotoFolderHelper) { return { restrict: 'E', replace: true, require: '?ngModel', terminate: true, templateUrl: 'views/directives/_obsolete/umb-photo-folder.html', link: function(scope, element, attrs, ngModel) { var lastWatch = null; ngModel.$render = function() { if (ngModel.$modelValue) { $timeout(function() { var photos = ngModel.$modelValue; scope.clickHandler = scope.$eval(element.attr('on-click')); var imagesOnly = element.attr('images-only') === "true"; var margin = element.attr('border') ? parseInt(element.attr('border'), 10) : 5; var startingIndex = element.attr('baseline') ? parseInt(element.attr('baseline'), 10) : 0; var minWidth = element.attr('min-width') ? parseInt(element.attr('min-width'), 10) : 420; var minHeight = element.attr('min-height') ? parseInt(element.attr('min-height'), 10) : 100; var maxHeight = element.attr('max-height') ? parseInt(element.attr('max-height'), 10) : 300; var idealImgPerRow = element.attr('ideal-items-per-row') ? parseInt(element.attr('ideal-items-per-row'), 10) : 5; var fixedRowWidth = Math.max(element.width(), minWidth); scope.containerStyle = { width: fixedRowWidth + "px" }; scope.rows = umbPhotoFolderHelper.buildGrid(photos, fixedRowWidth, maxHeight, startingIndex, minHeight, idealImgPerRow, margin, imagesOnly); if (attrs.filterBy) { //we track the watches that we create, we don't want to create multiple, so clear it // if it already exists before creating another. if (lastWatch) { lastWatch(); } //TODO: Need to debounce this so it doesn't filter too often! lastWatch = scope.$watch(attrs.filterBy, function (newVal, oldVal) { if (newVal && newVal !== oldVal) { var p = $filter('filter')(photos, newVal, false); scope.baseline = 0; var m = umbPhotoFolderHelper.buildGrid(p, fixedRowWidth, maxHeight, startingIndex, minHeight, idealImgPerRow, margin, imagesOnly); scope.rows = m; } }); } }, 500); //end timeout } //end if modelValue }; //end $render } }; }); /** * @ngdoc directive * @name umbraco.directives.directive:umbSort * @deprecated * We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use. * * @element div * @function * * @description * Resize div's automatically to fit to the bottom of the screen, as an optional parameter an y-axis offset can be set * So if you only want to scale the div to 70 pixels from the bottom you pass "70" * * @example * <example module="umbraco.directives"> * <file name="index.html"> * <div umb-sort="70" class="input-block-level"></div> * </file> * </example> **/ angular.module("umbraco.directives") .value('umbSortContextInternal',{}) .directive('umbSort', function($log,umbSortContextInternal) { return { require: '?ngModel', link: function(scope, element, attrs, ngModel) { var adjustment; var cfg = scope.$eval(element.attr('umb-sort')) || {}; scope.model = ngModel; scope.opts = cfg; scope.opts.containerSelector= cfg.containerSelector || ".umb-" + cfg.group + "-container", scope.opts.nested= cfg.nested || true, scope.opts.drop= cfg.drop || true, scope.opts.drag= cfg.drag || true, scope.opts.clone = cfg.clone || "<li/>"; scope.opts.mode = cfg.mode || "list"; scope.opts.itemSelectorFull = $.trim(scope.opts.itemPath + " " + scope.opts.itemSelector); /* scope.opts.isValidTarget = function(item, container) { if(container.el.is(".umb-" + scope.opts.group + "-container")){ return true; } return false; }; */ element.addClass("umb-sort"); element.addClass("umb-" + cfg.group + "-container"); scope.opts.onDrag = function (item, position) { if(scope.opts.mode === "list"){ item.css({ left: position.left - adjustment.left, top: position.top - adjustment.top }); } }; scope.opts.onDrop = function (item, targetContainer, _super) { if(scope.opts.mode === "list"){ //list mode var clonedItem = $(scope.opts.clone).css({height: 0}); item.after(clonedItem); clonedItem.animate({'height': item.height()}); item.animate(clonedItem.position(), function () { clonedItem.detach(); _super(item); }); } var children = $(scope.opts.itemSelectorFull, targetContainer.el); var targetIndex = children.index(item); var targetScope = $(targetContainer.el[0]).scope(); if(targetScope === umbSortContextInternal.sourceScope){ if(umbSortContextInternal.sourceScope.opts.onSortHandler){ var _largs = { oldIndex: umbSortContextInternal.sourceIndex, newIndex: targetIndex, scope: umbSortContextInternal.sourceScope }; umbSortContextInternal.sourceScope.opts.onSortHandler.call(this, item, _largs); } }else{ if(targetScope.opts.onDropHandler){ var args = { sourceScope: umbSortContextInternal.sourceScope, sourceIndex: umbSortContextInternal.sourceIndex, sourceContainer: umbSortContextInternal.sourceContainer, targetScope: targetScope, targetIndex: targetIndex, targetContainer: targetContainer }; targetScope.opts.onDropHandler.call(this, item, args); } if(umbSortContextInternal.sourceScope.opts.onReleaseHandler){ var _args = { sourceScope: umbSortContextInternal.sourceScope, sourceIndex: umbSortContextInternal.sourceIndex, sourceContainer: umbSortContextInternal.sourceContainer, targetScope: targetScope, targetIndex: targetIndex, targetContainer: targetContainer }; umbSortContextInternal.sourceScope.opts.onReleaseHandler.call(this, item, _args); } } }; scope.changeIndex = function(from, to){ scope.$apply(function(){ var i = ngModel.$modelValue.splice(from, 1)[0]; ngModel.$modelValue.splice(to, 0, i); }); }; scope.move = function(args){ var from = args.sourceIndex; var to = args.targetIndex; if(args.sourceContainer === args.targetContainer){ scope.changeIndex(from, to); }else{ scope.$apply(function(){ var i = args.sourceScope.model.$modelValue.splice(from, 1)[0]; args.targetScope.model.$modelvalue.splice(to,0, i); }); } }; scope.opts.onDragStart = function (item, container, _super) { var children = $(scope.opts.itemSelectorFull, container.el); var offset = item.offset(); umbSortContextInternal.sourceIndex = children.index(item); umbSortContextInternal.sourceScope = $(container.el[0]).scope(); umbSortContextInternal.sourceContainer = container; //current.item = ngModel.$modelValue.splice(current.index, 1)[0]; var pointer = container.rootGroup.pointer; adjustment = { left: pointer.left - offset.left, top: pointer.top - offset.top }; _super(item, container); }; element.sortable( scope.opts ); } }; }); /** * @ngdoc directive * @name umbraco.directives.directive:umbTabView * @deprecated * We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use. * * @restrict E **/ angular.module("umbraco.directives") .directive('umbTabView', function($timeout, $log){ return { restrict: 'E', replace: true, transclude: 'true', templateUrl: 'views/directives/_obsolete/umb-tab-view.html' }; }); /** * @ngdoc directive * @name umbraco.directives.directive:umbUploadDropzone * @deprecated * We plan to remove this directive in the next major version of umbraco (8.0). The directive is not recommended to use. * * @restrict E **/ angular.module("umbraco.directives.html") .directive('umbUploadDropzone', function(){ return { restrict: 'E', replace: true, templateUrl: 'views/directives/_obsolete/umb-upload-dropzone.html' }; }); /** * @ngdoc directive * @name umbraco.directives.directive:navResize * @restrict A * * @description * Handles how the navigation responds to window resizing and controls how the draggable resize panel works **/ angular.module("umbraco.directives") .directive('navResize', function (appState, eventsService, windowResizeListener) { return { restrict: 'A', link: function (scope, element, attrs, ctrl) { var minScreenSize = 1100; var resizeEnabled = false; function setTreeMode() { appState.setGlobalState("showNavigation", appState.getGlobalState("isTablet") === false); } function enableResize() { //only enable when the size is correct and it's not already enabled if (!resizeEnabled && appState.getGlobalState("isTablet") === false) { element.resizable( { containment: $("#mainwrapper"), autoHide: true, handles: "e", alsoResize: ".navigation-inner-container", resize: function(e, ui) { var wrapper = $("#mainwrapper"); var contentPanel = $("#contentwrapper"); var umbNotification = $("#umb-notifications-wrapper"); var apps = $("#applications"); var bottomBar = contentPanel.find(".umb-bottom-bar"); var navOffeset = $("#navOffset"); var leftPanelWidth = ui.element.width() + apps.width(); contentPanel.css({ left: leftPanelWidth }); bottomBar.css({ left: leftPanelWidth }); umbNotification.css({ left: leftPanelWidth }); navOffeset.css({ "margin-left": ui.element.outerWidth() }); }, stop: function (e, ui) { } }); resizeEnabled = true; } } function resetResize() { if (resizeEnabled) { //kill the resize element.resizable("destroy"); element.css("width", ""); var navInnerContainer = element.find(".navigation-inner-container"); navInnerContainer.css("width", ""); $("#contentwrapper").css("left", ""); $("#umb-notifications-wrapper").css("left", ""); $("#navOffset").css("margin-left", ""); resizeEnabled = false; } } var evts = []; //Listen for global state changes evts.push(eventsService.on("appState.globalState.changed", function (e, args) { if (args.key === "showNavigation") { if (args.value === false) { resetResize(); } else { enableResize(); } } })); var resizeCallback = function(size) { //set the global app state appState.setGlobalState("isTablet", (size.width <= minScreenSize)); setTreeMode(); }; windowResizeListener.register(resizeCallback); //ensure to unregister from all events and kill jquery plugins scope.$on('$destroy', function () { windowResizeListener.unregister(resizeCallback); for (var e in evts) { eventsService.unsubscribe(evts[e]); } var navInnerContainer = element.find(".navigation-inner-container"); navInnerContainer.resizable("destroy"); }); //init //set the global app state appState.setGlobalState("isTablet", ($(window).width() <= minScreenSize)); setTreeMode(); } }; }); angular.module("umbraco.directives") .directive('sectionIcon', function ($compile, iconHelper) { return { restrict: 'E', replace: true, link: function (scope, element, attrs) { var icon = attrs.icon; if (iconHelper.isLegacyIcon(icon)) { //its a known legacy icon, convert to a new one element.html("<i class='" + iconHelper.convertFromLegacyIcon(icon) + "'></i>"); } else if (iconHelper.isFileBasedIcon(icon)) { var convert = iconHelper.convertFromLegacyImage(icon); if(convert){ element.html("<i class='icon-section " + convert + "'></i>"); }else{ element.html("<img class='icon-section' src='images/tray/" + icon + "'>"); } //it's a file, normally legacy so look in the icon tray images } else { //it's normal element.html("<i class='icon-section " + icon + "'></i>"); } } }; }); angular.module("umbraco.directives") .directive('umbContextMenu', function (navigationService) { return { scope: { menuDialogTitle: "@", currentSection: "@", currentNode: "=", menuActions: "=" }, restrict: 'E', replace: true, templateUrl: 'views/components/application/umb-contextmenu.html', link: function (scope, element, attrs, ctrl) { //adds a handler to the context menu item click, we need to handle this differently //depending on what the menu item is supposed to do. scope.executeMenuItem = function (action) { navigationService.executeMenuAction(action, scope.currentNode, scope.currentSection); }; } }; }); /** * @ngdoc directive * @name umbraco.directives.directive:umbNavigation * @restrict E **/ function umbNavigationDirective() { return { restrict: "E", // restrict to an element replace: true, // replace the html element with the template templateUrl: 'views/components/application/umb-navigation.html' }; } angular.module('umbraco.directives').directive("umbNavigation", umbNavigationDirective); /** * @ngdoc directive * @name umbraco.directives.directive:umbSections * @restrict E **/ function sectionsDirective($timeout, $window, navigationService, treeService, sectionResource, appState, eventsService, $location) { return { restrict: "E", // restrict to an element replace: true, // replace the html element with the template templateUrl: 'views/components/application/umb-sections.html', link: function (scope, element, attr, ctrl) { //setup scope vars scope.maxSections = 7; scope.overflowingSections = 0; scope.sections = []; scope.currentSection = appState.getSectionState("currentSection"); scope.showTray = false; //appState.getGlobalState("showTray"); scope.stickyNavigation = appState.getGlobalState("stickyNavigation"); scope.needTray = false; scope.trayAnimation = function() { if (scope.showTray) { return 'slide'; } else if (scope.showTray === false) { return 'slide'; } else { return ''; } }; function loadSections(){ sectionResource.getSections() .then(function (result) { scope.sections = result; calculateHeight(); }); } function calculateHeight(){ $timeout(function(){ //total height minus room for avatar and help icon var height = $(window).height()-200; scope.totalSections = scope.sections.length; scope.maxSections = Math.floor(height / 70); scope.needTray = false; if(scope.totalSections > scope.maxSections){ scope.needTray = true; scope.overflowingSections = scope.maxSections - scope.totalSections; } }); } var evts = []; //Listen for global state changes evts.push(eventsService.on("appState.globalState.changed", function(e, args) { if (args.key === "showTray") { scope.showTray = args.value; } if (args.key === "stickyNavigation") { scope.stickyNavigation = args.value; } })); evts.push(eventsService.on("appState.sectionState.changed", function(e, args) { if (args.key === "currentSection") { scope.currentSection = args.value; } })); evts.push(eventsService.on("app.reInitialize", function(e, args) { //re-load the sections if we're re-initializing (i.e. package installed) loadSections(); })); //ensure to unregister from all events! scope.$on('$destroy', function () { for (var e in evts) { eventsService.unsubscribe(evts[e]); } }); //on page resize window.onresize = calculateHeight; scope.avatarClick = function(){ if(scope.helpDialog) { closeHelpDialog(); } if(!scope.userDialog) { scope.userDialog = { view: "user", show: true, close: function(oldModel) { closeUserDialog(); } }; } else { closeUserDialog(); } }; function closeUserDialog() { scope.userDialog.show = false; scope.userDialog = null; } scope.helpClick = function(){ if(scope.userDialog) { closeUserDialog(); } if(!scope.helpDialog) { scope.helpDialog = { view: "help", show: true, close: function(oldModel) { closeHelpDialog(); } }; } else { closeHelpDialog(); } }; function closeHelpDialog() { scope.helpDialog.show = false; scope.helpDialog = null; } scope.sectionClick = function (event, section) { if (event.ctrlKey || event.shiftKey || event.metaKey || // apple (event.button && event.button === 1) // middle click, >IE9 + everyone else ) { return; } if (scope.userDialog) { closeUserDialog(); } if (scope.helpDialog) { closeHelpDialog(); } navigationService.hideSearch(); navigationService.showTree(section.alias); $location.path("/" + section.alias); }; scope.sectionDblClick = function(section){ navigationService.reloadSection(section.alias); }; scope.trayClick = function () { // close dialogs if (scope.userDialog) { closeUserDialog(); } if (scope.helpDialog) { closeHelpDialog(); } if (appState.getGlobalState("showTray") === true) { navigationService.hideTray(); } else { navigationService.showTray(); } }; loadSections(); } }; } angular.module('umbraco.directives').directive("umbSections", sectionsDirective); /** @ngdoc directive @name umbraco.directives.directive:umbButton @restrict E @scope @description Use this directive to render an umbraco button. The directive can be used to generate all types of buttons, set type, style, translation, shortcut and much more. <h3>Markup example</h3> <pre> <div ng-controller="My.Controller as vm"> <umb-button action="vm.clickButton()" type="button" button-style="success" state="vm.buttonState" shortcut="ctrl+c" label="My button" disabled="vm.buttonState === 'busy'"> </umb-button> </div> </pre> <h3>Controller example</h3> <pre> (function () { "use strict"; function Controller(myService) { var vm = this; vm.buttonState = "init"; vm.clickButton = clickButton; function clickButton() { vm.buttonState = "busy"; myService.clickButton().then(function() { vm.buttonState = "success"; }, function() { vm.buttonState = "error"; }); } } angular.module("umbraco").controller("My.Controller", Controller); })(); </pre> @param {callback} action The button action which should be performed when the button is clicked. @param {string=} href Url/Path to navigato to. @param {string=} type Set the button type ("button" or "submit"). @param {string=} buttonStyle Set the style of the button. The directive uses the default bootstrap styles ("primary", "info", "success", "warning", "danger", "inverse", "link"). @param {string=} state Set a progress state on the button ("init", "busy", "success", "error"). @param {string=} shortcut Set a keyboard shortcut for the button ("ctrl+c"). @param {string=} label Set the button label. @param {string=} labelKey Set a localization key to make a multi lingual button ("general_buttonText"). @param {string=} icon Set a button icon. Can only be used when buttonStyle is "link". @param {boolean=} disabled Set to <code>true</code> to disable the button. **/ (function() { 'use strict'; function ButtonDirective($timeout) { function link(scope, el, attr, ctrl) { scope.style = null; function activate() { if (!scope.state) { scope.state = "init"; } if (scope.buttonStyle) { scope.style = "btn-" + scope.buttonStyle; } } activate(); var unbindStateWatcher = scope.$watch('state', function(newValue, oldValue) { if (newValue === 'success' || newValue === 'error') { $timeout(function() { scope.state = 'init'; }, 2000); } }); scope.$on('$destroy', function() { unbindStateWatcher(); }); } var directive = { transclude: true, restrict: 'E', replace: true, templateUrl: 'views/components/buttons/umb-button.html', link: link, scope: { action: "&?", href: "@?", type: "@", buttonStyle: "@?", state: "=?", shortcut: "@?", shortcutWhenHidden: "@", label: "@?", labelKey: "@?", icon: "@?", disabled: "=" } }; return directive; } angular.module('umbraco.directives').directive('umbButton', ButtonDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbButtonGroup @restrict E @scope @description Use this directive to render a button with a dropdown of alternative actions. <h3>Markup example</h3> <pre> <div ng-controller="My.Controller as vm"> <umb-button-group ng-if="vm.buttonGroup" default-button="vm.buttonGroup.defaultButton" sub-buttons="vm.buttonGroup.subButtons" direction="down" float="right"> </umb-button-group> </div> </pre> <h3>Controller example</h3> <pre> (function () { "use strict"; function Controller() { var vm = this; vm.buttonGroup = { defaultButton: { labelKey: "general_defaultButton", hotKey: "ctrl+d", hotKeyWhenHidden: true, handler: function() { // do magic here } }, subButtons: [ { labelKey: "general_subButton", hotKey: "ctrl+b", hotKeyWhenHidden: true, handler: function() { // do magic here } } ] }; } angular.module("umbraco").controller("My.Controller", Controller); })(); </pre> <h3>Button model description</h3> <ul> <li> <strong>labekKey</strong> <small>(string)</small> - Set a localization key to make a multi lingual button ("general_buttonText"). </li> <li> <strong>hotKey</strong> <small>(array)</small> - Set a keyboard shortcut for the button ("ctrl+c"). </li> <li> <strong>hotKeyWhenHidden</strong> <small>(boolean)</small> - As a default the hotkeys only works on elements visible in the UI. Set to <code>true</code> to set a hotkey on the hidden sub buttons. </li> <li> <strong>handler</strong> <small>(callback)</small> - Set a callback to handle button click events. </li> </ul> @param {object} defaultButton The model of the default button. @param {array} subButtons Array of sub buttons. @param {string=} state Set a progress state on the button ("init", "busy", "success", "error"). @param {string=} direction Set the direction of the dropdown ("up", "down"). @param {string=} float Set the float of the dropdown. ("left", "right"). **/ (function() { 'use strict'; function ButtonGroupDirective() { var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/buttons/umb-button-group.html', scope: { defaultButton: "=", subButtons: "=", state: "=?", direction: "@?", float: "@?" } }; return directive; } angular.module('umbraco.directives').directive('umbButtonGroup', ButtonGroupDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbEditorSubHeader @restrict E @description Use this directive to construct a sub header in the main editor window. The sub header is sticky and will follow along down the page when scrolling. <h3>Markup example</h3> <pre> <div ng-controller="MySection.Controller as vm"> <form name="mySectionForm" novalidate> <umb-editor-view> <umb-editor-container> <umb-editor-sub-header> // sub header content here </umb-editor-sub-header> </umb-editor-container> </umb-editor-view> </form> </div> </pre> <h3>Use in combination with</h3> <ul> <li>{@link umbraco.directives.directive:umbEditorSubHeaderContentLeft umbEditorSubHeaderContentLeft}</li> <li>{@link umbraco.directives.directive:umbEditorSubHeaderContentRight umbEditorSubHeaderContentRight}</li> <li>{@link umbraco.directives.directive:umbEditorSubHeaderSection umbEditorSubHeaderSection}</li> </ul> **/ (function() { 'use strict'; function EditorSubHeaderDirective() { var directive = { transclude: true, restrict: 'E', replace: true, templateUrl: 'views/components/editor/subheader/umb-editor-sub-header.html' }; return directive; } angular.module('umbraco.directives').directive('umbEditorSubHeader', EditorSubHeaderDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbEditorSubHeaderContentLeft @restrict E @description Use this directive to left align content in a sub header in the main editor window. <h3>Markup example</h3> <pre> <div ng-controller="MySection.Controller as vm"> <form name="mySectionForm" novalidate> <umb-editor-view> <umb-editor-container> <umb-editor-sub-header> <umb-editor-sub-header-content-left> // left content here </umb-editor-sub-header-content-left> <umb-editor-sub-header-content-right> // right content here </umb-editor-sub-header-content-right> </umb-editor-sub-header> </umb-editor-container> </umb-editor-view> </form> </div> </pre> <h3>Use in combination with</h3> <ul> <li>{@link umbraco.directives.directive:umbEditorSubHeader umbEditorSubHeader}</li> <li>{@link umbraco.directives.directive:umbEditorSubHeaderContentRight umbEditorSubHeaderContentRight}</li> <li>{@link umbraco.directives.directive:umbEditorSubHeaderSection umbEditorSubHeaderSection}</li> </ul> **/ (function() { 'use strict'; function EditorSubHeaderContentLeftDirective() { var directive = { transclude: true, restrict: 'E', replace: true, templateUrl: 'views/components/editor/subheader/umb-editor-sub-header-content-left.html' }; return directive; } angular.module('umbraco.directives').directive('umbEditorSubHeaderContentLeft', EditorSubHeaderContentLeftDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbEditorSubHeaderContentRight @restrict E @description Use this directive to rigt align content in a sub header in the main editor window. <h3>Markup example</h3> <pre> <div ng-controller="MySection.Controller as vm"> <form name="mySectionForm" novalidate> <umb-editor-view> <umb-editor-container> <umb-editor-sub-header> <umb-editor-sub-header-content-left> // left content here </umb-editor-sub-header-content-left> <umb-editor-sub-header-content-right> // right content here </umb-editor-sub-header-content-right> </umb-editor-sub-header> </umb-editor-container> </umb-editor-view> </form> </div> </pre> <h3>Use in combination with</h3> <ul> <li>{@link umbraco.directives.directive:umbEditorSubHeader umbEditorSubHeader}</li> <li>{@link umbraco.directives.directive:umbEditorSubHeaderContentLeft umbEditorSubHeaderContentLeft}</li> <li>{@link umbraco.directives.directive:umbEditorSubHeaderSection umbEditorSubHeaderSection}</li> </ul> **/ (function() { 'use strict'; function EditorSubHeaderContentRightDirective() { var directive = { transclude: true, restrict: 'E', replace: true, templateUrl: 'views/components/editor/subheader/umb-editor-sub-header-content-right.html' }; return directive; } angular.module('umbraco.directives').directive('umbEditorSubHeaderContentRight', EditorSubHeaderContentRightDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbEditorSubHeaderSection @restrict E @description Use this directive to create sections, divided by borders, in a sub header in the main editor window. <h3>Markup example</h3> <pre> <div ng-controller="MySection.Controller as vm"> <form name="mySectionForm" novalidate> <umb-editor-view> <umb-editor-container> <umb-editor-sub-header> <umb-editor-sub-header-content-right> <umb-editor-sub-header-section> // section content here </umb-editor-sub-header-section> <umb-editor-sub-header-section> // section content here </umb-editor-sub-header-section> <umb-editor-sub-header-section> // section content here </umb-editor-sub-header-section> </umb-editor-sub-header-content-right> </umb-editor-sub-header> </umb-editor-container> </umb-editor-view> </form> </div> </pre> <h3>Use in combination with</h3> <ul> <li>{@link umbraco.directives.directive:umbEditorSubHeader umbEditorSubHeader}</li> <li>{@link umbraco.directives.directive:umbEditorSubHeaderContentLeft umbEditorSubHeaderContentLeft}</li> <li>{@link umbraco.directives.directive:umbEditorSubHeaderContentRight umbEditorSubHeaderContentRight}</li> </ul> **/ (function() { 'use strict'; function EditorSubHeaderSectionDirective() { var directive = { transclude: true, restrict: 'E', replace: true, templateUrl: 'views/components/editor/subheader/umb-editor-sub-header-section.html' }; return directive; } angular.module('umbraco.directives').directive('umbEditorSubHeaderSection', EditorSubHeaderSectionDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbBreadcrumbs @restrict E @scope @description Use this directive to generate a list of breadcrumbs. <h3>Markup example</h3> <pre> <div ng-controller="My.Controller as vm"> <umb-breadcrumbs ng-if="vm.ancestors && vm.ancestors.length > 0" ancestors="vm.ancestors" entity-type="content"> </umb-breadcrumbs> </div> </pre> <h3>Controller example</h3> <pre> (function () { "use strict"; function Controller(myService) { var vm = this; vm.ancestors = []; myService.getAncestors().then(function(ancestors){ vm.ancestors = ancestors; }); } angular.module("umbraco").controller("My.Controller", Controller); })(); </pre> @param {array} ancestors Array of ancestors @param {string} entityType The content entity type (member, media, content). **/ (function() { 'use strict'; function BreadcrumbsDirective() { var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/editor/umb-breadcrumbs.html', scope: { ancestors: "=", entityType: "@" } }; return directive; } angular.module('umbraco.directives').directive('umbBreadcrumbs', BreadcrumbsDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbEditorContainer @restrict E @description Use this directive to construct a main content area inside the main editor window. <h3>Markup example</h3> <pre> <div ng-controller="Umbraco.Controller as vm"> <umb-editor-view> <umb-editor-header // header configuration> </umb-editor-header> <umb-editor-container> // main content here </umb-editor-container> <umb-editor-footer> // footer content here </umb-editor-footer> </umb-editor-view> </div> </pre> <h3>Use in combination with</h3> <ul> <li>{@link umbraco.directives.directive:umbEditorView umbEditorView}</li> <li>{@link umbraco.directives.directive:umbEditorHeader umbEditorHeader}</li> <li>{@link umbraco.directives.directive:umbEditorFooter umbEditorFooter}</li> </ul> **/ (function() { 'use strict'; function EditorContainerDirective(overlayHelper) { function link(scope, el, attr, ctrl) { scope.numberOfOverlays = 0; scope.$watch(function(){ return overlayHelper.getNumberOfOverlays(); }, function (newValue) { scope.numberOfOverlays = newValue; }); } var directive = { transclude: true, restrict: 'E', replace: true, templateUrl: 'views/components/editor/umb-editor-container.html', link: link }; return directive; } angular.module('umbraco.directives').directive('umbEditorContainer', EditorContainerDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbEditorFooter @restrict E @description Use this directive to construct a footer inside the main editor window. <h3>Markup example</h3> <pre> <div ng-controller="MySection.Controller as vm"> <form name="mySectionForm" novalidate> <umb-editor-view> <umb-editor-header // header configuration> </umb-editor-header> <umb-editor-container> // main content here </umb-editor-container> <umb-editor-footer> // footer content here </umb-editor-footer> </umb-editor-view> </form> </div> </pre> <h3>Use in combination with</h3> <ul> <li>{@link umbraco.directives.directive:umbEditorView umbEditorView}</li> <li>{@link umbraco.directives.directive:umbEditorHeader umbEditorHeader}</li> <li>{@link umbraco.directives.directive:umbEditorContainer umbEditorContainer}</li> <li>{@link umbraco.directives.directive:umbEditorFooterContentLeft umbEditorFooterContentLeft}</li> <li>{@link umbraco.directives.directive:umbEditorFooterContentRight umbEditorFooterContentRight}</li> </ul> **/ (function() { 'use strict'; function EditorFooterDirective() { var directive = { transclude: true, restrict: 'E', replace: true, templateUrl: 'views/components/editor/umb-editor-footer.html' }; return directive; } angular.module('umbraco.directives').directive('umbEditorFooter', EditorFooterDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbEditorFooterContentLeft @restrict E @description Use this directive to align content left inside the main editor footer. <h3>Markup example</h3> <pre> <div ng-controller="MySection.Controller as vm"> <form name="mySectionForm" novalidate> <umb-editor-view> <umb-editor-footer> <umb-editor-footer-content-left> // align content left </umb-editor-footer-content-left> <umb-editor-footer-content-right> // align content right </umb-editor-footer-content-right> </umb-editor-footer> </umb-editor-view> </form> </div> </pre> <h3>Use in combination with</h3> <ul> <li>{@link umbraco.directives.directive:umbEditorView umbEditorView}</li> <li>{@link umbraco.directives.directive:umbEditorHeader umbEditorHeader}</li> <li>{@link umbraco.directives.directive:umbEditorContainer umbEditorContainer}</li> <li>{@link umbraco.directives.directive:umbEditorFooter umbEditorFooter}</li> <li>{@link umbraco.directives.directive:umbEditorFooterContentRight umbEditorFooterContentRight}</li> </ul> **/ (function() { 'use strict'; function EditorFooterContentLeftDirective() { var directive = { transclude: true, restrict: 'E', replace: true, templateUrl: 'views/components/editor/umb-editor-footer-content-left.html' }; return directive; } angular.module('umbraco.directives').directive('umbEditorFooterContentLeft', EditorFooterContentLeftDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbEditorFooterContentRight @restrict E @description Use this directive to align content right inside the main editor footer. <h3>Markup example</h3> <pre> <div ng-controller="MySection.Controller as vm"> <form name="mySectionForm" novalidate> <umb-editor-view> <umb-editor-footer> <umb-editor-footer-content-left> // align content left </umb-editor-footer-content-left> <umb-editor-footer-content-right> // align content right </umb-editor-footer-content-right> </umb-editor-footer> </umb-editor-view> </form> </div> </pre> <h3>Use in combination with</h3> <ul> <li>{@link umbraco.directives.directive:umbEditorView umbEditorView}</li> <li>{@link umbraco.directives.directive:umbEditorHeader umbEditorHeader}</li> <li>{@link umbraco.directives.directive:umbEditorContainer umbEditorContainer}</li> <li>{@link umbraco.directives.directive:umbEditorFooter umbEditorFooter}</li> <li>{@link umbraco.directives.directive:umbEditorFooterContentLeft umbEditorFooterContentLeft}</li> </ul> **/ (function() { 'use strict'; function EditorFooterContentRightDirective() { var directive = { transclude: true, restrict: 'E', replace: true, templateUrl: 'views/components/editor/umb-editor-footer-content-right.html' }; return directive; } angular.module('umbraco.directives').directive('umbEditorFooterContentRight', EditorFooterContentRightDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbEditorHeader @restrict E @scope @description Use this directive to construct a header inside the main editor window. <h3>Markup example</h3> <pre> <div ng-controller="MySection.Controller as vm"> <form name="mySectionForm" novalidate> <umb-editor-view> <umb-editor-header name="vm.content.name" hide-alias="true" hide-description="true" hide-icon="true"> </umb-editor-header> <umb-editor-container> // main content here </umb-editor-container> <umb-editor-footer> // footer content here </umb-editor-footer> </umb-editor-view> </form> </div> </pre> <h3>Markup example - with tabs</h3> <pre> <div ng-controller="MySection.Controller as vm"> <form name="mySectionForm" val-form-manager novalidate> <umb-editor-view umb-tabs> <umb-editor-header name="vm.content.name" tabs="vm.content.tabs" hide-alias="true" hide-description="true" hide-icon="true"> </umb-editor-header> <umb-editor-container> <umb-tabs-content class="form-horizontal" view="true"> <umb-tab id="tab{{tab.id}}" ng-repeat="tab in vm.content.tabs" rel="{{tab.id}}"> <div ng-show="tab.alias==='tab1'"> // tab 1 content </div> <div ng-show="tab.alias==='tab2'"> // tab 2 content </div> </umb-tab> </umb-tabs-content> </umb-editor-container> <umb-editor-footer> // footer content here </umb-editor-footer> </umb-editor-view> </form> </div> </pre> <h3>Controller example - with tabs</h3> <pre> (function () { "use strict"; function Controller() { var vm = this; vm.content = { name: "", tabs: [ { id: 1, label: "Tab 1", alias: "tab1", active: true }, { id: 2, label: "Tab 2", alias: "tab2", active: false } ] }; } angular.module("umbraco").controller("MySection.Controller", Controller); })(); </pre> <h3>Markup example - with sub views</h3> <pre> <div ng-controller="MySection.Controller as vm"> <form name="mySectionForm" val-form-manager novalidate> <umb-editor-view> <umb-editor-header name="vm.content.name" navigation="vm.content.navigation" hide-alias="true" hide-description="true" hide-icon="true"> </umb-editor-header> <umb-editor-container> <umb-editor-sub-views sub-views="vm.content.navigation" model="vm.content"> </umb-editor-sub-views> </umb-editor-container> <umb-editor-footer> // footer content here </umb-editor-footer> </umb-editor-view> </form> </div> </pre> <h3>Controller example - with sub views</h3> <pre> (function () { "use strict"; function Controller() { var vm = this; vm.content = { name: "", navigation: [ { "name": "Section 1", "icon": "icon-document-dashed-line", "view": "/App_Plugins/path/to/html.html", "active": true }, { "name": "Section 2", "icon": "icon-list", "view": "/App_Plugins/path/to/html.html", } ] }; } angular.module("umbraco").controller("MySection.Controller", Controller); })(); </pre> <h3>Use in combination with</h3> <ul> <li>{@link umbraco.directives.directive:umbEditorView umbEditorView}</li> <li>{@link umbraco.directives.directive:umbEditorContainer umbEditorContainer}</li> <li>{@link umbraco.directives.directive:umbEditorFooter umbEditorFooter}</li> </ul> @param {string} name The content name. @param {array=} tabs Array of tabs. See example above. @param {array=} navigation Array of sub views. See example above. @param {boolean=} nameLocked Set to <code>true</code> to lock the name. @param {object=} menu Add a context menu to the editor. @param {string=} icon Show and edit the content icon. Opens an overlay to change the icon. @param {boolean=} hideIcon Set to <code>true</code> to hide icon. @param {string=} alias show and edit the content alias. @param {boolean=} hideAlias Set to <code>true</code> to hide alias. @param {string=} description Add a description to the content. @param {boolean=} hideDescription Set to <code>true</code> to hide description. **/ (function() { 'use strict'; function EditorHeaderDirective(iconHelper) { function link(scope, el, attr, ctrl) { scope.openIconPicker = function() { scope.dialogModel = { view: "iconpicker", show: true, submit: function (model) { /* ensure an icon is selected, because on focus on close button or an element in background no icon is submitted. So don't clear/update existing icon/preview. */ if (model.icon) { if (model.color) { scope.icon = model.icon + " " + model.color; } else { scope.icon = model.icon; } // set form to dirty ctrl.$setDirty(); } scope.dialogModel.show = false; scope.dialogModel = null; } }; }; } var directive = { require: '^form', transclude: true, restrict: 'E', replace: true, templateUrl: 'views/components/editor/umb-editor-header.html', scope: { tabs: "=", actions: "=", name: "=", nameLocked: "=", menu: "=", icon: "=", hideIcon: "@", alias: "=", hideAlias: "@", description: "=", hideDescription: "@", navigation: "=" }, link: link }; return directive; } angular.module('umbraco.directives').directive('umbEditorHeader', EditorHeaderDirective); })(); (function() { 'use strict'; function EditorMenuDirective($injector, treeService, navigationService, umbModelMapper, appState) { function link(scope, el, attr, ctrl) { //adds a handler to the context menu item click, we need to handle this differently //depending on what the menu item is supposed to do. scope.executeMenuItem = function (action) { navigationService.executeMenuAction(action, scope.currentNode, scope.currentSection); }; //callback method to go and get the options async scope.getOptions = function () { if (!scope.currentNode) { return; } //when the options item is selected, we need to set the current menu item in appState (since this is synonymous with a menu) appState.setMenuState("currentNode", scope.currentNode); if (!scope.actions) { treeService.getMenu({ treeNode: scope.currentNode }) .then(function (data) { scope.actions = data.menuItems; }); } }; } var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/editor/umb-editor-menu.html', link: link, scope: { currentNode: "=", currentSection: "@" } }; return directive; } angular.module('umbraco.directives').directive('umbEditorMenu', EditorMenuDirective); })(); (function() { 'use strict'; function EditorNavigationDirective() { function link(scope, el, attr, ctrl) { scope.showNavigation = true; scope.clickNavigationItem = function(selectedItem) { setItemToActive(selectedItem); runItemAction(selectedItem); }; function runItemAction(selectedItem) { if (selectedItem.action) { selectedItem.action(selectedItem); } } function setItemToActive(selectedItem) { // set all other views to inactive if (selectedItem.view) { for (var index = 0; index < scope.navigation.length; index++) { var item = scope.navigation[index]; item.active = false; } // set view to active selectedItem.active = true; } } function activate() { // hide navigation if there is only 1 item if (scope.navigation.length <= 1) { scope.showNavigation = false; } } activate(); } var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/editor/umb-editor-navigation.html', scope: { navigation: "=" }, link: link }; return directive; } angular.module('umbraco.directives.html').directive('umbEditorNavigation', EditorNavigationDirective); })(); (function() { 'use strict'; function EditorSubViewsDirective() { function link(scope, el, attr, ctrl) { scope.activeView = {}; // set toolbar from selected navigation item function setActiveView(items) { for (var index = 0; index < items.length; index++) { var item = items[index]; if (item.active && item.view) { scope.activeView = item; } } } // watch for navigation changes scope.$watch('subViews', function(newValue, oldValue) { if (newValue) { setActiveView(newValue); } }, true); } var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/editor/umb-editor-sub-views.html', scope: { subViews: "=", model: "=" }, link: link }; return directive; } angular.module('umbraco.directives').directive('umbEditorSubViews', EditorSubViewsDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbEditorView @restrict E @scope @description Use this directive to construct the main editor window. <h3>Markup example</h3> <pre> <div ng-controller="MySection.Controller as vm"> <form name="mySectionForm" novalidate> <umb-editor-view> <umb-editor-header name="vm.content.name" hide-alias="true" hide-description="true" hide-icon="true"> </umb-editor-header> <umb-editor-container> // main content here </umb-editor-container> <umb-editor-footer> // footer content here </umb-editor-footer> </umb-editor-view> </form> </div> </pre> <h3>Controller example</h3> <pre> (function () { "use strict"; function Controller() { var vm = this; } angular.module("umbraco").controller("MySection.Controller", Controller); })(); </pre> <h3>Use in combination with</h3> <ul> <li>{@link umbraco.directives.directive:umbEditorHeader umbEditorHeader}</li> <li>{@link umbraco.directives.directive:umbEditorContainer umbEditorContainer}</li> <li>{@link umbraco.directives.directive:umbEditorFooter umbEditorFooter}</li> </ul> **/ (function() { 'use strict'; function EditorViewDirective() { function link(scope, el, attr) { if(attr.footer) { scope.footer = attr.footer; } } var directive = { transclude: true, restrict: 'E', replace: true, templateUrl: 'views/components/editor/umb-editor-view.html', link: link }; return directive; } angular.module('umbraco.directives').directive('umbEditorView', EditorViewDirective); })(); /** * @description Utillity directives for key and field events **/ angular.module('umbraco.directives') .directive('onKeyup', function () { return { link: function (scope, elm, attrs) { var f = function () { scope.$apply(attrs.onKeyup); }; elm.on("keyup", f); scope.$on("$destroy", function(){ elm.off("keyup", f);} ); } }; }) .directive('onKeydown', function () { return { link: function (scope, elm, attrs) { var f = function () { scope.$apply(attrs.onKeydown); }; elm.on("keydown", f); scope.$on("$destroy", function(){ elm.off("keydown", f);} ); } }; }) .directive('onBlur', function () { return { link: function (scope, elm, attrs) { var f = function () { scope.$apply(attrs.onBlur); }; elm.on("blur", f); scope.$on("$destroy", function(){ elm.off("blur", f);} ); } }; }) .directive('onFocus', function () { return { link: function (scope, elm, attrs) { var f = function () { scope.$apply(attrs.onFocus); }; elm.on("focus", f); scope.$on("$destroy", function(){ elm.off("focus", f);} ); } }; }) .directive('onDragEnter', function () { return { link: function (scope, elm, attrs) { var f = function () { scope.$apply(attrs.onDragEnter); }; elm.on("dragenter", f); scope.$on("$destroy", function(){ elm.off("dragenter", f);} ); } }; }) .directive('onDragLeave', function () { return function (scope, elm, attrs) { var f = function (event) { var rect = this.getBoundingClientRect(); var getXY = function getCursorPosition(event) { var x, y; if (typeof event.clientX === 'undefined') { // try touch screen x = event.pageX + document.documentElement.scrollLeft; y = event.pageY + document.documentElement.scrollTop; } else { x = event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; y = event.clientY + document.body.scrollTop + document.documentElement.scrollTop; } return { x: x, y : y }; }; var e = getXY(event.originalEvent); // Check the mouseEvent coordinates are outside of the rectangle if (e.x > rect.left + rect.width - 1 || e.x < rect.left || e.y > rect.top + rect.height - 1 || e.y < rect.top) { scope.$apply(attrs.onDragLeave); } }; elm.on("dragleave", f); scope.$on("$destroy", function(){ elm.off("dragleave", f);} ); }; }) .directive('onDragOver', function () { return { link: function (scope, elm, attrs) { var f = function () { scope.$apply(attrs.onDragOver); }; elm.on("dragover", f); scope.$on("$destroy", function(){ elm.off("dragover", f);} ); } }; }) .directive('onDragStart', function () { return { link: function (scope, elm, attrs) { var f = function () { scope.$apply(attrs.onDragStart); }; elm.on("dragstart", f); scope.$on("$destroy", function(){ elm.off("dragstart", f);} ); } }; }) .directive('onDragEnd', function () { return { link: function (scope, elm, attrs) { var f = function () { scope.$apply(attrs.onDragEnd); }; elm.on("dragend", f); scope.$on("$destroy", function(){ elm.off("dragend", f);} ); } }; }) .directive('onDrop', function () { return { link: function (scope, elm, attrs) { var f = function () { scope.$apply(attrs.onDrop); }; elm.on("drop", f); scope.$on("$destroy", function(){ elm.off("drop", f);} ); } }; }) .directive('onOutsideClick', function ($timeout) { return function (scope, element, attrs) { var eventBindings = []; function oneTimeClick(event) { var el = event.target.nodeName; //ignore link and button clicks var els = ["INPUT","A","BUTTON"]; if(els.indexOf(el) >= 0){return;} // ignore children of links and buttons // ignore clicks on new overlay var parents = $(event.target).parents("a,button,.umb-overlay"); if(parents.length > 0){ return; } // ignore clicks on dialog from old dialog service var oldDialog = $(el).parents("#old-dialog-service"); if (oldDialog.length === 1) { return; } // ignore clicks in tinyMCE dropdown(floatpanel) var floatpanel = $(el).parents(".mce-floatpanel"); if (floatpanel.length === 1) { return; } //ignore clicks inside this element if( $(element).has( $(event.target) ).length > 0 ){ return; } scope.$apply(attrs.onOutsideClick); } $timeout(function(){ if ("bindClickOn" in attrs) { eventBindings.push(scope.$watch(function() { return attrs.bindClickOn; }, function(newValue) { if (newValue === "true") { $(document).on("click", oneTimeClick); } else { $(document).off("click", oneTimeClick); } })); } else { $(document).on("click", oneTimeClick); } scope.$on("$destroy", function() { $(document).off("click", oneTimeClick); // unbind watchers for (var e in eventBindings) { eventBindings[e](); } }); }); // Temp removal of 1 sec timeout to prevent bug where overlay does not open. We need to find a better solution. }; }) .directive('onRightClick',function(){ document.oncontextmenu = function (e) { if(e.target.hasAttribute('on-right-click')) { e.preventDefault(); e.stopPropagation(); return false; } }; return function(scope,el,attrs){ el.on('contextmenu',function(e){ e.preventDefault(); e.stopPropagation(); scope.$apply(attrs.onRightClick); return false; }); }; }) .directive('onDelayedMouseleave', function ($timeout, $parse) { return { restrict: 'A', link: function (scope, element, attrs, ctrl) { var active = false; var fn = $parse(attrs.onDelayedMouseleave); var leave_f = function(event) { var callback = function() { fn(scope, {$event:event}); }; active = false; $timeout(function(){ if(active === false){ scope.$apply(callback); } }, 650); }; var enter_f = function(event, args){ active = true; }; element.on("mouseleave", leave_f); element.on("mouseenter", enter_f); //unsub events scope.$on("$destroy", function(){ element.off("mouseleave", leave_f); element.off("mouseenter", enter_f); }); } }; }); /* http://vitalets.github.io/checklist-model/ <label ng-repeat="role in roles"> <input type="checkbox" checklist-model="user.roles" checklist-value="role.id"> {{role.text}} </label> */ angular.module('umbraco.directives') .directive('checklistModel', ['$parse', '$compile', function($parse, $compile) { // contains function contains(arr, item) { if (angular.isArray(arr)) { for (var i = 0; i < arr.length; i++) { if (angular.equals(arr[i], item)) { return true; } } } return false; } // add function add(arr, item) { arr = angular.isArray(arr) ? arr : []; for (var i = 0; i < arr.length; i++) { if (angular.equals(arr[i], item)) { return arr; } } arr.push(item); return arr; } // remove function remove(arr, item) { if (angular.isArray(arr)) { for (var i = 0; i < arr.length; i++) { if (angular.equals(arr[i], item)) { arr.splice(i, 1); break; } } } return arr; } // http://stackoverflow.com/a/19228302/1458162 function postLinkFn(scope, elem, attrs) { // compile with `ng-model` pointing to `checked` $compile(elem)(scope); // getter / setter for original model var getter = $parse(attrs.checklistModel); var setter = getter.assign; // value added to list var value = $parse(attrs.checklistValue)(scope.$parent); // watch UI checked change scope.$watch('checked', function(newValue, oldValue) { if (newValue === oldValue) { return; } var current = getter(scope.$parent); if (newValue === true) { setter(scope.$parent, add(current, value)); } else { setter(scope.$parent, remove(current, value)); } }); // watch original model change scope.$parent.$watch(attrs.checklistModel, function(newArr, oldArr) { scope.checked = contains(newArr, value); }, true); } return { restrict: 'A', priority: 1000, terminal: true, scope: true, compile: function(tElement, tAttrs) { if (tElement[0].tagName !== 'INPUT' || !tElement.attr('type', 'checkbox')) { throw 'checklist-model should be applied to `input[type="checkbox"]`.'; } if (!tAttrs.checklistValue) { throw 'You should provide `checklist-value`.'; } // exclude recursion tElement.removeAttr('checklist-model'); // local scope var storing individual checkbox model tElement.attr('ng-model', 'checked'); return postLinkFn; } }; }]); angular.module("umbraco.directives") .directive("contenteditable", function() { return { require: "ngModel", link: function(scope, element, attrs, ngModel) { function read() { ngModel.$setViewValue(element.html()); } ngModel.$render = function() { element.html(ngModel.$viewValue || ""); }; element.bind("focus", function(){ var range = document.createRange(); range.selectNodeContents(element[0]); var sel = window.getSelection(); sel.removeAllRanges(); sel.addRange(range); }); element.bind("blur keyup change", function() { scope.$apply(read); }); } }; }); /** * @ngdoc directive * @name umbraco.directives.directive:fixNumber * @restrict A * @description Used in conjunction with type='number' input fields to ensure that the bound value is converted to a number when using ng-model * because normally it thinks it's a string and also validation doesn't work correctly due to an angular bug. **/ function fixNumber($parse) { return { restrict: "A", require: "ngModel", link: function (scope, elem, attrs, ctrl) { //parse ngModel onload var modelVal = scope.$eval(attrs.ngModel); if (modelVal) { var asNum = parseFloat(modelVal, 10); if (!isNaN(asNum)) { $parse(attrs.ngModel).assign(scope, asNum); } } //always return an int to the model ctrl.$parsers.push(function (value) { if (value === 0) { return 0; } return parseFloat(value || '', 10); }); //always try to format the model value as an int ctrl.$formatters.push(function (value) { if (angular.isString(value)) { return parseFloat(value, 10); } return value; }); //This fixes this angular issue: //https://github.com/angular/angular.js/issues/2144 // which doesn't actually validate the number input properly since the model only changes when a real number is entered // but the input box still allows non-numbers to be entered which do not validate (only via html5) if (typeof elem.prop('validity') === 'undefined') { return; } elem.bind('input', function (e) { var validity = elem.prop('validity'); scope.$apply(function () { ctrl.$setValidity('number', !validity.badInput); }); }); } }; } angular.module('umbraco.directives').directive("fixNumber", fixNumber); angular.module("umbraco.directives").directive('focusWhen', function ($timeout) { return { restrict: 'A', link: function (scope, elm, attrs, ctrl) { attrs.$observe("focusWhen", function (newValue) { if (newValue === "true") { $timeout(function () { elm.focus(); }); } }); } }; }); /** * @ngdoc directive * @name umbraco.directives.directive:hexBgColor * @restrict A * @description Used to set a hex background color on an element, this will detect valid hex and when it is valid it will set the color, otherwise * a color will not be set. **/ function hexBgColor() { return { restrict: "A", link: function (scope, element, attr, formCtrl) { var origColor = null; if (attr.hexBgOrig) { //set the orig based on the attribute if there is one origColor = attr.hexBgOrig; } attr.$observe("hexBgColor", function (newVal) { if (newVal) { if (!origColor) { //get the orig color before changing it origColor = element.css("border-color"); } //validate it - test with and without the leading hash. if (/^([0-9a-f]{3}|[0-9a-f]{6})$/i.test(newVal)) { element.css("background-color", "#" + newVal); return; } if (/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(newVal)) { element.css("background-color", newVal); return; } } element.css("background-color", origColor); }); } }; } angular.module('umbraco.directives').directive("hexBgColor", hexBgColor); /** * @ngdoc directive * @name umbraco.directives.directive:hotkey **/ angular.module("umbraco.directives") .directive('hotkey', function($window, keyboardService, $log) { return function(scope, el, attrs) { var options = {}; var keyCombo = attrs.hotkey; if (!keyCombo) { //support data binding keyCombo = scope.$eval(attrs["hotkey"]); } function activate() { if (keyCombo) { // disable shortcuts in input fields if keycombo is 1 character if (keyCombo.length === 1) { options = { inputDisabled: true }; } keyboardService.bind(keyCombo, function() { var element = $(el); var activeElementType = document.activeElement.tagName; var clickableElements = ["A", "BUTTON"]; if (element.is("a,div,button,input[type='button'],input[type='submit'],input[type='checkbox']") && !element.is(':disabled')) { if (element.is(':visible') || attrs.hotkeyWhenHidden) { if (attrs.hotkeyWhen && attrs.hotkeyWhen === "false") { return; } // when keycombo is enter and a link or button has focus - click the link or button instead of using the hotkey if (keyCombo === "enter" && clickableElements.indexOf(activeElementType) === 0) { document.activeElement.click(); } else { element.click(); } } } else { element.focus(); } }, options); el.on('$destroy', function() { keyboardService.unbind(keyCombo); }); } } activate(); }; }); /** @ngdoc directive @name umbraco.directives.directive:preventDefault @description Use this directive to prevent default action of an element. Effectively implementing <a href="https://api.jquery.com/event.preventdefault/">jQuery's preventdefault</a> <h3>Markup example</h3> <pre> <a href="https://umbraco.com" prevent-default>Don't go to Umbraco.com</a> </pre> **/ angular.module("umbraco.directives") .directive('preventDefault', function() { return function(scope, element, attrs) { var enabled = true; //check if there's a value for the attribute, if there is and it's false then we conditionally don't //prevent default. if (attrs.preventDefault) { attrs.$observe("preventDefault", function (newVal) { enabled = (newVal === "false" || newVal === 0 || newVal === false) ? false : true; }); } $(element).click(function (event) { if (event.metaKey || event.ctrlKey) { return; } else { if (enabled === true) { event.preventDefault(); } } }); }; }); /** * @ngdoc directive * @name umbraco.directives.directive:preventEnterSubmit * @description prevents a form from submitting when the enter key is pressed on an input field **/ angular.module("umbraco.directives") .directive('preventEnterSubmit', function() { return function(scope, element, attrs) { var enabled = true; //check if there's a value for the attribute, if there is and it's false then we conditionally don't //prevent default. if (attrs.preventEnterSubmit) { attrs.$observe("preventEnterSubmit", function (newVal) { enabled = (newVal === "false" || newVal === 0 || newVal === false) ? false : true; }); } $(element).keypress(function (event) { if (event.which === 13) { event.preventDefault(); } }); }; }); /** * @ngdoc directive * @name umbraco.directives.directive:resizeToContent * @element div * @function * * @description * Resize iframe's automatically to fit to the content they contain * * @example <example module="umbraco.directives"> <file name="index.html"> <iframe resize-to-content src="meh.html"></iframe> </file> </example> */ angular.module("umbraco.directives") .directive('resizeToContent', function ($window, $timeout) { return function (scope, el, attrs) { var iframe = el[0]; var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow; if (iframeWin.document.body) { $timeout(function(){ var height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight; el.height(height); }, 3000); } }; }); angular.module("umbraco.directives") .directive('selectOnFocus', function () { return function (scope, el, attrs) { $(el).bind("click", function () { var editmode = $(el).data("editmode"); //If editmode is true a click is handled like a normal click if (!editmode) { //Initial click, select entire text this.select(); //Set the edit mode so subsequent clicks work normally $(el).data("editmode", true); } }). bind("blur", function () { //Reset on focus lost $(el).data("editmode", false); }); }; }); angular.module("umbraco.directives") .directive('umbAutoFocus', function($timeout) { return function(scope, element, attr){ var update = function() { //if it uses its default naming if(element.val() === "" || attr.focusOnFilled){ element.focus(); } }; $timeout(function() { update(); }); }; }); angular.module("umbraco.directives") .directive('umbAutoResize', function($timeout) { return { require: ["^?umbTabs", "ngModel"], link: function(scope, element, attr, controllersArr) { var domEl = element[0]; var domElType = domEl.type; var umbTabsController = controllersArr[0]; var ngModelController = controllersArr[1]; // IE elements var isIEFlag = false; var wrapper = angular.element('#umb-ie-resize-input-wrapper'); var mirror = angular.element('<span style="white-space:pre;"></span>'); function isIE() { var ua = window.navigator.userAgent; var msie = ua.indexOf("MSIE "); if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) || navigator.userAgent.match(/Edge\/\d+/)) { return true; } else { return false; } } function activate() { // check if browser is Internet Explorere isIEFlag = isIE(); // scrollWidth on element does not work in IE on inputs // we have to do some dirty dom element copying. if (isIEFlag === true && domElType === "text") { setupInternetExplorerElements(); } } function setupInternetExplorerElements() { if (!wrapper.length) { wrapper = angular.element('<div id="umb-ie-resize-input-wrapper" style="position:fixed; top:-999px; left:0;"></div>'); angular.element('body').append(wrapper); } angular.forEach(['fontFamily', 'fontSize', 'fontWeight', 'fontStyle', 'letterSpacing', 'textTransform', 'wordSpacing', 'textIndent', 'boxSizing', 'borderRightWidth', 'borderLeftWidth', 'borderLeftStyle', 'borderRightStyle', 'paddingLeft', 'paddingRight', 'marginLeft', 'marginRight' ], function(value) { mirror.css(value, element.css(value)); }); wrapper.append(mirror); } function resizeInternetExplorerInput() { mirror.text(element.val() || attr.placeholder); element.css('width', mirror.outerWidth() + 1); } function resizeInput() { if (domEl.scrollWidth !== domEl.clientWidth) { if (ngModelController.$modelValue) { element.width(domEl.scrollWidth); } } if(!ngModelController.$modelValue && attr.placeholder) { attr.$set('size', attr.placeholder.length); element.width('auto'); } } function resizeTextarea() { if(domEl.scrollHeight !== domEl.clientHeight) { element.height(domEl.scrollHeight); } } var update = function(force) { if (force === true) { if (domElType === "textarea") { element.height(0); } else if (domElType === "text") { element.width(0); } } if (isIEFlag === true && domElType === "text") { resizeInternetExplorerInput(); } else { if (domElType === "textarea") { resizeTextarea(); } else if (domElType === "text") { resizeInput(); } } }; activate(); //listen for tab changes if (umbTabsController != null) { umbTabsController.onTabShown(function(args) { update(); }); } // listen for ng-model changes var unbindModelWatcher = scope.$watch(function() { return ngModelController.$modelValue; }, function(newValue) { update(true); }); scope.$on('$destroy', function() { element.unbind('keyup keydown keypress change', update); element.unbind('blur', update(true)); unbindModelWatcher(); // clean up IE dom element if (isIEFlag === true && domElType === "text") { mirror.remove(); } }); } }; }); /* example usage: <textarea json-edit="myObject" rows="8" class="form-control"></textarea> jsonEditing is a string which we edit in a textarea. we try parsing to JSON with each change. when it is valid, propagate model changes via ngModelCtrl use isolate scope to prevent model propagation when invalid - will update manually. cannot replace with template, or will override ngModelCtrl, and not hide behind facade will override element type to textarea and add own attribute ngModel tied to jsonEditing */ angular.module("umbraco.directives") .directive('umbRawModel', function () { return { restrict: 'A', require: 'ngModel', template: '<textarea ng-model="jsonEditing"></textarea>', replace : true, scope: { model: '=umbRawModel', validateOn:'=' }, link: function (scope, element, attrs, ngModelCtrl) { function setEditing (value) { scope.jsonEditing = angular.copy( jsonToString(value)); } function updateModel (value) { scope.model = stringToJson(value); } function setValid() { ngModelCtrl.$setValidity('json', true); } function setInvalid () { ngModelCtrl.$setValidity('json', false); } function stringToJson(text) { try { return angular.fromJson(text); } catch (err) { setInvalid(); return text; } } function jsonToString(object) { // better than JSON.stringify(), because it formats + filters $$hashKey etc. // NOTE that this will remove all $-prefixed values return angular.toJson(object, true); } function isValidJson(model) { var flag = true; try { angular.fromJson(model); } catch (err) { flag = false; } return flag; } //init setEditing(scope.model); var onInputChange = function(newval,oldval){ if (newval !== oldval) { if (isValidJson(newval)) { setValid(); updateModel(newval); } else { setInvalid(); } } }; if(scope.validateOn){ element.on(scope.validateOn, function(){ scope.$apply(function(){ onInputChange(scope.jsonEditing); }); }); }else{ //check for changes going out scope.$watch('jsonEditing', onInputChange, true); } //check for changes coming in scope.$watch('model', function (newval, oldval) { if (newval !== oldval) { setEditing(newval); } }, true); } }; }); (function() { 'use strict'; function SelectWhen($timeout) { function link(scope, el, attr, ctrl) { attr.$observe("umbSelectWhen", function(newValue) { if (newValue === "true") { $timeout(function() { el.select(); }); } }); } var directive = { restrict: 'A', link: link }; return directive; } angular.module('umbraco.directives').directive('umbSelectWhen', SelectWhen); })(); angular.module("umbraco.directives") .directive('gridRte', function (tinyMceService, stylesheetResource, angularHelper, assetsService, $q, $timeout) { return { scope: { uniqueId: '=', value: '=', onClick: '&', onFocus: '&', onBlur: '&', configuration:"=", onMediaPickerClick: "=", onEmbedClick: "=", onMacroPickerClick: "=", onLinkPickerClick: "=" }, template: "<textarea ng-model=\"value\" rows=\"10\" class=\"mceNoEditor\" style=\"overflow:hidden\" id=\"{{uniqueId}}\"></textarea>", replace: true, link: function (scope, element, attrs) { var initTiny = function () { //we always fetch the default one, and then override parts with our own tinyMceService.configuration().then(function (tinyMceConfig) { //config value from general tinymce.config file var validElements = tinyMceConfig.validElements; var fallbackStyles = [{title: "Page header", block: "h2"}, {title: "Section header", block: "h3"}, {title: "Paragraph header", block: "h4"}, {title: "Normal", block: "p"}, {title: "Quote", block: "blockquote"}, {title: "Code", block: "code"}]; //These are absolutely required in order for the macros to render inline //we put these as extended elements because they get merged on top of the normal allowed elements by tiny mce var extendedValidElements = "@[id|class|style],-div[id|dir|class|align|style],ins[datetime|cite],-ul[class|style],-li[class|style],-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],-h3[id|dir|class|align|style],-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|style|dir|class|align],span[id|class|style]"; var invalidElements = tinyMceConfig.inValidElements; var plugins = _.map(tinyMceConfig.plugins, function (plugin) { if (plugin.useOnFrontend) { return plugin.name; } }).join(" ") + " autoresize"; //config value on the data type var toolbar = ["code", "styleselect", "bold", "italic", "alignleft", "aligncenter", "alignright", "bullist", "numlist", "link", "umbmediapicker", "umbembeddialog"].join(" | "); var stylesheets = []; var styleFormats = []; var await = []; //queue file loading if (typeof (tinymce) === "undefined") { await.push(assetsService.loadJs("lib/tinymce/tinymce.min.js", scope)); } if(scope.configuration && scope.configuration.toolbar){ toolbar = scope.configuration.toolbar.join(' | '); } if(scope.configuration && scope.configuration.stylesheets){ angular.forEach(scope.configuration.stylesheets, function(stylesheet, key){ stylesheets.push(Umbraco.Sys.ServerVariables.umbracoSettings.cssPath + "/" + stylesheet + ".css"); await.push(stylesheetResource.getRulesByName(stylesheet).then(function (rules) { angular.forEach(rules, function (rule) { var r = {}; var split = ""; r.title = rule.name; if (rule.selector[0] === ".") { r.inline = "span"; r.classes = rule.selector.substring(1); }else if (rule.selector[0] === "#") { //Even though this will render in the style drop down, it will not actually be applied // to the elements, don't think TinyMCE even supports this and it doesn't really make much sense // since only one element can have one id. r.inline = "span"; r.attributes = { id: rule.selector.substring(1) }; }else if (rule.selector[0] !== "." && rule.selector.indexOf(".") > -1) { split = rule.selector.split("."); r.block = split[0]; r.classes = rule.selector.substring(rule.selector.indexOf(".") + 1).replace(".", " "); }else if (rule.selector[0] !== "#" && rule.selector.indexOf("#") > -1) { split = rule.selector.split("#"); r.block = split[0]; r.classes = rule.selector.substring(rule.selector.indexOf("#") + 1); }else { r.block = rule.selector; } styleFormats.push(r); }); })); }); }else{ stylesheets.push("views/propertyeditors/grid/config/grid.default.rtestyles.css"); styleFormats = fallbackStyles; } //stores a reference to the editor var tinyMceEditor = null; $q.all(await).then(function () { var uniqueId = scope.uniqueId; //create a baseline Config to exten upon var baseLineConfigObj = { mode: "exact", skin: "umbraco", plugins: plugins, valid_elements: validElements, invalid_elements: invalidElements, extended_valid_elements: extendedValidElements, menubar: false, statusbar: false, relative_urls: false, toolbar: toolbar, content_css: stylesheets, style_formats: styleFormats, autoresize_bottom_margin: 0 }; if (tinyMceConfig.customConfig) { //if there is some custom config, we need to see if the string value of each item might actually be json and if so, we need to // convert it to json instead of having it as a string since this is what tinymce requires for (var i in tinyMceConfig.customConfig) { var val = tinyMceConfig.customConfig[i]; if (val) { val = val.toString().trim(); if (val.detectIsJson()) { try { tinyMceConfig.customConfig[i] = JSON.parse(val); //now we need to check if this custom config key is defined in our baseline, if it is we don't want to //overwrite the baseline config item if it is an array, we want to concat the items in the array, otherwise //if it's an object it will overwrite the baseline if (angular.isArray(baseLineConfigObj[i]) && angular.isArray(tinyMceConfig.customConfig[i])) { //concat it and below this concat'd array will overwrite the baseline in angular.extend tinyMceConfig.customConfig[i] = baseLineConfigObj[i].concat(tinyMceConfig.customConfig[i]); } } catch (e) { //cannot parse, we'll just leave it } } } } angular.extend(baseLineConfigObj, tinyMceConfig.customConfig); } //set all the things that user configs should not be able to override baseLineConfigObj.elements = uniqueId; baseLineConfigObj.setup = function (editor) { //set the reference tinyMceEditor = editor; //enable browser based spell checking editor.on('init', function (e) { editor.getBody().setAttribute('spellcheck', true); //force overflow to hidden to prevent no needed scroll editor.getBody().style.overflow = "hidden"; $timeout(function(){ if(scope.value === null){ editor.focus(); } }, 400); }); //when we leave the editor (maybe) editor.on('blur', function (e) { editor.save(); angularHelper.safeApply(scope, function () { scope.value = editor.getContent(); var _toolbar = $(editor.editorContainer) .find(".mce-toolbar"); if(scope.onBlur){ scope.onBlur(); } }); }); // Focus on editor editor.on('focus', function (e) { angularHelper.safeApply(scope, function () { if(scope.onFocus){ scope.onFocus(); } }); }); // Click on editor editor.on('click', function (e) { angularHelper.safeApply(scope, function () { if(scope.onClick){ scope.onClick(); } }); }); //when buttons modify content editor.on('ExecCommand', function (e) { editor.save(); angularHelper.safeApply(scope, function () { scope.value = editor.getContent(); }); }); // Update model on keypress editor.on('KeyUp', function (e) { editor.save(); angularHelper.safeApply(scope, function () { scope.value = editor.getContent(); }); }); // Update model on change, i.e. copy/pasted text, plugins altering content editor.on('SetContent', function (e) { if (!e.initial) { editor.save(); angularHelper.safeApply(scope, function () { scope.value = editor.getContent(); }); } }); editor.on('ObjectResized', function (e) { var qs = "?width=" + e.width + "&height=" + e.height; var srcAttr = $(e.target).attr("src"); var path = srcAttr.split("?")[0]; $(e.target).attr("data-mce-src", path + qs); }); //Create the insert link plugin tinyMceService.createLinkPicker(editor, scope, function(currentTarget, anchorElement){ if(scope.onLinkPickerClick) { scope.onLinkPickerClick(editor, currentTarget, anchorElement); } }); //Create the insert media plugin tinyMceService.createMediaPicker(editor, scope, function(currentTarget, userData){ if(scope.onMediaPickerClick) { scope.onMediaPickerClick(editor, currentTarget, userData); } }); //Create the embedded plugin tinyMceService.createInsertEmbeddedMedia(editor, scope, function(){ if(scope.onEmbedClick) { scope.onEmbedClick(editor); } }); //Create the insert macro plugin tinyMceService.createInsertMacro(editor, scope, function(dialogData){ if(scope.onMacroPickerClick) { scope.onMacroPickerClick(editor, dialogData); } }); }; /** Loads in the editor */ function loadTinyMce() { //we need to add a timeout here, to force a redraw so TinyMCE can find //the elements needed $timeout(function () { tinymce.DOM.events.domLoaded = true; tinymce.init(baseLineConfigObj); }, 150, false); } loadTinyMce(); //here we declare a special method which will be called whenever the value has changed from the server //this is instead of doing a watch on the model.value = faster //scope.model.onValueChanged = function (newVal, oldVal) { // //update the display val again if it has changed from the server; // tinyMceEditor.setContent(newVal, { format: 'raw' }); // //we need to manually fire this event since it is only ever fired based on loading from the DOM, this // // is required for our plugins listening to this event to execute // tinyMceEditor.fire('LoadContent', null); //}; //listen for formSubmitting event (the result is callback used to remove the event subscription) var unsubscribe = scope.$on("formSubmitting", function () { //TODO: Here we should parse out the macro rendered content so we can save on a lot of bytes in data xfer // we do parse it out on the server side but would be nice to do that on the client side before as well. scope.value = tinyMceEditor.getContent(); }); //when the element is disposed we need to unsubscribe! // NOTE: this is very important otherwise if this is part of a modal, the listener still exists because the dom // element might still be there even after the modal has been hidden. scope.$on('$destroy', function () { unsubscribe(); }); }); }); }; initTiny(); } }; }); /** * @ngdoc directive * @name umbraco.directives.directive:umbControlGroup * @restrict E **/ angular.module("umbraco.directives.html") .directive('umbControlGroup', function (localizationService) { return { scope: { label: "@label", description: "@", hideLabel: "@", alias: "@" }, require: '?^form', transclude: true, restrict: 'E', replace: true, templateUrl: 'views/components/html/umb-control-group.html', link: function (scope, element, attr, formCtrl) { scope.formValid = function() { if (formCtrl) { return formCtrl.$valid; } //there is no form. return true; }; if (scope.label && scope.label[0] === "@") { scope.labelstring = localizationService.localize(scope.label.substring(1)); } else { scope.labelstring = scope.label; } if (scope.description && scope.description[0] === "@") { scope.descriptionstring = localizationService.localize(scope.description.substring(1)); } else { scope.descriptionstring = scope.description; } } }; }); /** * @ngdoc directive * @name umbraco.directives.directive:umbPane * @restrict E **/ angular.module("umbraco.directives.html") .directive('umbPane', function () { return { transclude: true, restrict: 'E', replace: true, templateUrl: 'views/components/html/umb-pane.html' }; }); /** * @ngdoc directive * @name umbraco.directives.directive:umbPanel * @restrict E **/ angular.module("umbraco.directives.html") .directive('umbPanel', function($timeout, $log){ return { restrict: 'E', replace: true, transclude: 'true', templateUrl: 'views/components/html/umb-panel.html' }; }); /** * @ngdoc directive * @name umbraco.directives.directive:umbImageCrop * @restrict E * @function **/ angular.module("umbraco.directives") .directive('umbImageCrop', function ($timeout, localizationService, cropperHelper, $log) { return { restrict: 'E', replace: true, templateUrl: 'views/components/imaging/umb-image-crop.html', scope: { src: '=', width: '@', height: '@', crop: "=", center: "=", maxSize: '@' }, link: function(scope, element, attrs) { scope.width = 400; scope.height = 320; scope.dimensions = { image: {}, cropper:{}, viewport:{}, margin: 20, scale: { min: 0.3, max: 3, current: 1 } }; //live rendering of viewport and image styles scope.style = function () { return { 'height': (parseInt(scope.dimensions.viewport.height, 10)) + 'px', 'width': (parseInt(scope.dimensions.viewport.width, 10)) + 'px' }; }; //elements var $viewport = element.find(".viewport"); var $image = element.find("img"); var $overlay = element.find(".overlay"); var $container = element.find(".crop-container"); //default constraints for drag n drop var constraints = {left: {max: scope.dimensions.margin, min: scope.dimensions.margin}, top: {max: scope.dimensions.margin, min: scope.dimensions.margin}, }; scope.constraints = constraints; //set constaints for cropping drag and drop var setConstraints = function(){ constraints.left.min = scope.dimensions.margin + scope.dimensions.cropper.width - scope.dimensions.image.width; constraints.top.min = scope.dimensions.margin + scope.dimensions.cropper.height - scope.dimensions.image.height; }; var setDimensions = function(originalImage){ originalImage.width("auto"); originalImage.height("auto"); var image = {}; image.originalWidth = originalImage.width(); image.originalHeight = originalImage.height(); image.width = image.originalWidth; image.height = image.originalHeight; image.left = originalImage[0].offsetLeft; image.top = originalImage[0].offsetTop; scope.dimensions.image = image; //unscaled editor size //var viewPortW = $viewport.width(); //var viewPortH = $viewport.height(); var _viewPortW = parseInt(scope.width, 10); var _viewPortH = parseInt(scope.height, 10); //if we set a constraint we will scale it down if needed if(scope.maxSize){ var ratioCalculation = cropperHelper.scaleToMaxSize( _viewPortW, _viewPortH, scope.maxSize); //so if we have a max size, override the thumb sizes _viewPortW = ratioCalculation.width; _viewPortH = ratioCalculation.height; } scope.dimensions.viewport.width = _viewPortW + 2 * scope.dimensions.margin; scope.dimensions.viewport.height = _viewPortH + 2 * scope.dimensions.margin; scope.dimensions.cropper.width = _viewPortW; // scope.dimensions.viewport.width - 2 * scope.dimensions.margin; scope.dimensions.cropper.height = _viewPortH; // scope.dimensions.viewport.height - 2 * scope.dimensions.margin; }; //when loading an image without any crop info, we center and fit it var resizeImageToEditor = function(){ //returns size fitting the cropper var size = cropperHelper.calculateAspectRatioFit( scope.dimensions.image.width, scope.dimensions.image.height, scope.dimensions.cropper.width, scope.dimensions.cropper.height, true); //sets the image size and updates the scope scope.dimensions.image.width = size.width; scope.dimensions.image.height = size.height; //calculate the best suited ratios scope.dimensions.scale.min = size.ratio; scope.dimensions.scale.max = 2; scope.dimensions.scale.current = size.ratio; //center the image var position = cropperHelper.centerInsideViewPort(scope.dimensions.image, scope.dimensions.cropper); scope.dimensions.top = position.top; scope.dimensions.left = position.left; setConstraints(); }; //resize to a given ratio var resizeImageToScale = function(ratio){ //do stuff var size = cropperHelper.calculateSizeToRatio(scope.dimensions.image.originalWidth, scope.dimensions.image.originalHeight, ratio); scope.dimensions.image.width = size.width; scope.dimensions.image.height = size.height; setConstraints(); validatePosition(scope.dimensions.image.left, scope.dimensions.image.top); }; //resize the image to a predefined crop coordinate var resizeImageToCrop = function(){ scope.dimensions.image = cropperHelper.convertToStyle( scope.crop, {width: scope.dimensions.image.originalWidth, height: scope.dimensions.image.originalHeight}, scope.dimensions.cropper, scope.dimensions.margin); var ratioCalculation = cropperHelper.calculateAspectRatioFit( scope.dimensions.image.originalWidth, scope.dimensions.image.originalHeight, scope.dimensions.cropper.width, scope.dimensions.cropper.height, true); scope.dimensions.scale.current = scope.dimensions.image.ratio; //min max based on original width/height scope.dimensions.scale.min = ratioCalculation.ratio; scope.dimensions.scale.max = 2; }; var validatePosition = function(left, top){ if(left > constraints.left.max) { left = constraints.left.max; } if(left <= constraints.left.min){ left = constraints.left.min; } if(top > constraints.top.max) { top = constraints.top.max; } if(top <= constraints.top.min){ top = constraints.top.min; } if(scope.dimensions.image.left !== left){ scope.dimensions.image.left = left; } if(scope.dimensions.image.top !== top){ scope.dimensions.image.top = top; } }; //sets scope.crop to the recalculated % based crop var calculateCropBox = function(){ scope.crop = cropperHelper.pixelsToCoordinates(scope.dimensions.image, scope.dimensions.cropper.width, scope.dimensions.cropper.height, scope.dimensions.margin); }; //Drag and drop positioning, using jquery ui draggable var onStartDragPosition, top, left; $overlay.draggable({ drag: function(event, ui) { scope.$apply(function(){ validatePosition(ui.position.left, ui.position.top); }); }, stop: function(event, ui){ scope.$apply(function(){ //make sure that every validates one more time... validatePosition(ui.position.left, ui.position.top); calculateCropBox(); scope.dimensions.image.rnd = Math.random(); }); } }); var init = function(image){ scope.loaded = false; //set dimensions on image, viewport, cropper etc setDimensions(image); //if we have a crop already position the image if(scope.crop){ resizeImageToCrop(); }else{ resizeImageToEditor(); } //sets constaints for the cropper setConstraints(); scope.loaded = true; }; /// WATCHERS //// scope.$watchCollection('[width, height]', function(newValues, oldValues){ //we have to reinit the whole thing if //one of the external params changes if(newValues !== oldValues){ setDimensions($image); setConstraints(); } }); var throttledResizing = _.throttle(function(){ resizeImageToScale(scope.dimensions.scale.current); calculateCropBox(); }, 100); //happens when we change the scale scope.$watch("dimensions.scale.current", function(){ if(scope.loaded){ throttledResizing(); } }); //ie hack if(window.navigator.userAgent.indexOf("MSIE ")){ var ranger = element.find("input"); ranger.bind("change",function(){ scope.$apply(function(){ scope.dimensions.scale.current = ranger.val(); }); }); } //// INIT ///// $image.load(function(){ $timeout(function(){ init($image); }); }); } }; }); /** * @ngdoc directive * @name umbraco.directives.directive:umbImageGravity * @restrict E * @function * @description **/ angular.module("umbraco.directives") .directive('umbImageGravity', function ($timeout, localizationService, $log) { return { restrict: 'E', replace: true, templateUrl: 'views/components/imaging/umb-image-gravity.html', scope: { src: '=', center: "=", onImageLoaded: "=" }, link: function(scope, element, attrs) { //Internal values for keeping track of the dot and the size of the editor scope.dimensions = { width: 0, height: 0, left: 0, top: 0 }; scope.loaded = false; //elements var $viewport = element.find(".viewport"); var $image = element.find("img"); var $overlay = element.find(".overlay"); scope.style = function () { if(scope.dimensions.width <= 0){ setDimensions(); } return { 'top': scope.dimensions.top + 'px', 'left': scope.dimensions.left + 'px' }; }; scope.setFocalPoint = function(event) { scope.$emit("imageFocalPointStart"); var offsetX = event.offsetX - 10; var offsetY = event.offsetY - 10; calculateGravity(offsetX, offsetY); lazyEndEvent(); }; var setDimensions = function(){ scope.dimensions.width = $image.width(); scope.dimensions.height = $image.height(); if(scope.center){ scope.dimensions.left = scope.center.left * scope.dimensions.width -10; scope.dimensions.top = scope.center.top * scope.dimensions.height -10; }else{ scope.center = { left: 0.5, top: 0.5 }; } }; var calculateGravity = function(offsetX, offsetY){ scope.dimensions.left = offsetX; scope.dimensions.top = offsetY; scope.center.left = (scope.dimensions.left+10) / scope.dimensions.width; scope.center.top = (scope.dimensions.top+10) / scope.dimensions.height; }; var lazyEndEvent = _.debounce(function(){ scope.$apply(function(){ scope.$emit("imageFocalPointStop"); }); }, 2000); //Drag and drop positioning, using jquery ui draggable //TODO ensure that the point doesnt go outside the box $overlay.draggable({ containment: "parent", start: function(){ scope.$apply(function(){ scope.$emit("imageFocalPointStart"); }); }, stop: function() { scope.$apply(function(){ var offsetX = $overlay[0].offsetLeft; var offsetY = $overlay[0].offsetTop; calculateGravity(offsetX, offsetY); }); lazyEndEvent(); } }); //// INIT ///// $image.load(function(){ $timeout(function(){ setDimensions(); scope.loaded = true; scope.onImageLoaded(); }); }); $(window).on('resize.umbImageGravity', function(){ scope.$apply(function(){ $timeout(function(){ setDimensions(); }); var offsetX = $overlay[0].offsetLeft; var offsetY = $overlay[0].offsetTop; calculateGravity(offsetX, offsetY); }); }); scope.$on('$destroy', function() { $(window).off('.umbImageGravity'); }); } }; }); /** * @ngdoc directive * @name umbraco.directives.directive:umbImageThumbnail * @restrict E * @function * @description **/ angular.module("umbraco.directives") .directive('umbImageThumbnail', function ($timeout, localizationService, cropperHelper, $log) { return { restrict: 'E', replace: true, templateUrl: 'views/components/imaging/umb-image-thumbnail.html', scope: { src: '=', width: '@', height: '@', center: "=", crop: "=", maxSize: '@' }, link: function(scope, element, attrs) { //// INIT ///// var $image = element.find("img"); scope.loaded = false; $image.load(function(){ $timeout(function(){ $image.width("auto"); $image.height("auto"); scope.image = {}; scope.image.width = $image[0].width; scope.image.height = $image[0].height; //we force a lower thumbnail size to fit the max size //we do not compare to the image dimensions, but the thumbs if(scope.maxSize){ var ratioCalculation = cropperHelper.calculateAspectRatioFit( scope.width, scope.height, scope.maxSize, scope.maxSize, false); //so if we have a max size, override the thumb sizes scope.width = ratioCalculation.width; scope.height = ratioCalculation.height; } setPreviewStyle(); scope.loaded = true; }); }); /// WATCHERS //// scope.$watchCollection('[crop, center]', function(newValues, oldValues){ //we have to reinit the whole thing if //one of the external params changes setPreviewStyle(); }); scope.$watch("center", function(){ setPreviewStyle(); }, true); function setPreviewStyle(){ if(scope.crop && scope.image){ scope.preview = cropperHelper.convertToStyle( scope.crop, scope.image, {width: scope.width, height: scope.height}, 0); }else if(scope.image){ //returns size fitting the cropper var p = cropperHelper.calculateAspectRatioFit( scope.image.width, scope.image.height, scope.width, scope.height, true); if(scope.center){ var xy = cropperHelper.alignToCoordinates(p, scope.center, {width: scope.width, height: scope.height}); p.top = xy.top; p.left = xy.left; }else{ } p.position = "absolute"; scope.preview = p; } } } }; }); angular.module("umbraco.directives") /** * @ngdoc directive * @name umbraco.directives.directive:localize * @restrict EA * @function * @description Localize directive **/ .directive('localize', function ($log, localizationService) { return { restrict: 'E', scope:{ key: '@' }, replace: true, link: function (scope, element, attrs) { var key = scope.key; localizationService.localize(key).then(function(value){ element.html(value); }); } }; }) .directive('localize', function ($log, localizationService) { return { restrict: 'A', link: function (scope, element, attrs) { var keys = attrs.localize.split(','); angular.forEach(keys, function(value, key){ var attr = element.attr(value); if(attr){ if(attr[0] === '@'){ var t = localizationService.tokenize(attr.substring(1), scope); localizationService.localize(t.key, t.tokens).then(function(val){ element.attr(value, val); }); } } }); } }; }); /** * @ngdoc directive * @name umbraco.directives.directive:umbNotifications */ (function() { 'use strict'; function NotificationDirective(notificationsService) { function link(scope, el, attr, ctrl) { //subscribes to notifications in the notification service scope.notifications = notificationsService.current; scope.$watch('notificationsService.current', function (newVal, oldVal, scope) { if (newVal) { scope.notifications = newVal; } }); } var directive = { restrict: "E", replace: true, templateUrl: 'views/components/notifications/umb-notifications.html', link: link }; return directive; } angular.module('umbraco.directives').directive('umbNotifications', NotificationDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbOverlay @restrict E @scope @description <h3>Markup example</h3> <pre> <div ng-controller="My.Controller as vm"> <button type="button" ng-click="vm.openOverlay()"></button> <umb-overlay ng-if="vm.overlay.show" model="vm.overlay" view="vm.overlay.view" position="right"> </umb-overlay> </div> </pre> <h3>Controller example</h3> <pre> (function () { "use strict"; function Controller() { var vm = this; vm.openOverlay = openOverlay; function openOverlay() { vm.overlay = { view: "mediapicker", show: true, submit: function(model) { vm.overlay.show = false; vm.overlay = null; }, close: function(oldModel) { vm.overlay.show = false; vm.overlay = null; } } }; } angular.module("umbraco").controller("My.Controller", Controller); })(); </pre> <h1>General Options</h1> Lorem ipsum dolor sit amet.. <table> <thead> <tr> <th>Param</th> <th>Type</th> <th>Details</th> </tr> </thead> <tr> <td>model.title</td> <td>String</td> <td>Set the title of the overlay.</td> </tr> <tr> <td>model.subTitle</td> <td>String</td> <td>Set the subtitle of the overlay.</td> </tr> <tr> <td>model.submitButtonLabel</td> <td>String</td> <td>Set an alternate submit button text</td> </tr> <tr> <td>model.submitButtonLabelKey</td> <td>String</td> <td>Set an alternate submit button label key for localized texts</td> </tr> <tr> <td>model.hideSubmitButton</td> <td>Boolean</td> <td>Hides the submit button</td> </tr> <tr> <td>model.closeButtonLabel</td> <td>String</td> <td>Set an alternate close button text</td> </tr> <tr> <td>model.closeButtonLabelKey</td> <td>String</td> <td>Set an alternate close button label key for localized texts</td> </tr> <tr> <td>model.show</td> <td>Boolean</td> <td>Show/hide the overlay</td> </tr> <tr> <td>model.submit</td> <td>Function</td> <td>Callback function when the overlay submits. Returns the overlay model object</td> </tr> <tr> <td>model.close</td> <td>Function</td> <td>Callback function when the overlay closes. Returns a copy of the overlay model object before being modified</td> </tr> </table> <h1>Content Picker</h1> Opens a content picker.</br> <strong>view: </strong>contentpicker <table> <thead> <tr> <th>Param</th> <th>Type</th> <th>Details</th> </tr> </thead> <tr> <td>model.multiPicker</td> <td>Boolean</td> <td>Pick one or multiple items</td> </tr> </table> <table> <thead> <tr> <th>Returns</th> <th>Type</th> <th>Details</th> </tr> </thead> <tr> <td>model.selection</td> <td>Array</td> <td>Array of content objects</td> </tr> </table> <h1>Icon Picker</h1> Opens an icon picker.</br> <strong>view: </strong>iconpicker <table> <thead> <tr> <th>Returns</th> <th>Type</th> <th>Details</th> </tr> </thead> <tr> <td>model.icon</td> <td>String</td> <td>The icon class</td> </tr> </table> <h1>Item Picker</h1> Opens an item picker.</br> <strong>view: </strong>itempicker <table> <thead> <tr> <th>Param</th> <th>Type</th> <th>Details</th> </tr> </thead> <tbody> <tr> <td>model.availableItems</td> <td>Array</td> <td>Array of available items</td> </tr> <tr> <td>model.selectedItems</td> <td>Array</td> <td>Array of selected items. When passed in the selected items will be filtered from the available items.</td> </tr> <tr> <td>model.filter</td> <td>Boolean</td> <td>Set to false to hide the filter</td> </tr> </tbody> </table> <table> <thead> <tr> <th>Returns</th> <th>Type</th> <th>Details</th> </tr> </thead> <tr> <td>model.selectedItem</td> <td>Object</td> <td>The selected item</td> </tr> </table> <h1>Macro Picker</h1> Opens a media picker.</br> <strong>view: </strong>macropicker <table> <thead> <tr> <th>Param</th> <th>Type</th> <th>Details</th> </tr> </thead> <tbody> <tr> <td>model.dialogData</td> <td>Object</td> <td>Object which contains array of allowedMacros. Set to <code>null</code> to allow all.</td> </tr> </tbody> </table> <table> <thead> <tr> <th>Returns</th> <th>Type</th> <th>Details</th> </tr> </thead> <tbody> <tr> <td>model.macroParams</td> <td>Array</td> <td>Array of macro params</td> </tr> <tr> <td>model.selectedMacro</td> <td>Object</td> <td>The selected macro</td> </tr> </tbody> </table> <h1>Media Picker</h1> Opens a media picker.</br> <strong>view: </strong>mediapicker <table> <thead> <tr> <th>Param</th> <th>Type</th> <th>Details</th> </tr> </thead> <tbody> <tr> <td>model.multiPicker</td> <td>Boolean</td> <td>Pick one or multiple items</td> </tr> <tr> <td>model.onlyImages</td> <td>Boolean</td> <td>Only display files that have an image file-extension</td> </tr> <tr> <td>model.disableFolderSelect</td> <td>Boolean</td> <td>Disable folder selection</td> </tr> </tbody> </table> <table> <thead> <tr> <th>Returns</th> <th>Type</th> <th>Details</th> </tr> </thead> <tbody> <tr> <td>model.selectedImages</td> <td>Array</td> <td>Array of selected images</td> </tr> </tbody> </table> <h1>Member Group Picker</h1> Opens a member group picker.</br> <strong>view: </strong>membergrouppicker <table> <thead> <tr> <th>Param</th> <th>Type</th> <th>Details</th> </tr> </thead> <tbody> <tr> <td>model.multiPicker</td> <td>Boolean</td> <td>Pick one or multiple items</td> </tr> </tbody> </table> <table> <thead> <tr> <th>Returns</th> <th>Type</th> <th>Details</th> </tr> </thead> <tbody> <tr> <td>model.selectedMemberGroup</td> <td>String</td> <td>The selected member group</td> </tr> <tr> <td>model.selectedMemberGroups (multiPicker)</td> <td>Array</td> <td>The selected member groups</td> </tr> </tbody> </table> <h1>Member Picker</h1> Opens a member picker. </br> <strong>view: </strong>memberpicker <table> <thead> <tr> <th>Param</th> <th>Type</th> <th>Details</th> </tr> </thead> <tbody> <tr> <td>model.multiPicker</td> <td>Boolean</td> <td>Pick one or multiple items</td> </tr> </tbody> </table> <table> <thead> <tr> <th>Returns</th> <th>Type</th> <th>Details</th> </tr> </thead> <tbody> <tr> <td>model.selection</td> <td>Array</td> <td>Array of selected members/td> </tr> </tbody> </table> <h1>YSOD</h1> Opens an overlay to show a custom YSOD. </br> <strong>view: </strong>ysod <table> <thead> <tr> <th>Param</th> <th>Type</th> <th>Details</th> </tr> </thead> <tbody> <tr> <td>model.error</td> <td>Object</td> <td>Error object</td> </tr> </tbody> </table> @param {object} model Overlay options. @param {string} view Path to view or one of the default view names. @param {string} position The overlay position ("left", "right", "center": "target"). **/ (function() { 'use strict'; function OverlayDirective($timeout, formHelper, overlayHelper, localizationService) { function link(scope, el, attr, ctrl) { scope.directive = { enableConfirmButton: false }; var overlayNumber = 0; var numberOfOverlays = 0; var isRegistered = false; var modelCopy = {}; function activate() { setView(); setButtonText(); modelCopy = makeModelCopy(scope.model); $timeout(function() { if (scope.position === "target") { setTargetPosition(); } // this has to be done inside a timeout to ensure the destroy // event on other overlays is run before registering a new one registerOverlay(); setOverlayIndent(); }); } function setView() { if (scope.view) { if (scope.view.indexOf(".html") === -1) { var viewAlias = scope.view.toLowerCase(); scope.view = "views/common/overlays/" + viewAlias + "/" + viewAlias + ".html"; } } } function setButtonText() { if (!scope.model.closeButtonLabelKey && !scope.model.closeButtonLabel) { scope.model.closeButtonLabel = localizationService.localize("general_close"); } if (!scope.model.submitButtonLabelKey && !scope.model.submitButtonLabel) { scope.model.submitButtonLabel = localizationService.localize("general_submit"); } } function registerOverlay() { overlayNumber = overlayHelper.registerOverlay(); $(document).bind("keydown.overlay-" + overlayNumber, function(event) { if (event.which === 27) { numberOfOverlays = overlayHelper.getNumberOfOverlays(); if(numberOfOverlays === overlayNumber) { scope.closeOverLay(); } event.preventDefault(); } if (event.which === 13) { numberOfOverlays = overlayHelper.getNumberOfOverlays(); if(numberOfOverlays === overlayNumber) { var activeElementType = document.activeElement.tagName; var clickableElements = ["A", "BUTTON"]; var submitOnEnter = document.activeElement.hasAttribute("overlay-submit-on-enter"); if(clickableElements.indexOf(activeElementType) === 0) { document.activeElement.click(); event.preventDefault(); } else if(activeElementType === "TEXTAREA" && !submitOnEnter) { } else { scope.$apply(function () { scope.submitForm(scope.model); }); event.preventDefault(); } } } }); isRegistered = true; } function unregisterOverlay() { if(isRegistered) { overlayHelper.unregisterOverlay(); $(document).unbind("keydown.overlay-" + overlayNumber); isRegistered = false; } } function makeModelCopy(object) { var newObject = {}; for (var key in object) { if (key !== "event") { newObject[key] = angular.copy(object[key]); } } return newObject; } function setOverlayIndent() { var overlayIndex = overlayNumber - 1; var indentSize = overlayIndex * 20; var overlayWidth = el.context.clientWidth; el.css('width', overlayWidth - indentSize); if(scope.position === "center" || scope.position === "target") { var overlayTopPosition = el.context.offsetTop; el.css('top', overlayTopPosition + indentSize); } } function setTargetPosition() { var container = $("#contentwrapper"); var containerLeft = container[0].offsetLeft; var containerRight = containerLeft + container[0].offsetWidth; var containerTop = container[0].offsetTop; var containerBottom = containerTop + container[0].offsetHeight; var mousePositionClickX = null; var mousePositionClickY = null; var elementHeight = null; var elementWidth = null; var position = { right: "inherit", left: "inherit", top: "inherit", bottom: "inherit" }; // if mouse click position is know place element with mouse in center if (scope.model.event && scope.model.event) { // click position mousePositionClickX = scope.model.event.pageX; mousePositionClickY = scope.model.event.pageY; // element size elementHeight = el.context.clientHeight; elementWidth = el.context.clientWidth; // move element to this position position.left = mousePositionClickX - (elementWidth / 2); position.top = mousePositionClickY - (elementHeight / 2); // check to see if element is outside screen // outside right if (position.left + elementWidth > containerRight) { position.right = 10; position.left = "inherit"; } // outside bottom if (position.top + elementHeight > containerBottom) { position.bottom = 10; position.top = "inherit"; } // outside left if (position.left < containerLeft) { position.left = containerLeft + 10; position.right = "inherit"; } // outside top if (position.top < containerTop) { position.top = 10; position.bottom = "inherit"; } el.css(position); } } scope.submitForm = function(model) { if(scope.model.submit) { if (formHelper.submitForm({scope: scope})) { formHelper.resetForm({ scope: scope }); if(scope.model.confirmSubmit && scope.model.confirmSubmit.enable && !scope.directive.enableConfirmButton) { scope.model.submit(model, modelCopy, scope.directive.enableConfirmButton); } else { unregisterOverlay(); scope.model.submit(model, modelCopy, scope.directive.enableConfirmButton); } } } }; scope.cancelConfirmSubmit = function() { scope.model.confirmSubmit.show = false; }; scope.closeOverLay = function() { unregisterOverlay(); if (scope.model.close) { scope.model = modelCopy; scope.model.close(scope.model); } else { scope.model.show = false; scope.model = null; } }; // angular does not support ng-show on custom directives // width isolated scopes. So we have to make our own. if (attr.hasOwnProperty("ngShow")) { scope.$watch("ngShow", function(value) { if (value) { el.show(); activate(); } else { unregisterOverlay(); el.hide(); } }); } else { activate(); } scope.$on('$destroy', function(){ unregisterOverlay(); }); } var directive = { transclude: true, restrict: 'E', replace: true, templateUrl: 'views/components/overlays/umb-overlay.html', scope: { ngShow: "=", model: "=", view: "=", position: "@" }, link: link }; return directive; } angular.module('umbraco.directives').directive('umbOverlay', OverlayDirective); })(); (function() { 'use strict'; function OverlayBackdropDirective(overlayHelper) { function link(scope, el, attr, ctrl) { scope.numberOfOverlays = 0; scope.$watch(function(){ return overlayHelper.getNumberOfOverlays(); }, function (newValue) { scope.numberOfOverlays = newValue; }); } var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/overlays/umb-overlay-backdrop.html', link: link }; return directive; } angular.module('umbraco.directives').directive('umbOverlayBackdrop', OverlayBackdropDirective); })(); /** * @ngdoc directive * @name umbraco.directives.directive:umbProperty * @restrict E **/ angular.module("umbraco.directives") .directive('umbProperty', function (umbPropEditorHelper) { return { scope: { property: "=" }, transclude: true, restrict: 'E', replace: true, templateUrl: 'views/components/property/umb-property.html', link: function(scope) { scope.propertyAlias = Umbraco.Sys.ServerVariables.isDebuggingEnabled === true ? scope.property.alias : null; }, //Define a controller for this directive to expose APIs to other directives controller: function ($scope, $timeout) { var self = this; //set the API properties/methods self.property = $scope.property; self.setPropertyError = function(errorMsg) { $scope.property.propertyErrorMessage = errorMsg; }; } }; }); /** * @ngdoc directive * @function * @name umbraco.directives.directive:umbPropertyEditor * @requires formController * @restrict E **/ //share property editor directive function var _umbPropertyEditor = function (umbPropEditorHelper) { return { scope: { model: "=", isPreValue: "@", preview: "@" }, require: "^form", restrict: 'E', replace: true, templateUrl: 'views/components/property/umb-property-editor.html', link: function (scope, element, attrs, ctrl) { //we need to copy the form controller val to our isolated scope so that //it get's carried down to the child scopes of this! //we'll also maintain the current form name. scope[ctrl.$name] = ctrl; if(!scope.model.alias){ scope.model.alias = Math.random().toString(36).slice(2); } scope.$watch("model.view", function(val){ scope.propertyEditorView = umbPropEditorHelper.getViewPath(scope.model.view, scope.isPreValue); }); } }; }; //Preffered is the umb-property-editor as its more explicit - but we keep umb-editor for backwards compat angular.module("umbraco.directives").directive('umbPropertyEditor', _umbPropertyEditor); angular.module("umbraco.directives").directive('umbEditor', _umbPropertyEditor); angular.module("umbraco.directives.html") .directive('umbPropertyGroup', function () { return { transclude: true, restrict: 'E', replace: true, templateUrl: 'views/components/property/umb-property-group.html' }; }); /** * @ngdoc directive * @name umbraco.directives.directive:umbTab * @restrict E **/ angular.module("umbraco.directives") .directive('umbTab', function ($parse, $timeout) { return { restrict: 'E', replace: true, transclude: 'true', templateUrl: 'views/components/tabs/umb-tab.html' }; }); /** * @ngdoc directive * @name umbraco.directives.directive:umbTabs * @restrict A * @description Used to bind to bootstrap tab events so that sub directives can use this API to listen to tab changes **/ angular.module("umbraco.directives") .directive('umbTabs', function () { return { restrict: 'A', controller: function ($scope, $element, $attrs) { var callbacks = []; this.onTabShown = function(cb) { callbacks.push(cb); }; function tabShown(event) { var curr = $(event.target); // active tab var prev = $(event.relatedTarget); // previous tab for (var c in callbacks) { callbacks[c].apply(this, [{current: curr, previous: prev}]); } } //NOTE: it MUST be done this way - binding to an ancestor element that exists // in the DOM to bind to the dynamic elements that will be created. // It would be nicer to create this event handler as a directive for which child // directives can attach to. $element.on('shown', '.nav-tabs a', tabShown); //ensure to unregister $scope.$on('$destroy', function () { $element.off('shown', '.nav-tabs a', tabShown); for (var c in callbacks) { delete callbacks[c]; } callbacks = null; }); } }; }); (function() { 'use strict'; function UmbTabsContentDirective() { function link(scope, el, attr, ctrl) { scope.view = attr.view; } var directive = { restrict: "E", replace: true, transclude: 'true', templateUrl: "views/components/tabs/umb-tabs-content.html", link: link }; return directive; } angular.module('umbraco.directives').directive('umbTabsContent', UmbTabsContentDirective); })(); (function() { 'use strict'; function UmbTabsNavDirective($timeout) { function link(scope, el, attr) { function activate() { $timeout(function () { //use bootstrap tabs API to show the first one el.find("a:first").tab('show'); //enable the tab drop el.tabdrop(); }); } var unbindModelWatch = scope.$watch('model', function(newValue, oldValue){ activate(); }); scope.$on('$destroy', function () { //ensure to destroy tabdrop (unbinds window resize listeners) el.tabdrop("destroy"); unbindModelWatch(); }); } var directive = { restrict: "E", replace: true, templateUrl: "views/components/tabs/umb-tabs-nav.html", scope: { model: "=", tabdrop: "=" }, link: link }; return directive; } angular.module('umbraco.directives').directive('umbTabsNav', UmbTabsNavDirective); })(); /** * @ngdoc directive * @name umbraco.directives.directive:umbTree * @restrict E **/ function umbTreeDirective($compile, $log, $q, $rootScope, treeService, notificationsService, $timeout, userService) { return { restrict: 'E', replace: true, terminal: false, scope: { section: '@', treealias: '@', hideoptions: '@', hideheader: '@', cachekey: '@', isdialog: '@', //Custom query string arguments to pass in to the tree as a string, example: "startnodeid=123&something=value" customtreeparams: '@', eventhandler: '=', enablecheckboxes: '@', enablelistviewsearch: '@' }, compile: function(element, attrs) { //config //var showheader = (attrs.showheader !== 'false'); var hideoptions = (attrs.hideoptions === 'true') ? "hide-options" : ""; var template = '<ul class="umb-tree ' + hideoptions + '"><li class="root">'; template += '<div ng-hide="hideheader" on-right-click="altSelect(tree.root, $event)">' + '<h5>' + '<a href="#/{{section}}" ng-click="select(tree.root, $event)" class="root-link"><i ng-if="enablecheckboxes == \'true\'" ng-class="selectEnabledNodeClass(tree.root)"></i> {{tree.name}}</a></h5>' + '<a class="umb-options" ng-hide="tree.root.isContainer || !tree.root.menuUrl" ng-click="options(tree.root, $event)" ng-swipe-right="options(tree.root, $event)"><i></i><i></i><i></i></a>' + '</div>'; template += '<ul>' + '<umb-tree-item ng-repeat="child in tree.root.children" eventhandler="eventhandler" node="child" current-node="currentNode" tree="this" section="{{section}}" ng-animate="animation()"></umb-tree-item>' + '</ul>' + '</li>' + '</ul>'; element.replaceWith(template); return function(scope, elem, attr, controller) { //flag to track the last loaded section when the tree 'un-loads'. We use this to determine if we should // re-load the tree again. For example, if we hover over 'content' the content tree is shown. Then we hover // outside of the tree and the tree 'un-loads'. When we re-hover over 'content', we don't want to re-load the // entire tree again since we already still have it in memory. Of course if the section is different we will // reload it. This saves a lot on processing if someone is navigating in and out of the same section many times // since it saves on data retreival and DOM processing. var lastSection = ""; //setup a default internal handler if (!scope.eventhandler) { scope.eventhandler = $({}); } //flag to enable/disable delete animations var deleteAnimations = false; /** Helper function to emit tree events */ function emitEvent(eventName, args) { if (scope.eventhandler) { $(scope.eventhandler).trigger(eventName, args); } } /** This will deleteAnimations to true after the current digest */ function enableDeleteAnimations() { //do timeout so that it re-enables them after this digest $timeout(function () { //enable delete animations deleteAnimations = true; }, 0, false); } /*this is the only external interface a tree has */ function setupExternalEvents() { if (scope.eventhandler) { scope.eventhandler.clearCache = function(section) { treeService.clearCache({ section: section }); }; scope.eventhandler.load = function(section) { scope.section = section; loadTree(); }; scope.eventhandler.reloadNode = function(node) { if (!node) { node = scope.currentNode; } if (node) { scope.loadChildren(node, true); } }; /** Used to do the tree syncing. If the args.tree is not specified we are assuming it has been specified previously using the _setActiveTreeType */ scope.eventhandler.syncTree = function(args) { if (!args) { throw "args cannot be null"; } if (!args.path) { throw "args.path cannot be null"; } var deferred = $q.defer(); //this is super complex but seems to be working in other places, here we're listening for our // own events, once the tree is sycned we'll resolve our promise. scope.eventhandler.one("treeSynced", function (e, syncArgs) { deferred.resolve(syncArgs); }); //this should normally be set unless it is being called from legacy // code, so set the active tree type before proceeding. if (args.tree) { loadActiveTree(args.tree); } if (angular.isString(args.path)) { args.path = args.path.replace('"', '').split(','); } //reset current node selection //scope.currentNode = null; //Filter the path for root node ids (we don't want to pass in -1 or 'init') args.path = _.filter(args.path, function (item) { return (item !== "init" && item !== "-1"); }); //Once those are filtered we need to check if the current user has a special start node id, // if they do, then we're going to trim the start of the array for anything found from that start node // and previous so that the tree syncs properly. The tree syncs from the top down and if there are parts // of the tree's path in there that don't actually exist in the dom/model then syncing will not work. userService.getCurrentUser().then(function(userData) { var startNodes = [userData.startContentId, userData.startMediaId]; _.each(startNodes, function (i) { var found = _.find(args.path, function (p) { return String(p) === String(i); }); if (found) { args.path = args.path.splice(_.indexOf(args.path, found)); } }); loadPath(args.path, args.forceReload, args.activate); }); return deferred.promise; }; /** Internal method that should ONLY be used by the legacy API wrapper, the legacy API used to have to set an active tree and then sync, the new API does this in one method by using syncTree. loadChildren is optional but if it is set, it will set the current active tree and load the root node's children - this is synonymous with the legacy refreshTree method - again should not be used and should only be used for the legacy code to work. */ scope.eventhandler._setActiveTreeType = function(treeAlias, loadChildren) { loadActiveTree(treeAlias, loadChildren); }; } } //helper to load a specific path on the active tree as soon as its ready function loadPath(path, forceReload, activate) { if (scope.activeTree) { syncTree(scope.activeTree, path, forceReload, activate); } else { scope.eventhandler.one("activeTreeLoaded", function (e, args) { syncTree(args.tree, path, forceReload, activate); }); } } //given a tree alias, this will search the current section tree for the specified tree alias and //set that to the activeTree //NOTE: loadChildren is ONLY used for legacy purposes, do not use this when syncing the tree as it will cause problems // since there will be double request and event handling operations. function loadActiveTree(treeAlias, loadChildren) { if (!treeAlias) { return; } scope.activeTree = undefined; function doLoad(tree) { var childrenAndSelf = [tree].concat(tree.children); scope.activeTree = _.find(childrenAndSelf, function (node) { if(node && node.metaData && node.metaData.treeAlias) { return node.metaData.treeAlias.toUpperCase() === treeAlias.toUpperCase(); } return false; }); if (!scope.activeTree) { throw "Could not find the tree " + treeAlias + ", activeTree has not been set"; } //This is only used for the legacy tree method refreshTree! if (loadChildren) { scope.activeTree.expanded = true; scope.loadChildren(scope.activeTree, false).then(function() { emitEvent("activeTreeLoaded", { tree: scope.activeTree }); }); } else { emitEvent("activeTreeLoaded", { tree: scope.activeTree }); } } if (scope.tree) { doLoad(scope.tree.root); } else { scope.eventhandler.one("treeLoaded", function(e, args) { doLoad(args.tree.root); }); } } /** Method to load in the tree data */ function loadTree() { if (!scope.loading && scope.section) { scope.loading = true; //anytime we want to load the tree we need to disable the delete animations deleteAnimations = false; //default args var args = { section: scope.section, tree: scope.treealias, cacheKey: scope.cachekey, isDialog: scope.isdialog ? scope.isdialog : false }; //add the extra query string params if specified if (scope.customtreeparams) { args["queryString"] = scope.customtreeparams; } treeService.getTree(args) .then(function(data) { //set the data once we have it scope.tree = data; enableDeleteAnimations(); scope.loading = false; //set the root as the current active tree scope.activeTree = scope.tree.root; emitEvent("treeLoaded", { tree: scope.tree }); emitEvent("treeNodeExpanded", { tree: scope.tree, node: scope.tree.root, children: scope.tree.root.children }); }, function(reason) { scope.loading = false; notificationsService.error("Tree Error", reason); }); } } /** syncs the tree, the treeNode can be ANY tree node in the tree that requires syncing */ function syncTree(treeNode, path, forceReload, activate) { deleteAnimations = false; treeService.syncTree({ node: treeNode, path: path, forceReload: forceReload }).then(function (data) { if (activate === undefined || activate === true) { scope.currentNode = data; } emitEvent("treeSynced", { node: data, activate: activate }); enableDeleteAnimations(); }); } scope.selectEnabledNodeClass = function (node) { return node ? node.selected ? 'icon umb-tree-icon sprTree icon-check blue temporary' : '' : ''; }; /** method to set the current animation for the node. * This changes dynamically based on if we are changing sections or just loading normal tree data. * When changing sections we don't want all of the tree-ndoes to do their 'leave' animations. */ scope.animation = function() { if (deleteAnimations && scope.tree && scope.tree.root && scope.tree.root.expanded) { return { leave: 'tree-node-delete-leave' }; } else { return {}; } }; /* helper to force reloading children of a tree node */ scope.loadChildren = function(node, forceReload) { var deferred = $q.defer(); //emit treeNodeExpanding event, if a callback object is set on the tree emitEvent("treeNodeExpanding", { tree: scope.tree, node: node }); //standardising if (!node.children) { node.children = []; } if (forceReload || (node.hasChildren && node.children.length === 0)) { //get the children from the tree service treeService.loadNodeChildren({ node: node, section: scope.section }) .then(function(data) { //emit expanded event emitEvent("treeNodeExpanded", { tree: scope.tree, node: node, children: data }); enableDeleteAnimations(); deferred.resolve(data); }); } else { emitEvent("treeNodeExpanded", { tree: scope.tree, node: node, children: node.children }); node.expanded = true; enableDeleteAnimations(); deferred.resolve(node.children); } return deferred.promise; }; /** Method called when the options button next to the root node is called. The tree doesnt know about this, so it raises an event to tell the parent controller about it. */ scope.options = function(n, ev) { emitEvent("treeOptionsClick", { element: elem, node: n, event: ev }); }; /** Method called when an item is clicked in the tree, this passes the DOM element, the tree node object and the original click and emits it as a treeNodeSelect element if there is a callback object defined on the tree */ scope.select = function (n, ev) { //on tree select we need to remove the current node - // whoever handles this will need to make sure the correct node is selected //reset current node selection scope.currentNode = null; emitEvent("treeNodeSelect", { element: elem, node: n, event: ev }); }; scope.altSelect = function(n, ev) { emitEvent("treeNodeAltSelect", { element: elem, tree: scope.tree, node: n, event: ev }); }; //watch for section changes scope.$watch("section", function(newVal, oldVal) { if (!scope.tree) { loadTree(); } if (!newVal) { //store the last section loaded lastSection = oldVal; } else if (newVal !== oldVal && newVal !== lastSection) { //only reload the tree data and Dom if the newval is different from the old one // and if the last section loaded is different from the requested one. loadTree(); //store the new section to be loaded as the last section //clear any active trees to reset lookups lastSection = newVal; } }); setupExternalEvents(); loadTree(); }; } }; } angular.module("umbraco.directives").directive('umbTree', umbTreeDirective); /** * @ngdoc directive * @name umbraco.directives.directive:umbTreeItem * @element li * @function * * @description * Renders a list item, representing a single node in the tree. * Includes element to toggle children, and a menu toggling button * * **note:** This directive is only used internally in the umbTree directive * * @example <example module="umbraco"> <file name="index.html"> <umb-tree-item ng-repeat="child in tree.children" node="child" callback="callback" section="content"></umb-tree-item> </file> </example> */ angular.module("umbraco.directives") .directive('umbTreeItem', function ($compile, $http, $templateCache, $interpolate, $log, $location, $rootScope, $window, treeService, $timeout, localizationService) { return { restrict: 'E', replace: true, scope: { section: '@', eventhandler: '=', currentNode: '=', node: '=', tree: '=' }, //TODO: Remove more of the binding from this template and move the DOM manipulation to be manually done in the link function, // this will greatly improve performance since there's potentially a lot of nodes being rendered = a LOT of watches! template: '<li ng-class="{\'current\': (node == currentNode), \'has-children\': node.hasChildren}" on-right-click="altSelect(node, $event)">' + '<div ng-class="getNodeCssClass(node)" ng-swipe-right="options(node, $event)" >' + //NOTE: This ins element is used to display the search icon if the node is a container/listview and the tree is currently in dialog //'<ins ng-if="tree.enablelistviewsearch && node.metaData.isContainer" class="umb-tree-node-search icon-search" ng-click="searchNode(node, $event)" alt="searchAltText"></ins>' + '<ins ng-class="{\'icon-navigation-right\': !node.expanded, \'icon-navigation-down\': node.expanded}" ng-click="load(node)">&nbsp;</ins>' + '<i class="icon umb-tree-icon sprTree" ng-click="select(node, $event)"></i>' + '<a href="#/{{node.routePath}}" ng-click="select(node, $event)"></a>' + //NOTE: These are the 'option' elipses '<a class="umb-options" ng-click="options(node, $event)"><i></i><i></i><i></i></a>' + '<div ng-show="node.loading" class="l"><div></div></div>' + '</div>' + '</li>', link: function (scope, element, attrs) { localizationService.localize("general_search").then(function (value) { scope.searchAltText = value; }); //flag to enable/disable delete animations, default for an item is true var deleteAnimations = true; // Helper function to emit tree events function emitEvent(eventName, args) { if (scope.eventhandler) { $(scope.eventhandler).trigger(eventName, args); } } // updates the node's DOM/styles function setupNodeDom(node, tree) { //get the first div element element.children(":first") //set the padding .css("padding-left", (node.level * 20) + "px"); //toggle visibility of last 'ins' depending on children //visibility still ensure the space is "reserved", so both nodes with and without children are aligned. if (!node.hasChildren) { element.find("ins").last().css("visibility", "hidden"); } else { element.find("ins").last().css("visibility", "visible"); } var icon = element.find("i:first"); icon.addClass(node.cssClass); icon.attr("title", node.routePath); element.find("a:first").text(node.name); if (!node.menuUrl) { element.find("a.umb-options").remove(); } if (node.style) { element.find("i:first").attr("style", node.style); } } //This will deleteAnimations to true after the current digest function enableDeleteAnimations() { //do timeout so that it re-enables them after this digest $timeout(function () { //enable delete animations deleteAnimations = true; }, 0, false); } /** Returns the css classses assigned to the node (div element) */ scope.getNodeCssClass = function (node) { if (!node) { return ''; } var css = []; if (node.cssClasses) { _.each(node.cssClasses, function(c) { css.push(c); }); } if (node.selected) { css.push("umb-tree-node-checked"); } return css.join(" "); }; //add a method to the node which we can use to call to update the node data if we need to , // this is done by sync tree, we don't want to add a $watch for each node as that would be crazy insane slow // so we have to do this scope.node.updateNodeData = function (newNode) { _.extend(scope.node, newNode); //now update the styles setupNodeDom(scope.node, scope.tree); }; /** Method called when the options button next to a node is called In the main tree this opens the menu, but internally the tree doesnt know about this, so it simply raises an event to tell the parent controller about it. */ scope.options = function (n, ev) { emitEvent("treeOptionsClick", { element: element, tree: scope.tree, node: n, event: ev }); }; /** Method called when an item is clicked in the tree, this passes the DOM element, the tree node object and the original click and emits it as a treeNodeSelect element if there is a callback object defined on the tree */ scope.select = function (n, ev) { if (ev.ctrlKey || ev.shiftKey || ev.metaKey || // apple (ev.button && ev.button === 1) // middle click, >IE9 + everyone else ) { return; } emitEvent("treeNodeSelect", { element: element, tree: scope.tree, node: n, event: ev }); ev.preventDefault(); }; /** Method called when an item is right-clicked in the tree, this passes the DOM element, the tree node object and the original click and emits it as a treeNodeSelect element if there is a callback object defined on the tree */ scope.altSelect = function (n, ev) { emitEvent("treeNodeAltSelect", { element: element, tree: scope.tree, node: n, event: ev }); }; /** method to set the current animation for the node. * This changes dynamically based on if we are changing sections or just loading normal tree data. * When changing sections we don't want all of the tree-ndoes to do their 'leave' animations. */ scope.animation = function () { if (scope.node.showHideAnimation) { return scope.node.showHideAnimation; } if (deleteAnimations && scope.node.expanded) { return { leave: 'tree-node-delete-leave' }; } else { return {}; } }; /** Method called when a node in the tree is expanded, when clicking the arrow takes the arrow DOM element and node data as parameters emits treeNodeCollapsing event if already expanded and treeNodeExpanding if collapsed */ scope.load = function (node) { if (node.expanded) { deleteAnimations = false; emitEvent("treeNodeCollapsing", { tree: scope.tree, node: node, element: element }); node.expanded = false; } else { scope.loadChildren(node, false); } }; /* helper to force reloading children of a tree node */ scope.loadChildren = function (node, forceReload) { //emit treeNodeExpanding event, if a callback object is set on the tree emitEvent("treeNodeExpanding", { tree: scope.tree, node: node }); if (node.hasChildren && (forceReload || !node.children || (angular.isArray(node.children) && node.children.length === 0))) { //get the children from the tree service treeService.loadNodeChildren({ node: node, section: scope.section }) .then(function (data) { //emit expanded event emitEvent("treeNodeExpanded", { tree: scope.tree, node: node, children: data }); enableDeleteAnimations(); }); } else { emitEvent("treeNodeExpanded", { tree: scope.tree, node: node, children: node.children }); node.expanded = true; enableDeleteAnimations(); } }; //if the current path contains the node id, we will auto-expand the tree item children setupNodeDom(scope.node, scope.tree); var template = '<ul ng-class="{collapsed: !node.expanded}"><umb-tree-item ng-repeat="child in node.children" eventhandler="eventhandler" tree="tree" current-node="currentNode" node="child" section="{{section}}" ng-animate="animation()"></umb-tree-item></ul>'; var newElement = angular.element(template); $compile(newElement)(scope); element.append(newElement); } }; }); /** * @ngdoc directive * @name umbraco.directives.directive:umbTreeSearchBox * @function * @element ANY * @restrict E **/ function treeSearchBox(localizationService, searchService, $q) { return { scope: { searchFromId: "@", searchFromName: "@", showSearch: "@", section: "@", hideSearchCallback: "=", searchCallback: "=" }, restrict: "E", // restrict to an element replace: true, // replace the html element with the template templateUrl: 'views/components/tree/umb-tree-search-box.html', link: function (scope, element, attrs, ctrl) { scope.term = ""; scope.hideSearch = function() { scope.term = ""; scope.hideSearchCallback(); }; localizationService.localize("general_typeToSearch").then(function (value) { scope.searchPlaceholderText = value; }); if (!scope.showSearch) { scope.showSearch = "false"; } //used to cancel any request in progress if another one needs to take it's place var canceler = null; function performSearch() { if (scope.term) { scope.results = []; //a canceler exists, so perform the cancelation operation and reset if (canceler) { canceler.resolve(); canceler = $q.defer(); } else { canceler = $q.defer(); } var searchArgs = { term: scope.term, canceler: canceler }; //append a start node context if there is one if (scope.searchFromId) { searchArgs["searchFrom"] = scope.searchFromId; } searcher(searchArgs).then(function (data) { scope.searchCallback(data); //set back to null so it can be re-created canceler = null; }); } } scope.$watch("term", _.debounce(function(newVal, oldVal) { scope.$apply(function() { if (newVal !== null && newVal !== undefined && newVal !== oldVal) { performSearch(); } }); }, 200)); var searcher = searchService.searchContent; //search if (scope.section === "member") { searcher = searchService.searchMembers; } else if (scope.section === "media") { searcher = searchService.searchMedia; } } }; } angular.module('umbraco.directives').directive("umbTreeSearchBox", treeSearchBox); /** * @ngdoc directive * @name umbraco.directives.directive:umbTreeSearchResults * @function * @element ANY * @restrict E **/ function treeSearchResults() { return { scope: { results: "=", selectResultCallback: "=" }, restrict: "E", // restrict to an element replace: true, // replace the html element with the template templateUrl: 'views/components/tree/umb-tree-search-results.html', link: function (scope, element, attrs, ctrl) { } }; } angular.module('umbraco.directives').directive("umbTreeSearchResults", treeSearchResults); /** @ngdoc directive @name umbraco.directives.directive:umbGenerateAlias @restrict E @scope @description Use this directive to generate a camelCased umbraco alias. When the aliasFrom value is changed the directive will get a formatted alias from the server and update the alias model. If "enableLock" is set to <code>true</code> the directive will use {@link umbraco.directives.directive:umbLockedField umbLockedField} to lock and unlock the alias. <h3>Markup example</h3> <pre> <div ng-controller="My.Controller as vm"> <input type="text" ng-model="vm.name" /> <umb-generate-alias enable-lock="true" alias-from="vm.name" alias="vm.alias"> </umb-generate-alias> </div> </pre> <h3>Controller example</h3> <pre> (function () { "use strict"; function Controller() { var vm = this; vm.name = ""; vm.alias = ""; } angular.module("umbraco").controller("My.Controller", Controller); })(); </pre> @param {string} alias (<code>binding</code>): The model where the alias is bound. @param {string} aliasFrom (<code>binding</code>): The model to generate the alias from. @param {boolean=} enableLock (<code>binding</code>): Set to <code>true</code> to add a lock next to the alias from where it can be unlocked and changed. **/ angular.module("umbraco.directives") .directive('umbGenerateAlias', function ($timeout, entityResource) { return { restrict: 'E', templateUrl: 'views/components/umb-generate-alias.html', replace: true, scope: { alias: '=', aliasFrom: '=', enableLock: '=?', serverValidationField: '@' }, link: function (scope, element, attrs, ctrl) { var eventBindings = []; var bindWatcher = true; var generateAliasTimeout = ""; var updateAlias = false; scope.locked = true; scope.placeholderText = "Enter alias..."; function generateAlias(value) { if (generateAliasTimeout) { $timeout.cancel(generateAliasTimeout); } if( value !== undefined && value !== "" && value !== null) { scope.alias = ""; scope.placeholderText = "Generating Alias..."; generateAliasTimeout = $timeout(function () { updateAlias = true; entityResource.getSafeAlias(value, true).then(function (safeAlias) { if (updateAlias) { scope.alias = safeAlias.alias; } }); }, 500); } else { updateAlias = true; scope.alias = ""; scope.placeholderText = "Enter alias..."; } } // if alias gets unlocked - stop watching alias eventBindings.push(scope.$watch('locked', function(newValue, oldValue){ if(newValue === false) { bindWatcher = false; } })); // validate custom entered alias eventBindings.push(scope.$watch('alias', function(newValue, oldValue){ if(scope.alias === "" && bindWatcher === true || scope.alias === null && bindWatcher === true) { // add watcher eventBindings.push(scope.$watch('aliasFrom', function(newValue, oldValue) { if(bindWatcher) { generateAlias(newValue); } })); } })); // clean up scope.$on('$destroy', function(){ // unbind watchers for(var e in eventBindings) { eventBindings[e](); } }); } }; }); /** @ngdoc directive @name umbraco.directives.directive:umbAvatar @restrict E @scope @description Use this directive to render an avatar. <h3>Markup example</h3> <pre> <div ng-controller="My.Controller as vm"> <umb-avatar size="xs" img-src="{{vm.avatar[0].value}}" img-srcset="{{vm.avatar[1].value}} 2x, {{vm.avatar[2].value}} 3x"> </umb-avatar> </div> </pre> <h3>Controller example</h3> <pre> (function () { "use strict"; function Controller() { var vm = this; vm.avatar = [ { value: "assets/logo.png" }, { value: "assets/logo@2x.png" }, { value: "assets/logo@3x.png" } ]; } angular.module("umbraco").controller("My.Controller", Controller); })(); </pre> @param {string} size (<code>attribute</code>): The size of the avatar (xs, s, m, l, xl). @param {string} img-src (<code>attribute</code>): The image source to the avatar. @param {string} img-srcset (<code>atribute</code>): Reponsive support for the image source. **/ (function() { 'use strict'; function AvatarDirective() { var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/umb-avatar.html', scope: { size: "@", imgSrc: "@", imgSrcset: "@" } }; return directive; } angular.module('umbraco.directives').directive('umbAvatar', AvatarDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbChildSelector @restrict E @scope @description Use this directive to render a ui component for selecting child items to a parent node. <h3>Markup example</h3> <pre> <div ng-controller="My.Controller as vm"> <umb-child-selector selected-children="vm.selectedChildren" available-children="vm.availableChildren" parent-name="vm.name" parent-icon="vm.icon" parent-id="vm.id" on-add="vm.addChild" on-remove="vm.removeChild"> </umb-child-selector> <!-- use overlay to select children from --> <umb-overlay ng-if="vm.overlay.show" model="vm.overlay" position="target" view="vm.overlay.view"> </umb-overlay> </div> </pre> <h3>Controller example</h3> <pre> (function () { "use strict"; function Controller() { var vm = this; vm.id = 1; vm.name = "My Parent element"; vm.icon = "icon-document"; vm.selectedChildren = []; vm.availableChildren = [ { id: 1, alias: "item1", name: "Item 1", icon: "icon-document" }, { id: 2, alias: "item2", name: "Item 2", icon: "icon-document" } ]; vm.addChild = addChild; vm.removeChild = removeChild; function addChild($event) { vm.overlay = { view: "itempicker", title: "Choose child", availableItems: vm.availableChildren, selectedItems: vm.selectedChildren, event: $event, show: true, submit: function(model) { // add selected child vm.selectedChildren.push(model.selectedItem); // close overlay vm.overlay.show = false; vm.overlay = null; } }; } function removeChild($index) { vm.selectedChildren.splice($index, 1); } } angular.module("umbraco").controller("My.Controller", Controller); })(); </pre> @param {array} selectedChildren (<code>binding</code>): Array of selected children. @param {array} availableChildren (<code>binding</code>: Array of items available for selection. @param {string} parentName (<code>binding</code>): The parent name. @param {string} parentIcon (<code>binding</code>): The parent icon. @param {number} parentId (<code>binding</code>): The parent id. @param {callback} onRemove (<code>binding</code>): Callback when the remove button is clicked on an item. <h3>The callback returns:</h3> <ul> <li><code>child</code>: The selected item.</li> <li><code>$index</code>: The selected item index.</li> </ul> @param {callback} onAdd (<code>binding</code>): Callback when the add button is clicked. <h3>The callback returns:</h3> <ul> <li><code>$event</code>: The select event.</li> </ul> **/ (function() { 'use strict'; function ChildSelectorDirective() { function link(scope, el, attr, ctrl) { var eventBindings = []; scope.dialogModel = {}; scope.showDialog = false; scope.removeChild = function(selectedChild, $index) { if(scope.onRemove) { scope.onRemove(selectedChild, $index); } }; scope.addChild = function($event) { if(scope.onAdd) { scope.onAdd($event); } }; function syncParentName() { // update name on available item angular.forEach(scope.availableChildren, function(availableChild){ if(availableChild.id === scope.parentId) { availableChild.name = scope.parentName; } }); // update name on selected child angular.forEach(scope.selectedChildren, function(selectedChild){ if(selectedChild.id === scope.parentId) { selectedChild.name = scope.parentName; } }); } function syncParentIcon() { // update icon on available item angular.forEach(scope.availableChildren, function(availableChild){ if(availableChild.id === scope.parentId) { availableChild.icon = scope.parentIcon; } }); // update icon on selected child angular.forEach(scope.selectedChildren, function(selectedChild){ if(selectedChild.id === scope.parentId) { selectedChild.icon = scope.parentIcon; } }); } eventBindings.push(scope.$watch('parentName', function(newValue, oldValue){ if (newValue === oldValue) { return; } if ( oldValue === undefined || newValue === undefined) { return; } syncParentName(); })); eventBindings.push(scope.$watch('parentIcon', function(newValue, oldValue){ if (newValue === oldValue) { return; } if ( oldValue === undefined || newValue === undefined) { return; } syncParentIcon(); })); // clean up scope.$on('$destroy', function(){ // unbind watchers for(var e in eventBindings) { eventBindings[e](); } }); } var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/umb-child-selector.html', scope: { selectedChildren: '=', availableChildren: "=", parentName: "=", parentIcon: "=", parentId: "=", onRemove: "=", onAdd: "=" }, link: link }; return directive; } angular.module('umbraco.directives').directive('umbChildSelector', ChildSelectorDirective); })(); /** * @ngdoc directive * @name umbraco.directives.directive:umbConfirm * @function * @description * A confirmation dialog * * @restrict E */ function confirmDirective() { return { restrict: "E", // restrict to an element replace: true, // replace the html element with the template templateUrl: 'views/components/umb-confirm.html', scope: { onConfirm: '=', onCancel: '=', caption: '@' }, link: function (scope, element, attr, ctrl) { } }; } angular.module('umbraco.directives').directive("umbConfirm", confirmDirective); /** @ngdoc directive @name umbraco.directives.directive:umbConfirmAction @restrict E @scope @description <p>Use this directive to toggle a confirmation prompt for an action. The prompt consists of a checkmark and a cross to confirm or cancel the action. The prompt can be opened in four direction up, down, left or right.</p> <h3>Markup example</h3> <pre> <div ng-controller="My.Controller as vm"> <div class="my-action" style="position:relative;"> <i class="icon-trash" ng-click="vm.showPrompt()"></i> <umb-confirm-action ng-if="vm.promptIsVisible" direction="left" on-confirm="vm.confirmAction()" on-cancel="vm.hidePrompt()"> </umb-confirm-action> </div> </div> </pre> <h3>Controller example</h3> <pre> (function () { "use strict"; function Controller() { var vm = this; vm.promptIsVisible = false; vm.confirmAction = confirmAction; vm.showPrompt = showPrompt; vm.hidePrompt = hidePrompt; function confirmAction() { // confirm logic here } function showPrompt() { vm.promptIsVisible = true; } function hidePrompt() { vm.promptIsVisible = false; } } angular.module("umbraco").controller("My.Controller", Controller); })(); </pre> @param {string} direction The direction the prompt opens ("up", "down", "left", "right"). @param {callback} onConfirm Callback when the checkmark is clicked. @param {callback} onCancel Callback when the cross is clicked. **/ (function() { 'use strict'; function ConfirmAction() { function link(scope, el, attr, ctrl) { scope.clickConfirm = function() { if(scope.onConfirm) { scope.onConfirm(); } }; scope.clickCancel = function() { if(scope.onCancel) { scope.onCancel(); } }; } var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/umb-confirm-action.html', scope: { direction: "@", onConfirm: "&", onCancel: "&" }, link: link }; return directive; } angular.module('umbraco.directives').directive('umbConfirmAction', ConfirmAction); })(); /** @ngdoc directive @name umbraco.directives.directive:umbContentGrid @restrict E @scope @description Use this directive to generate a list of content items presented as a flexbox grid. <h3>Markup example</h3> <pre> <div ng-controller="My.Controller as vm"> <umb-content-grid content="vm.contentItems" content-properties="vm.includeProperties" on-click="vm.selectItem" on-click-name="vm.clickItem"> </umb-content-grid> </div> </pre> <h3>Controller example</h3> <pre> (function () { "use strict"; function Controller() { var vm = this; vm.contentItems = [ { "name": "Cape", "published": true, "icon": "icon-document", "updateDate": "15-02-2016", "owner": "Mr. Batman", "selected": false }, { "name": "Utility Belt", "published": true, "icon": "icon-document", "updateDate": "15-02-2016", "owner": "Mr. Batman", "selected": false }, { "name": "Cave", "published": true, "icon": "icon-document", "updateDate": "15-02-2016", "owner": "Mr. Batman", "selected": false } ]; vm.includeProperties = [ { "alias": "updateDate", "header": "Last edited" }, { "alias": "owner", "header": "Created by" } ]; vm.clickItem = clickItem; vm.selectItem = selectItem; function clickItem(item, $event, $index){ // do magic here } function selectItem(item, $event, $index) { // set item.selected = true; to select the item // do magic here } } angular.module("umbraco").controller("My.Controller", Controller); })(); </pre> @param {array} content (<code>binding</code>): Array of content items. @param {array=} contentProperties (<code>binding</code>): Array of content item properties to include in the item. If left empty the item will only show the item icon and name. @param {callback=} onClick (<code>binding</code>): Callback method to handle click events on the content item. <h3>The callback returns:</h3> <ul> <li><code>item</code>: The clicked item</li> <li><code>$event</code>: The select event</li> <li><code>$index</code>: The item index</li> </ul> @param {callback=} onClickName (<code>binding</code>): Callback method to handle click events on the checkmark icon. <h3>The callback returns:</h3> <ul> <li><code>item</code>: The selected item</li> <li><code>$event</code>: The select event</li> <li><code>$index</code>: The item index</li> </ul> **/ (function() { 'use strict'; function ContentGridDirective() { function link(scope, el, attr, ctrl) { scope.clickItem = function(item, $event, $index) { if(scope.onClick) { scope.onClick(item, $event, $index); } }; scope.clickItemName = function(item, $event, $index) { if(scope.onClickName) { scope.onClickName(item, $event, $index); } }; } var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/umb-content-grid.html', scope: { content: '=', contentProperties: "=", onClick: "=", onClickName: "=" }, link: link }; return directive; } angular.module('umbraco.directives').directive('umbContentGrid', ContentGridDirective); })(); (function() { 'use strict'; function UmbDisableFormValidation() { var directive = { restrict: 'A', require: '?form', link: function (scope, elm, attrs, ctrl) { //override the $setValidity function of the form to disable validation ctrl.$setValidity = function () { }; } }; return directive; } angular.module('umbraco.directives').directive('umbDisableFormValidation', UmbDisableFormValidation); })(); /** @ngdoc directive @name umbraco.directives.directive:umbEmptyState @restrict E @scope @description Use this directive to show an empty state message. <h3>Markup example</h3> <pre> <div ng-controller="My.Controller as vm"> <umb-empty-state ng-if="!vm.items" position="center"> // Empty state content </umb-empty-state> </div> </pre> @param {string=} size Set the size of the text ("small", "large"). @param {string=} position Set the position of the text ("center"). **/ (function() { 'use strict'; function EmptyStateDirective() { var directive = { restrict: 'E', replace: true, transclude: true, templateUrl: 'views/components/umb-empty-state.html', scope: { size: '@', position: '@' } }; return directive; } angular.module('umbraco.directives').directive('umbEmptyState', EmptyStateDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbFolderGrid @restrict E @scope @description Use this directive to generate a list of folders presented as a flexbox grid. <h3>Markup example</h3> <pre> <div ng-controller="My.Controller as vm"> <umb-folder-grid ng-if="vm.folders.length > 0" folders="vm.folders" on-click="vm.clickFolder" on-select="vm.selectFolder"> </umb-folder-grid> </div> </pre> <h3>Controller example</h3> <pre> (function () { "use strict"; function Controller(myService) { var vm = this; vm.folders = [ { "name": "Folder 1", "icon": "icon-folder", "selected": false }, { "name": "Folder 2", "icon": "icon-folder", "selected": false } ]; vm.clickFolder = clickFolder; vm.selectFolder = selectFolder; myService.getFolders().then(function(folders){ vm.folders = folders; }); function clickFolder(folder){ // Execute when clicking folder name/link } function selectFolder(folder, event, index) { // Execute when clicking folder // set folder.selected = true; to show checkmark icon } } angular.module("umbraco").controller("My.Controller", Controller); })(); </pre> @param {array} folders (<code>binding</code>): Array of folders @param {callback=} onClick (<code>binding</code>): Callback method to handle click events on the folder. <h3>The callback returns:</h3> <ul> <li><code>folder</code>: The selected folder</li> </ul> @param {callback=} onSelect (<code>binding</code>): Callback method to handle click events on the checkmark icon. <h3>The callback returns:</h3> <ul> <li><code>folder</code>: The selected folder</li> <li><code>$event</code>: The select event</li> <li><code>$index</code>: The folder index</li> </ul> **/ (function() { 'use strict'; function FolderGridDirective() { function link(scope, el, attr, ctrl) { scope.clickFolder = function(folder, $event, $index) { if(scope.onClick) { scope.onClick(folder, $event, $index); } }; scope.clickFolderName = function(folder, $event, $index) { if(scope.onClickName) { scope.onClickName(folder, $event, $index); $event.stopPropagation(); } }; } var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/umb-folder-grid.html', scope: { folders: '=', onClick: "=", onClickName: "=" }, link: link }; return directive; } angular.module('umbraco.directives').directive('umbFolderGrid', FolderGridDirective); })(); (function() { 'use strict'; function GridSelector() { function link(scope, el, attr, ctrl) { var eventBindings = []; scope.dialogModel = {}; scope.showDialog = false; scope.itemLabel = ""; // set default item name if(!scope.itemName){ scope.itemLabel = "item"; } else { scope.itemLabel = scope.itemName; } scope.removeItem = function(selectedItem) { var selectedItemIndex = scope.selectedItems.indexOf(selectedItem); scope.selectedItems.splice(selectedItemIndex, 1); }; scope.removeDefaultItem = function() { // it will be the last item so we can clear the array scope.selectedItems = []; // remove as default item scope.defaultItem = null; }; scope.openItemPicker = function($event){ scope.dialogModel = { view: "itempicker", title: "Choose " + scope.itemLabel, availableItems: scope.availableItems, selectedItems: scope.selectedItems, event: $event, show: true, submit: function(model) { scope.selectedItems.push(model.selectedItem); // if no default item - set item as default if(scope.defaultItem === null) { scope.setAsDefaultItem(model.selectedItem); } scope.dialogModel.show = false; scope.dialogModel = null; } }; }; scope.setAsDefaultItem = function(selectedItem) { // clear default item scope.defaultItem = {}; // set as default item scope.defaultItem = selectedItem; }; function updatePlaceholders() { // update default item if(scope.defaultItem !== null && scope.defaultItem.placeholder) { scope.defaultItem.name = scope.name; if(scope.alias !== null && scope.alias !== undefined) { scope.defaultItem.alias = scope.alias; } } // update selected items angular.forEach(scope.selectedItems, function(selectedItem) { if(selectedItem.placeholder) { selectedItem.name = scope.name; if(scope.alias !== null && scope.alias !== undefined) { selectedItem.alias = scope.alias; } } }); // update availableItems angular.forEach(scope.availableItems, function(availableItem) { if(availableItem.placeholder) { availableItem.name = scope.name; if(scope.alias !== null && scope.alias !== undefined) { availableItem.alias = scope.alias; } } }); } function activate() { // add watchers for updating placeholde name and alias if(scope.updatePlaceholder) { eventBindings.push(scope.$watch('name', function(newValue, oldValue){ updatePlaceholders(); })); eventBindings.push(scope.$watch('alias', function(newValue, oldValue){ updatePlaceholders(); })); } } activate(); // clean up scope.$on('$destroy', function(){ // clear watchers for(var e in eventBindings) { eventBindings[e](); } }); } var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/umb-grid-selector.html', scope: { name: "=", alias: "=", selectedItems: '=', availableItems: "=", defaultItem: "=", itemName: "@", updatePlaceholder: "=" }, link: link }; return directive; } angular.module('umbraco.directives').directive('umbGridSelector', GridSelector); })(); (function() { 'use strict'; function GroupsBuilderDirective(contentTypeHelper, contentTypeResource, mediaTypeResource, dataTypeHelper, dataTypeResource, $filter, iconHelper, $q, $timeout, notificationsService, localizationService) { function link(scope, el, attr, ctrl) { var validationTranslated = ""; var tabNoSortOrderTranslated = ""; scope.sortingMode = false; scope.toolbar = []; scope.sortableOptionsGroup = {}; scope.sortableOptionsProperty = {}; scope.sortingButtonKey = "general_reorder"; function activate() { setSortingOptions(); // set placeholder property on each group if (scope.model.groups.length !== 0) { angular.forEach(scope.model.groups, function(group) { addInitProperty(group); }); } // add init tab addInitGroup(scope.model.groups); activateFirstGroup(scope.model.groups); // localize texts localizationService.localize("validation_validation").then(function(value) { validationTranslated = value; }); localizationService.localize("contentTypeEditor_tabHasNoSortOrder").then(function(value) { tabNoSortOrderTranslated = value; }); } function setSortingOptions() { scope.sortableOptionsGroup = { distance: 10, tolerance: "pointer", opacity: 0.7, scroll: true, cursor: "move", placeholder: "umb-group-builder__group-sortable-placeholder", zIndex: 6000, handle: ".umb-group-builder__group-handle", items: ".umb-group-builder__group-sortable", start: function(e, ui) { ui.placeholder.height(ui.item.height()); }, stop: function(e, ui) { updateTabsSortOrder(); }, }; scope.sortableOptionsProperty = { distance: 10, tolerance: "pointer", connectWith: ".umb-group-builder__properties", opacity: 0.7, scroll: true, cursor: "move", placeholder: "umb-group-builder__property_sortable-placeholder", zIndex: 6000, handle: ".umb-group-builder__property-handle", items: ".umb-group-builder__property-sortable", start: function(e, ui) { ui.placeholder.height(ui.item.height()); }, stop: function(e, ui) { updatePropertiesSortOrder(); } }; } function updateTabsSortOrder() { var first = true; var prevSortOrder = 0; scope.model.groups.map(function(group){ var index = scope.model.groups.indexOf(group); if(group.tabState !== "init") { // set the first not inherited tab to sort order 0 if(!group.inherited && first) { // set the first tab sort order to 0 if prev is 0 if( prevSortOrder === 0 ) { group.sortOrder = 0; // when the first tab is inherited and sort order is not 0 } else { group.sortOrder = prevSortOrder + 1; } first = false; } else if(!group.inherited && !first) { // find next group var nextGroup = scope.model.groups[index + 1]; // if a groups is dropped in the middle of to groups with // same sort order. Give it the dropped group same sort order if( prevSortOrder === nextGroup.sortOrder ) { group.sortOrder = prevSortOrder; } else { group.sortOrder = prevSortOrder + 1; } } // store this tabs sort order as reference for the next prevSortOrder = group.sortOrder; } }); } function filterAvailableCompositions(selectedContentType, selecting) { //selecting = true if the user has check the item, false if the user has unchecked the item var selectedContentTypeAliases = selecting ? //the user has selected the item so add to the current list _.union(scope.compositionsDialogModel.compositeContentTypes, [selectedContentType.alias]) : //the user has unselected the item so remove from the current list _.reject(scope.compositionsDialogModel.compositeContentTypes, function(i) { return i === selectedContentType.alias; }); //get the currently assigned property type aliases - ensure we pass these to the server side filer var propAliasesExisting = _.filter(_.flatten(_.map(scope.model.groups, function(g) { return _.map(g.properties, function(p) { return p.alias; }); })), function (f) { return f !== null && f !== undefined; }); //use a different resource lookup depending on the content type type var resourceLookup = scope.contentType === "documentType" ? contentTypeResource.getAvailableCompositeContentTypes : mediaTypeResource.getAvailableCompositeContentTypes; return resourceLookup(scope.model.id, selectedContentTypeAliases, propAliasesExisting).then(function (filteredAvailableCompositeTypes) { _.each(scope.compositionsDialogModel.availableCompositeContentTypes, function (current) { //reset first current.allowed = true; //see if this list item is found in the response (allowed) list var found = _.find(filteredAvailableCompositeTypes, function (f) { return current.contentType.alias === f.contentType.alias; }); //allow if the item was found in the response (allowed) list - // and ensure its set to allowed if it is currently checked, // DO not allow if it's a locked content type. current.allowed = scope.model.lockedCompositeContentTypes.indexOf(current.contentType.alias) === -1 && (selectedContentTypeAliases.indexOf(current.contentType.alias) !== -1) || ((found !== null && found !== undefined) ? found.allowed : false); }); }); } function updatePropertiesSortOrder() { angular.forEach(scope.model.groups, function(group){ if( group.tabState !== "init" ) { group.properties = contentTypeHelper.updatePropertiesSortOrder(group.properties); } }); } function setupAvailableContentTypesModel(result) { scope.compositionsDialogModel.availableCompositeContentTypes = result; //iterate each one and set it up _.each(scope.compositionsDialogModel.availableCompositeContentTypes, function (c) { //enable it if it's part of the selected model if (scope.compositionsDialogModel.compositeContentTypes.indexOf(c.contentType.alias) !== -1) { c.allowed = true; } //set the inherited flags c.inherited = false; if (scope.model.lockedCompositeContentTypes.indexOf(c.contentType.alias) > -1) { c.inherited = true; } // convert icons for composite content types iconHelper.formatContentTypeIcons([c.contentType]); }); } /* ---------- DELETE PROMT ---------- */ scope.togglePrompt = function (object) { object.deletePrompt = !object.deletePrompt; }; scope.hidePrompt = function (object) { object.deletePrompt = false; }; /* ---------- TOOLBAR ---------- */ scope.toggleSortingMode = function(tool) { if (scope.sortingMode === true) { var sortOrderMissing = false; for (var i = 0; i < scope.model.groups.length; i++) { var group = scope.model.groups[i]; if (group.tabState !== "init" && group.sortOrder === undefined) { sortOrderMissing = true; group.showSortOrderMissing = true; notificationsService.error(validationTranslated + ": " + group.name + " " + tabNoSortOrderTranslated); } } if (!sortOrderMissing) { scope.sortingMode = false; scope.sortingButtonKey = "general_reorder"; } } else { scope.sortingMode = true; scope.sortingButtonKey = "general_reorderDone"; } }; scope.openCompositionsDialog = function() { scope.compositionsDialogModel = { title: "Compositions", contentType: scope.model, compositeContentTypes: scope.model.compositeContentTypes, view: "views/common/overlays/contenttypeeditor/compositions/compositions.html", confirmSubmit: { title: "Warning", description: "Removing a composition will delete all the associated property data. Once you save the document type there's no way back, are you sure?", checkboxLabel: "I know what I'm doing", enable: true }, submit: function(model, oldModel, confirmed) { var compositionRemoved = false; // check if any compositions has been removed for(var i = 0; oldModel.compositeContentTypes.length > i; i++) { var oldComposition = oldModel.compositeContentTypes[i]; if(_.contains(model.compositeContentTypes, oldComposition) === false) { compositionRemoved = true; } } // show overlay confirm box if compositions has been removed. if(compositionRemoved && confirmed === false) { scope.compositionsDialogModel.confirmSubmit.show = true; // submit overlay if no compositions has been removed // or the action has been confirmed } else { // make sure that all tabs has an init property if (scope.model.groups.length !== 0) { angular.forEach(scope.model.groups, function(group) { addInitProperty(group); }); } // remove overlay scope.compositionsDialogModel.show = false; scope.compositionsDialogModel = null; } }, close: function(oldModel) { // reset composition changes scope.model.groups = oldModel.contentType.groups; scope.model.compositeContentTypes = oldModel.contentType.compositeContentTypes; // remove overlay scope.compositionsDialogModel.show = false; scope.compositionsDialogModel = null; }, selectCompositeContentType: function (selectedContentType) { //first check if this is a new selection - we need to store this value here before any further digests/async // because after that the scope.model.compositeContentTypes will be populated with the selected value. var newSelection = scope.model.compositeContentTypes.indexOf(selectedContentType.alias) === -1; if (newSelection) { //merge composition with content type //use a different resource lookup depending on the content type type var resourceLookup = scope.contentType === "documentType" ? contentTypeResource.getById : mediaTypeResource.getById; resourceLookup(selectedContentType.id).then(function (composition) { //based on the above filtering we shouldn't be able to select an invalid one, but let's be safe and // double check here. var overlappingAliases = contentTypeHelper.validateAddingComposition(scope.model, composition); if (overlappingAliases.length > 0) { //this will create an invalid composition, need to uncheck it scope.compositionsDialogModel.compositeContentTypes.splice( scope.compositionsDialogModel.compositeContentTypes.indexOf(composition.alias), 1); //dissallow this until something else is unchecked selectedContentType.allowed = false; } else { contentTypeHelper.mergeCompositeContentType(scope.model, composition); } //based on the selection, we need to filter the available composite types list filterAvailableCompositions(selectedContentType, newSelection).then(function () { //TODO: Here we could probably re-enable selection if we previously showed a throbber or something }); }); } else { // split composition from content type contentTypeHelper.splitCompositeContentType(scope.model, selectedContentType); //based on the selection, we need to filter the available composite types list filterAvailableCompositions(selectedContentType, newSelection).then(function () { //TODO: Here we could probably re-enable selection if we previously showed a throbber or something }); } } }; var availableContentTypeResource = scope.contentType === "documentType" ? contentTypeResource.getAvailableCompositeContentTypes : mediaTypeResource.getAvailableCompositeContentTypes; var countContentTypeResource = scope.contentType === "documentType" ? contentTypeResource.getCount : mediaTypeResource.getCount; //get the currently assigned property type aliases - ensure we pass these to the server side filer var propAliasesExisting = _.filter(_.flatten(_.map(scope.model.groups, function(g) { return _.map(g.properties, function(p) { return p.alias; }); })), function(f) { return f !== null && f !== undefined; }); $q.all([ //get available composite types availableContentTypeResource(scope.model.id, [], propAliasesExisting).then(function (result) { setupAvailableContentTypesModel(result); }), //get content type count countContentTypeResource().then(function(result) { scope.compositionsDialogModel.totalContentTypes = parseInt(result, 10); }) ]).then(function() { //resolves when both other promises are done, now show it scope.compositionsDialogModel.show = true; }); }; /* ---------- GROUPS ---------- */ scope.addGroup = function(group) { // set group sort order var index = scope.model.groups.indexOf(group); var prevGroup = scope.model.groups[index - 1]; if( index > 0) { // set index to 1 higher than the previous groups sort order group.sortOrder = prevGroup.sortOrder + 1; } else { // first group - sort order will be 0 group.sortOrder = 0; } // activate group scope.activateGroup(group); }; scope.activateGroup = function(selectedGroup) { // set all other groups that are inactive to active angular.forEach(scope.model.groups, function(group) { // skip init tab if (group.tabState !== "init") { group.tabState = "inActive"; } }); selectedGroup.tabState = "active"; }; scope.removeGroup = function(groupIndex) { scope.model.groups.splice(groupIndex, 1); addInitGroup(scope.model.groups); }; scope.updateGroupTitle = function(group) { if (group.properties.length === 0) { addInitProperty(group); } }; scope.changeSortOrderValue = function(group) { if (group.sortOrder !== undefined) { group.showSortOrderMissing = false; } scope.model.groups = $filter('orderBy')(scope.model.groups, 'sortOrder'); }; function addInitGroup(groups) { // check i init tab already exists var addGroup = true; angular.forEach(groups, function(group) { if (group.tabState === "init") { addGroup = false; } }); if (addGroup) { groups.push({ properties: [], parentTabContentTypes: [], parentTabContentTypeNames: [], name: "", tabState: "init" }); } return groups; } function activateFirstGroup(groups) { if (groups && groups.length > 0) { var firstGroup = groups[0]; if(!firstGroup.tabState || firstGroup.tabState === "inActive") { firstGroup.tabState = "active"; } } } /* ---------- PROPERTIES ---------- */ scope.addProperty = function(property, group) { // set property sort order var index = group.properties.indexOf(property); var prevProperty = group.properties[index - 1]; if( index > 0) { // set index to 1 higher than the previous property sort order property.sortOrder = prevProperty.sortOrder + 1; } else { // first property - sort order will be 0 property.sortOrder = 0; } // open property settings dialog scope.editPropertyTypeSettings(property, group); }; scope.editPropertyTypeSettings = function(property, group) { if (!property.inherited && !property.locked) { scope.propertySettingsDialogModel = {}; scope.propertySettingsDialogModel.title = "Property settings"; scope.propertySettingsDialogModel.property = property; scope.propertySettingsDialogModel.contentType = scope.contentType; scope.propertySettingsDialogModel.contentTypeName = scope.model.name; scope.propertySettingsDialogModel.view = "views/common/overlays/contenttypeeditor/propertysettings/propertysettings.html"; scope.propertySettingsDialogModel.show = true; // set state to active to access the preview property.propertyState = "active"; // set property states property.dialogIsOpen = true; scope.propertySettingsDialogModel.submit = function(model) { property.inherited = false; property.dialogIsOpen = false; // update existing data types if(model.updateSameDataTypes) { updateSameDataTypes(property); } // remove dialog scope.propertySettingsDialogModel.show = false; scope.propertySettingsDialogModel = null; // push new init property to group addInitProperty(group); // set focus on init property var numberOfProperties = group.properties.length; group.properties[numberOfProperties - 1].focus = true; // push new init tab to the scope addInitGroup(scope.model.groups); }; scope.propertySettingsDialogModel.close = function(oldModel) { // reset all property changes property.label = oldModel.property.label; property.alias = oldModel.property.alias; property.description = oldModel.property.description; property.config = oldModel.property.config; property.editor = oldModel.property.editor; property.view = oldModel.property.view; property.dataTypeId = oldModel.property.dataTypeId; property.dataTypeIcon = oldModel.property.dataTypeIcon; property.dataTypeName = oldModel.property.dataTypeName; property.validation.mandatory = oldModel.property.validation.mandatory; property.validation.pattern = oldModel.property.validation.pattern; property.showOnMemberProfile = oldModel.property.showOnMemberProfile; property.memberCanEdit = oldModel.property.memberCanEdit; // because we set state to active, to show a preview, we have to check if has been filled out // label is required so if it is not filled we know it is a placeholder if(oldModel.property.editor === undefined || oldModel.property.editor === null || oldModel.property.editor === "") { property.propertyState = "init"; } else { property.propertyState = oldModel.property.propertyState; } // remove dialog scope.propertySettingsDialogModel.show = false; scope.propertySettingsDialogModel = null; }; } }; scope.deleteProperty = function(tab, propertyIndex) { // remove property tab.properties.splice(propertyIndex, 1); // if the last property in group is an placeholder - remove add new tab placeholder if(tab.properties.length === 1 && tab.properties[0].propertyState === "init") { angular.forEach(scope.model.groups, function(group, index, groups){ if(group.tabState === 'init') { groups.splice(index, 1); } }); } }; function addInitProperty(group) { var addInitPropertyBool = true; var initProperty = { label: null, alias: null, propertyState: "init", validation: { mandatory: false, pattern: null } }; // check if there already is an init property angular.forEach(group.properties, function(property) { if (property.propertyState === "init") { addInitPropertyBool = false; } }); if (addInitPropertyBool) { group.properties.push(initProperty); } return group; } function updateSameDataTypes(newProperty) { // find each property angular.forEach(scope.model.groups, function(group){ angular.forEach(group.properties, function(property){ if(property.dataTypeId === newProperty.dataTypeId) { // update property data property.config = newProperty.config; property.editor = newProperty.editor; property.view = newProperty.view; property.dataTypeId = newProperty.dataTypeId; property.dataTypeIcon = newProperty.dataTypeIcon; property.dataTypeName = newProperty.dataTypeName; } }); }); } var unbindModelWatcher = scope.$watch('model', function(newValue, oldValue) { if (newValue !== undefined && newValue.groups !== undefined) { activate(); } }); // clean up scope.$on('$destroy', function(){ unbindModelWatcher(); }); } var directive = { restrict: "E", replace: true, templateUrl: "views/components/umb-groups-builder.html", scope: { model: "=", compositions: "=", sorting: "=", contentType: "@" }, link: link }; return directive; } angular.module('umbraco.directives').directive('umbGroupsBuilder', GroupsBuilderDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbkeyboardShortcutsOverview @restrict E @scope @description <p>Use this directive to show an overview of keyboard shortcuts in an editor. The directive will render an overview trigger wich shows how the overview is opened. When this combination is hit an overview is opened with shortcuts based on the model sent to the directive.</p> <h3>Markup example</h3> <pre> <div ng-controller="My.Controller as vm"> <umb-keyboard-shortcuts-overview model="vm.keyboardShortcutsOverview"> </umb-keyboard-shortcuts-overview> </div> </pre> <h3>Controller example</h3> <pre> (function () { "use strict"; function Controller() { var vm = this; vm.keyboardShortcutsOverview = [ { "name": "Sections", "shortcuts": [ { "description": "Navigate sections", "keys": [ {"key": "1"}, {"key": "4"} ], "keyRange": true } ] }, { "name": "Design", "shortcuts": [ { "description": "Add tab", "keys": [ {"key": "alt"}, {"key": "shift"}, {"key": "t"} ] } ] } ]; } angular.module("umbraco").controller("My.Controller", Controller); })(); </pre> <h3>Model description</h3> <ul> <li> <strong>name</strong> <small>(string)</small> - Sets the shortcut section name. </li> <li> <strong>shortcuts</strong> <small>(array)</small> - Array of available shortcuts in the section. </li> <ul> <li> <strong>description</strong> <small>(string)</small> - Short description of the shortcut. </li> <li> <strong>keys</strong> <small>(array)</small> - Array of keys in the shortcut. </li> <ul> <li> <strong>key</strong> <small>(string)</small> - The invidual key in the shortcut. </li> </ul> <li> <strong>keyRange</strong> <small>(boolean)</small> - Set to <code>true</code> to show a key range. It combines the shortcut keys with "-" instead of "+". </li> </ul> </ul> @param {object} model keyboard shortcut model. See description and example above. **/ (function() { 'use strict'; function KeyboardShortcutsOverviewDirective() { function link(scope, el, attr, ctrl) { scope.shortcutOverlay = false; scope.toggleShortcutsOverlay = function() { scope.shortcutOverlay = !scope.shortcutOverlay; }; } var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/umb-keyboard-shortcuts-overview.html', link: link, scope: { model: "=" } }; return directive; } angular.module('umbraco.directives').directive('umbKeyboardShortcutsOverview', KeyboardShortcutsOverviewDirective); })(); /** * @ngdoc directive * @name umbraco.directives.directive:umbLaunchMiniEditor * @restrict E * @function * @description * Used on a button to launch a mini content editor editor dialog **/ angular.module("umbraco.directives") .directive('umbLaunchMiniEditor', function (dialogService, editorState, fileManager, contentEditingHelper) { return { restrict: 'A', replace: false, scope: { node: '=umbLaunchMiniEditor', }, link: function(scope, element, attrs) { var launched = false; element.click(function() { if (launched === true) { return; } launched = true; //We need to store the current files selected in the file manager locally because the fileManager // is a singleton and is shared globally. The mini dialog will also be referencing the fileManager // and we don't want it to be sharing the same files as the main editor. So we'll store the current files locally here, // clear them out and then launch the dialog. When the dialog closes, we'll reset the fileManager to it's previous state. var currFiles = _.groupBy(fileManager.getFiles(), "alias"); fileManager.clearFiles(); //We need to store the original editorState entity because it will need to change when the mini editor is loaded so that // any property editors that are working with editorState get given the correct entity, otherwise strange things will // start happening. var currEditorState = editorState.getCurrent(); dialogService.open({ template: "views/common/dialogs/content/edit.html", id: scope.node.id, closeOnSave: true, tabFilter: ["Generic properties"], callback: function (data) { //set the node name back scope.node.name = data.name; //reset the fileManager to what it was fileManager.clearFiles(); _.each(currFiles, function (val, key) { fileManager.setFiles(key, _.map(currFiles['upload'], function (i) { return i.file; })); }); //reset the editor state editorState.set(currEditorState); //Now we need to check if the content item that was edited was actually the same content item // as the main content editor and if so, update all property data if (data.id === currEditorState.id) { var changed = contentEditingHelper.reBindChangedProperties(currEditorState, data); } launched = false; }, closeCallback: function () { //reset the fileManager to what it was fileManager.clearFiles(); _.each(currFiles, function (val, key) { fileManager.setFiles(key, _.map(currFiles['upload'], function (i) { return i.file; })); }); //reset the editor state editorState.set(currEditorState); launched = false; } }); }); } }; }); (function() { 'use strict'; function LayoutSelectorDirective() { function link(scope, el, attr, ctrl) { scope.layoutDropDownIsOpen = false; scope.showLayoutSelector = true; function activate() { setVisibility(); setActiveLayout(scope.layouts); } function setVisibility() { var numberOfAllowedLayouts = getNumberOfAllowedLayouts(scope.layouts); if(numberOfAllowedLayouts === 1) { scope.showLayoutSelector = false; } } function getNumberOfAllowedLayouts(layouts) { var allowedLayouts = 0; for (var i = 0; layouts.length > i; i++) { var layout = layouts[i]; if(layout.selected === true) { allowedLayouts++; } } return allowedLayouts; } function setActiveLayout(layouts) { for (var i = 0; layouts.length > i; i++) { var layout = layouts[i]; if(layout.path === scope.activeLayout.path) { layout.active = true; } } } scope.pickLayout = function(selectedLayout) { if(scope.onLayoutSelect) { scope.onLayoutSelect(selectedLayout); scope.layoutDropDownIsOpen = false; } }; scope.toggleLayoutDropdown = function() { scope.layoutDropDownIsOpen = !scope.layoutDropDownIsOpen; }; scope.closeLayoutDropdown = function() { scope.layoutDropDownIsOpen = false; }; activate(); } var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/umb-layout-selector.html', scope: { layouts: '=', activeLayout: '=', onLayoutSelect: "=" }, link: link }; return directive; } angular.module('umbraco.directives').directive('umbLayoutSelector', LayoutSelectorDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbLightbox @restrict E @scope @description <p>Use this directive to open a gallery in a lightbox overlay.</p> <h3>Markup example</h3> <pre> <div ng-controller="My.Controller as vm"> <div class="my-gallery"> <a href="" ng-repeat="image in images" ng-click="vm.openLightbox($index, images)"> <img ng-src="image.source" /> </a> </div> <umb-lightbox ng-if="vm.lightbox.show" items="vm.lightbox.items" active-item-index="vm.lightbox.activeIndex" on-close="vm.closeLightbox"> </umb-lightbox> </div> </pre> <h3>Controller example</h3> <pre> (function () { "use strict"; function Controller() { var vm = this; vm.images = [ { "source": "linkToImage" }, { "source": "linkToImage" } ] vm.openLightbox = openLightbox; vm.closeLightbox = closeLightbox; function openLightbox(itemIndex, items) { vm.lightbox = { show: true, items: items, activeIndex: itemIndex }; } function closeLightbox() { vm.lightbox.show = false; vm.lightbox = null; } } angular.module("umbraco").controller("My.Controller", Controller); })(); </pre> @param {array} items Array of gallery items. @param {callback} onClose Callback when the lightbox is closed. @param {number} activeItemIndex Index of active item. **/ (function() { 'use strict'; function LightboxDirective() { function link(scope, el, attr, ctrl) { function activate() { var eventBindings = []; el.appendTo("body"); // clean up scope.$on('$destroy', function() { // unbind watchers for (var e in eventBindings) { eventBindings[e](); } }); } scope.next = function() { var nextItemIndex = scope.activeItemIndex + 1; if( nextItemIndex < scope.items.length) { scope.items[scope.activeItemIndex].active = false; scope.items[nextItemIndex].active = true; scope.activeItemIndex = nextItemIndex; } }; scope.prev = function() { var prevItemIndex = scope.activeItemIndex - 1; if( prevItemIndex >= 0) { scope.items[scope.activeItemIndex].active = false; scope.items[prevItemIndex].active = true; scope.activeItemIndex = prevItemIndex; } }; scope.close = function() { if(scope.onClose) { scope.onClose(); } }; activate(); } var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/umb-lightbox.html', scope: { items: '=', onClose: "=", activeItemIndex: "=" }, link: link }; return directive; } angular.module('umbraco.directives').directive('umbLightbox', LightboxDirective); })(); (function() { 'use strict'; function ListViewLayoutDirective() { function link(scope, el, attr, ctrl) { scope.getContent = function(contentId) { if(scope.onGetContent) { scope.onGetContent(contentId); } }; } var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/umb-list-view-layout.html', scope: { contentId: '=', folders: '=', items: '=', selection: '=', options: '=', entityType: '@', onGetContent: '=' }, link: link }; return directive; } angular.module('umbraco.directives').directive('umbListViewLayout', ListViewLayoutDirective); })(); (function() { 'use strict'; function ListViewSettingsDirective(contentTypeResource, dataTypeResource, dataTypeHelper, listViewPrevalueHelper) { function link(scope, el, attr, ctrl) { scope.dataType = {}; scope.editDataTypeSettings = false; scope.customListViewCreated = false; /* ---------- INIT ---------- */ function activate() { if(scope.enableListView) { dataTypeResource.getByName(scope.listViewName) .then(function(dataType) { scope.dataType = dataType; listViewPrevalueHelper.setPrevalues(dataType.preValues); scope.customListViewCreated = checkForCustomListView(); }); } else { scope.dataType = {}; } } /* ----------- LIST VIEW SETTINGS --------- */ scope.toggleEditListViewDataTypeSettings = function() { scope.editDataTypeSettings = !scope.editDataTypeSettings; }; scope.saveListViewDataType = function() { var preValues = dataTypeHelper.createPreValueProps(scope.dataType.preValues); dataTypeResource.save(scope.dataType, preValues, false).then(function(dataType) { // store data type scope.dataType = dataType; // hide settings panel scope.editDataTypeSettings = false; }); }; /* ---------- CUSTOM LIST VIEW ---------- */ scope.createCustomListViewDataType = function() { dataTypeResource.createCustomListView(scope.modelAlias).then(function(dataType) { // store data type scope.dataType = dataType; // set list view name on scope scope.listViewName = dataType.name; // change state to custom list view scope.customListViewCreated = true; // show settings panel scope.editDataTypeSettings = true; }); }; scope.removeCustomListDataType = function() { scope.editDataTypeSettings = false; // delete custom list view data type dataTypeResource.deleteById(scope.dataType.id).then(function(dataType) { // set list view name on scope if(scope.contentType === "documentType") { scope.listViewName = "List View - Content"; } else if(scope.contentType === "mediaType") { scope.listViewName = "List View - Media"; } // get default data type dataTypeResource.getByName(scope.listViewName) .then(function(dataType) { // store data type scope.dataType = dataType; // change state to default list view scope.customListViewCreated = false; }); }); }; /* ----------- SCOPE WATCHERS ----------- */ var unbindEnableListViewWatcher = scope.$watch('enableListView', function(newValue, oldValue){ if(newValue !== undefined) { activate(); } }); // clean up scope.$on('$destroy', function(){ unbindEnableListViewWatcher(); }); /* ----------- METHODS ---------- */ function checkForCustomListView() { return scope.dataType.name === "List View - " + scope.modelAlias; } } var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/umb-list-view-settings.html', scope: { enableListView: "=", listViewName: "=", modelAlias: "=", contentType: "@" }, link: link }; return directive; } angular.module('umbraco.directives').directive('umbListViewSettings', ListViewSettingsDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbLoadIndicator @restrict E @description Use this directive to generate a loading indicator. <h3>Markup example</h3> <pre> <div ng-controller="My.Controller as vm"> <umb-load-indicator ng-if="vm.loading"> </umb-load-indicator> <div class="content" ng-if="!vm.loading"> <p>{{content}}</p> </div> </div> </pre> <h3>Controller example</h3> <pre> (function () { "use strict"; function Controller(myService) { var vm = this; vm.content = ""; vm.loading = true; myService.getContent().then(function(content){ vm.content = content; vm.loading = false; }); } ½ angular.module("umbraco").controller("My.Controller", Controller); })(); </pre> **/ (function() { 'use strict'; function UmbLoadIndicatorDirective() { var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/umb-load-indicator.html' }; return directive; } angular.module('umbraco.directives').directive('umbLoadIndicator', UmbLoadIndicatorDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbLockedField @restrict E @scope @description Use this directive to render a value with a lock next to it. When the lock is clicked the value gets unlocked and can be edited. <h3>Markup example</h3> <pre> <div ng-controller="My.Controller as vm"> <umb-locked-field ng-model="vm.value" placeholder-text="'Click to unlock...'"> </umb-locked-field> </div> </pre> <h3>Controller example</h3> <pre> (function () { "use strict"; function Controller() { var vm = this; vm.value = "My locked text"; } angular.module("umbraco").controller("My.Controller", Controller); })(); </pre> @param {string} ngModel (<code>binding</code>): The locked text. @param {boolean=} locked (<code>binding</code>): <Code>true</code> by default. Set to <code>false</code> to unlock the text. @param {string=} placeholderText (<code>binding</code>): If ngModel is empty this text will be shown. @param {string=} regexValidation (<code>binding</code>): Set a regex expression for validation of the field. @param {string=} serverValidationField (<code>attribute</code>): Set a server validation field. **/ (function() { 'use strict'; function LockedFieldDirective($timeout, localizationService) { function link(scope, el, attr, ngModelCtrl) { function activate() { // if locked state is not defined as an attr set default state if (scope.locked === undefined || scope.locked === null) { scope.locked = true; } // if regex validation is not defined as an attr set default state // if this is set to an empty string then regex validation can be ignored. if (scope.regexValidation === undefined || scope.regexValidation === null) { scope.regexValidation = "^[a-zA-Z]\\w.*$"; } if (scope.serverValidationField === undefined || scope.serverValidationField === null) { scope.serverValidationField = ""; } // if locked state is not defined as an attr set default state if (scope.placeholderText === undefined || scope.placeholderText === null) { scope.placeholderText = "Enter value..."; } } scope.lock = function() { scope.locked = true; }; scope.unlock = function() { scope.locked = false; }; activate(); } var directive = { require: "ngModel", restrict: 'E', replace: true, templateUrl: 'views/components/umb-locked-field.html', scope: { ngModel: "=", locked: "=?", placeholderText: "=?", regexValidation: "=?", serverValidationField: "@" }, link: link }; return directive; } angular.module('umbraco.directives').directive('umbLockedField', LockedFieldDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbMediaGrid @restrict E @scope @description Use this directive to generate a thumbnail grid of media items. <h3>Markup example</h3> <pre> <div ng-controller="My.Controller as vm"> <umb-media-grid items="vm.mediaItems" on-click="vm.clickItem" on-click-name="vm.clickItemName"> </umb-media-grid> </div> </pre> <h3>Controller example</h3> <pre> (function () { "use strict"; function Controller() { var vm = this; vm.mediaItems = []; vm.clickItem = clickItem; vm.clickItemName = clickItemName; myService.getMediaItems().then(function (mediaItems) { vm.mediaItems = mediaItems; }); function clickItem(item, $event, $index){ // do magic here } function clickItemName(item, $event, $index) { // set item.selected = true; to select the item // do magic here } } angular.module("umbraco").controller("My.Controller", Controller); })(); </pre> @param {array} items (<code>binding</code>): Array of media items. @param {callback=} onDetailsHover (<code>binding</code>): Callback method when the details icon is hovered. <h3>The callback returns:</h3> <ul> <li><code>item</code>: The hovered item</li> <li><code>$event</code>: The hover event</li> <li><code>hover</code>: Boolean to tell if the item is hovered or not</li> </ul> @param {callback=} onClick (<code>binding</code>): Callback method to handle click events on the media item. <h3>The callback returns:</h3> <ul> <li><code>item</code>: The clicked item</li> <li><code>$event</code>: The click event</li> <li><code>$index</code>: The item index</li> </ul> @param {callback=} onClickName (<code>binding</code>): Callback method to handle click events on the media item name. <h3>The callback returns:</h3> <ul> <li><code>item</code>: The clicked item</li> <li><code>$event</code>: The click event</li> <li><code>$index</code>: The item index</li> </ul> @param {string=} filterBy (<code>binding</code>): String to filter media items by @param {string=} itemMaxWidth (<code>attribute</code>): Sets a max width on the media item thumbnails. @param {string=} itemMaxHeight (<code>attribute</code>): Sets a max height on the media item thumbnails. @param {string=} itemMinWidth (<code>attribute</code>): Sets a min width on the media item thumbnails. @param {string=} itemMinHeight (<code>attribute</code>): Sets a min height on the media item thumbnails. **/ (function() { 'use strict'; function MediaGridDirective($filter, mediaHelper) { function link(scope, el, attr, ctrl) { var itemDefaultHeight = 200; var itemDefaultWidth = 200; var itemMaxWidth = 200; var itemMaxHeight = 200; var itemMinWidth = 125; var itemMinHeight = 125; function activate() { if (scope.itemMaxWidth) { itemMaxWidth = scope.itemMaxWidth; } if (scope.itemMaxHeight) { itemMaxHeight = scope.itemMaxHeight; } if (scope.itemMinWidth) { itemMinWidth = scope.itemMinWidth; } if (scope.itemMinWidth) { itemMinHeight = scope.itemMinHeight; } for (var i = 0; scope.items.length > i; i++) { var item = scope.items[i]; setItemData(item); setOriginalSize(item, itemMaxHeight); // remove non images when onlyImages is set to true if(scope.onlyImages === "true" && !item.isFolder && !item.thumbnail){ scope.items.splice(i, 1); i--; } } if (scope.items.length > 0) { setFlexValues(scope.items); } } function setItemData(item) { item.isFolder = !mediaHelper.hasFilePropertyType(item); if (!item.isFolder) { item.thumbnail = mediaHelper.resolveFile(item, true); item.image = mediaHelper.resolveFile(item, false); var fileProp = _.find(item.properties, function (v) { return (v.alias === "umbracoFile"); }); if (fileProp && fileProp.value) { item.file = fileProp.value; } var extensionProp = _.find(item.properties, function (v) { return (v.alias === "umbracoExtension"); }); if (extensionProp && extensionProp.value) { item.extension = extensionProp.value; } } } function setOriginalSize(item, maxHeight) { //set to a square by default item.width = itemDefaultWidth; item.height = itemDefaultHeight; item.aspectRatio = 1; var widthProp = _.find(item.properties, function(v) { return (v.alias === "umbracoWidth"); }); if (widthProp && widthProp.value) { item.width = parseInt(widthProp.value, 10); if (isNaN(item.width)) { item.width = itemDefaultWidth; } } var heightProp = _.find(item.properties, function(v) { return (v.alias === "umbracoHeight"); }); if (heightProp && heightProp.value) { item.height = parseInt(heightProp.value, 10); if (isNaN(item.height)) { item.height = itemDefaultWidth; } } item.aspectRatio = item.width / item.height; // set max width and height // landscape if (item.aspectRatio >= 1) { if (item.width > itemMaxWidth) { item.width = itemMaxWidth; item.height = itemMaxWidth / item.aspectRatio; } // portrait } else { if (item.height > itemMaxHeight) { item.height = itemMaxHeight; item.width = itemMaxHeight * item.aspectRatio; } } } function setFlexValues(mediaItems) { var flexSortArray = mediaItems; var smallestImageWidth = null; var widestImageAspectRatio = null; // sort array after image width with the widest image first flexSortArray = $filter('orderBy')(flexSortArray, 'width', true); // find widest image aspect ratio widestImageAspectRatio = flexSortArray[0].aspectRatio; // find smallest image width smallestImageWidth = flexSortArray[flexSortArray.length - 1].width; for (var i = 0; flexSortArray.length > i; i++) { var mediaItem = flexSortArray[i]; var flex = 1 / (widestImageAspectRatio / mediaItem.aspectRatio); if (flex === 0) { flex = 1; } var imageMinFlexWidth = smallestImageWidth * flex; var flexStyle = { "flex": flex + " 1 " + imageMinFlexWidth + "px", "max-width": mediaItem.width + "px", "min-width": itemMinWidth + "px", "min-height": itemMinHeight + "px" }; mediaItem.flexStyle = flexStyle; } } scope.clickItem = function(item, $event, $index) { if (scope.onClick) { scope.onClick(item, $event, $index); } }; scope.clickItemName = function(item, $event, $index) { if (scope.onClickName) { scope.onClickName(item, $event, $index); $event.stopPropagation(); } }; scope.hoverItemDetails = function(item, $event, hover) { if (scope.onDetailsHover) { scope.onDetailsHover(item, $event, hover); } }; var unbindItemsWatcher = scope.$watch('items', function(newValue, oldValue) { if (angular.isArray(newValue)) { activate(); } }); scope.$on('$destroy', function() { unbindItemsWatcher(); }); } var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/umb-media-grid.html', scope: { items: '=', onDetailsHover: "=", onClick: '=', onClickName: "=", filterBy: "=", itemMaxWidth: "@", itemMaxHeight: "@", itemMinWidth: "@", itemMinHeight: "@", onlyImages: "@" }, link: link }; return directive; } angular.module('umbraco.directives').directive('umbMediaGrid', MediaGridDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbPagination @restrict E @scope @description Use this directive to generate a pagination. <h3>Markup example</h3> <pre> <div ng-controller="My.Controller as vm"> <umb-pagination page-number="vm.pagination.pageNumber" total-pages="vm.pagination.totalPages" on-next="vm.nextPage" on-prev="vm.prevPage" on-go-to-page="vm.goToPage"> </umb-pagination> </div> </pre> <h3>Controller example</h3> <pre> (function () { "use strict"; function Controller() { var vm = this; vm.pagination = { pageNumber: 1, totalPages: 10 } vm.nextPage = nextPage; vm.prevPage = prevPage; vm.goToPage = goToPage; function nextPage(pageNumber) { // do magic here console.log(pageNumber); alert("nextpage"); } function prevPage(pageNumber) { // do magic here console.log(pageNumber); alert("prevpage"); } function goToPage(pageNumber) { // do magic here console.log(pageNumber); alert("go to"); } } angular.module("umbraco").controller("My.Controller", Controller); })(); </pre> @param {number} pageNumber (<code>binding</code>): Current page number. @param {number} totalPages (<code>binding</code>): The total number of pages. @param {callback} onNext (<code>binding</code>): Callback method to go to the next page. <h3>The callback returns:</h3> <ul> <li><code>pageNumber</code>: The page number</li> </ul> @param {callback=} onPrev (<code>binding</code>): Callback method to go to the previous page. <h3>The callback returns:</h3> <ul> <li><code>pageNumber</code>: The page number</li> </ul> @param {callback=} onGoToPage (<code>binding</code>): Callback method to go to a specific page. <h3>The callback returns:</h3> <ul> <li><code>pageNumber</code>: The page number</li> </ul> **/ (function() { 'use strict'; function PaginationDirective() { function link(scope, el, attr, ctrl) { function activate() { scope.pagination = []; var i = 0; if (scope.totalPages <= 10) { for (i = 0; i < scope.totalPages; i++) { scope.pagination.push({ val: (i + 1), isActive: scope.pageNumber === (i + 1) }); } } else { //if there is more than 10 pages, we need to do some fancy bits //get the max index to start var maxIndex = scope.totalPages - 10; //set the start, but it can't be below zero var start = Math.max(scope.pageNumber - 5, 0); //ensure that it's not too far either start = Math.min(maxIndex, start); for (i = start; i < (10 + start) ; i++) { scope.pagination.push({ val: (i + 1), isActive: scope.pageNumber === (i + 1) }); } //now, if the start is greater than 0 then '1' will not be displayed, so do the elipses thing if (start > 0) { scope.pagination.unshift({ name: "First", val: 1, isActive: false }, {val: "...",isActive: false}); } //same for the end if (start < maxIndex) { scope.pagination.push({ val: "...", isActive: false }, { name: "Last", val: scope.totalPages, isActive: false }); } } } scope.next = function() { if (scope.onNext && scope.pageNumber < scope.totalPages) { scope.pageNumber++; scope.onNext(scope.pageNumber); } }; scope.prev = function(pageNumber) { if (scope.onPrev && scope.pageNumber > 1) { scope.pageNumber--; scope.onPrev(scope.pageNumber); } }; scope.goToPage = function(pageNumber) { if(scope.onGoToPage) { scope.pageNumber = pageNumber + 1; scope.onGoToPage(scope.pageNumber); } }; var unbindPageNumberWatcher = scope.$watch('pageNumber', function(newValue, oldValue){ activate(); }); scope.$on('$destroy', function(){ unbindPageNumberWatcher(); }); activate(); } var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/umb-pagination.html', scope: { pageNumber: "=", totalPages: "=", onNext: "=", onPrev: "=", onGoToPage: "=" }, link: link }; return directive; } angular.module('umbraco.directives').directive('umbPagination', PaginationDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbProgressBar @restrict E @scope @description Use this directive to generate a progress bar. <h3>Markup example</h3> <pre> <umb-progress-bar percentage="60"> </umb-progress-bar> </pre> @param {number} percentage (<code>attribute</code>): The progress in percentage. **/ (function() { 'use strict'; function ProgressBarDirective() { var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/umb-progress-bar.html', scope: { percentage: "@" } }; return directive; } angular.module('umbraco.directives').directive('umbProgressBar', ProgressBarDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbStickyBar @restrict A @description Use this directive make an element sticky and follow the page when scrolling. <h3>Markup example</h3> <pre> <div ng-controller="My.Controller as vm"> <div class="my-sticky-bar" umb-sticky-bar scrollable-container=".container"> </div> </div> </pre> <h3>CSS example</h3> <pre> .my-sticky-bar { padding: 15px 0; background: #000000; position: relative; top: 0; } .my-sticky-bar.-umb-sticky-bar { top: 100px; } </pre> @param {string} scrollableContainer Set the class (".element") or the id ("#element") of the scrollable container element. **/ (function() { 'use strict'; function StickyBarDirective($rootScope) { function link(scope, el, attr, ctrl) { var bar = $(el); var scrollableContainer = null; var clonedBar = null; var cloneIsMade = false; var barTop = bar.context.offsetTop; function activate() { if (attr.scrollableContainer) { scrollableContainer = $(attr.scrollableContainer); } else { scrollableContainer = $(window); } scrollableContainer.on('scroll.umbStickyBar', determineVisibility).trigger("scroll"); $(window).on('resize.umbStickyBar', determineVisibility); scope.$on('$destroy', function() { scrollableContainer.off('.umbStickyBar'); $(window).off('.umbStickyBar'); }); } function determineVisibility() { var scrollTop = scrollableContainer.scrollTop(); if (scrollTop > barTop) { if (!cloneIsMade) { createClone(); clonedBar.css({ 'visibility': 'visible' }); } else { calculateSize(); } } else { if (cloneIsMade) { //remove cloned element (switched places with original on creation) bar.remove(); bar = clonedBar; clonedBar = null; bar.removeClass('-umb-sticky-bar'); bar.css({ position: 'relative', 'width': 'auto', 'height': 'auto', 'z-index': 'auto', 'visibility': 'visible' }); cloneIsMade = false; } } } function calculateSize() { clonedBar.css({ width: bar.outerWidth(), height: bar.height() }); } function createClone() { //switch place with cloned element, to keep binding intact clonedBar = bar; bar = clonedBar.clone(); clonedBar.after(bar); clonedBar.addClass('-umb-sticky-bar'); clonedBar.css({ 'position': 'fixed', 'z-index': 500, 'visibility': 'hidden' }); cloneIsMade = true; calculateSize(); } activate(); } var directive = { restrict: 'A', link: link }; return directive; } angular.module('umbraco.directives').directive('umbStickyBar', StickyBarDirective); })(); (function () { 'use strict'; function TableDirective() { function link(scope, el, attr, ctrl) { scope.clickItem = function (item, $event) { if (scope.onClick) { scope.onClick(item); $event.stopPropagation(); } }; scope.selectItem = function (item, $index, $event) { if (scope.onSelect) { scope.onSelect(item, $index, $event); $event.stopPropagation(); } }; scope.selectAll = function ($event) { if (scope.onSelectAll) { scope.onSelectAll($event); } }; scope.isSelectedAll = function () { if (scope.onSelectedAll && scope.items && scope.items.length > 0) { return scope.onSelectedAll(); } }; scope.isSortDirection = function (col, direction) { if (scope.onSortingDirection) { return scope.onSortingDirection(col, direction); } }; scope.sort = function (field, allow, isSystem) { if (scope.onSort) { scope.onSort(field, allow, isSystem); } }; } var directive = { restrict: 'E', replace: true, templateUrl: 'views/components/umb-table.html', scope: { items: '=', itemProperties: '=', allowSelectAll: '=', onSelect: '=', onClick: '=', onSelectAll: '=', onSelectedAll: '=', onSortingDirection: '=', onSort: '=' }, link: link }; return directive; } angular.module('umbraco.directives').directive('umbTable', TableDirective); })(); /** @ngdoc directive @name umbraco.directives.directive:umbTooltip @restrict E @scope @description Use this directive to render a tooltip. <h3>Markup example</h3> <pre> <div ng-controller="My.Controller as vm"> <div ng-mouseover="vm.mouseOver($event)" ng-mouseleave="vm.mouseLeave()"> Hover me </div> <umb-tooltip ng-if="vm.tooltip.show" event="vm.tooltip.event"> // tooltip content here </umb-tooltip> </div> </pre> <h3>Controller example</h3> <pre> (function () { "use strict"; function Controller() { var vm = this; vm.tooltip = { show: false, event: null }; vm.mouseOver = mouseOver; vm.mouseLeave = mouseLeave; function mouseOver($event) { vm.tooltip = { show: true, event: $event }; } function mouseLeave() { vm.tooltip = { show: false, event: null }; } } angular.module("umbraco").controller("My.Controller", Controller); })(); </pre> @param {string} event Set the $event from the target element to position the tooltip relative to the mouse cursor. **/ (function() { 'use strict'; function TooltipDirective($timeout) { function link(scope, el, attr, ctrl) { scope.tooltipStyles = {}; scope.tooltipStyles.left = 0; scope.tooltipStyles.top = 0; function activate() { $timeout(function() { setTooltipPosition(scope.event); }); } function setTooltipPosition(event) { var container = $("#contentwrapper"); var containerLeft = container[0].offsetLeft; var containerRight = containerLeft + container[0].offsetWidth; var containerTop = container[0].offsetTop; var containerBottom = containerTop + container[0].offsetHeight; var elementHeight = null; var elementWidth = null; var position = { right: "inherit", left: "inherit", top: "inherit", bottom: "inherit" }; // element size elementHeight = el.context.clientHeight; elementWidth = el.context.clientWidth; position.left = event.pageX - (elementWidth / 2); position.top = event.pageY; // check to see if element is outside screen // outside right if (position.left + elementWidth > containerRight) { position.right = 10; position.left = "inherit"; } // outside bottom if (position.top + elementHeight > containerBottom) { position.bottom = 10; position.top = "inherit"; } // outside left if (position.left < containerLeft) { position.left = containerLeft + 10; position.right = "inherit"; } // outside top if (position.top < containerTop) { position.top = 10; position.bottom = "inherit"; } scope.tooltipStyles = position; el.css(position); } activate(); } var directive = { restrict: 'E', transclude: true, replace: true, templateUrl: 'views/components/umb-tooltip.html', scope: { event: "=" }, link: link }; return directive; } angular.module('umbraco.directives').directive('umbTooltip', TooltipDirective); })(); /** * @ngdoc directive * @name umbraco.directives.directive:umbFileDropzone * @restrict E * @function * @description * Used by editors that require naming an entity. Shows a textbox/headline with a required validator within it's own form. **/ /* TODO .directive("umbFileDrop", function ($timeout, $upload, localizationService, umbRequestHelper){ return{ restrict: "A", link: function(scope, element, attrs){ //load in the options model } } }) */ angular.module("umbraco.directives") .directive('umbFileDropzone', function ($timeout, Upload, localizationService, umbRequestHelper) { return { restrict: 'E', replace: true, templateUrl: 'views/components/upload/umb-file-dropzone.html', scope: { parentId: '@', contentTypeAlias: '@', propertyAlias: '@', accept: '@', maxFileSize: '@', compact: '@', hideDropzone: '@', filesQueued: '=', handleFile: '=', filesUploaded: '=' }, link: function(scope, element, attrs) { scope.queue = []; scope.done = []; scope.rejected = []; scope.currentFile = undefined; function _filterFile(file) { var ignoreFileNames = ['Thumbs.db']; var ignoreFileTypes = ['directory']; // ignore files with names from the list // ignore files with types from the list // ignore files which starts with "." if(ignoreFileNames.indexOf(file.name) === -1 && ignoreFileTypes.indexOf(file.type) === -1 && file.name.indexOf(".") !== 0) { return true; } else { return false; } } function _filesQueued(files, event){ //Push into the queue angular.forEach(files, function(file){ if(_filterFile(file) === true) { if(file.$error) { scope.rejected.push(file); } else { scope.queue.push(file); } } }); //when queue is done, kick the uploader if(!scope.working){ _processQueueItem(); } } function _processQueueItem(){ if(scope.queue.length > 0){ scope.currentFile = scope.queue.shift(); _upload(scope.currentFile); }else if(scope.done.length > 0){ if(scope.filesUploaded){ //queue is empty, trigger the done action scope.filesUploaded(scope.done); } //auto-clear the done queue after 3 secs var currentLength = scope.done.length; $timeout(function(){ scope.done.splice(0, currentLength); }, 3000); } } function _upload(file) { scope.propertyAlias = scope.propertyAlias ? scope.propertyAlias : "umbracoFile"; scope.contentTypeAlias = scope.contentTypeAlias ? scope.contentTypeAlias : "Image"; Upload.upload({ url: umbRequestHelper.getApiUrl("mediaApiBaseUrl", "PostAddFile"), fields: { 'currentFolder': scope.parentId, 'contentTypeAlias': scope.contentTypeAlias, 'propertyAlias': scope.propertyAlias, 'path': file.path }, file: file }).progress(function (evt) { // calculate progress in percentage var progressPercentage = parseInt(100.0 * evt.loaded / evt.total, 10); // set percentage property on file file.uploadProgress = progressPercentage; // set uploading status on file file.uploadStatus = "uploading"; }).success(function (data, status, headers, config) { if(data.notifications && data.notifications.length > 0) { // set error status on file file.uploadStatus = "error"; // Throw message back to user with the cause of the error file.serverErrorMessage = data.notifications[0].message; // Put the file in the rejected pool scope.rejected.push(file); } else { // set done status on file file.uploadStatus = "done"; // set date/time for when done - used for sorting file.doneDate = new Date(); // Put the file in the done pool scope.done.push(file); } scope.currentFile = undefined; //after processing, test if everthing is done _processQueueItem(); }).error( function (evt, status, headers, config) { // set status done file.uploadStatus = "error"; //if the service returns a detailed error if (evt.InnerException) { file.serverErrorMessage = evt.InnerException.ExceptionMessage; //Check if its the common "too large file" exception if (evt.InnerException.StackTrace && evt.InnerException.StackTrace.indexOf("ValidateRequestEntityLength") > 0) { file.serverErrorMessage = "File too large to upload"; } } else if (evt.Message) { file.serverErrorMessage = evt.Message; } // If file not found, server will return a 404 and display this message if(status === 404 ) { file.serverErrorMessage = "File not found"; } //after processing, test if everthing is done scope.rejected.push(file); scope.currentFile = undefined; _processQueueItem(); }); } scope.handleFiles = function(files, event){ if(scope.filesQueued){ scope.filesQueued(files, event); } _filesQueued(files, event); }; } }; }); /** * @ngdoc directive * @name umbraco.directives.directive:umbFileUpload * @function * @restrict A * @scope * @description * Listens for file input control changes and emits events when files are selected for use in other controllers. **/ function umbFileUpload() { return { restrict: "A", scope: true, //create a new scope link: function (scope, el, attrs) { el.bind('change', function (event) { var files = event.target.files; //emit event upward scope.$emit("filesSelected", { files: files }); }); } }; } angular.module('umbraco.directives').directive("umbFileUpload", umbFileUpload); /** * @ngdoc directive * @name umbraco.directives.directive:umbSingleFileUpload * @function * @restrict A * @scope * @description * A single file upload field that will reset itself based on the object passed in for the rebuild parameter. This * is required because the only way to reset an upload control is to replace it's html. **/ function umbSingleFileUpload($compile) { return { restrict: "E", scope: { rebuild: "=" }, replace: true, template: "<div><input type='file' umb-file-upload /></div>", link: function (scope, el, attrs) { scope.$watch("rebuild", function (newVal, oldVal) { if (newVal && newVal !== oldVal) { //recompile it! el.html("<input type='file' umb-file-upload />"); $compile(el.contents())(scope); } }); } }; } angular.module('umbraco.directives').directive("umbSingleFileUpload", umbSingleFileUpload); /** * Konami Code directive for AngularJS * @version v0.0.1 * @license MIT License, http://www.opensource.org/licenses/MIT */ angular.module('umbraco.directives') .directive('konamiCode', ['$document', function ($document) { var konamiKeysDefault = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65]; return { restrict: 'A', link: function (scope, element, attr) { if (!attr.konamiCode) { throw ('Konami directive must receive an expression as value.'); } // Let user define a custom code. var konamiKeys = attr.konamiKeys || konamiKeysDefault; var keyIndex = 0; /** * Fired when konami code is type. */ function activated() { if ('konamiOnce' in attr) { stopListening(); } // Execute expression. scope.$eval(attr.konamiCode); } /** * Handle keydown events. */ function keydown(e) { if (e.keyCode === konamiKeys[keyIndex++]) { if (keyIndex === konamiKeys.length) { keyIndex = 0; activated(); } } else { keyIndex = 0; } } /** * Stop to listen typing. */ function stopListening() { $document.off('keydown', keydown); } // Start listening to key typing. $document.on('keydown', keydown); // Stop listening when scope is destroyed. scope.$on('$destroy', stopListening); } }; }]); /** * @ngdoc directive * @name umbraco.directives.directive:noDirtyCheck * @restrict A * @description Can be attached to form inputs to prevent them from setting the form as dirty (http://stackoverflow.com/questions/17089090/prevent-input-from-setting-form-dirty-angularjs) **/ function noDirtyCheck() { return { restrict: 'A', require: 'ngModel', link: function (scope, elm, attrs, ctrl) { elm.focus(function () { ctrl.$pristine = false; }); } }; } angular.module('umbraco.directives.validation').directive("noDirtyCheck", noDirtyCheck); (function() { 'use strict'; function SetDirtyOnChange() { function link(scope, el, attr, ctrl) { var initValue = attr.umbSetDirtyOnChange; attr.$observe("umbSetDirtyOnChange", function (newValue) { if(newValue !== initValue) { ctrl.$setDirty(); } }); } var directive = { require: "^form", restrict: 'A', link: link }; return directive; } angular.module('umbraco.directives').directive('umbSetDirtyOnChange', SetDirtyOnChange); })(); /** * General-purpose validator for ngModel. * angular.js comes with several built-in validation mechanism for input fields (ngRequired, ngPattern etc.) but using * an arbitrary validation function requires creation of a custom formatters and / or parsers. * The ui-validate directive makes it easy to use any function(s) defined in scope as a validator function(s). * A validator function will trigger validation on both model and input changes. * * @example <input val-custom=" 'myValidatorFunction($value)' "> * @example <input val-custom="{ foo : '$value > anotherModel', bar : 'validateFoo($value)' }"> * @example <input val-custom="{ foo : '$value > anotherModel' }" val-custom-watch=" 'anotherModel' "> * @example <input val-custom="{ foo : '$value > anotherModel', bar : 'validateFoo($value)' }" val-custom-watch=" { foo : 'anotherModel' } "> * * @param val-custom {string|object literal} If strings is passed it should be a scope's function to be used as a validator. * If an object literal is passed a key denotes a validation error key while a value should be a validator function. * In both cases validator function should take a value to validate as its argument and should return true/false indicating a validation result. */ /* This code comes from the angular UI project, we had to change the directive name and module but other then that its unmodified */ angular.module('umbraco.directives.validation') .directive('valCustom', function () { return { restrict: 'A', require: 'ngModel', link: function (scope, elm, attrs, ctrl) { var validateFn, watch, validators = {}, validateExpr = scope.$eval(attrs.valCustom); if (!validateExpr){ return;} if (angular.isString(validateExpr)) { validateExpr = { validator: validateExpr }; } angular.forEach(validateExpr, function (exprssn, key) { validateFn = function (valueToValidate) { var expression = scope.$eval(exprssn, { '$value' : valueToValidate }); if (angular.isObject(expression) && angular.isFunction(expression.then)) { // expression is a promise expression.then(function(){ ctrl.$setValidity(key, true); }, function(){ ctrl.$setValidity(key, false); }); return valueToValidate; } else if (expression) { // expression is true ctrl.$setValidity(key, true); return valueToValidate; } else { // expression is false ctrl.$setValidity(key, false); return undefined; } }; validators[key] = validateFn; ctrl.$parsers.push(validateFn); }); function apply_watch(watch) { //string - update all validators on expression change if (angular.isString(watch)) { scope.$watch(watch, function(){ angular.forEach(validators, function(validatorFn){ validatorFn(ctrl.$modelValue); }); }); return; } //array - update all validators on change of any expression if (angular.isArray(watch)) { angular.forEach(watch, function(expression){ scope.$watch(expression, function() { angular.forEach(validators, function(validatorFn){ validatorFn(ctrl.$modelValue); }); }); }); return; } //object - update appropriate validator if (angular.isObject(watch)) { angular.forEach(watch, function(expression, validatorKey) { //value is string - look after one expression if (angular.isString(expression)) { scope.$watch(expression, function(){ validators[validatorKey](ctrl.$modelValue); }); } //value is array - look after all expressions in array if (angular.isArray(expression)) { angular.forEach(expression, function(intExpression) { scope.$watch(intExpression, function(){ validators[validatorKey](ctrl.$modelValue); }); }); } }); } } // Support for val-custom-watch if (attrs.valCustomWatch){ apply_watch( scope.$eval(attrs.valCustomWatch) ); } } }; }); /** * @ngdoc directive * @name umbraco.directives.directive:valHighlight * @restrict A * @description Used on input fields when you want to signal that they are in error, this will highlight the item for 1 second **/ function valHighlight($timeout) { return { restrict: "A", link: function (scope, element, attrs, ctrl) { attrs.$observe("valHighlight", function (newVal) { if (newVal === "true") { element.addClass("highlight-error"); $timeout(function () { //set the bound scope property to false scope[attrs.valHighlight] = false; }, 1000); } else { element.removeClass("highlight-error"); } }); } }; } angular.module('umbraco.directives.validation').directive("valHighlight", valHighlight); angular.module('umbraco.directives.validation') .directive('valCompare',function () { return { require: "ngModel", link: function (scope, elem, attrs, ctrl) { //TODO: Pretty sure this should be done using a requires ^form in the directive declaration var otherInput = elem.inheritedData("$formController")[attrs.valCompare]; ctrl.$parsers.push(function(value) { if(value === otherInput.$viewValue) { ctrl.$setValidity("valCompare", true); return value; } ctrl.$setValidity("valCompare", false); }); otherInput.$parsers.push(function(value) { ctrl.$setValidity("valCompare", value === ctrl.$viewValue); return value; }); } }; }); /** * @ngdoc directive * @name umbraco.directives.directive:valEmail * @restrict A * @description A custom directive to validate an email address string, this is required because angular's default validator is incorrect. **/ function valEmail(valEmailExpression) { return { require: 'ngModel', restrict: "A", link: function (scope, elm, attrs, ctrl) { var patternValidator = function (viewValue) { //NOTE: we don't validate on empty values, use required validator for that if (!viewValue || valEmailExpression.EMAIL_REGEXP.test(viewValue)) { // it is valid ctrl.$setValidity('valEmail', true); //assign a message to the validator ctrl.errorMsg = ""; return viewValue; } else { // it is invalid, return undefined (no model update) ctrl.$setValidity('valEmail', false); //assign a message to the validator ctrl.errorMsg = "Invalid email"; return undefined; } }; //if there is an attribute: type="email" then we need to remove those formatters and parsers if (attrs.type === "email") { //we need to remove the existing parsers = the default angular one which is created by // type="email", but this has a regex issue, so we'll remove that and add our custom one ctrl.$parsers.pop(); //we also need to remove the existing formatter - the default angular one will not render // what it thinks is an invalid email address, so it will just be blank ctrl.$formatters.pop(); } ctrl.$parsers.push(patternValidator); } }; } angular.module('umbraco.directives.validation') .directive("valEmail", valEmail) .factory('valEmailExpression', function () { //NOTE: This is the fixed regex which is part of the newer angular return { EMAIL_REGEXP: /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i }; }); /** * @ngdoc directive * @name umbraco.directives.directive:valFormManager * @restrict A * @require formController * @description Used to broadcast an event to all elements inside this one to notify that form validation has * changed. If we don't use this that means you have to put a watch for each directive on a form's validation * changing which would result in much higher processing. We need to actually watch the whole $error collection of a form * because just watching $valid or $invalid doesn't acurrately trigger form validation changing. * This also sets the show-validation (or a custom) css class on the element when the form is invalid - this lets * us css target elements to be displayed when the form is submitting/submitted. * Another thing this directive does is to ensure that any .control-group that contains form elements that are invalid will * be marked with the 'error' css class. This ensures that labels included in that control group are styled correctly. **/ function valFormManager(serverValidationManager, $rootScope, $log, $timeout, notificationsService, eventsService, $routeParams) { return { require: "form", restrict: "A", controller: function($scope) { //This exposes an API for direct use with this directive var unsubscribe = []; var self = this; //This is basically the same as a directive subscribing to an event but maybe a little // nicer since the other directive can use this directive's API instead of a magical event this.onValidationStatusChanged = function (cb) { unsubscribe.push($scope.$on("valStatusChanged", function(evt, args) { cb.apply(self, [evt, args]); })); }; //Ensure to remove the event handlers when this instance is destroyted $scope.$on('$destroy', function () { for (var u in unsubscribe) { unsubscribe[u](); } }); }, link: function (scope, element, attr, formCtrl) { scope.$watch(function () { return formCtrl.$error; }, function (e) { scope.$broadcast("valStatusChanged", { form: formCtrl }); //find all invalid elements' .control-group's and apply the error class var inError = element.find(".control-group .ng-invalid").closest(".control-group"); inError.addClass("error"); //find all control group's that have no error and ensure the class is removed var noInError = element.find(".control-group .ng-valid").closest(".control-group").not(inError); noInError.removeClass("error"); }, true); var className = attr.valShowValidation ? attr.valShowValidation : "show-validation"; var savingEventName = attr.savingEvent ? attr.savingEvent : "formSubmitting"; var savedEvent = attr.savedEvent ? attr.savingEvent : "formSubmitted"; //This tracks if the user is currently saving a new item, we use this to determine // if we should display the warning dialog that they are leaving the page - if a new item // is being saved we never want to display that dialog, this will also cause problems when there // are server side validation issues. var isSavingNewItem = false; //we should show validation if there are any msgs in the server validation collection if (serverValidationManager.items.length > 0) { element.addClass(className); } var unsubscribe = []; //listen for the forms saving event unsubscribe.push(scope.$on(savingEventName, function(ev, args) { element.addClass(className); //set the flag so we can check to see if we should display the error. isSavingNewItem = $routeParams.create; })); //listen for the forms saved event unsubscribe.push(scope.$on(savedEvent, function(ev, args) { //remove validation class element.removeClass(className); //clear form state as at this point we retrieve new data from the server //and all validation will have cleared at this point formCtrl.$setPristine(); })); //This handles the 'unsaved changes' dialog which is triggered when a route is attempting to be changed but // the form has pending changes var locationEvent = $rootScope.$on('$locationChangeStart', function(event, nextLocation, currentLocation) { if (!formCtrl.$dirty || isSavingNewItem) { return; } var path = nextLocation.split("#")[1]; if (path) { if (path.indexOf("%253") || path.indexOf("%252")) { path = decodeURIComponent(path); } if (!notificationsService.hasView()) { var msg = { view: "confirmroutechange", args: { path: path, listener: locationEvent } }; notificationsService.add(msg); } //prevent the route! event.preventDefault(); //raise an event eventsService.emit("valFormManager.pendingChanges", true); } }); unsubscribe.push(locationEvent); //Ensure to remove the event handler when this instance is destroyted scope.$on('$destroy', function() { for (var u in unsubscribe) { unsubscribe[u](); } }); $timeout(function(){ formCtrl.$setPristine(); }, 1000); } }; } angular.module('umbraco.directives.validation').directive("valFormManager", valFormManager); /** * @ngdoc directive * @name umbraco.directives.directive:valPropertyMsg * @restrict A * @element textarea * @requires formController * @description This directive is used to control the display of the property level validation message. * We will listen for server side validation changes * and when an error is detected for this property we'll show the error message. * In order for this directive to work, the valStatusChanged directive must be placed on the containing form. **/ function valPropertyMsg(serverValidationManager) { return { scope: { property: "=" }, require: "^form", //require that this directive is contained within an ngForm replace: true, //replace the element with the template restrict: "E", //restrict to element template: "<div ng-show=\"errorMsg != ''\" class='alert alert-error property-error' >{{errorMsg}}</div>", /** Our directive requries a reference to a form controller which gets passed in to this parameter */ link: function (scope, element, attrs, formCtrl) { var watcher = null; // Gets the error message to display function getErrorMsg() { //this can be null if no property was assigned if (scope.property) { //first try to get the error msg from the server collection var err = serverValidationManager.getPropertyError(scope.property.alias, ""); //if there's an error message use it if (err && err.errorMsg) { return err.errorMsg; } else { return scope.property.propertyErrorMessage ? scope.property.propertyErrorMessage : "Property has errors"; } } return "Property has errors"; } // We need to subscribe to any changes to our model (based on user input) // This is required because when we have a server error we actually invalidate // the form which means it cannot be resubmitted. // So once a field is changed that has a server error assigned to it // we need to re-validate it for the server side validator so the user can resubmit // the form. Of course normal client-side validators will continue to execute. function startWatch() { //if there's not already a watch if (!watcher) { watcher = scope.$watch("property.value", function (newValue, oldValue) { if (!newValue || angular.equals(newValue, oldValue)) { return; } var errCount = 0; for (var e in formCtrl.$error) { if (angular.isArray(formCtrl.$error[e])) { errCount++; } } //we are explicitly checking for valServer errors here, since we shouldn't auto clear // based on other errors. We'll also check if there's no other validation errors apart from valPropertyMsg, if valPropertyMsg // is the only one, then we'll clear. if ((errCount === 1 && angular.isArray(formCtrl.$error.valPropertyMsg)) || (formCtrl.$invalid && angular.isArray(formCtrl.$error.valServer))) { scope.errorMsg = ""; formCtrl.$setValidity('valPropertyMsg', true); stopWatch(); } }, true); } } //clear the watch when the property validator is valid again function stopWatch() { if (watcher) { watcher(); watcher = null; } } //if there's any remaining errors in the server validation service then we should show them. var showValidation = serverValidationManager.items.length > 0; var hasError = false; //create properties on our custom scope so we can use it in our template scope.errorMsg = ""; var unsubscribe = []; //listen for form error changes unsubscribe.push(scope.$on("valStatusChanged", function(evt, args) { if (args.form.$invalid) { //first we need to check if the valPropertyMsg validity is invalid if (formCtrl.$error.valPropertyMsg && formCtrl.$error.valPropertyMsg.length > 0) { //since we already have an error we'll just return since this means we've already set the // hasError and errorMsg properties which occurs below in the serverValidationManager.subscribe return; } else if (element.closest(".umb-control-group").find(".ng-invalid").length > 0) { //check if it's one of the properties that is invalid in the current content property hasError = true; //update the validation message if we don't already have one assigned. if (showValidation && scope.errorMsg === "") { scope.errorMsg = getErrorMsg(); } } else { hasError = false; scope.errorMsg = ""; } } else { hasError = false; scope.errorMsg = ""; } }, true)); //listen for the forms saving event unsubscribe.push(scope.$on("formSubmitting", function(ev, args) { showValidation = true; if (hasError && scope.errorMsg === "") { scope.errorMsg = getErrorMsg(); } else if (!hasError) { scope.errorMsg = ""; stopWatch(); } })); //listen for the forms saved event unsubscribe.push(scope.$on("formSubmitted", function(ev, args) { showValidation = false; scope.errorMsg = ""; formCtrl.$setValidity('valPropertyMsg', true); stopWatch(); })); //listen for server validation changes // NOTE: we pass in "" in order to listen for all validation changes to the content property, not for // validation changes to fields in the property this is because some server side validators may not // return the field name for which the error belongs too, just the property for which it belongs. // It's important to note that we need to subscribe to server validation changes here because we always must // indicate that a content property is invalid at the property level since developers may not actually implement // the correct field validation in their property editors. if (scope.property) { //this can be null if no property was assigned serverValidationManager.subscribe(scope.property.alias, "", function (isValid, propertyErrors, allErrors) { hasError = !isValid; if (hasError) { //set the error message to the server message scope.errorMsg = propertyErrors[0].errorMsg; //flag that the current validator is invalid formCtrl.$setValidity('valPropertyMsg', false); startWatch(); } else { scope.errorMsg = ""; //flag that the current validator is valid formCtrl.$setValidity('valPropertyMsg', true); stopWatch(); } }); //when the element is disposed we need to unsubscribe! // NOTE: this is very important otherwise when this controller re-binds the previous subscriptsion will remain // but they are a different callback instance than the above. element.bind('$destroy', function () { stopWatch(); serverValidationManager.unsubscribe(scope.property.alias, ""); }); } //when the scope is disposed we need to unsubscribe scope.$on('$destroy', function () { for (var u in unsubscribe) { unsubscribe[u](); } }); } }; } angular.module('umbraco.directives.validation').directive("valPropertyMsg", valPropertyMsg); /** * @ngdoc directive * @name umbraco.directives.directive:valPropertyValidator * @restrict A * @description Performs any custom property value validation checks on the client side. This allows property editors to be highly flexible when it comes to validation on the client side. Typically if a property editor stores a primitive value (i.e. string) then the client side validation can easily be taken care of with standard angular directives such as ng-required. However since some property editors store complex data such as JSON, a given property editor might require custom validation. This directive can be used to validate an Umbraco property in any way that a developer would like by specifying a callback method to perform the validation. The result of this method must return an object in the format of {isValid: true, errorKey: 'required', errorMsg: 'Something went wrong' } The error message returned will also be displayed for the property level validation message. This directive should only be used when dealing with complex models, if custom validation needs to be performed with primitive values, use the simpler angular validation directives instead since this will watch the entire model. **/ function valPropertyValidator(serverValidationManager) { return { scope: { valPropertyValidator: "=" }, // The element must have ng-model attribute and be inside an umbProperty directive require: ['ngModel', '?^umbProperty'], restrict: "A", link: function (scope, element, attrs, ctrls) { var modelCtrl = ctrls[0]; var propCtrl = ctrls.length > 1 ? ctrls[1] : null; // Check whether the scope has a valPropertyValidator method if (!scope.valPropertyValidator || !angular.isFunction(scope.valPropertyValidator)) { throw new Error('val-property-validator directive must specify a function to call'); } var initResult = scope.valPropertyValidator(); // Validation method var validate = function (viewValue) { // Calls the validition method var result = scope.valPropertyValidator(); if (!result.errorKey || result.isValid === undefined || !result.errorMsg) { throw "The result object from valPropertyValidator does not contain required properties: isValid, errorKey, errorMsg"; } if (result.isValid === true) { // Tell the controller that the value is valid modelCtrl.$setValidity(result.errorKey, true); if (propCtrl) { propCtrl.setPropertyError(null); } } else { // Tell the controller that the value is invalid modelCtrl.$setValidity(result.errorKey, false); if (propCtrl) { propCtrl.setPropertyError(result.errorMsg); } } }; // Parsers are called as soon as the value in the form input is modified modelCtrl.$parsers.push(validate); } }; } angular.module('umbraco.directives.validation').directive("valPropertyValidator", valPropertyValidator); /** * @ngdoc directive * @name umbraco.directives.directive:valRegex * @restrict A * @description A custom directive to allow for matching a value against a regex string. * NOTE: there's already an ng-pattern but this requires that a regex expression is set, not a regex string **/ function valRegex() { return { require: 'ngModel', restrict: "A", link: function (scope, elm, attrs, ctrl) { var flags = ""; var regex; var eventBindings = []; attrs.$observe("valRegexFlags", function (newVal) { if (newVal) { flags = newVal; } }); attrs.$observe("valRegex", function (newVal) { if (newVal) { try { var resolved = newVal; if (resolved) { regex = new RegExp(resolved, flags); } else { regex = new RegExp(attrs.valRegex, flags); } } catch (e) { regex = new RegExp(attrs.valRegex, flags); } } }); eventBindings.push(scope.$watch('ngModel', function(newValue, oldValue){ if(newValue && newValue !== oldValue) { patternValidator(newValue); } })); var patternValidator = function (viewValue) { if (regex) { //NOTE: we don't validate on empty values, use required validator for that if (!viewValue || regex.test(viewValue.toString())) { // it is valid ctrl.$setValidity('valRegex', true); //assign a message to the validator ctrl.errorMsg = ""; return viewValue; } else { // it is invalid, return undefined (no model update) ctrl.$setValidity('valRegex', false); //assign a message to the validator ctrl.errorMsg = "Value is invalid, it does not match the correct pattern"; return undefined; } } }; scope.$on('$destroy', function(){ // unbind watchers for(var e in eventBindings) { eventBindings[e](); } }); } }; } angular.module('umbraco.directives.validation').directive("valRegex", valRegex); (function() { 'use strict'; function ValRequireComponentDirective() { function link(scope, el, attr, ngModel) { var unbindModelWatcher = scope.$watch(function () { return ngModel.$modelValue; }, function(newValue) { if(newValue === undefined || newValue === null || newValue === "") { ngModel.$setValidity("valRequiredComponent", false); } else { ngModel.$setValidity("valRequiredComponent", true); } }); // clean up scope.$on('$destroy', function(){ unbindModelWatcher(); }); } var directive = { require: 'ngModel', restrict: "A", link: link }; return directive; } angular.module('umbraco.directives').directive('valRequireComponent', ValRequireComponentDirective); })(); /** * @ngdoc directive * @name umbraco.directives.directive:valServer * @restrict A * @description This directive is used to associate a content property with a server-side validation response * so that the validators in angular are updated based on server-side feedback. **/ function valServer(serverValidationManager) { return { require: ['ngModel', '?^umbProperty'], restrict: "A", link: function (scope, element, attr, ctrls) { var modelCtrl = ctrls[0]; var umbPropCtrl = ctrls.length > 1 ? ctrls[1] : null; if (!umbPropCtrl) { //we cannot proceed, this validator will be disabled return; } var watcher = null; //Need to watch the value model for it to change, previously we had subscribed to //modelCtrl.$viewChangeListeners but this is not good enough if you have an editor that // doesn't specifically have a 2 way ng binding. This is required because when we // have a server error we actually invalidate the form which means it cannot be // resubmitted. So once a field is changed that has a server error assigned to it // we need to re-validate it for the server side validator so the user can resubmit // the form. Of course normal client-side validators will continue to execute. function startWatch() { //if there's not already a watch if (!watcher) { watcher = scope.$watch(function () { return modelCtrl.$modelValue; }, function (newValue, oldValue) { if (!newValue || angular.equals(newValue, oldValue)) { return; } if (modelCtrl.$invalid) { modelCtrl.$setValidity('valServer', true); stopWatch(); } }, true); } } function stopWatch() { if (watcher) { watcher(); watcher = null; } } var currentProperty = umbPropCtrl.property; //default to 'value' if nothing is set var fieldName = "value"; if (attr.valServer) { fieldName = scope.$eval(attr.valServer); if (!fieldName) { //eval returned nothing so just use the string fieldName = attr.valServer; } } //subscribe to the server validation changes serverValidationManager.subscribe(currentProperty.alias, fieldName, function (isValid, propertyErrors, allErrors) { if (!isValid) { modelCtrl.$setValidity('valServer', false); //assign an error msg property to the current validator modelCtrl.errorMsg = propertyErrors[0].errorMsg; startWatch(); } else { modelCtrl.$setValidity('valServer', true); //reset the error message modelCtrl.errorMsg = ""; stopWatch(); } }); //when the element is disposed we need to unsubscribe! // NOTE: this is very important otherwise when this controller re-binds the previous subscriptsion will remain // but they are a different callback instance than the above. element.bind('$destroy', function () { stopWatch(); serverValidationManager.unsubscribe(currentProperty.alias, fieldName); }); } }; } angular.module('umbraco.directives.validation').directive("valServer", valServer); /** * @ngdoc directive * @name umbraco.directives.directive:valServerField * @restrict A * @description This directive is used to associate a content field (not user defined) with a server-side validation response * so that the validators in angular are updated based on server-side feedback. **/ function valServerField(serverValidationManager) { return { require: 'ngModel', restrict: "A", link: function (scope, element, attr, ctrl) { var fieldName = null; var eventBindings = []; attr.$observe("valServerField", function (newVal) { if (newVal && fieldName === null) { fieldName = newVal; //subscribe to the changed event of the view model. This is required because when we // have a server error we actually invalidate the form which means it cannot be // resubmitted. So once a field is changed that has a server error assigned to it // we need to re-validate it for the server side validator so the user can resubmit // the form. Of course normal client-side validators will continue to execute. eventBindings.push(scope.$watch('ngModel', function(newValue){ if (ctrl.$invalid) { ctrl.$setValidity('valServerField', true); } })); //subscribe to the server validation changes serverValidationManager.subscribe(null, fieldName, function (isValid, fieldErrors, allErrors) { if (!isValid) { ctrl.$setValidity('valServerField', false); //assign an error msg property to the current validator ctrl.errorMsg = fieldErrors[0].errorMsg; } else { ctrl.$setValidity('valServerField', true); //reset the error message ctrl.errorMsg = ""; } }); //when the element is disposed we need to unsubscribe! // NOTE: this is very important otherwise when this controller re-binds the previous subscriptsion will remain // but they are a different callback instance than the above. element.bind('$destroy', function () { serverValidationManager.unsubscribe(null, fieldName); }); } }); scope.$on('$destroy', function(){ // unbind watchers for(var e in eventBindings) { eventBindings[e](); } }); } }; } angular.module('umbraco.directives.validation').directive("valServerField", valServerField); /** * @ngdoc directive * @name umbraco.directives.directive:valSubView * @restrict A * @description Used to show validation warnings for a editor sub view to indicate that the section content has validation errors in its data. * In order for this directive to work, the valFormManager directive must be placed on the containing form. **/ (function() { 'use strict'; function valSubViewDirective() { function link(scope, el, attr, ctrl) { var valFormManager = ctrl[1]; scope.subView.hasError = false; //listen for form validation changes valFormManager.onValidationStatusChanged(function (evt, args) { if (!args.form.$valid) { var subViewContent = el.find(".ng-invalid"); if (subViewContent.length > 0) { scope.subView.hasError = true; } else { scope.subView.hasError = false; } } else { scope.subView.hasError = false; } }); } var directive = { require: ['^form', '^valFormManager'], restrict: "A", link: link }; return directive; } angular.module('umbraco.directives').directive('valSubView', valSubViewDirective); })(); /** * @ngdoc directive * @name umbraco.directives.directive:valTab * @restrict A * @description Used to show validation warnings for a tab to indicate that the tab content has validations errors in its data. * In order for this directive to work, the valFormManager directive must be placed on the containing form. **/ function valTab() { return { require: ['^form', '^valFormManager'], restrict: "A", link: function (scope, element, attr, ctrs) { var valFormManager = ctrs[1]; var tabId = "tab" + scope.tab.id; scope.tabHasError = false; //listen for form validation changes valFormManager.onValidationStatusChanged(function (evt, args) { if (!args.form.$valid) { var tabContent = element.closest(".umb-panel").find("#" + tabId); //check if the validation messages are contained inside of this tabs if (tabContent.find(".ng-invalid").length > 0) { scope.tabHasError = true; } else { scope.tabHasError = false; } } else { scope.tabHasError = false; } }); } }; } angular.module('umbraco.directives.validation').directive("valTab", valTab); function valToggleMsg(serverValidationManager) { return { require: "^form", restrict: "A", /** Our directive requries a reference to a form controller which gets passed in to this parameter */ link: function (scope, element, attr, formCtrl) { if (!attr.valToggleMsg){ throw "valToggleMsg requires that a reference to a validator is specified"; } if (!attr.valMsgFor){ throw "valToggleMsg requires that the attribute valMsgFor exists on the element"; } if (!formCtrl[attr.valMsgFor]) { throw "valToggleMsg cannot find field " + attr.valMsgFor + " on form " + formCtrl.$name; } //if there's any remaining errors in the server validation service then we should show them. var showValidation = serverValidationManager.items.length > 0; var hasCustomMsg = element.contents().length > 0; //add a watch to the validator for the value (i.e. myForm.value.$error.required ) scope.$watch(function () { //sometimes if a dialog closes in the middle of digest we can get null references here return (formCtrl && formCtrl[attr.valMsgFor]) ? formCtrl[attr.valMsgFor].$error[attr.valToggleMsg] : null; }, function () { //sometimes if a dialog closes in the middle of digest we can get null references here if ((formCtrl && formCtrl[attr.valMsgFor])) { if (formCtrl[attr.valMsgFor].$error[attr.valToggleMsg] && showValidation) { element.show(); //display the error message if this element has no contents if (!hasCustomMsg) { element.html(formCtrl[attr.valMsgFor].errorMsg); } } else { element.hide(); } } }); var unsubscribe = []; //listen for the saving event (the result is a callback method which is called to unsubscribe) unsubscribe.push(scope.$on("formSubmitting", function(ev, args) { showValidation = true; if (formCtrl[attr.valMsgFor].$error[attr.valToggleMsg]) { element.show(); //display the error message if this element has no contents if (!hasCustomMsg) { element.html(formCtrl[attr.valMsgFor].errorMsg); } } else { element.hide(); } })); //listen for the saved event (the result is a callback method which is called to unsubscribe) unsubscribe.push(scope.$on("formSubmitted", function(ev, args) { showValidation = false; element.hide(); })); //when the element is disposed we need to unsubscribe! // NOTE: this is very important otherwise if this directive is part of a modal, the listener still exists because the dom // element might still be there even after the modal has been hidden. element.bind('$destroy', function () { for (var u in unsubscribe) { unsubscribe[u](); } }); } }; } /** * @ngdoc directive * @name umbraco.directives.directive:valToggleMsg * @restrict A * @element input * @requires formController * @description This directive will show/hide an error based on: is the value + the given validator invalid? AND, has the form been submitted ? **/ angular.module('umbraco.directives.validation').directive("valToggleMsg", valToggleMsg); angular.module('umbraco.directives.validation') .directive('valTriggerChange', function($sniffer) { return { link : function(scope, elem, attrs) { elem.bind('click', function(){ $(attrs.valTriggerChange).trigger($sniffer.hasEvent('input') ? 'input' : 'change'); }); }, priority : 1 }; }); })();
/** * Developer: Alexandr Voronyansky * E-mail: alexandr@voronynsky.com * Date: 04.10.13 * Time: 10:07 */ (function( $, global ){ document.fullScreen = document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement|| document.documentElement.requestFullscreen || document.documentElement.mozRequestFullScreen || document.documentElement.webkitRequestFullscreen; document.cancelFullScreen = document.cancelFullScreen || document.mozCancelFullScreen || document.webkitCancelFullScreen; /** * Настройки презентации по умолчанию * * @type {{slideClass: string, autoplay: boolean, autoplayDelay: number, progressBar: boolean, slideIndex: boolean, thumbnails: boolean, controls: Array, enableScroll: boolean, toggleEffect: string}} */ var defaultSettings = { slideClass: "", autoplay: false, autoplayDelay: 2000, progressBar: true, slideIndex: true, thumbnails: false, controls: ["next", "prev", "play", "fullscreen"], enableHotKeys: false, enableScroll: false, toggleEffect: "base" }; /** * Данные для генерации навигационной панели * @type {{}} */ var controlData = { /* пространство имен "_ss" нужно для безопасной поддержки метода destroy */ next: { text: 'вперед', hotKeyHelp: " ( Пробел, →, ↑ )", className: 'ss-next', title: 'листаем вперед', init: function ( p ){ var _self = this; $( this ).on( "click._ss", ".ss-next", function( e ){ shareMethods.next.apply( _self ); e.preventDefault(); }); } }, prev: { text: 'назад', hotKeyHelp: " ( Backspace, ←, ↓ )", className: 'ss-prev', title: 'листаем назад', init: function ( p ){ var _self = this; $( this ).on( "click._ss", ".ss-prev", function( e ){ shareMethods.prev.apply( _self ); e.preventDefault(); }) } }, play: { text: 'воспроизвести', hotKeyHelp: " (Ctrl + P, Ctrl + Enter)", textActive: 'остановить', className: 'ss-play', title: 'воспроизвести', titleActive: 'отановить', init: function ( p ){ var _self = this; $( this ).on( "click._ss", ".ss-play", function( e ){ if ( p.isPlaying ){ shareMethods.stop.apply( _self ); }else{ shareMethods.play.apply( _self ); } e.preventDefault(); }) } }, fullscreen: { text: 'на весь экран', hotKeyHelp: " (Ctrl + F)", textActive: 'обычный режим', className: 'ss-fullscreen', title: 'развернуть презентацию в полноэкранном режиме', titleActive: 'выйти из полноэкранного режима (ESC)', init: function ( p ){ var _self = this; $( this ).on( "click._ss", ".ss-fullscreen", function( e ){ shareMethods.fullscreen.apply( _self ); e.preventDefault(); }); } } }; /** * Анимирующие функции, импользуются для смены активного слайда. * Можно легко реализовать возможность добавления пользователем своих анимирующих функций в систему * * @type {{base: Function, fade: Function, scrolllr: Function, scrolltb: Function}} */ var animateFunctions = { base: function ( actualSlide, requireSlide ){ var defer = new $.Deferred(); actualSlide.removeClass( "active" ); requireSlide.addClass( "active" ); defer.resolve(); return defer.promise(); }, fade: function( actualSlide, requireSlide ){ requireSlide.css( "opacity", 0).addClass( "active" ); return $.when( actualSlide.animate( {"opacity": 0}, 200, function(){ actualSlide.removeClass( "active" ).css( "opacity", 1 ); }), requireSlide.animate( {"opacity": 1}, 150 ) ).promise(); }, scrolllr: function( actualSlide, requireSlide ){ requireSlide.css( "left", "-" + requireSlide.width() + "px" ).addClass( "active" ); return $.when( actualSlide.animate( {"left": actualSlide.width() + "px"}, 500, function(){ actualSlide.removeClass( "active" ).css( "left", 0 ); }), requireSlide.animate( {"left": 0}, 500 ) ).promise(); }, scrolltb: function( actualSlide, requireSlide ){ requireSlide.css( "top", "-" + requireSlide.height() + "px" ).addClass( "active" ); return $.when( actualSlide.animate( {"top": actualSlide.height() + 200 + "px"}, 500, function(){ actualSlide.removeClass( "active" ).css( "top", 0 ); }), requireSlide.animate( {"top": 0}, 500 ) ).promise(); } }; /** * Внутренние сервисные методы. Недоступны для пользователя * * @type {{init: Function, loadSlide: Function, toggleSlides: Function, getPersentage: Function}} */ var helperMethod = { /** * Инициализатор системы * @param options */ init: function( options ){ var _self = this, container = $(this), p = {}; /* если презентация уже инициализирована */ if ( !!container.data( "ss_data" ) ) return; if ( options && options.controls === "all" ){ options.controls = defaultSettings.controls; } p.settings = $.extend( $.extend( {},defaultSettings ), options || {} ); p.allSlides = container.children( p.settings.slideClass ); p.isPlaying = false; p.tick = null; if ( p.allSlides.length == 0 ) return; var enableSlides = p.allSlides.filter( function(){ return !$( this ).hasClass( "ss-disabled" ); }), firstRequest = enableSlides.filter( ".ss-start" ); p.enableSlideCount = enableSlides.length; p.actualSlide = null; container.addClass( "ss-slide-show" ); if ( container.css( "position" ) === "static" ){ container.css( {position: "relative"} ); } p.allSlides.addClass( "ss-slide" ).css( { position: "absolute" } ); $.each( enableSlides, function( index, el){ var slide = $( el ); slide.addClass( "ss-inqueue" ).data( "ss_index", index + 1 ); }); p.actualSlide = firstRequest.length == 0 ? enableSlides.first() : firstRequest.first(); p.actualIndex = p.actualSlide.data( "ss_index" ); p.actualSlide.addClass( "active" ); /* инициализация панели управления */ if ( p.settings.controls && Object.prototype.toString.call( p.settings.controls ) === "[object Array]" ){ var controlArr = p.settings.controls, control, i; for ( i = 0; i < controlArr.length && controlData.hasOwnProperty( controlArr[i] ); i++ ){ control = $( "." + controlData[controlArr[i]].className, container ); if ( control.length == 0 ){ control = $('<a class="' + controlData[controlArr[i]].className + '" href="#">' + controlData[controlArr[i]].text + '</a>'); control.appendTo( container ); } control.addClass( "ss-control" ); control.attr( "title", p.settings.enableHotKeys ? controlData[controlArr[i]].title + controlData[controlArr[i]].hotKeyHelp : controlData[controlArr[i]].title ); controlData[ controlArr[i] ].init.apply( this, [p] ); } } /* инициализация прогрессбара */ if ( p.settings.progressBar ){ p.progressBar = $(".ss-progress", container ); if ( p.progressBar.length == 0 ){ p.progressBar = $('<div class="ss-control ss-progress"></div>'); p.progressBar.css( { width: helperMethod.getPersentage( p.enableSlideCount, p.actualIndex ) + "%" } ).appendTo(container ); } } /* инициализация счетчика слайдов */ if ( p.settings.slideIndex && p.actualIndex ){ p.slideIndex = $(".ss-slide-index", container ); if ( p.slideIndex.length == 0 ){ p.slideIndex = $('<div class="ss-control ss-slide-index">' + p.actualIndex + '</div>'); p.slideIndex.appendTo(container ); } } /* инициализация управления с клавиатуры */ if ( p.settings.enableHotKeys ){ $( document).on( "keydown._ss", function( e ){ if ( e.ctrlKey ){ if ( e.keyCode == 80 || e.keyCode == 13 ){ shareMethods.play.apply( _self ); e.preventDefault(); } if ( e.keyCode == 70 ){ shareMethods.fullscreen.apply( _self ); e.preventDefault(); } }else{ if ( e.keyCode == 37 || e.keyCode == 40 || e.keyCode == 8 ){ shareMethods.prev.apply( _self ); e.preventDefault(); } if ( e.keyCode == 32 || e.keyCode == 38 || e.keyCode == 39 ){ shareMethods.next.apply( _self ); e.preventDefault(); } } }); } /* инициализация поддержки скроллинга */ if ( p.settings.enableScroll ){ var throttledPrev = $.throttle( 300, true, shareMethods.prev), throttledNext = $.throttle( 300, true, shareMethods.next ); container.on( "mousewheel._ss", function( e, delta, deltaX, deltaY ){ if ( deltaY > 0 ){ throttledPrev.apply( _self ); }else{ throttledNext.apply( _self ); } e.preventDefault(); }) } /* инициализация панели с миниатюрами */ if ( p.settings.thumbnails ){ var thumbPanel = $( p.settings.thumbnails ); if ( thumbPanel.length ){ var actualIndex = 0; $.each( p.allSlides, function( index, el ){ var slide = $( el ), thumb = $('<div class="ss-thumb"></div>'); thumb.appendTo( thumbPanel ); if ( !slide.hasClass( "ss-disabled" ) ){ actualIndex += 1; thumb.data( "ss_index", actualIndex).addClass( "ss-inqueue").text( actualIndex ); if ( actualIndex == p.actualIndex ){ thumb.addClass( "active" ); } }else{ thumb.addClass( "ss-disabled" ); } helperMethod.generateThumb.apply( this, [ slide, thumb ] ); }); if ( p.allSlides.length ){ thumbPanel.on( "click._ss", ".ss-inqueue", function( e ){ var thumb = $( this ), index = thumb.data( "ss_index" ); shareMethods.stop.apply( _self ); helperMethod.loadSlide.apply( _self, [index] ); $( ".active", thumbPanel ).removeClass( "active" ); thumb.addClass( "active" ); e.preventDefault(); }); } if ( container.has( thumbPanel ) ){ thumbPanel.addClass( "ss-control" ); } } } $( ".ss-control", container ).css( { "z-index": 3000 } ); container.data( "ss_data", p ); if ( p.settings.autoplay ){ shareMethods.play.apply( this ); } }, /** * Загрузчик нового активного слайда. Может обрабатывать как указание направдения "next" или "prev", * так и запросы на загрузку конкретных слайдов по номерам * * @param param * @returns {null|*} */ loadSlide: function( param ){ var container = $( this ), p = container.data( "ss_data" ), requireSlide = null; if ( Object.prototype.toString.call( param ) === "[object Number]" ){ param--; if ( param != p.actualIndex - 1 && param >= 0 && param < p.enableSlideCount ){ requireSlide = $( ".ss-inqueue:eq(" + param + ")", container ); } }else{ var searchNode = p.actualSlide[param]( ".ss-slide" ); while ( requireSlide == null && searchNode.length ){ if ( searchNode.hasClass( "ss-disabled" ) ){ searchNode = searchNode[param]( ".ss-slide" ); continue; } requireSlide = searchNode; } } if ( requireSlide && requireSlide != p.actualSlide ){ helperMethod.toggleSlides( p.actualSlide, requireSlide, p.settings, function( slideIndex ){ if ( p.settings.progressBar ){ p.progressBar.css( { width: helperMethod.getPersentage( p.enableSlideCount, slideIndex ) + "%" } ); } if ( p.settings.slideIndex ){ p.slideIndex.text( slideIndex ); } }); p.actualSlide = requireSlide; p.actualIndex = p.actualSlide.data( "ss_index" ); if ( p.settings.thumbnails ){ var thumbPanel = $( p.settings.thumbnails ); $(".active", thumbPanel).removeClass("active"); $(".ss-inqueue:eq(" + ( p.actualIndex - 1 ) + ")", thumbPanel).addClass( "active" ); } } /* вернуть загружаемый слайд */ return requireSlide || p.actualSlide ; }, /** * Вспомогательный метод, управляет сменой текушего и нового активного слайдов. * * @param actualSlide - текущий слайд * @param requireSlide - слайд, ожидающий загрузки * @param settings - настройки презентации * @param callback - вызывается после окончания смены слайдов */ toggleSlides: function( actualSlide, requireSlide, settings, callback ){ var effect = requireSlide.attr( "data-effect"), animateFunction = animateFunctions.hasOwnProperty( effect ) ? animateFunctions[effect] : animateFunctions.hasOwnProperty( settings.toggleEffect ) ? animateFunctions[settings.toggleEffect] : animateFunctions.base, animateRequest = animateFunction( actualSlide, requireSlide ); if ( callback ){ animateRequest.done( callback( requireSlide.data("ss_index")) ); } }, /** * Вспомогательный метод. Возвращает процентную долю числа от целого. * Используется для управления прогрессбаром презентации * * @param total * @param part * @returns {number} */ getPersentage: function( total, part ){ if ( total == 0 ) return 0; return part / total * 100; }, /** * Сгенерировать эскиз слайда * * @param slide * @param thumb */ generateThumb: function( slide, thumb ){ var desc = slide.attr( "data-desc" ); if ( !!desc ){ $( '<h3 class="ss-thumb-desc">' + desc + '</h3>').appendTo( thumb ); } if ( slide.css( "display" ) === "none" ){ slide.get(0).style.display = "block"; } try{ /* попытка сгенерировать эскиз слайда */ html2canvas( slide.get(0), { onrendered: function ( canvas ){ if ( !canvas.toDataURL ) return; var jqCanvas = $( canvas ); jqCanvas.appendTo( "body" ); thumb.css( 'background-image', 'url("' + canvas.toDataURL() + '")'); jqCanvas.remove(); slide.get(0).style.display = null; } }); }catch( e ){ /* намеренно тушим исключение */ } } }; /** * Методы, достыпнве для пользователя системы * * @type {{next: Function, prev: Function, go: Function, play: Function, stop: Function, fullscreen: Function}} */ var shareMethods = { /** * Загружает слайд из очереди, следующий за текущим * Позволяет двигаться по очереди слайдов вперед * */ next: function(){ shareMethods.stop.apply( this ); helperMethod.loadSlide.apply( this, ["next"] ); }, /** * Загружает слайд из очереди, следующий перед текущим * Позволяет двигаться по очереди слайдов назад * */ prev: function(){ shareMethods.stop.apply( this ); helperMethod.loadSlide.apply( this, ["prev"] ); }, /** * Позволяет перейти к указанному слайду * Позволяет произвольно перемещаться по очереди слайдов * * @param slideIndex */ go: function( slideIndex ){ helperMethod.loadSlide.apply( this, [slideIndex] ); }, /** * Запускает автопроигрывание презентации */ play: function(){ var container = $( this ), _self = this, p = container.data( "ss_data" ); if ( !p.isPlaying ){ var playBtn = container.find(".ss-play"), lastSlide = p.actualSlide; playBtn.addClass( "ss-playing" ).text( controlData.play.textActive).attr( "title", controlData.play.titleActive ); p.isPlaying = true; p.tick = setInterval( function(){ var slide = helperMethod.loadSlide.apply( _self, ["next"] ); if ( slide == lastSlide ){ shareMethods.stop.apply( _self ); }else{ lastSlide = slide; } } , p.settings.autoplayDelay); container.data( "ss_data", p ); } }, /** * Останавливает автопроигрывание презентации */ stop: function(){ var container = $( this ), p = container.data( "ss_data" ); if ( p.isPlaying ){ p.isPlaying = false; clearInterval( p.tick ); container.find( ".ss-play" ).removeClass( "ss-playing" ).text( controlData.play.text).attr( "title", controlData.play.title ); container.data( "ss_data", p ); } }, /** * Включает полноэкранный режим презентации */ fullscreen: function(){ //TODO: не срабатывает при вызове через API var container = $( this ), _self = this; if ( !container.hasClass( "ss-fs-active" ) ){ if ( document.fullScreen ){ document.fullScreen.call( this[0] ); }else{ $( "body" ).addClass("ss-fs-active" ); container.css( {position: "fixed"} ); } container.find( ".ss-fullscreen" ) .addClass( "ss-expanded") .text( controlData.fullscreen.textActive) .attr( "title", controlData.fullscreen.titleActive ); container.addClass( "ss-fs-active" ); /* перехватываем ESC для режима эмуляции и обновления состояния кнопки в современном режиме*/ $( document ).on( "keyup._ss_esc", function( e ){ if ( e.keyCode == 27 ){ shareMethods.fullscreen.apply( _self ); } }); }else{ if ( document.cancelFullScreen ){ document.cancelFullScreen(); }else{ $( "body" ).removeClass( "ss-fs-active" ); container.css( {position: "relative"} ); } container.find( ".ss-fullscreen" ) .removeClass( "ss-expanded" ) .text( controlData.fullscreen.text ) .attr( "title", controlData.fullscreen.title ); container.removeClass( "ss-fs-active" ); /* удалить обработчик перехвата ESC */ $( document ).off( "keyup._ss_esc" ); } }, /** * Откат к неинициализированному состоянию */ destroy: function(){ var container = $( this ), p = container.data( "ss_data" ); if ( p.settings.enableHotKeys ){ $( document).off( "keydown._ss" ); } if ( p.settings.enableScroll ){ container.off( "mousewheel._ss" ); } if ( p.settings.thumbnails ){ var thumbContainer = $( p.settings.thumbnails ); thumbContainer.off( "click._ss" ); $( ".ss-thumb", thumbContainer).remove(); } $( ".ss-slide", container ).removeClass( "ss-slide ss-inqueue active" ); $( ".ss-control", container ).remove(); container.off( "click._ss" ); container.removeData( "ss_data" ); } }; $.fn.presentation = function( options ){ if ( this.length > 1 ){ $.each( this, function( index, el){ $( el).presentation( options ); }); }else{ if ( shareMethods.hasOwnProperty( options ) ){ shareMethods[options].apply( this, Array.prototype.slice.call( arguments, 1 ) ); }else if ( !options || Object.prototype.toString.call( options ) === "[object Object]" ){ helperMethod.init.apply( this, arguments ); }else{ throw new Error( "Method [" + options + "] not found in presentation api." ); } } return this; } }( jQuery, window ));
'use strict'; var mongoose = require('mongoose'), Schema = mongoose.Schema, archive = require('./archive.js'), modelUtils = require('./modelUtils'), config = require('meanio').loadConfig() ; var FolderSchema = new Schema({ created: { type: Date, default: Date.now }, updated: { type: Date }, recycled: { type: Date, }, title: { type: String }, office: { type: Schema.ObjectId, ref: 'Office' }, discussion: { type: Schema.ObjectId, ref: 'Discussion' }, creator: { type: Schema.ObjectId, ref: 'User' }, manager: { type: Schema.ObjectId, ref: 'User' }, signature: { circles: {}, codes: {} }, color: { type: String, required: true }, status: { type: String, enum: ['new', 'in-progress', 'canceled', 'done', 'archived'], default: 'new' }, tags: [String], description: { type: String }, //should we maybe have finer grain control on this watchers: [ { type: Schema.ObjectId, ref: 'User' } ], bolded: [ { _id: false, id: {type: Schema.ObjectId, ref: 'User'}, bolded: Boolean, lastViewed: Date } ], permissions: [ { _id: false, id: {type: Schema.ObjectId, ref: 'User'}, level: { type: String, enum: ['viewer', 'commenter', 'editor'], default: 'viewer' } } ], parent: { type: Schema.ObjectId, ref: 'Folder' }, room: { type: String }, hasRoom: { type: Boolean, default: false }, sources: [String], circles: { type: Schema.Types.Mixed }, WantRoom: { type: Boolean, default: false }, roomName: { type: String } }); var starVirtual = FolderSchema.virtual('star'); starVirtual.get(function() { return this._star; }); starVirtual.set(function(value) { this._star = value; }); FolderSchema.set('toJSON', { virtuals: true }); FolderSchema.set('toObject', { virtuals: true }); /** * Validations */ FolderSchema.path('color').validate(function(color) { return /^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/i.test(color); }, 'Invalid HEX color.'); /** * Statics */ FolderSchema.statics.load = function(id, cb) { this.findOne({ _id: id }).populate('creator', 'name username').exec(cb); }; FolderSchema.statics.office = function(id, cb) { require('./office'); var Office = mongoose.model('Office'); Office.findById(id, function(err, office) { cb(err, office || {}); }); }; /** * Post middleware */ var elasticsearch = require('../controllers/elasticsearch'); FolderSchema.post('save', function(req, next) { var task = this; FolderSchema.statics.office(this.office, function(err, office) { if(err) { return err; } elasticsearch.save(task, 'folder'); }); next(); }); FolderSchema.pre('remove', function(next) { var task = this; FolderSchema.statics.office(this.office, function(err, office) { if(err) { return err; } elasticsearch.delete(task, 'task', next); }); next(); }); /** * middleware */ // Will not execute until the first middleware calls `next()` FolderSchema.pre('save', function(next) { let entity = this ; config.superSeeAll ? modelUtils.superSeeAll(entity,next) : next() ; }); FolderSchema.post('save', function(req, next) { elasticsearch.save(this, 'folder'); next(); }); FolderSchema.pre('remove', function(next) { elasticsearch.delete(this, 'folder', next); next(); }); FolderSchema.plugin(archive, 'folder'); module.exports = mongoose.model('Folder', FolderSchema);
var searchData= [ ['angle',['Angle',['../classlm_1_1_angle.html#a5128c164b47782001ec59ee549c925b8',1,'lm::Angle::Angle()'],['../classlm_1_1_angle.html#af18023849e8f9d286bcf729a7a9d108c',1,'lm::Angle::Angle(double angle)']]], ['append',['append',['../classlm_1_1_shader_pipeline.html#ae51f0a50859ab30b849b43e444b6b9a2',1,'lm::ShaderPipeline']]], ['atlas',['atlas',['../classlm_1_1_sprite.html#a2e03615ff467524b10ea476816d99003',1,'lm::Sprite::atlas()'],['../classlm_1_1_texture.html#a5eeb6175e0d38870aac74f85d1eb6bf5',1,'lm::Texture::atlas()']]], ['attach',['attach',['../classlm_1_1_game_object.html#a00ea48a39b06fdbc49c113285bdbcac1',1,'lm::GameObject::attach()'],['../classlm_1_1_shader_program.html#a1e3620e5bfa37edb9b79941a02bf5d39',1,'lm::ShaderProgram::attach()']]] ];
// import path from 'path'; // import {isCI} from '../lib/ci'; module.exports = { // // - - - - CHIMP - - - - // watch: false, // watchTags: '@watch,@focus', // domainSteps: null, // e2eSteps: null, // fullDomain: false, // domainOnly: false, // e2eTags: '@e2e', // watchWithPolling: false, // server: false, // serverPort: 8060, // serverHost: 'localhost', // sync: true, // offline: false, // showXolvioMessages: true, // // - - - - CUCUMBER - - - - path: 'tests/end-to-end', // format: 'pretty', // tags: '~@ignore', // singleSnippetPerFile: true, // recommendedFilenameSeparator: '_', // chai: false, // screenshotsOnError: isCI(), // screenshotsPath: '.screenshots', // captureAllStepScreenshots: false, // saveScreenshotsToDisk: true, // // Note: With a large viewport size and captureAllStepScreenshots enabled, // // you may run out of memory. Use browser.setViewportSize to make the // // viewport size smaller. // saveScreenshotsToReport: false, // jsonOutput: null, // compiler: 'js:' + path.resolve(__dirname, '../lib/babel-register.js'), // conditionOutput: true, // // - - - - SELENIUM - - - - // browser: null, // platform: 'ANY', // name: '', // user: '', // key: '', // port: null, // host: null, // // deviceName: null, // // - - - - WEBDRIVER-IO - - - - // webdriverio: { // desiredCapabilities: {}, // logLevel: 'silent', // // logOutput: null, // host: '127.0.0.1', // port: 4444, // path: '/wd/hub', // baseUrl: null, // coloredLogs: true, // screenshotPath: null, // waitforTimeout: 500, // waitforInterval: 250, // }, // // - - - - SELENIUM-STANDALONE // seleniumStandaloneOptions: { // // check for more recent versions of selenium here: // // http://selenium-release.storage.googleapis.com/index.html // version: '2.53.1', // baseURL: 'https://selenium-release.storage.googleapis.com', // drivers: { // chrome: { // // check for more recent versions of chrome driver here: // // http://chromedriver.storage.googleapis.com/index.html // version: '2.25', // arch: process.arch, // baseURL: 'https://chromedriver.storage.googleapis.com' // }, // ie: { // // check for more recent versions of internet explorer driver here: // // http://selenium-release.storage.googleapis.com/index.html // version: '2.50.0', // arch: 'ia32', // baseURL: 'https://selenium-release.storage.googleapis.com' // }, // firefox: { // // check for more recent versions of gecko driver here: // // https://github.com/mozilla/geckodriver/releases // version: '0.11.1', // arch: process.arch, // baseURL: 'https://github.com/mozilla/geckodriver/releases/download' // } // } // }, // // - - - - SESSION-MANAGER - - - - // noSessionReuse: false, // // - - - - SIMIAN - - - - // simianResultEndPoint: 'api.simian.io/v1.0/result', // simianAccessToken: false, // simianResultBranch: null, // simianRepositoryId: null, // // - - - - MOCHA - - - - mocha: true, mochaCommandLineOptions: ['--color'], mochaConfig: { // tags and grep only work when watch mode is false tags: '', grep: null, timeout: 40000, reporter: 'min', slow: 100, retries: 3, bail: false // bail after first test failure }, // // - - - - JASMINE - - - - // jasmine: false, // jasmineConfig: { // specDir: '.', // specFiles: [ // '**/*@(_spec|-spec|Spec).@(js|jsx)', // ], // helpers: [ // 'support/**/*.@(js|jsx)', // ], // stopSpecOnExpectationFailure: false, // random: false, // }, // jasmineReporterConfig: { // // This options are passed to jasmine.configureDefaultReporter(...) // // See: http://jasmine.github.io/2.4/node.html#section-Reporters // }, // // - - - - METEOR - - - - ddp: 'http://localhost:3000' // serverExecuteTimeout: 10000, // // - - - - PHANTOM - - - - // phantom_w: 1280, // phantom_h: 1024, // phantom_ignoreSSLErrors: false, // // - - - - DEBUGGING - - - - // log: 'info', // debug: false, // seleniumDebug: null, // debugCucumber: null, // debugBrkCucumber: null, // debugMocha: null, // debugBrkMocha: null, };
version https://git-lfs.github.com/spec/v1 oid sha256:3fe2372bec3008f9cab29eec1d438c62ef2cc056aacfc8f70c533ec50ba9b7f5 size 4224
'use strict'; /** This file should be loaded via `import()` to be code-split into separate bundle. */ import { HiGlassComponent } from 'higlass/dist/hglib'; // import from just 'higlass-register' itself don't work, should update its package.json to have `"module": "src/index.js",` (or 'esm' or w/e it is) for that. import { default as higlassRegister } from 'higlass-register/dist/higlass-register'; import { default as StackedBarTrack } from 'higlass-multivec/es/StackedBarTrack'; export { HiGlassComponent, higlassRegister, StackedBarTrack };
var exports = module.exports; exports.setup = function(callback) { var write = process.stdout.write; process.stdout.write = (function(stub) { return function(string, encoding, fd) { stub.apply(process.stdout, arguments); callback(string, encoding, fd); }; })(process.stdout.write); return function() { process.stdout.write = write; }; };
import React from 'react' class Shortest extends React.Component { render() { return ( <div>Shortest</div> ) } } export default Shortest
function GameManager(size, InputManager, Actuator, StorageManager) { this.size = size; // Size of the grid this.inputManager = new InputManager; this.storageManager = new StorageManager; this.actuator = new Actuator; this.startTiles = 2; this.inputManager.on("move", this.move.bind(this)); this.inputManager.on("restart", this.restart.bind(this)); this.inputManager.on("keepPlaying", this.keepPlaying.bind(this)); this.setup(); } // Restart the game GameManager.prototype.restart = function () { this.storageManager.clearGameState(); this.actuator.continueGame(); // Clear the game won/lost message this.setup(); }; // Keep playing after winning (allows going over 2048) GameManager.prototype.keepPlaying = function () { this.keepPlaying = true; this.actuator.continueGame(); // Clear the game won/lost message }; // Return true if the game is lost, or has won and the user hasn't kept playing GameManager.prototype.isGameTerminated = function () { if (this.over || (this.won && !this.keepPlaying)) { return true; } else { return false; } }; // Set up the game GameManager.prototype.setup = function () { var previousState = this.storageManager.getGameState(); // Reload the game from a previous game if present if (previousState) { this.grid = new Grid(previousState.grid.size, previousState.grid.cells); // Reload grid this.score = previousState.score; this.over = previousState.over; this.won = previousState.won; this.keepPlaying = previousState.keepPlaying; } else { this.grid = new Grid(this.size); this.score = 0; this.over = false; this.won = false; this.keepPlaying = false; // Add the initial tiles this.addStartTiles(); } // Update the actuator this.actuate(); }; // Set up the initial tiles to start the game with GameManager.prototype.addStartTiles = function () { for (var i = 0; i < this.startTiles; i++) { this.addRandomTile(); } }; // Adds a tile in a random position GameManager.prototype.addRandomTile = function () { if (this.grid.cellsAvailable()) { var value = Math.random() < 0.9 ? 2048: 1024; var tile = new Tile(this.grid.randomAvailableCell(), value); this.grid.insertTile(tile); } }; // Sends the updated grid to the actuator GameManager.prototype.actuate = function () { if (this.storageManager.getBestScore() < this.score) { this.storageManager.setBestScore(this.score); } // Clear the state when the game is over (game over only, not win) if (this.over) { this.storageManager.clearGameState(); } else { this.storageManager.setGameState(this.serialize()); } this.actuator.actuate(this.grid, { score: this.score, over: this.over, won: this.won, bestScore: this.storageManager.getBestScore(), terminated: this.isGameTerminated() }); }; // Represent the current game as an object GameManager.prototype.serialize = function () { return { grid: this.grid.serialize(), score: this.score, over: this.over, won: this.won, keepPlaying: this.keepPlaying }; }; // Save all tile positions and remove merger info GameManager.prototype.prepareTiles = function () { this.grid.eachCell(function (x, y, tile) { if (tile) { tile.mergedFrom = null; tile.savePosition(); } }); }; // Move a tile and its representation GameManager.prototype.moveTile = function (tile, cell) { this.grid.cells[tile.x][tile.y] = null; this.grid.cells[cell.x][cell.y] = tile; tile.updatePosition(cell); }; // Move tiles on the grid in the specified direction GameManager.prototype.move = function (direction) { // 0: up, 1: right, 2: down, 3: left var self = this; if (this.isGameTerminated()) return; // Don't do anything if the game's over var cell, tile; var vector = this.getVector(direction); var traversals = this.buildTraversals(vector); var moved = false; // Save the current tile positions and remove merger information this.prepareTiles(); // Traverse the grid in the right direction and move tiles traversals.x.forEach(function (x) { traversals.y.forEach(function (y) { cell = { x: x, y: y }; tile = self.grid.cellContent(cell); if (tile) { var positions = self.findFarthestPosition(cell, vector); var next = self.grid.cellContent(positions.next); // Only one merger per row traversal? if (next && next.value === tile.value && !next.mergedFrom) { var merged = new Tile(positions.next, tile.value / 2); merged.mergedFrom = [tile, next]; self.grid.insertTile(merged); self.grid.removeTile(tile); // Converge the two tiles' positions tile.updatePosition(positions.next); // Update the score self.score += (2048/merged.value); // The mighty 2048 tile if (merged.value === 1) self.won = true; } else { self.moveTile(tile, positions.farthest); } if (!self.positionsEqual(cell, tile)) { moved = true; // The tile moved from its original cell! } } }); }); if (moved) { this.addRandomTile(); if (!this.movesAvailable()) { this.over = true; // Game over! } this.actuate(); } }; // Get the vector representing the chosen direction GameManager.prototype.getVector = function (direction) { // Vectors representing tile movement var map = { 0: { x: 0, y: -1 }, // Up 1: { x: 1, y: 0 }, // Right 2: { x: 0, y: 1 }, // Down 3: { x: -1, y: 0 } // Left }; return map[direction]; }; // Build a list of positions to traverse in the right order GameManager.prototype.buildTraversals = function (vector) { var traversals = { x: [], y: [] }; for (var pos = 0; pos < this.size; pos++) { traversals.x.push(pos); traversals.y.push(pos); } // Always traverse from the farthest cell in the chosen direction if (vector.x === 1) traversals.x = traversals.x.reverse(); if (vector.y === 1) traversals.y = traversals.y.reverse(); return traversals; }; GameManager.prototype.findFarthestPosition = function (cell, vector) { var previous; // Progress towards the vector direction until an obstacle is found do { previous = cell; cell = { x: previous.x + vector.x, y: previous.y + vector.y }; } while (this.grid.withinBounds(cell) && this.grid.cellAvailable(cell)); return { farthest: previous, next: cell // Used to check if a merge is required }; }; GameManager.prototype.movesAvailable = function () { return this.grid.cellsAvailable() || this.tileMatchesAvailable(); }; // Check for available matches between tiles (more expensive check) GameManager.prototype.tileMatchesAvailable = function () { var self = this; var tile; for (var x = 0; x < this.size; x++) { for (var y = 0; y < this.size; y++) { tile = this.grid.cellContent({ x: x, y: y }); if (tile) { for (var direction = 0; direction < 4; direction++) { var vector = self.getVector(direction); var cell = { x: x + vector.x, y: y + vector.y }; var other = self.grid.cellContent(cell); if (other && other.value === tile.value) { return true; // These two tiles can be merged } } } } } return false; }; GameManager.prototype.positionsEqual = function (first, second) { return first.x === second.x && first.y === second.y; };
/** * @module gallery-linkedlist */ /********************************************************************** * Iterator for LinkedList. Stable except when the next item is removed by * calling list.remove() instead of iter.removeNext(). When items are * inserted into an empty list, the pointer remains at the end, not the * beginning. * * @class LinkedListIterator * @method constructor * @private * @param list {LinkedList} */ function LinkedListIterator( /* LinkedList */ list) { this._list = list; this.moveToBeginning(); } LinkedListIterator.prototype = { /** * @method atBeginning * @return {Boolean} true if at the beginning */ atBeginning: function() { return (!this._next || (!this._at_end && !this._next._prev)); }, /** * @method atEnd * @return {Boolean} true if at the end */ atEnd: function() { return (!this._next || this._at_end); }, /** * Move to the beginning of the list. * * @method moveToBeginning */ moveToBeginning: function() { this._next = this._list._head; this._at_end = !this._next; }, /** * Move to the end of the list. * * @method moveToEnd */ moveToEnd: function() { this._next = this._list._tail; this._at_end = true; }, /** * @method next * @return {Mixed} next value in the list or undefined if at the end */ next: function() { if (this._at_end) { return; } var result = this._next; if (this._next && this._next._next) { this._next = this._next._next; } else { this._at_end = true; } if (result) { return result.value; } }, /** * @method prev * @return {Mixed} previous value in the list or undefined if at the beginning */ prev: function() { var result; if (this._at_end) { this._at_end = false; result = this._next; } else if (this._next) { result = this._next._prev; if (result) { this._next = result; } } if (result) { return result.value; } }, /** * Insert the given value at the iteration position. The inserted item * will be returned by next(). * * @method insert * @param value {Mixed} value to insert * @return {LinkedListItem} inserted item */ insert: function( /* object */ value) { if (this._at_end || !this._next) { this._next = this._list.append(value); } else { this._next = this._list.insertBefore(value, this._next); } return this._next; }, /** * Remove the previous item from the list. * * @method removePrev * @return {LinkedListItem} removed item or undefined if at the end */ removePrev: function() { var result; if (this._at_end) { result = this._next; if (this._next) { this._next = this._next._prev; } } else if (this._next) { result = this._next._prev; } if (result) { this._list.remove(result); return result; } }, /** * Remove the next item from the list. * * @method removeNext * @return {LinkedListItem} removed item or undefined if at the end */ removeNext: function() { var result; if (this._next && !this._at_end) { result = this._next; if (this._next && this._next._next) { this._next = this._next._next; } else { this._next = this._next ? this._next._prev : null; this._at_end = true; } } if (result) { this._list.remove(result); return result; } } };
/* @flow */ /*eslint-disable no-undef, no-unused-vars, no-console*/ import _, { compose, pipe, curry, filter, find, repeat, zipWith } from 'ramda' const ns: Array<number> = [ 1, 2, 3, 4, 5 ] const ss: Array<string> = [ 'one', 'two', 'three', 'four' ] const obj: {[k:string]:number} = { a: 1, c: 2 } const objMixed: {[k:string]:mixed} = { a: 1, c: 'd' } const os: Array<{[k:string]: number|string}> = [ { a: 1, c: 'd' }, { b: 2 } ] const str: string = 'hello world' // List { const xs: Array<number> = _.adjust(x => x + 1, 2, ns) const xs1: Array<number> = _.adjust(x => x + 1, 2)(ns) //$FlowExpectedError const xs3: Array<string> = _.adjust(x => x + 1)(2)(ns) const as: boolean = _.all(x => x > 1, ns) const asf: (s: Array<string>) => boolean = _.any(x => x.length > 1) const as1: boolean = asf(ss) const aps: Array<Array<number>> = _.aperture(2, ns) const aps2: Array<Array<string>> = _.aperture(2)(ss) const newXs: Array<string> = _.append('one', ss) const newXs1: Array<number> = _.prepend(1)(ns) const concatxs1: Array<number> = _.concat([ 4, 5, 6 ], [ 1, 2, 3 ]) const concatxs2: string = _.concat('ABC', 'DEF') const cont1: boolean = _.contains('s', ss) const dropxs: Array<string> = _.drop(4, ss) const dropxs1: string = _.drop(3)(str) const dropxs2: Array<string> = _.dropLast(4, ss) const dropxs3: string = _.dropLast(3)(str) const dropxs4: Array<number> = _.dropLastWhile(x => x <= 3, ns) const dropxs5: Array<string> = _.dropRepeats(ss) const dropxs6: Array<number> = _.dropRepeatsWith(_.eqBy(Math.abs), ns) const dropxs7: Array<number> = _.dropWhile(x => x === 1, ns) const findxs:?{[k:string]:number|string} = _.find(_.propEq('a', 2), os) const findxs1:?{[k:string]:number|string} = _.find(_.propEq('a', 4))(os) const findxs2:?{[k:string]:number|string} = _.findLast(_.propEq('a', 2), os) const findxs3:?{[k:string]:number|string} = _.findLast(_.propEq('a', 4))(os) const findxs4: number = _.findIndex(_.propEq('a', 2), os) const findxs5:number = _.findIndex(_.propEq('a', 4))(os) const findxs6:number = _.findLastIndex(_.propEq('a', 2), os) const findxs7:number = _.findLastIndex(_.propEq('a', 4))(os) const forEachObj = _.forEachObjIndexed((value, key) => {}, {x: 1, y: 2}) const s: Array<number> = filter(x => x > 1, [ 1, 2 ]) const s1: Array<string> = _.filter(x => x === '2', [ '2', '3' ]) const s3: {[key: string]: string} = _.filter(x => x === '2', { a:'2', b:'3' }) const s4 = _.find(x => x === '2', [ '1', '2' ]) //$FlowExpectedError const s5: ?{[key: string]: string} = _.find(x => x === '2', { a: 1, b: 2 }) const s6: number = _.findIndex(x => x === '2', [ '1', '2' ]) const s7: number = _.findIndex(x => x === '2', { a:'1', b:'2' }) const forEachxs = _.forEach(x => console.log(x), ns) const groupedBy: {[k: string]: Array<number>} = _.groupBy(x => x > 1 ? 'more' : 'less' , ns) //$FlowExpectedError const groupedBy1: {[k: string]: Array<string>} = _.groupBy(x => x > 1 ? 'more' : 'less')(ns) const groupedWith: Array<Array<number>> = _.groupWith(x => x > 1, ns) const groupedWith1: Array<Array<string>> = _.groupWith(x => x === 'one')(ss) const xOfXs: ?number = _.head(ns) const xOfXs2: ?number = _.head(ns) const xOfStr: string = _.head(str) const transducer = _.compose(_.map(_.add(1)), _.take(2)) const txs: Array<number> = _.into([], transducer, ns) //$FlowExpectedError const txs1: string = _.into([], transducer, ns) //$FlowExpectedError const txs2: string = _.into([], transducer, ss) const ind: number = _.indexOf(1, ns) const ind1: number = _.indexOf(str)(ss) const ind2:{[key: string]:{[k: string]: number|string}} = _.indexBy(x => 's', os) const ind3:{[key: string]:{[k: string]: number|string}} = _.indexBy(x => 's')(os) const insxs: Array<number> = _.insert(1, 2, ns) const insxs2: Array<string> = _.insert(1, '2', ss) const insxs3: Array<number> = _.insertAll(1, [ 2, 3 ], ns) // this is disgusting — don't do this :) // Technically it's a tuple with arbitrary size const insxs4: Array<number|boolean|string> = _.insertAll(1, [ '2', false ], ns) const insxs5: Array<string|number> = _.insertAll(1, [ 2 ], ss) const joinxs: string = _.join('|', ns) const lastxs: ?number = _.last(ns) const laststr: string = _.last(str) const lasti: number = _.lastIndexOf(3, [ -1,3,3,0,1,2,3,4 ]) const mapxs: Array<number>= _.map(x => x + 1, ns) const someObj: { a: string, b: number } = { a: 'a', b: 2 } const someMap: { [string]: { a: string, b: number } } = { so: someObj } const mapObj: { [string]: string } = _.map((x: { a: string, b: number }): string => x.a)(someMap) const functor = { x: 1, map(f) { return f(this.x) }, } // Doesn't typecheck (yet) but at least doesn't break const mapFxs = _.map(_.toString, functor) const double = x => x * 2 const dxs: Array<number> = _.map(double, [ 1, 2, 3 ]) const dos: $Shape<typeof obj> = _.map(double, obj) const appender = (a, b) => [ a + b, a + b ] const mapacc:[number, Array<number>] = _.mapAccum(appender, 0, ns) const mapacc1:[number, Array<number>] = _.mapAccumRight(appender, 0, ns) const nxs: boolean = _.none(x => x > 1, ns) const nthxs: ?string = _.nth(2, [ 'curry' ]) const nthxs1: ?string = _.nth(2)([ 'curry' ]) //$FlowExpectedError const nthxs2: string = _.nth(2, [ 1, 2, 3 ]) const xxs: Array<number> = _.append(1, [ 1, 2, 3 ]) const xxxs: Array<number> = _.intersperse(1, [ 1, 2, 3 ]) const pairxs:[number,string] = _.pair(2, 'str') const partxs:[Array<string>,Array<string>] = _.partition(_.contains('s'), [ 'sss', 'ttt', 'foo', 'bars' ]) const partxs1: [{[k:string]:string}, {[k:string]:string}] = _.partition(_.contains('s'), { a: 'sss', b: 'ttt', foo: 'bars' }) const pl:Array<number|string> = _.pluck('a')([ { a: '1' }, { a: 2 } ]) const pl1:Array<number> = _.pluck(0)([ [ 1, 2 ], [ 3, 4 ] ]) const rxs: Array<number> = _.range(1, 10) const remxs: Array<string> = _.remove(0, 2, ss) const remxs1: Array<string> = _.remove(0, 2)(ss) const remxs2: Array<string> = _.remove(0)(2)(ss) const remxs3: Array<string> = _.remove(0)(2, ss) const ys4: Array<string> = _.repeat('1', 10) const ys5: Array<number> = _.repeat(1, 10) const redxs: number = _.reduce(_.add, 10, ns) const redxs1: string = _.reduce(_.concat, '', ss) const redxs2: Array<string> = _.reduce(_.concat, [])(_.map(x => [ x ], ss)) const redxs3: number = _.reduceRight(_.add, 10, ns) const redxs4: string = _.reduceRight(_.concat, '', ss) const redxs5: Array<string> = _.reduceRight(_.concat, [])(_.map(x => [ x ], ss)) const redxs6: number = _.scan(_.add, 10, ns) const redxs7: string = _.scan(_.concat, '', ss) const redxs8: Array<string> = _.scan(_.concat, [])(_.map(x => [ x ], ss)) const reduceToNamesBy = _.reduceBy((acc, student) => acc.concat(student.name), []) const namesByGrade = reduceToNamesBy((student) => { const score = student.score return score < 65 ? 'F' : score < 70 ? 'D' : score < 80 ? 'C' : score < 90 ? 'B' : 'A' }) const students = [ { name: 'Lucy', score: 92 }, { name: 'Drew', score: 85 }, { name: 'Bart', score: 62 }, ] const names1: {[k: string]: Array<string>} = namesByGrade(students) const spl: Array<string> = _.split(/\./, 'a.b.c.xyz.d') const spl1: [Array<number>,Array<number>] = _.splitAt(1, [ 1, 2, 3 ]) const spl2: [string, string] = _.splitAt(5, 'hello world') const spl3: [string, string]= _.splitAt(-1, 'foobar') const spl4: Array<Array<number>> = _.splitEvery(3, [ 1, 2, 3, 4, 5, 6, 7 ]) const spl5: Array<string> = _.splitEvery(3, 'foobarbaz') const spl6: [Array<number>,Array<number>] = _.splitWhen(_.equals(2))([ 1, 2, 3, 1, 2, 3 ]) const slixs: Array<string> = _.slice(0, 2, ss) const slixs1: Array<string> = _.slice(0, 2)(ss) const slixs2: Array<string> = _.slice(0)(2)(ss) const slixs3: Array<string> = _.slice(0)(2, ss) const diff = function (a, b) { return a - b } const sortxs: Array<number> = _.sort(diff, [ 4,2,7,5 ]) const timesxs: Array<number> = _.times(_.identity, 5) const unf: (x: string) => Array<string> = _.unfold((x: string) => x.length > 10 || [ x, x + '0' ]) const unf1: Array<number> = _.unfold(x => x > 10 || [ x, x + 1 ], 0) const f = n => n > 50 ? false : [ -n, n + 10 ] const unf11: Array<number> = _.unfold(f, 10) //$FlowExpectedError const unf2 = _.unfold(x => x.length > 10 || [ x, x + '0' ], 2) const unby: Array<number> = _.uniqBy(Math.abs)([ -1, -5, 2, 10, 1, 2 ]) const strEq = _.eqBy(String) const strEq2 = _.eqBy(String, 1, 2) const unw = _.uniqWith(strEq)([ 1, '1', 2, 1 ]) const unw1 = _.uniqWith(strEq)([ {}, {} ]) const unw2 = _.uniqWith(strEq)([ 1, '1', 1 ]) const unw3 = _.uniqWith(strEq)([ '1', 1, 1 ]) //$FlowExpectedError const ys6: {[key: string]: string} = _.fromPairs([ [ 'h', 2 ] ]) const withoutxs: Array<number> = _.without([ 1, 2 ], ns) const withoutxs1: Array<string> = _.without([ 'a' ], ss) const xprodxs: Array<[ number, string ]> = _.xprod([ 1, 2 ], [ 'a', 'b', 'c' ]) const xprodxs1: Array<[ boolean, string ]> = _.xprod([ true, false ])([ 'a', 'b' ]) const zipxs: Array<[ number, string ]> = _.zip([ 1, 2, 3 ], [ 'a', 'b', 'c' ]) //$FlowExpectedError const zipxs1: Array<[ number, string ]> = _.zip([ true, false ])([ 'a', 'b' ]) const zipos: {[k:string]:number} = _.zipObj([ 'a', 'b', 'c' ], [ 1, 2, 3 ]) const ys9: {[k:string]: number} = _.zipObj([ 'me', 'you' ], [ 1, 2 ]) const zipped: Array<{s: number, y: string}> = zipWith((a, b) => ({ s: a, y: b }), [ 1, 2, 3 ], [ '1', '2', '3' ]) const zipped2: Array<{s: number, y: string}> = _.zipWith((a, b) => ({ s: a, y: b }), [ 1, 2, 3 ])([ '1', '2', '3' ]) const zipped3: Array<{s: number, y: string}> = _.zipWith((a, b) => ({ s: a, y: b }))([ 1, 2, 3 ])([ '1', '2', '3' ]) }
/* Task Description */ /* * Create an object domElement, that has the following properties and methods: * use prototypal inheritance, without function constructors * method init() that gets the domElement type * i.e. `Object.create(domElement).init('div')` * property type that is the type of the domElement * a valid type is any non-empty string that contains only Latin letters and digits * property innerHTML of type string * gets the domElement, parsed as valid HTML * <type attr1="value1" attr2="value2" ...> .. content / children's.innerHTML .. </type> * property content of type string * sets the content of the element * works only if there are no children * property attributes * each attribute has name and value * a valid attribute has a non-empty string for a name that contains only Latin letters and digits or dashes (-) * property children * each child is a domElement or a string * property parent * parent is a domElement * method appendChild(domElement / string) * appends to the end of children list * method addAttribute(name, value) * throw Error if type is not valid * // method removeAttribute(attribute) */ /* Example var meta = Object.create(domElement) .init('meta') .addAttribute('charset', 'utf-8'); var head = Object.create(domElement) .init('head') .appendChild(meta) var div = Object.create(domElement) .init('div') .addAttribute('style', 'font-size: 42px'); div.content = 'Hello, world!'; var body = Object.create(domElement) .init('body') .appendChild(div) .addAttribute('id', 'cuki') .addAttribute('bgcolor', '#012345'); var root = Object.create(domElement) .init('html') .appendChild(head) .appendChild(body); console.log(root.innerHTML); Outputs: <html><head><meta charset="utf-8"></meta></head><body bgcolor="#012345" id="cuki"><div style="font-size: 42px">Hello, world!</div></body></html> */ function solve() { var domElement = (function () { var domElement = {}; function validateType(type){ if (type.match(/^[a-zA-Z0-9]+$/) === null){ throw new Error; } } function validateAttributeName(type){ if (type.match(/^[a-zA-Z0-9\-]+$/) === null){ throw new Error; } } Object.defineProperties(domElement,{ init: { value: function (type) { this.type = type; this.attributes = []; this.result = ''; this.isFromChild = false; this.content = ''; this.parent = {}; this.children = []; this.visited = false; return this; } }, type: { get: function () { return this._type; }, set: function (type) { validateType(type); this._type = type; } }, content: { get: function () { return this._content; }, set: function (content) { this._content = content; } }, parent:{ get: function () { return this._parent; }, set: function (parent) { this._parent = parent; } }, visited: { get: function () { return this._visited; }, set: function (value) { this._visited = value; } }, appendChild:{ value: function (child) { if (typeof child === "object") { this.children.push(child); child.parent = this; } else { this.children.push(child); } return this; } }, addAttribute: { value: function (name, value) { validateAttributeName(name); if (this.attributes.length > 0) { for (var attributeCheckCount = 0; attributeCheckCount < this.attributes.length; attributeCheckCount += 1) { if (this.attributes[attributeCheckCount].attributeName === name) { this.attributes.splice(attributeCheckCount, 1); } } } this.attributes.push({attributeName: name, attributeContent: value}); function compare(a, b) { if (a.attributeName < b.attributeName) return -1; if (a.attributeName > b.attributeName) return 1; return 0; } this.attributes.sort(compare); return this; } }, removeAttribute: { value: function (attributeForRemoving) { if (this.attributes.length > 0) { for (var attributeCheckCount = 0; attributeCheckCount < this.attributes.length; attributeCheckCount += 1) { if (this.attributes[attributeCheckCount].attributeName === attributeForRemoving) { this.attributes.splice(attributeCheckCount, 1); break; } if (attributeCheckCount === this.attributes.length - 1) { throw new Error; } } } else { throw new Error; } return this; } }, innerHTML: { get: function () { var end = '', obj = this, front = '', self = this, startObject = this; obj.result = (function getText(currentObject) { function getFront() { front = front + '<' + currentObject.type for (var attributeCounter = 0, len = currentObject.attributes.length; attributeCounter < len; attributeCounter += 1) { front = front + ' ' + currentObject.attributes[attributeCounter].attributeName + '="' + currentObject.attributes[attributeCounter].attributeContent + '"'; } front = front + '>'; return front; } if ((currentObject.visited === false && currentObject.children.length === 0)) { front = getFront(); end = '</' + currentObject.type + '>' + end; currentObject.result = front + currentObject.content + end; // front = ''; end = ''; currentObject.visited = true; return currentObject.result; } else { for (var childrenCounter = 0, numberOfChildren = currentObject.children.length; childrenCounter < numberOfChildren; childrenCounter += 1) { if (typeof currentObject.children[childrenCounter] === "object") { currentObject.result = currentObject.result + getText(currentObject.children[childrenCounter]); } else { currentObject.result = currentObject.result + currentObject.children[childrenCounter]; } if (childrenCounter === currentObject.children.length - 1) { end = '</' + currentObject.type + '>' + end; front = getFront(); currentObject.result = front + currentObject.result + end; front = ''; end = ''; currentObject.visited = true; return currentObject.result; } } } }(obj)); return obj.result; } } }); return domElement; } ()); return domElement; } module.exports = solve; //var meta = Object.create(domElement) // .init('meta') // .addAttribute('charset', 'utf-8'); // //var head = Object.create(domElement) // .init('head') // .appendChild(meta) // //var div = Object.create(domElement) // .init('div') // .addAttribute('style', 'font-size: 42px'); // //div.content = 'Hello, world!'; // //var body = Object.create(domElement) // .init('body') // .appendChild(div) // .addAttribute('id', 'cuki') // .addAttribute('bgcolor', '#012345'); // //var root = Object.create(domElement) // .init('html') // .appendChild(head) // .appendChild(body); // // //console.log(root.innerHTML); // //it('expect correct HTML when having both string and domElement children', function() { // var text = 'the text you SEE!', // root = Object.create(domElement).init('p'), // child1 = Object.create(domElement).init('b'), // child2 = Object.create(domElement).init('s'); // root.appendChild(text); // root.appendChild(child1); // root.appendChild(text); // root.appendChild(child2); // root.appendChild(text); // console.log(root.innerHTML) //.to.eql('<p>' + text + '<b></b>' + text + '<s></s>' + text + '</p>'); //}); //Object.create(domElement).init('hi'); //Object.create(domElement).init('hello!');
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow * @format */ 'use strict'; const readRelayQueryData = require('../../store/readRelayQueryData'); const warning = require('warning'); const {recycleNodesInto, RelayProfiler} = require('relay-runtime'); import type RelayQuery from '../../query/RelayQuery'; import type RelayStoreData from '../../store/RelayStoreData'; import type {ChangeSubscription, StoreReaderData} from '../../tools/RelayTypes'; import type {DataID} from 'relay-runtime'; type DataIDSet = {[dataID: DataID]: any}; /** * @internal * * Resolves data from fragment pointers. * * The supplied `callback` will be invoked whenever data returned by the last * invocation to `resolve` has changed. */ class GraphQLStoreQueryResolver { _callback: Function; _fragment: RelayQuery.Fragment; _resolver: ?( | GraphQLStorePluralQueryResolver | GraphQLStoreSingleQueryResolver ); _storeData: RelayStoreData; constructor( storeData: RelayStoreData, fragment: RelayQuery.Fragment, callback: Function, ) { this.dispose(); this._callback = callback; this._fragment = fragment; this._resolver = null; this._storeData = storeData; } /** * disposes the resolver's internal state such that future `resolve()` results * will not be `===` to previous results, and unsubscribes any subscriptions. */ dispose(): void { if (this._resolver) { this._resolver.dispose(); } } resolve( fragment: RelayQuery.Fragment, dataIDs: DataID | Array<DataID>, ): ?(StoreReaderData | Array<?StoreReaderData>) { // Warn but don't crash if resolved with the wrong fragment. if ( this._fragment.getConcreteFragmentID() !== fragment.getConcreteFragmentID() ) { warning( false, 'GraphQLStoreQueryResolver: Expected `resolve` to be called with the ' + 'same concrete fragment as the constructor. The resolver was created ' + 'with fragment `%s` but resolved with fragment `%s`.', this._fragment.getDebugName(), fragment.getDebugName(), ); } // Rather than crash on mismatched plurality of fragment/ids just warn // and resolve as if the fragment's pluarity matched the format of the ids. // Note that the inverse - attempt to resolve based on fragment plurarity - // doesn't work because there's no way convert plural ids to singular w/o // losing data. if (Array.isArray(dataIDs)) { // Fragment should be plural if data is pluaral. warning( fragment.isPlural(), 'GraphQLStoreQueryResolver: Expected id/fragment plurality to be ' + 'consistent: got plural ids for singular fragment `%s`.', fragment.getDebugName(), ); let resolver = this._resolver; if (resolver instanceof GraphQLStoreSingleQueryResolver) { resolver.dispose(); resolver = null; } if (!resolver) { resolver = new GraphQLStorePluralQueryResolver( this._storeData, this._callback, ); } this._resolver = resolver; return resolver.resolve(fragment, dataIDs); } else { // Fragment should be singular if data is singular. warning( !fragment.isPlural(), 'GraphQLStoreQueryResolver: Expected id/fragment plurality to be ' + 'consistent: got a singular id for plural fragment `%s`.', fragment.getDebugName(), ); let resolver = this._resolver; if (resolver instanceof GraphQLStorePluralQueryResolver) { resolver.dispose(); resolver = null; } if (!resolver) { resolver = new GraphQLStoreSingleQueryResolver( this._storeData, this._callback, ); } this._resolver = resolver; return resolver.resolve(fragment, dataIDs); } } } /** * Resolves plural fragments. */ class GraphQLStorePluralQueryResolver { _callback: Function; _resolvers: Array<GraphQLStoreSingleQueryResolver>; _results: Array<?StoreReaderData>; _storeData: RelayStoreData; constructor(storeData: RelayStoreData, callback: Function) { this.dispose(); this._callback = callback; this._storeData = storeData; } dispose(): void { if (this._resolvers) { this._resolvers.forEach(resolver => resolver.dispose()); } this._resolvers = []; this._results = []; } /** * Resolves a plural fragment pointer into an array of records. * * If the data, order, and number of resolved records has not changed since * the last call to `resolve`, the same array will be returned. Otherwise, a * new array will be returned. */ resolve( fragment: RelayQuery.Fragment, nextIDs: Array<DataID>, ): Array<?StoreReaderData> { const prevResults = this._results; let nextResults; const prevLength = prevResults.length; const nextLength = nextIDs.length; const resolvers = this._resolvers; // Ensure that we have exactly `nextLength` resolvers. while (resolvers.length < nextLength) { resolvers.push( new GraphQLStoreSingleQueryResolver(this._storeData, this._callback), ); } while (resolvers.length > nextLength) { resolvers.pop().dispose(); } // Allocate `nextResults` if and only if results have changed. if (prevLength !== nextLength) { nextResults = []; } for (let ii = 0; ii < nextLength; ii++) { const nextResult = resolvers[ii].resolve(fragment, nextIDs[ii]); if (nextResults || ii >= prevLength || nextResult !== prevResults[ii]) { nextResults = nextResults || prevResults.slice(0, ii); nextResults.push(nextResult); } } if (nextResults) { this._results = nextResults; } return this._results; } } /** * Resolves non-plural fragments. */ class GraphQLStoreSingleQueryResolver { _callback: Function; _fragment: ?RelayQuery.Fragment; _hasDataChanged: boolean; _result: ?StoreReaderData; _resultID: ?DataID; _storeData: RelayStoreData; _subscribedIDs: DataIDSet; _subscription: ?ChangeSubscription; constructor(storeData: RelayStoreData, callback: Function) { this.dispose(); this._callback = callback; this._storeData = storeData; this._subscribedIDs = {}; } dispose(): void { if (this._subscription) { this._subscription.remove(); } this._hasDataChanged = false; this._fragment = null; this._result = null; this._resultID = null; this._subscription = null; this._subscribedIDs = {}; } /** * Resolves data for a single fragment pointer. */ resolve(nextFragment: RelayQuery.Fragment, nextID: DataID): ?StoreReaderData { const prevFragment = this._fragment; const prevID = this._resultID; let nextResult; const prevResult = this._result; let subscribedIDs; if ( prevFragment != null && prevID != null && this._getCanonicalID(prevID) === this._getCanonicalID(nextID) ) { if ( prevID !== nextID || this._hasDataChanged || !nextFragment.isEquivalent(prevFragment) ) { // same canonical ID, // but the data, call(s), route, and/or variables have changed [nextResult, subscribedIDs] = this._resolveFragment( nextFragment, nextID, ); nextResult = recycleNodesInto(prevResult, nextResult); } else { // same id, route, variables, and data nextResult = prevResult; } } else { // Pointer has a different ID or is/was fake data. [nextResult, subscribedIDs] = this._resolveFragment(nextFragment, nextID); } // update subscriptions whenever results change if (prevResult !== nextResult) { if (this._subscription) { this._subscription.remove(); this._subscription = null; } if (subscribedIDs) { // always subscribe to the root ID subscribedIDs[nextID] = true; const changeEmitter = this._storeData.getChangeEmitter(); this._subscription = changeEmitter.addListenerForIDs( Object.keys(subscribedIDs), this._handleChange.bind(this), ); this._subscribedIDs = subscribedIDs; } this._resultID = nextID; this._result = nextResult; } this._hasDataChanged = false; this._fragment = nextFragment; return this._result; } /** * Ranges publish events for the entire range, not the specific view of that * range. For example, if "client:1" is a range, the event is on "client:1", * not "client:1_first(5)". */ _getCanonicalID(id: DataID): DataID { return this._storeData.getRangeData().getCanonicalClientID(id); } _handleChange(): void { if (!this._hasDataChanged) { this._hasDataChanged = true; this._callback(); } } _resolveFragment( fragment: RelayQuery.Fragment, dataID: DataID, ): [?StoreReaderData, DataIDSet] { const {data, dataIDs} = readRelayQueryData( this._storeData, fragment, dataID, ); return [data, dataIDs]; } } RelayProfiler.instrumentMethods(GraphQLStoreQueryResolver.prototype, { resolve: 'GraphQLStoreQueryResolver.resolve', }); module.exports = GraphQLStoreQueryResolver;
/** * @license AngularJS v1.2.13-build.2242+sha.e645f7c * (c) 2010-2014 Google, Inc. http://angularjs.org * License: MIT */ (function(window, angular, undefined) {'use strict'; var $resourceMinErr = angular.$$minErr('$resource'); // Helper functions and regex to lookup a dotted path on an object // stopping at undefined/null. The path must be composed of ASCII // identifiers (just like $parse) var MEMBER_NAME_REGEX = /^(\.[a-zA-Z_$][0-9a-zA-Z_$]*)+$/; function isValidDottedPath(path) { return (path != null && path !== '' && path !== 'hasOwnProperty' && MEMBER_NAME_REGEX.test('.' + path)); } function lookupDottedPath(obj, path) { if (!isValidDottedPath(path)) { throw $resourceMinErr('badmember', 'Dotted member path "@{0}" is invalid.', path); } var keys = path.split('.'); for (var i = 0, ii = keys.length; i < ii && obj !== undefined; i++) { var key = keys[i]; obj = (obj !== null) ? obj[key] : undefined; } return obj; } /** * Create a shallow copy of an object and clear other fields from the destination */ function shallowClearAndCopy(src, dst) { dst = dst || {}; angular.forEach(dst, function(value, key){ delete dst[key]; }); for (var key in src) { if (src.hasOwnProperty(key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) { dst[key] = src[key]; } } return dst; } /** * @ngdoc overview * @name ngResource * @description * * # ngResource * * The `ngResource` module provides interaction support with RESTful services * via the $resource service. * * {@installModule resource} * * <div doc-module-components="ngResource"></div> * * See {@link ngResource.$resource `$resource`} for usage. */ /** * @ngdoc object * @name ngResource.$resource * @requires $http * * @description * A factory which creates a resource object that lets you interact with * [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) server-side data sources. * * The returned resource object has action methods which provide high-level behaviors without * the need to interact with the low level {@link ng.$http $http} service. * * Requires the {@link ngResource `ngResource`} module to be installed. * * @param {string} url A parametrized URL template with parameters prefixed by `:` as in * `/user/:username`. If you are using a URL with a port number (e.g. * `http://example.com:8080/api`), it will be respected. * * If you are using a url with a suffix, just add the suffix, like this: * `$resource('http://example.com/resource.json')` or `$resource('http://example.com/:id.json')` * or even `$resource('http://example.com/resource/:resource_id.:format')` * If the parameter before the suffix is empty, :resource_id in this case, then the `/.` will be * collapsed down to a single `.`. If you need this sequence to appear and not collapse then you * can escape it with `/\.`. * * @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in * `actions` methods. If any of the parameter value is a function, it will be executed every time * when a param value needs to be obtained for a request (unless the param was overridden). * * Each key value in the parameter object is first bound to url template if present and then any * excess keys are appended to the url search query after the `?`. * * Given a template `/path/:verb` and parameter `{verb:'greet', salutation:'Hello'}` results in * URL `/path/greet?salutation=Hello`. * * If the parameter value is prefixed with `@` then the value of that parameter is extracted from * the data object (useful for non-GET operations). * * @param {Object.<Object>=} actions Hash with declaration of custom action that should extend the * default set of resource actions. The declaration should be created in the format of {@link * ng.$http#usage_parameters $http.config}: * * {action1: {method:?, params:?, isArray:?, headers:?, ...}, * action2: {method:?, params:?, isArray:?, headers:?, ...}, * ...} * * Where: * * - **`action`** – {string} – The name of action. This name becomes the name of the method on * your resource object. * - **`method`** – {string} – HTTP request method. Valid methods are: `GET`, `POST`, `PUT`, * `DELETE`, and `JSONP`. * - **`params`** – {Object=} – Optional set of pre-bound parameters for this action. If any of * the parameter value is a function, it will be executed every time when a param value needs to * be obtained for a request (unless the param was overridden). * - **`url`** – {string} – action specific `url` override. The url templating is supported just * like for the resource-level urls. * - **`isArray`** – {boolean=} – If true then the returned object for this action is an array, * see `returns` section. * - **`transformRequest`** – * `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` – * transform function or an array of such functions. The transform function takes the http * request body and headers and returns its transformed (typically serialized) version. * - **`transformResponse`** – * `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` – * transform function or an array of such functions. The transform function takes the http * response body and headers and returns its transformed (typically deserialized) version. * - **`cache`** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the * GET request, otherwise if a cache instance built with * {@link ng.$cacheFactory $cacheFactory}, this cache will be used for * caching. * - **`timeout`** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise} that * should abort the request when resolved. * - **`withCredentials`** - `{boolean}` - whether to set the `withCredentials` flag on the * XHR object. See {@link https://developer.mozilla.org/en/http_access_control#section_5 * requests with credentials} for more information. * - **`responseType`** - `{string}` - see {@link * https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType requestType}. * - **`interceptor`** - `{Object=}` - The interceptor object has two optional methods - * `response` and `responseError`. Both `response` and `responseError` interceptors get called * with `http response` object. See {@link ng.$http $http interceptors}. * * @returns {Object} A resource "class" object with methods for the default set of resource actions * optionally extended with custom `actions`. The default set contains these actions: * * { 'get': {method:'GET'}, * 'save': {method:'POST'}, * 'query': {method:'GET', isArray:true}, * 'remove': {method:'DELETE'}, * 'delete': {method:'DELETE'} }; * * Calling these methods invoke an {@link ng.$http} with the specified http method, * destination and parameters. When the data is returned from the server then the object is an * instance of the resource class. The actions `save`, `remove` and `delete` are available on it * as methods with the `$` prefix. This allows you to easily perform CRUD operations (create, * read, update, delete) on server-side data like this: * <pre> var User = $resource('/user/:userId', {userId:'@id'}); var user = User.get({userId:123}, function() { user.abc = true; user.$save(); }); </pre> * * It is important to realize that invoking a $resource object method immediately returns an * empty reference (object or array depending on `isArray`). Once the data is returned from the * server the existing reference is populated with the actual data. This is a useful trick since * usually the resource is assigned to a model which is then rendered by the view. Having an empty * object results in no rendering, once the data arrives from the server then the object is * populated with the data and the view automatically re-renders itself showing the new data. This * means that in most cases one never has to write a callback function for the action methods. * * The action methods on the class object or instance object can be invoked with the following * parameters: * * - HTTP GET "class" actions: `Resource.action([parameters], [success], [error])` * - non-GET "class" actions: `Resource.action([parameters], postData, [success], [error])` * - non-GET instance actions: `instance.$action([parameters], [success], [error])` * * Success callback is called with (value, responseHeaders) arguments. Error callback is called * with (httpResponse) argument. * * Class actions return empty instance (with additional properties below). * Instance actions return promise of the action. * * The Resource instances and collection have these additional properties: * * - `$promise`: the {@link ng.$q promise} of the original server interaction that created this * instance or collection. * * On success, the promise is resolved with the same resource instance or collection object, * updated with data from server. This makes it easy to use in * {@link ngRoute.$routeProvider resolve section of $routeProvider.when()} to defer view * rendering until the resource(s) are loaded. * * On failure, the promise is resolved with the {@link ng.$http http response} object, without * the `resource` property. * * - `$resolved`: `true` after first server interaction is completed (either with success or * rejection), `false` before that. Knowing if the Resource has been resolved is useful in * data-binding. * * @example * * # Credit card resource * * <pre> // Define CreditCard class var CreditCard = $resource('/user/:userId/card/:cardId', {userId:123, cardId:'@id'}, { charge: {method:'POST', params:{charge:true}} }); // We can retrieve a collection from the server var cards = CreditCard.query(function() { // GET: /user/123/card // server returns: [ {id:456, number:'1234', name:'Smith'} ]; var card = cards[0]; // each item is an instance of CreditCard expect(card instanceof CreditCard).toEqual(true); card.name = "J. Smith"; // non GET methods are mapped onto the instances card.$save(); // POST: /user/123/card/456 {id:456, number:'1234', name:'J. Smith'} // server returns: {id:456, number:'1234', name: 'J. Smith'}; // our custom method is mapped as well. card.$charge({amount:9.99}); // POST: /user/123/card/456?amount=9.99&charge=true {id:456, number:'1234', name:'J. Smith'} }); // we can create an instance as well var newCard = new CreditCard({number:'0123'}); newCard.name = "Mike Smith"; newCard.$save(); // POST: /user/123/card {number:'0123', name:'Mike Smith'} // server returns: {id:789, number:'0123', name: 'Mike Smith'}; expect(newCard.id).toEqual(789); * </pre> * * The object returned from this function execution is a resource "class" which has "static" method * for each action in the definition. * * Calling these methods invoke `$http` on the `url` template with the given `method`, `params` and * `headers`. * When the data is returned from the server then the object is an instance of the resource type and * all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD * operations (create, read, update, delete) on server-side data. <pre> var User = $resource('/user/:userId', {userId:'@id'}); var user = User.get({userId:123}, function() { user.abc = true; user.$save(); }); </pre> * * It's worth noting that the success callback for `get`, `query` and other methods gets passed * in the response that came from the server as well as $http header getter function, so one * could rewrite the above example and get access to http headers as: * <pre> var User = $resource('/user/:userId', {userId:'@id'}); User.get({userId:123}, function(u, getResponseHeaders){ u.abc = true; u.$save(function(u, putResponseHeaders) { //u => saved user object //putResponseHeaders => $http header getter }); }); </pre> * # Creating a custom 'PUT' request * In this example we create a custom method on our resource to make a PUT request * <pre> * var app = angular.module('app', ['ngResource', 'ngRoute']); * * // Some APIs expect a PUT request in the format URL/object/ID * // Here we are creating an 'update' method * app.factory('Notes', ['$resource', function($resource) { * return $resource('/notes/:id', null, * { * 'update': { method:'PUT' } * }); * }]); * * // In our controller we get the ID from the URL using ngRoute and $routeParams * // We pass in $routeParams and our Notes factory along with $scope * app.controller('NotesCtrl', ['$scope', '$routeParams', 'Notes', function($scope, $routeParams, Notes) { * // First get a note object from the factory * var note = Notes.get({ id:$routeParams.id }); * $id = note.id; * * // Now call update passing in the ID first then the object you are updating * Notes.update({ id:$id }, note); * * // This will PUT /notes/ID with the note object in the request payload * }]); * </pre> */ angular.module('ngResource', ['ng']). factory('$resource', ['$http', '$q', function($http, $q) { var DEFAULT_ACTIONS = { 'get': {method:'GET'}, 'save': {method:'POST'}, 'query': {method:'GET', isArray:true}, 'remove': {method:'DELETE'}, 'delete': {method:'DELETE'} }; var noop = angular.noop, forEach = angular.forEach, extend = angular.extend, copy = angular.copy, isFunction = angular.isFunction; /** * We need our custom method because encodeURIComponent is too aggressive and doesn't follow * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path * segments: * segment = *pchar * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" * pct-encoded = "%" HEXDIG HEXDIG * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" * / "*" / "+" / "," / ";" / "=" */ function encodeUriSegment(val) { return encodeUriQuery(val, true). replace(/%26/gi, '&'). replace(/%3D/gi, '='). replace(/%2B/gi, '+'); } /** * This method is intended for encoding *key* or *value* parts of query component. We need a * custom method because encodeURIComponent is too aggressive and encodes stuff that doesn't * have to be encoded per http://tools.ietf.org/html/rfc3986: * query = *( pchar / "/" / "?" ) * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" * pct-encoded = "%" HEXDIG HEXDIG * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" * / "*" / "+" / "," / ";" / "=" */ function encodeUriQuery(val, pctEncodeSpaces) { return encodeURIComponent(val). replace(/%40/gi, '@'). replace(/%3A/gi, ':'). replace(/%24/g, '$'). replace(/%2C/gi, ','). replace(/%20/g, (pctEncodeSpaces ? '%20' : '+')); } function Route(template, defaults) { this.template = template; this.defaults = defaults || {}; this.urlParams = {}; } Route.prototype = { setUrlParams: function(config, params, actionUrl) { var self = this, url = actionUrl || self.template, val, encodedVal; var urlParams = self.urlParams = {}; forEach(url.split(/\W/), function(param){ if (param === 'hasOwnProperty') { throw $resourceMinErr('badname', "hasOwnProperty is not a valid parameter name."); } if (!(new RegExp("^\\d+$").test(param)) && param && (new RegExp("(^|[^\\\\]):" + param + "(\\W|$)").test(url))) { urlParams[param] = true; } }); url = url.replace(/\\:/g, ':'); params = params || {}; forEach(self.urlParams, function(_, urlParam){ val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam]; if (angular.isDefined(val) && val !== null) { encodedVal = encodeUriSegment(val); url = url.replace(new RegExp(":" + urlParam + "(\\W|$)", "g"), function(match, p1) { return encodedVal + p1; }); } else { url = url.replace(new RegExp("(\/?):" + urlParam + "(\\W|$)", "g"), function(match, leadingSlashes, tail) { if (tail.charAt(0) == '/') { return tail; } else { return leadingSlashes + tail; } }); } }); // strip trailing slashes and set the url url = url.replace(/\/+$/, '') || '/'; // then replace collapse `/.` if found in the last URL path segment before the query // E.g. `http://url.com/id./format?q=x` becomes `http://url.com/id.format?q=x` url = url.replace(/\/\.(?=\w+($|\?))/, '.'); // replace escaped `/\.` with `/.` config.url = url.replace(/\/\\\./, '/.'); // set params - delegate param encoding to $http forEach(params, function(value, key){ if (!self.urlParams[key]) { config.params = config.params || {}; config.params[key] = value; } }); } }; function resourceFactory(url, paramDefaults, actions) { var route = new Route(url); actions = extend({}, DEFAULT_ACTIONS, actions); function extractParams(data, actionParams){ var ids = {}; actionParams = extend({}, paramDefaults, actionParams); forEach(actionParams, function(value, key){ if (isFunction(value)) { value = value(); } ids[key] = value && value.charAt && value.charAt(0) == '@' ? lookupDottedPath(data, value.substr(1)) : value; }); return ids; } function defaultResponseInterceptor(response) { return response.resource; } function Resource(value){ shallowClearAndCopy(value || {}, this); } forEach(actions, function(action, name) { var hasBody = /^(POST|PUT|PATCH)$/i.test(action.method); Resource[name] = function(a1, a2, a3, a4) { var params = {}, data, success, error; /* jshint -W086 */ /* (purposefully fall through case statements) */ switch(arguments.length) { case 4: error = a4; success = a3; //fallthrough case 3: case 2: if (isFunction(a2)) { if (isFunction(a1)) { success = a1; error = a2; break; } success = a2; error = a3; //fallthrough } else { params = a1; data = a2; success = a3; break; } case 1: if (isFunction(a1)) success = a1; else if (hasBody) data = a1; else params = a1; break; case 0: break; default: throw $resourceMinErr('badargs', "Expected up to 4 arguments [params, data, success, error], got {0} arguments", arguments.length); } /* jshint +W086 */ /* (purposefully fall through case statements) */ var isInstanceCall = this instanceof Resource; var value = isInstanceCall ? data : (action.isArray ? [] : new Resource(data)); var httpConfig = {}; var responseInterceptor = action.interceptor && action.interceptor.response || defaultResponseInterceptor; var responseErrorInterceptor = action.interceptor && action.interceptor.responseError || undefined; forEach(action, function(value, key) { if (key != 'params' && key != 'isArray' && key != 'interceptor') { httpConfig[key] = copy(value); } }); if (hasBody) httpConfig.data = data; route.setUrlParams(httpConfig, extend({}, extractParams(data, action.params || {}), params), action.url); var promise = $http(httpConfig).then(function(response) { var data = response.data, promise = value.$promise; if (data) { // Need to convert action.isArray to boolean in case it is undefined // jshint -W018 if (angular.isArray(data) !== (!!action.isArray)) { throw $resourceMinErr('badcfg', 'Error in resource configuration. Expected ' + 'response to contain an {0} but got an {1}', action.isArray?'array':'object', angular.isArray(data)?'array':'object'); } // jshint +W018 if (action.isArray) { value.length = 0; forEach(data, function(item) { value.push(new Resource(item)); }); } else { shallowClearAndCopy(data, value); value.$promise = promise; } } value.$resolved = true; response.resource = value; return response; }, function(response) { value.$resolved = true; (error||noop)(response); return $q.reject(response); }); promise = promise.then( function(response) { var value = responseInterceptor(response); (success||noop)(value, response.headers); return value; }, responseErrorInterceptor); if (!isInstanceCall) { // we are creating instance / collection // - set the initial promise // - return the instance / collection value.$promise = promise; value.$resolved = false; return value; } // instance call return promise; }; Resource.prototype['$' + name] = function(params, success, error) { if (isFunction(params)) { error = success; success = params; params = {}; } var result = Resource[name].call(this, params, this, success, error); return result.$promise || result; }; }); Resource.bind = function(additionalParamDefaults){ return resourceFactory(url, extend({}, paramDefaults, additionalParamDefaults), actions); }; return Resource; } return resourceFactory; }]); })(window, window.angular);
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ /* Copyright 2008 litl, LLC. */ /** * The tween list object. Stores all of the properties and information that pertain to individual tweens. * * @author Nate Chatellier, Zeh Fernando * @version 1.0.4 * @private */ /* Licensed under the MIT License Copyright (c) 2006-2007 Zeh Fernando and Nate Chatellier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. http://code.google.com/p/tweener/ http://code.google.com/p/tweener/wiki/License */ function TweenList(scope, timeStart, timeComplete, useFrames, transition, transitionParams) { this._init(scope, timeStart, timeComplete, useFrames, transition, transitionParams); } TweenList.prototype = { _init: function(scope, timeStart, timeComplete, userFrames, transition, transitionParams) { this.scope = scope; this.timeStart = timeStart; this.timeComplete = timeComplete; this.userFrames = userFrames; this.transition = transition; this.transitionParams = transitionParams; /* Other default information */ this.properties = new Object(); this.isPaused = false; this.timePaused = undefined; this.isCaller = false; this.updatesSkipped = 0; this.timesCalled = 0; this.skipUpdates = 0; this.hasStarted = false; }, clone: function(omitEvents) { var tween = new TweenList(this.scope, this.timeStart, this.timeComplete, this.userFrames, this.transition, this.transitionParams); tween.properties = new Array(); for (let name in this.properties) { tween.properties[name] = this.properties[name]; } tween.skipUpdates = this.skipUpdates; tween.updatesSkipped = this.updatesSkipped; if (!omitEvents) { tween.onStart = this.onStart; tween.onUpdate = this.onUpdate; tween.onComplete = this.onComplete; tween.onOverwrite = this.onOverwrite; tween.onError = this.onError; tween.onStartParams = this.onStartParams; tween.onUpdateParams = this.onUpdateParams; tween.onCompleteParams = this.onCompleteParams; tween.onOverwriteParams = this.onOverwriteParams; tween.onStartScope = this.onStartScope; tween.onUpdateScope = this.onUpdateScope; tween.onCompleteScope = this.onCompleteScope; tween.onOverwriteScope = this.onOverwriteScope; tween.onErrorScope = this.onErrorScope; } tween.rounded = this.rounded; tween.min = this.min; tween.max = this.max; tween.isPaused = this.isPaused; tween.timePaused = this.timePaused; tween.isCaller = this.isCaller; tween.count = this.count; tween.timesCalled = this.timesCalled; tween.waitFrames = this.waitFrames; tween.hasStarted = this.hasStarted; return tween; } }; function makePropertiesChain(obj) { /* Tweener has a bunch of code here to get all the properties of all * the objects we inherit from (the objects in the 'base' property). * I don't think that applies to JavaScript... */ return obj; };
/** * @ngdoc service * @name $ionicModal * @module ionic * @description * * Related: {@link ionic.controller:ionicModal ionicModal controller}. * * The Modal is a content pane that can go over the user's main view * temporarily. Usually used for making a choice or editing an item. * * Put the content of the modal inside of an `<ion-modal-view>` element. * * **Notes:** * - A modal will broadcast 'modal.shown', 'modal.hidden', and 'modal.removed' events from its originating * scope, passing in itself as an event argument. Both the modal.removed and modal.hidden events are * called when the modal is removed. * * - This example assumes your modal is in your main index file or another template file. If it is in its own * template file, remove the script tags and call it by file name. * * @usage * ```html * <script id="my-modal.html" type="text/ng-template"> * <ion-modal-view> * <ion-header-bar> * <h1 class="title">My Modal title</h1> * </ion-header-bar> * <ion-content> * Hello! * </ion-content> * </ion-modal-view> * </script> * ``` * ```js * angular.module('testApp', ['ionic']) * .controller('MyController', function($scope, $ionicModal) { * $ionicModal.fromTemplateUrl('my-modal.html', { * scope: $scope, * animation: 'slide-in-up' * }).then(function(modal) { * $scope.modal = modal; * }); * $scope.openModal = function() { * $scope.modal.show(); * }; * $scope.closeModal = function() { * $scope.modal.hide(); * }; * //Cleanup the modal when we're done with it! * $scope.$on('$destroy', function() { * $scope.modal.remove(); * }); * // Execute action on hide modal * $scope.$on('modal.hidden', function() { * // Execute action * }); * // Execute action on remove modal * $scope.$on('modal.removed', function() { * // Execute action * }); * }); * ``` */ IonicModule .factory('$ionicModal', [ '$rootScope', '$ionicBody', '$compile', '$timeout', '$ionicPlatform', '$ionicTemplateLoader', '$q', '$log', function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTemplateLoader, $q, $log) { /** * @ngdoc controller * @name ionicModal * @module ionic * @description * Instantiated by the {@link ionic.service:$ionicModal} service. * * Be sure to call [remove()](#remove) when you are done with each modal * to clean it up and avoid memory leaks. * * Note: a modal will broadcast 'modal.shown', 'modal.hidden', and 'modal.removed' events from its originating * scope, passing in itself as an event argument. Note: both modal.removed and modal.hidden are * called when the modal is removed. */ var ModalView = ionic.views.Modal.inherit({ /** * @ngdoc method * @name ionicModal#initialize * @description Creates a new modal controller instance. * @param {object} options An options object with the following properties: * - `{object=}` `scope` The scope to be a child of. * Default: creates a child of $rootScope. * - `{string=}` `animation` The animation to show & hide with. * Default: 'slide-in-up' * - `{boolean=}` `focusFirstInput` Whether to autofocus the first input of * the modal when shown. Default: false. * - `{boolean=}` `backdropClickToClose` Whether to close the modal on clicking the backdrop. * Default: true. * - `{boolean=}` `hardwareBackButtonClose` Whether the modal can be closed using the hardware * back button on Android and similar devices. Default: true. */ initialize: function(opts) { ionic.views.Modal.prototype.initialize.call(this, opts); this.animation = opts.animation || 'slide-in-up'; }, /** * @ngdoc method * @name ionicModal#show * @description Show this modal instance. * @returns {promise} A promise which is resolved when the modal is finished animating in. */ show: function(target) { var self = this; if(self.scope.$$destroyed) { $log.error('Cannot call ' + self.viewType + '.show() after remove(). Please create a new ' + self.viewType + ' instance.'); return; } var modalEl = jqLite(self.modalEl); self.el.classList.remove('hide'); $timeout(function(){ $ionicBody.addClass(self.viewType + '-open'); }, 400); if(!self.el.parentElement) { modalEl.addClass(self.animation); $ionicBody.append(self.el); } if(target && self.positionView) { self.positionView(target, modalEl); } modalEl.addClass('ng-enter active') .removeClass('ng-leave ng-leave-active'); self._isShown = true; self._deregisterBackButton = $ionicPlatform.registerBackButtonAction( self.hardwareBackButtonClose ? angular.bind(self, self.hide) : angular.noop, PLATFORM_BACK_BUTTON_PRIORITY_MODAL ); self._isOpenPromise = $q.defer(); ionic.views.Modal.prototype.show.call(self); $timeout(function(){ modalEl.addClass('ng-enter-active'); ionic.trigger('resize'); self.scope.$parent && self.scope.$parent.$broadcast(self.viewType + '.shown', self); self.el.classList.add('active'); }, 20); return $timeout(function() { //After animating in, allow hide on backdrop click self.$el.on('click', function(e) { if (self.backdropClickToClose && e.target === self.el) { self.hide(); } }); }, 400); }, /** * @ngdoc method * @name ionicModal#hide * @description Hide this modal instance. * @returns {promise} A promise which is resolved when the modal is finished animating out. */ hide: function() { var self = this; var modalEl = jqLite(self.modalEl); self.el.classList.remove('active'); modalEl.addClass('ng-leave'); $timeout(function(){ modalEl.addClass('ng-leave-active') .removeClass('ng-enter ng-enter-active active'); }, 20); self.$el.off('click'); self._isShown = false; self.scope.$parent && self.scope.$parent.$broadcast(self.viewType + '.hidden', self); self._deregisterBackButton && self._deregisterBackButton(); ionic.views.Modal.prototype.hide.call(self); return $timeout(function(){ $ionicBody.removeClass(self.viewType + '-open'); self.el.classList.add('hide'); }, self.hideDelay || 320); }, /** * @ngdoc method * @name ionicModal#remove * @description Remove this modal instance from the DOM and clean up. * @returns {promise} A promise which is resolved when the modal is finished animating out. */ remove: function() { var self = this; self.scope.$parent && self.scope.$parent.$broadcast(self.viewType + '.removed', self); return self.hide().then(function() { self.scope.$destroy(); self.$el.remove(); }); }, /** * @ngdoc method * @name ionicModal#isShown * @returns boolean Whether this modal is currently shown. */ isShown: function() { return !!this._isShown; } }); var createModal = function(templateString, options) { // Create a new scope for the modal var scope = options.scope && options.scope.$new() || $rootScope.$new(true); options.viewType = options.viewType || 'modal'; extend(scope, { $hasHeader: false, $hasSubheader: false, $hasFooter: false, $hasSubfooter: false, $hasTabs: false, $hasTabsTop: false }); // Compile the template var element = $compile('<ion-' + options.viewType + '>' + templateString + '</ion-' + options.viewType + '>')(scope); options.$el = element; options.el = element[0]; options.modalEl = options.el.querySelector('.' + options.viewType); var modal = new ModalView(options); modal.scope = scope; // If this wasn't a defined scope, we can assign the viewType to the isolated scope // we created if(!options.scope) { scope[ options.viewType ] = modal; } return modal; }; return { /** * @ngdoc method * @name $ionicModal#fromTemplate * @param {string} templateString The template string to use as the modal's * content. * @param {object} options Options to be passed {@link ionic.controller:ionicModal#initialize ionicModal#initialize} method. * @returns {object} An instance of an {@link ionic.controller:ionicModal} * controller. */ fromTemplate: function(templateString, options) { var modal = createModal(templateString, options || {}); return modal; }, /** * @ngdoc method * @name $ionicModal#fromTemplateUrl * @param {string} templateUrl The url to load the template from. * @param {object} options Options to be passed {@link ionic.controller:ionicModal#initialize ionicModal#initialize} method. * options object. * @returns {promise} A promise that will be resolved with an instance of * an {@link ionic.controller:ionicModal} controller. */ fromTemplateUrl: function(url, options, _) { var cb; //Deprecated: allow a callback as second parameter. Now we return a promise. if (angular.isFunction(options)) { cb = options; options = _; } return $ionicTemplateLoader.load(url).then(function(templateString) { var modal = createModal(templateString, options || {}); cb && cb(modal); return modal; }); } }; }]);
import Dashboard from './components/Dashboard' export function dashboardPlugin(context) { context.on('application:routes', opts => { console.info('dashboardPlugin - application:routes') console.log('dashboardPlugin - application:routes', opts) opts.nextState.routes.push({ id: 'dashboard', entries: [ { path: 'dashboard', name: 'dashboard', component: Dashboard, } ] }) console.log('dashboardPlugin - application:routes - return', opts) return opts }) return { getName: () => 'dashboardPlugin' } }
/** @type {import("../../../../").Configuration} */ module.exports = { name: "compiler-name", module: { rules: [ { test: /a\.js$/, compiler: "compiler", use: "./loader" }, { test: /b\.js$/, compiler: "other-compiler", use: "./loader" } ] } };
/*jshint node:true*/ module.exports = { description: '<%= name %>', normalizeEntityName: function () {}, afterInstall: function(options) { return this.addPackagesToProject([{ name: 'ember-jsonapi-resources', target: '~1.1.2' }]); } };
/** * Module for filters */ (function () { 'use strict'; angular.module('<%= appName %>.filters', []); })();
'use strict'; const { createController } = require('../controller'); describe('Default Controller', () => { test('Creates Collection Type default actions', () => { const service = {}; const contentType = { modelName: 'testModel', kind: 'collectionType', }; const controller = createController({ service, contentType }); expect(controller).toEqual({ find: expect.any(Function), findOne: expect.any(Function), create: expect.any(Function), update: expect.any(Function), delete: expect.any(Function), }); }); test('Creates Single Type default actions', () => { const service = {}; const contentType = { modelName: 'testModel', kind: 'singleType', }; const controller = createController({ service, contentType }); expect(controller).toEqual({ find: expect.any(Function), update: expect.any(Function), delete: expect.any(Function), }); }); });
import { combineReducers } from 'redux'; import loginStatus from './loginStatus'; import getModuleStatusReducer from '../../lib/getModuleStatusReducer'; export function getLoginStatusReducer(types) { return (state = null, { type, loggedIn, refreshTokenValid }) => { switch (type) { case types.login: return loginStatus.loggingIn; case types.loginSuccess: case types.refreshSuccess: case types.cancelLogout: return loginStatus.loggedIn; case types.loginError: case types.logoutSuccess: case types.logoutError: return loginStatus.notLoggedIn; case types.refreshError: return refreshTokenValid ? state : loginStatus.notLoggedIn; case types.logout: return loginStatus.loggingOut; case types.beforeLogout: return loginStatus.beforeLogout; case types.initSuccess: case types.tabSync: return loggedIn ? loginStatus.loggedIn : loginStatus.notLoggedIn; default: return state; } }; } export function getTokenReducer(types) { return (state = {}, { type, token, refreshTokenValid }) => { switch (type) { case types.loginSuccess: case types.refreshSuccess: return { ownerId: token.owner_id, endpointId: token.endpoint_id, accessToken: token.access_token, expireTime: token.expire_time, expiresIn: token.expires_in, }; case types.loginError: case types.logoutSuccess: case types.logoutError: return {}; case types.refreshError: if (refreshTokenValid) { return state; } return {}; case types.initSuccess: case types.tabSync: if (token) { return { ownerId: token.owner_id, endpointId: token.endpoint_id, accessToken: token.access_token, expireTime: token.expire_time, expiresIn: token.expires_in, }; } return {}; default: return state; } }; } export function getFreshLoginReducer(types) { return (state = null, { type, loggedIn }) => { switch (type) { case types.initSuccess: case types.tabSync: return loggedIn ? false : null; case types.login: return true; case types.loginError: case types.refreshError: case types.logoutSuccess: case types.logoutError: return null; default: return state; } }; } export default function getAuthReducer(types) { return combineReducers({ status: getModuleStatusReducer(types), loginStatus: getLoginStatusReducer(types), freshLogin: getFreshLoginReducer(types), token: getTokenReducer(types), }); }
/* global describe, it */ /* * The MIT License (MIT) * * Copyright (c) 2014 Apigee Corporation * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ 'use strict'; // Here to quiet down Connect logging errors process.env.NODE_ENV = 'test'; // Indicate to swagger-tools that we're in testing mode process.env.RUNNING_SWAGGER_TOOLS_TESTS = 'true'; var _ = require('lodash-compat'); var assert = require('assert'); var helpers = require('../helpers'); var request = require('supertest'); var petJson = _.cloneDeep(require('../../samples/1.2/pet.json')); var rlJson = _.cloneDeep(require('../../samples/1.2/resource-listing.json')); var storeJson = _.cloneDeep(require('../../samples/1.2/store.json')); var userJson = _.cloneDeep(require('../../samples/1.2/user.json')); var SecurityDef = function (allow, delay) { var self = this; if (allow === undefined) { allow = true; } if (delay === undefined) { delay = 0; } this.called = false; this.func = function (request, securityDefinition, scopes, cb) { assert(Array.isArray(scopes)); self.called = true; setTimeout(function() { cb(allow ? null : new Error('disallowed')); }, delay); }; }; var ApiKeySecurityDef = function() { var self = this; this.apiKey = undefined; this.func = function(request, securityDefinition, key, cb) { assert(key); self.apiKey = key; cb(); }; }; // Create security definitions rlJson.authorizations.local = rlJson.authorizations.local2 = { grantTypes: { 'authorization_code': { tokenEndpoint: { tokenName: 'auth_code', url: 'http://petstore.swagger.wordnik.com/oauth/token' }, tokenRequestEndpoint: { clientIdName: 'client_id', clientSecretName: 'client_secret', url: 'http://petstore.swagger.wordnik.com/oauth/requestToken' } }, implicit: { loginEndpoint: { url: 'http://petstore.swagger.wordnik.com/oauth/dialog' }, tokenName: 'access_token' } }, scopes: [ { description: 'Modify pets in your account', scope: 'write:pets' }, { description: 'Read your pets', scope: 'read:pets' }, { description: 'Anything (testing)', scope: 'test:anything' } ], type: 'oauth2' }; rlJson.authorizations.apiKeyHeader = { type: 'apiKey', passAs: 'header', keyname: 'X-API-KEY' }; rlJson.authorizations.apiKeyQuery = { type: 'apiKey', passAs: 'query', keyname: 'apiKey' }; // Create paths // Create paths var swaggerRouterOptions = { controllers: {} }; _.forEach([ 'secured', 'securedAnd', 'securedOr', 'unsecured', 'securedApiKeyQuery', 'securedApiKeyHeader'], function (name) { var cApiDef = _.cloneDeep(petJson.apis[4]); var authorizations; var operation; // Delete all but the 'GET' operation _.forEach(cApiDef.operations, function (opDef, index) { if (opDef.method !== 'GET') { delete cApiDef.operations[index]; } else { operation = opDef; } }); // Set the path cApiDef.path = '/' + name; // Add security switch (name) { case 'secured': authorizations = { local: [ { description: 'Read your', scope: 'read:pets' } ] }; break; case 'securedAnd': authorizations = { local: [ { description: 'Read your', scope: 'read:pets' } ], local2: [ { description: 'Read your', scope: 'read:pets' } ] }; break; case 'securedOr': authorizations = { local: [ { description: 'Read your', scope: 'read:pets' } ], local2: [ { description: 'Read your', scope: 'read:pets' } ] }; break; case 'securedApiKeyQuery': authorizations = { apiKeyQuery: [] }; break; case 'securedApiKeyHeader': authorizations = { apiKeyHeader: [] }; } if (_.isUndefined(authorizations)) { delete cApiDef.authorizations; } else { operation.authorizations = authorizations; } // Set the operation properties operation.nickname = name; // Make parameter optional operation.parameters[0].required = false; // Add the path petJson.apis.push(cApiDef); // Create handler swaggerRouterOptions.controllers[name] = function (req, res) { res.end('OK'); }; }); // Delete global security delete petJson.authorizations; describe('Swagger Security Middleware v1.2', function () { it('should call middleware when secured', function(done) { var localDef = new SecurityDef(); helpers.createServer([rlJson, [petJson, storeJson, userJson]], { swaggerRouterOptions: swaggerRouterOptions, swaggerSecurityOptions: { local: localDef.func } }, function (app) { request(app) .get('/api/secured') .expect(200) .end(function(err, res) { helpers.expectContent('OK')(err, res); assert(localDef.called); done(); }); }); }); it('should not call middleware when unsecured', function (done) { var localDef = new SecurityDef(); helpers.createServer([rlJson, [petJson, storeJson, userJson]], { swaggerRouterOptions: swaggerRouterOptions, swaggerSecurityOptions: { local: localDef.func } }, function (app) { request(app) .get('/api/unsecured') .expect(200) .end(function(err, res) { helpers.expectContent('OK')(err, res); assert(!localDef.called); done(); }); }); }); it('should not authorize if handler denies', function(done) { var localDef = new SecurityDef(false); helpers.createServer([rlJson, [petJson, storeJson, userJson]], { swaggerRouterOptions: swaggerRouterOptions, swaggerSecurityOptions: { local: localDef.func } }, function (app) { request(app) .get('/api/secured') .expect(403) .end(done); }); }); // Not possible due to https://github.com/swagger-api/swagger-spec/issues/159 // describe('with global requirements', function () { // it('should call global middleware when unsecured locally', function (done) { // var cPetJson = _.cloneDeep(petJson); // var globalDef = new SecurityDef(); // var localDef = new SecurityDef(); // // cPetJson.authorizations = { // oauth2: [ // { // description: 'Read your pets', // scope: 'read:pets' // } // ] // }; // // helpers.createServer([rlJson, [cPetJson, storeJson, userJson]], { // swaggerSecurityOptions: { // oauth2: globalDef.func, // local: localDef.func // } // }, function (app) { // request(app) // .get('/api/unsecured') // .expect(200) // .end(function(err) { // if (err) { return done(err); } // // assert(globalDef.called); // assert(!localDef.called); // // done(); // }); // }); // }); // // it('should call local middleware when secured locally', function (done) { // var cPetJson = _.cloneDeep(petJson); // var globalDef = new SecurityDef(); // var localDef = new SecurityDef(); // // cPetJson.authorizations = { // oauth2: [ // { // description: 'Read your pets', // scope: 'read:pets' // } // ] // }; // // helpers.createServer([rlJson, [cPetJson, storeJson, userJson]], { // swaggerSecurityOptions: { // oauth2: globalDef.func, // local: localDef.func // } // }, function (app) { // request(app) // .get('/api/secured') // .expect(200) // .end(function(err) { // if (err) { return done(err); } // // assert(localDef.called); // assert(!globalDef.called); // // done(); // }); // }); // }); // // it('should not authorize if handler denies', function (done) { // var cPetJson = _.cloneDeep(petJson); // var globalDef = new SecurityDef(false); // var localDef = new SecurityDef(true); // // cPetJson.authorizations = { // oauth2: [ // { // description: 'Read your pets', // scope: 'read:pets' // } // ] // }; // // helpers.createServer([rlJson, [cPetJson, storeJson, userJson]], { // swaggerSecurityOptions: { // oauth2: globalDef.func, // local: localDef.func // } // }, function (app) { // request(app) // .get('/api/unsecured') // .expect(403) // .end(done); // }); // }); // }); describe('API Key support', function() { it('in header', function (done) { var security = new ApiKeySecurityDef(); var API_KEY = 'abc123'; helpers.createServer([rlJson, [petJson, storeJson, userJson]], { swaggerRouterOptions: swaggerRouterOptions, swaggerSecurityOptions: { apiKeyHeader: security.func } }, function(app) { request(app) .get('/api/securedApiKeyHeader') .set({ 'X-API-KEY': API_KEY }) .expect(200) .end(function(err) { if (err) { return done(err); } assert(security.apiKey === API_KEY); done(); }); }); }); it('in query', function (done) { var security = new ApiKeySecurityDef(); var API_KEY = 'abc123'; helpers.createServer([rlJson, [petJson, storeJson, userJson]], { swaggerRouterOptions: swaggerRouterOptions, swaggerSecurityOptions: { apiKeyQuery: security.func } }, function(app) { request(app) .get('/api/securedApiKeyQuery') .query({ apiKey: API_KEY }) .expect(200) .end(function(err) { if (err) { return done(err); } assert(security.apiKey === API_KEY); done(); }); }); }); }); describe('AND requirements', function() { it('should authorize if both are true', function (done) { var local = new SecurityDef(true); var local2 = new SecurityDef(true); helpers.createServer([rlJson, [petJson, storeJson, userJson]], { swaggerRouterOptions: swaggerRouterOptions, swaggerSecurityOptions: { local: local.func, local2: local2.func } }, function (app) { request(app) .get('/api/securedAnd') .expect(200) .end(helpers.expectContent('OK', done)); }); }); it('should not authorize if first is false', function (done) { var local = new SecurityDef(false); var local2 = new SecurityDef(true); helpers.createServer([rlJson, [petJson, storeJson, userJson]], { swaggerRouterOptions: swaggerRouterOptions, swaggerSecurityOptions: { local: local.func, local2: local2.func } }, function (app) { request(app) .get('/api/securedAnd') .expect(200) .end(helpers.expectContent('OK', done)); }); }); it('should not authorize if second is false', function (done) { var local = new SecurityDef(true); var local2 = new SecurityDef(false); helpers.createServer([rlJson, [petJson, storeJson, userJson]], { swaggerRouterOptions: swaggerRouterOptions, swaggerSecurityOptions: { local: local.func, local2: local2.func } }, function (app) { request(app) .get('/api/securedAnd') .expect(200) .end(helpers.expectContent('OK', done)); }); }); it('should not authorize if both are false', function(done) { var local = new SecurityDef(false); var local2 = new SecurityDef(false); helpers.createServer([rlJson, [petJson, storeJson, userJson]], { swaggerRouterOptions: swaggerRouterOptions, swaggerSecurityOptions: { local: local.func, local2: local2.func } }, function (app) { request(app) .get('/api/securedAnd') .expect(403) .end(done); }); }); }); describe('OR requirements', function() { it('should authorize if both are true', function(done) { var local = new SecurityDef(true); var local2 = new SecurityDef(true); helpers.createServer([rlJson, [petJson, storeJson, userJson]], { swaggerRouterOptions: swaggerRouterOptions, swaggerSecurityOptions: { local: local.func, local2: local2.func } }, function (app) { request(app) .get('/api/securedOr') .expect(200) .end(helpers.expectContent('OK', done)); }); }); it('should authorize first if both are true', function(done) { var local = new SecurityDef(true, 400); var local2 = new SecurityDef(true); helpers.createServer([rlJson, [petJson, storeJson, userJson]], { swaggerRouterOptions: swaggerRouterOptions, swaggerSecurityOptions: { local: local.func, local2: local2.func } }, function (app) { request(app) .get('/api/securedOr') .expect(200) .end(function(err, res) { helpers.expectContent('OK')(err, res); assert(!local2.called); done(); }); }); }); it('should authorize if first is true', function(done) { var local = new SecurityDef(true); var local2 = new SecurityDef(false); helpers.createServer([rlJson, [petJson, storeJson, userJson]], { swaggerRouterOptions: swaggerRouterOptions, swaggerSecurityOptions: { local: local.func, local2: local2.func } }, function (app) { request(app) .get('/api/securedOr') .expect(200) .end(helpers.expectContent('OK', done)); }); }); it('should authorize if second is true', function(done) { var local = new SecurityDef(false); var local2 = new SecurityDef(true); helpers.createServer([rlJson, [petJson, storeJson, userJson]], { swaggerRouterOptions: swaggerRouterOptions, swaggerSecurityOptions: { local: local.func, local2: local2.func } }, function (app) { request(app) .get('/api/securedOr') .expect(200) .end(helpers.expectContent('OK', done)); }); }); it('should not authorize if both are false', function(done) { var local = new SecurityDef(false); var local2 = new SecurityDef(false); helpers.createServer([rlJson, [petJson, storeJson, userJson]], { swaggerRouterOptions: swaggerRouterOptions, swaggerSecurityOptions: { local: local.func, local2: local2.func } }, function (app) { request(app) .get('/api/securedOr') .expect(403) .end(done); }); }); }); });
module.exports = utest; utest.Collection = require('./lib/Collection'); utest.TestCase = require('./lib/TestCase'); utest.BashReporter = require('./lib/reporter/BashReporter'); var collection; var reporter; function utest(name, tests) { if (!collection) { collection = new utest.Collection(); reporter = new utest.BashReporter({collection: collection}); } var testCase = new utest.TestCase({name: name, tests: tests}); collection.add(testCase); };
const express = require("express"); const getApp = () => { const app = express(); return app; }; module.exports = { getApp };
// Copyright (c) 2012 Ecma International. All rights reserved. // Ecma International makes this code available under the terms and conditions set // forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the // "Use Terms"). Any redistribution of this code must retain the above // copyright and this notice and otherwise comply with the Use Terms. /*--- es5id: 11.13.2-11-s description: > Strict Mode - ReferenceError is thrown if the LeftHandSideExpression of a Compound Assignment operator(|=) evaluates to an unresolvable reference flags: [onlyStrict] includes: [runTestCase.js] ---*/ function testcase() { "use strict"; try { eval("_11_13_2_11 |= 1;"); return false; } catch (e) { return e instanceof ReferenceError; } } runTestCase(testcase);
'use strict'; var baseDir = 'client'; module.exports = { //This is the list of file patterns to load into the browser during testing. files: [ baseDir + '/src/vendor/angular/angular.js', baseDir + '/src/vendor/angular-mocks/angular-mocks.js', baseDir + '/src/vendor/angular-ui-router/release/angular-ui-router.js', baseDir + '/src/**/*.js', 'build/tmp/*.js', baseDir + '/test/unit/**/*.spec.js' ], //used framework frameworks: ['jasmine'], plugins: [ 'karma-chrome-launcher', 'karma-phantomjs-launcher', 'karma-jasmine', 'karma-coverage', 'karma-html-reporter', 'karma-mocha-reporter' ], preprocessors: { '**/client/src/**/*.js': 'coverage' }, reporters: ['mocha', 'html', 'coverage'], coverageReporter: { type: 'html', dir: baseDir + '/test/unit-results/coverage', file: 'coverage.html' }, htmlReporter: { outputDir: baseDir + '//test/unit-results/html' }, logLevel: 'info', urlRoot: '/__test/', //used browsers (overriddeng in some gulp task) browsers: ['Chrome'], };
//>>built define({previousMessage:"Alegeri anterioare",nextMessage:"Mai multe alegeri"});
/** * ### Attention please: we don't need the Node Type[folder,leaf], when we use horizontalTree --Anjing */ (function ($) { var thisTool = Dolphin; function HORIZONTAL_TREE(param) { this.init(param); if (this.opts.data) { this.loadData(this.opts.data); } else if (this.opts.url) { this.load(null, null); } return this; } HORIZONTAL_TREE.defaults = { //required panel: null, // url: null, data: null, //options fluid: false, idField: "id", nameField: "name", childrenField: "children", loadingFlag: true, ajax: thisTool.ajax, mockPathData: null, levelTitle: null, singleRoot: false, itemType: null, defaultId : -1, requestKey : 'id', buttons: [], buttonDefaultClass: 'btn-primary', itemButtons: [], //icon icon: {}, dataFilter: null }; HORIZONTAL_TREE.prototype = { /* ==================== property ================= */ constructor: HORIZONTAL_TREE, panel: null, data: null, selectedItem: null, itemPanel: {}, /* ===================== method ================== */ init: function (param) { this.opts = $.extend({}, HORIZONTAL_TREE.defaults, param); this.initLayout(); return this; }, initLayout: function () { var _this = this, horizontal_tree, table, tbody, tr, td, i; horizontal_tree = $('<div class="_horizontal_tree">').appendTo(this.opts.panel); if (_this.opts.fluid) { horizontal_tree.addClass('_horizontal_fluid'); } table = $('<table>').appendTo(horizontal_tree); tbody = $('<tbody>').appendTo(table); this.panel = $('<tr>').appendTo(tbody); return this; }, loadData: function (node, data) { var _this = this; if (node) { node[_this.opts.childrenField] = data; } else { this.data = data; } this.renderLevel(data, node); this.complete(); return this; }, load: function (node, url, param) { var _this = this, data = {}; if (url) { _this.opts.url = url; } else { url = _this.opts.url; } if (node) { data[_this.opts.requestKey] = node[_this.opts.idField]; url = _this.opts.url.replace('{'+_this.opts.requestKey+'}', node[_this.opts.idField]); } else { data[_this.opts.requestKey] = _this.opts.defaultId; url = _this.opts.url.replace('{'+_this.opts.requestKey+'}', _this.opts.defaultId); } this.opts.ajax({ url: url, mockPathData: _this.opts.mockPathData, loading: _this.opts.loadingFlag, data: data, onSuccess: function (reData) { if (typeof _this.opts.dataFilter == 'function') { reData = _this.opts.dataFilter.call(_this, reData); } if (node) { node[_this.opts.childrenField] = reData.rows; } else { _this.data = reData.rows; _this.panel.empty(); } _this.renderLevel(reData.rows, node); _this.complete(); } }); }, renderLevel: function (data, parent) { //在商品新增的品类选择界面,不需要在扩展新的列出来 if(parent!=null && this.opts.buttons.length==0 && parent[this.opts.childrenField].length==0) return; var _this = this, _data = data || this.data, col, title, level, items, item, buttons, button, i, _level = $(this.panel).children('td').length; col = $('<td>').appendTo(_this.panel); level = $('<div class="_level">').attr('data-parentId', parent && parent[_this.opts.idField]).appendTo(col); if (_data.title) { title = $('<div class="_title">').html(_data.title).appendTo(level); } else if (_this.opts.levelTitle) { title = $('<div class="_title">').appendTo(level); if (_level < _this.opts.levelTitle.length) { title.html(_this.opts.levelTitle[_level]); } else { title.html("level : " + _level); } } items = $('<div class="_items">').appendTo(level); $.each(_data, function (i, itemData) { //将节点拼接起来,使每个叶子节点可以追溯到根节点 itemData.parent = parent; //设置其type为folder or leaf if (itemData.children && itemData.children.length > 0) { itemData.type = 'folder'; } else { itemData.type = 'leaf'; } _this.addItem(itemData, items); }); if (!_this.opts.singleRoot || (_this.opts.singleRoot && parent)) { buttons = $('<div class="_button">').appendTo(level); $.each(_this.opts.buttons, function (i, buttonData) { button = $('<button class="btn btn-xs">').addClass(buttonData.class || _this.opts.buttonDefaultClass) .html(buttonData.name).attr(buttonData.attr).appendTo(buttons); if (typeof buttonData.click == 'function') { button.click(function (event) { buttonData.click.call(_this, data, parent, this, event); }); } }); } return _this; }, addItem: function (data, panel, parent) { var _this = this, item, i, buttons, name; item = $('<div class="_item">').attr('id', data[_this.opts.idField]).appendTo(panel); if (typeof _this.opts.nameField === 'function') { name = _this.opts.nameField.call(_this, data) } else { name = data[_this.opts.nameField]; } $('<span class="_itemName">').attr('title', name).html(name).appendTo(item); if (data.type == "folder") { $('<span class="glyphicon glyphicon-play float-right">').appendTo(item); } if (_this.opts.itemButtons) { buttons = $('<span class="_itemButtons">').appendTo(item); $.each(_this.opts.itemButtons, function (i, b) { $('<span class="glyphicon">').addClass(b.icon).click(function (event) { b.click.call(_this, data, parent, item); event.stopPropagation(); return false; }).appendTo(buttons); }); } item.click(function (event) { _this.click.call(_this, data, this, event); }); if (parent && parent[_this.opts.childrenField]) { parent[_this.opts.childrenField].push(data); } }, reloadItem: function (id, data) { var _this = this; var item, itemPanel, name, _url, _data; if (typeof id === 'string') { item = _this.findItem(id); } else { item = id } itemPanel = $('div._item[id="' + item[_this.opts.idField] + '"]'); if (data) { $.extend(item, data); if (typeof _this.opts.nameField === 'function') { name = _this.opts.nameField.call(_this, data) } else { name = data[_this.opts.nameField]; } itemPanel.find('._itemName').attr('title', name).html(name); itemPanel.click(); } else { _data = {}; if (item[_this.opts.idField]) { _data[_this.opts.requestKey] = item[_this.opts.idField]; _url = _this.opts.url.replace('{'+_this.opts.requestKey+'}', item[_this.opts.idField]); } else { _data[_this.opts.requestKey] = _this.opts.defaultId; _url = _this.opts.url.replace('{'+_this.opts.requestKey+'}', _this.opts.defaultId); } this.opts.ajax({ url: _url, data : _data, mockPathData: _this.opts.mockPathData, loading: _this.opts.loadingFlag, onSuccess: function (reData) { if (reData.rows && reData.rows[0]) { $.extend(Dolphin.emptyObj(item), reData.rows[0]); if (typeof _this.opts.nameField === 'function') { name = _this.opts.nameField.call(_this, item) } else { name = item[_this.opts.nameField]; } itemPanel.find('._itemName').attr('title', name).html(name); itemPanel.removeClass('active'); itemPanel.click(); } } }); } }, findItem: function (id) { var item, _this = this; item = traversal(_this.data); function traversal(data) { var i, item; for (i = 0; i < data.length; i++) { if (data[i][_this.opts.idField] == id) { return data[i]; } else { if (data[i][_this.opts.childrenField]) { item = arguments.callee(data[i][_this.opts.childrenField]); if (item) { return item } } } } return null; } return item; }, click: function (itemData, thisItem, event) { var _this = this; if (!$(thisItem).hasClass('active')) { $(thisItem).closest('td').nextAll().remove(); $(thisItem).siblings(".active").removeClass('active'); $(thisItem).addClass('active'); //if(itemData.type == "folder" || _this.opts.buttons.length>0){ if (itemData[_this.opts.childrenField]) { _this.loadData(itemData, itemData[_this.opts.childrenField]); } else { _this.load(itemData); } //} } $(thisItem).closest('table').find('.selected').removeClass('selected'); $(thisItem).addClass('selected'); _this.selectedItem = itemData; if (typeof _this.opts.click === 'function') { _this.opts.click.call(thisItem, itemData, event); } }, complete: function () { } }; thisTool.HORIZONTAL_TREE = HORIZONTAL_TREE; })(jQuery);
/** * Visual Blocks Language * * Copyright 2012 Google Inc. * http://blockly.googlecode.com/ * * Licensed under the Apache License, Version 2.0 (the "License")'; * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview Simplified Chinese strings. * @author weihuali0509@gmail.com (Weihua Li) * @author helen.nie94@gmail.com (Helen Nie) * @author moyehan@gmail.com (Morton Mok) * @author roadlabs@gmail.com (roadlabs) * @author jcjzhl@gmail.com (Congjun Jin) */ 'use strict'; goog.provide('Blockly.Msg.zh_tw'); /** * Due to the frequency of long strings, the 80-column wrap rule need not apply * to message files. */ Blockly.Msg.zh_tw.switch_language_to_chinese_tw = { // Switch language to Simplified Chinese. category: '', helpUrl: '', init: function() { // Context menus. Blockly.Msg.DUPLICATE_BLOCK = '復制代碼塊'; Blockly.Msg.REMOVE_COMMENT = '刪除註釋'; Blockly.Msg.ADD_COMMENT = '添加註釋'; Blockly.Msg.EXTERNAL_INPUTS = '外掛輸入項'; Blockly.Msg.INLINE_INPUTS = '內嵌輸入項'; Blockly.Msg.HORIZONTAL_PARAMETERS = '橫向排列參數項'; Blockly.Msg.VERTICAL_PARAMETERS = '縱向排列參數項'; Blockly.Msg.DELETE_BLOCK = '刪除代碼塊'; Blockly.Msg.DELETE_X_BLOCKS = '刪除 %1 個代碼塊'; Blockly.Msg.COLLAPSE_BLOCK = '折疊代碼塊'; Blockly.Msg.EXPAND_BLOCK = '展開代碼塊'; Blockly.Msg.DISABLE_BLOCK = '禁用代碼塊'; Blockly.Msg.ENABLE_BLOCK = '啟用代碼塊'; Blockly.Msg.HELP = '幫助'; Blockly.Msg.COLLAPSE_ALL = '折疊所有塊'; Blockly.Msg.EXPAND_ALL = '展開所有塊'; Blockly.Msg.ARRANGE_H = '橫向排列所有塊'; Blockly.Msg.ARRANGE_V = '縱向排列所有塊'; Blockly.Msg.ARRANGE_S = '斜向排列所有塊'; Blockly.Msg.SORT_W = '按寬度對所有塊排序'; Blockly.Msg.SORT_H = '按高度對所有塊排序'; Blockly.Msg.SORT_C = '按類別對所有塊排序'; Blockly.Msg.YAIL_OPTION = '生成Yail代碼'; Blockly.Msg.DOIT_OPTION = '執行該代碼塊'; // Variable renaming. Blockly.MSG_CHANGE_VALUE_TITLE = '修改數值:'; Blockly.MSG_NEW_VARIABLE = '新建變量...'; Blockly.MSG_NEW_VARIABLE_TITLE = '新建變量名稱:'; Blockly.MSG_RENAME_VARIABLE = '變量重命名...'; Blockly.MSG_RENAME_VARIABLE_TITLE = '將所有 "%1" 變量重命名為:'; // Toolbox. Blockly.MSG_VARIABLE_CATEGORY = '變量'; Blockly.MSG_PROCEDURE_CATEGORY = '過程'; // Warnings/Errors Blockly.ERROR_BLOCK_CANNOT_BE_IN_DEFINTION = '該代碼塊不能被定義'; Blockly.ERROR_SELECT_VALID_ITEM_FROM_DROPDOWN = '請從下拉列表中選擇合適項'; Blockly.ERROR_DUPLICATE_EVENT_HANDLER = '重復的組件事件處理器'; Blockly.ERROR_CAN_NOT_DO_IT_TITLE = '無法執行該代碼塊'; Blockly.ERROR_CAN_NOT_DO_IT_CONTENT = '只有連接助手或模擬器程序,才能執行'; // Colour Blocks. Blockly.Msg.LANG_COLOUR_PICKER_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/colors#basic'; Blockly.Msg.LANG_COLOUR_PICKER_TOOLTIP = '點擊方塊選取所需顏色'; Blockly.Msg.LANG_COLOUR_BLACK = '黑色'; Blockly.Msg.LANG_COLOUR_WHITE = '白色'; Blockly.Msg.LANG_COLOUR_RED = '紅色'; Blockly.Msg.LANG_COLOUR_PINK = '粉色'; Blockly.Msg.LANG_COLOUR_ORANGE = '橙色'; Blockly.Msg.LANG_COLOUR_YELLOW = '黃色'; Blockly.Msg.LANG_COLOUR_GREEN = '綠色'; Blockly.Msg.LANG_COLOUR_CYAN = '青色'; Blockly.Msg.LANG_COLOUR_BLUE = '藍色'; Blockly.Msg.LANG_COLOUR_MAGENTA = '品紅'; Blockly.Msg.LANG_COLOUR_LIGHT_GRAY = '淺灰'; Blockly.Msg.LANG_COLOUR_DARK_GRAY = '深灰'; Blockly.Msg.LANG_COLOUR_GRAY = '灰色'; Blockly.Msg.LANG_COLOUR_SPLIT_COLOUR = '分解色值'; Blockly.Msg.LANG_COLOUR_SPLIT_COLOUR_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/colors#split'; Blockly.Msg.LANG_COLOUR_SPLIT_COLOUR_TOOLTIP = '返回含紅、綠、藍色值以及透明度值(0-255)的列表'; Blockly.Msg.LANG_COLOUR_MAKE_COLOUR = '合成顏色'; Blockly.Msg.LANG_COLOUR_MAKE_COLOUR_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/colors#make'; Blockly.Msg.LANG_COLOUR_MAKE_COLOUR_TOOLTIP = '返回由指定紅、綠、藍色值以及透明度值合成的顏色。'; // Control Blocks Blockly.Msg.LANG_CATEGORY_CONTROLS = '控制'; Blockly.Msg.LANG_CONTROLS_IF_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/control#if'; Blockly.Msg.LANG_CONTROLS_IF_TOOLTIP_1 = '如果值為真,則執行相關語句塊'; Blockly.Msg.LANG_CONTROLS_IF_TOOLTIP_2 = '如果值為真,則執行第壹個語句塊\n' + '否則, 執行第二個語句塊'; Blockly.Msg.LANG_CONTROLS_IF_TOOLTIP_3 = '如果第壹個值為真,則執行第壹個語句塊,\n' + '否則,如果第二個值為真,則執行第二個語句塊'; Blockly.Msg.LANG_CONTROLS_IF_TOOLTIP_4 = '如果第壹個值為真,則執行第壹個語句塊,\n' + '否則,如果第二個值為真,則執行第二個語句塊,\n' + '如果值皆不為真,則執行最後壹個語句塊'; Blockly.Msg.LANG_CONTROLS_IF_MSG_IF = '如果'; Blockly.Msg.LANG_CONTROLS_IF_MSG_ELSEIF = '否則,如果'; Blockly.Msg.LANG_CONTROLS_IF_MSG_ELSE = '否則'; Blockly.Msg.LANG_CONTROLS_IF_MSG_THEN = '則'; Blockly.Msg.LANG_CONTROLS_IF_IF_TITLE_IF = '如果'; Blockly.Msg.LANG_CONTROLS_IF_IF_TOOLTIP = '添加、移除或重排相關元素,\n' + '重新設置該“如果”語句塊功能'; Blockly.Msg.LANG_CONTROLS_IF_ELSEIF_TITLE_ELSEIF = '否則,如果'; Blockly.Msg.LANG_CONTROLS_IF_ELSEIF_TOOLTIP = '為“如果”語句塊增設條件'; Blockly.Msg.LANG_CONTROLS_IF_ELSE_TITLE_ELSE = '否則'; Blockly.Msg.LANG_CONTROLS_IF_ELSE_TOOLTIP = '設最終條件,當所有條件均不滿足時執行'; Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/control#while'; Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_TITLE_REPEAT = '重復'; Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_INPUT_DO = '執行'; Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_WHILE = '只要'; Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL = '直到'; Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE = '只要值為真,就重復執行相關語句'; Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL = '只要值為假,就重復執行相關語句'; Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_TOOLTIP_1 = '只要條件為真,就執行”執行“區域所包含的語句塊'; Blockly.Msg.LANG_CONTROLS_FOR_HELPURL = ''; Blockly.Msg.LANG_CONTROLS_FOR_INPUT_WITH = '循環取數到'; Blockly.Msg.LANG_CONTROLS_FOR_INPUT_VAR = 'x'; Blockly.Msg.LANG_CONTROLS_FOR_INPUT_FROM = '範圍從'; Blockly.Msg.LANG_CONTROLS_FOR_INPUT_TO = '到'; Blockly.Msg.LANG_CONTROLS_FOR_INPUT_DO = '執行'; Blockly.Msg.LANG_CONTROLS_FOR_TOOLTIP = '從壹個數字開始取數,到另壹個數結束。\n' + '每取壹個數,都將其值賦給\n' + '變量 "%1",並執行語句塊。'; Blockly.Msg.LANG_CONTROLS_FORRANGE_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/control#forrange'; Blockly.Msg.LANG_CONTROLS_FORRANGE_INPUT_ITEM = '循環取'; Blockly.Msg.LANG_CONTROLS_FORRANGE_INPUT_VAR = '數字'; Blockly.Msg.LANG_CONTROLS_FORRANGE_INPUT_START = '範圍從'; Blockly.Msg.LANG_CONTROLS_FORRANGE_INPUT_END = '到'; Blockly.Msg.LANG_CONTROLS_FORRANGE_INPUT_STEP = '間隔為'; Blockly.Msg.LANG_CONTROLS_FORRANGE_INPUT_DO = '執行'; Blockly.Msg.LANG_CONTROLS_FORRANGE_INPUT_COLLAPSED_TEXT = '對壹定範圍內的數字'; Blockly.Msg.LANG_CONTROLS_FORRANGE_INPUT_COLLAPSED_PREFIX = '對於 '; Blockly.Msg.LANG_CONTROLS_FORRANGE_INPUT_COLLAPSED_SUFFIX = ' 範圍內的'; Blockly.Msg.LANG_CONTROLS_FORRANGE_TOOLTIP = '按指定範圍和增量循環取值,每次循環均將數值賦予指定變量,並運行“執行”區域所包含的代碼塊'; Blockly.Msg.LANG_CONTROLS_FOREACH_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/control#foreach'; Blockly.Msg.LANG_CONTROLS_FOREACH_INPUT_ITEM = '循環取'; Blockly.Msg.LANG_CONTROLS_FOREACH_INPUT_VAR = '列表項'; Blockly.Msg.LANG_CONTROLS_FOREACH_INPUT_INLIST = '列表為'; Blockly.Msg.LANG_CONTROLS_FOREACH_INPUT_DO = '執行'; Blockly.Msg.LANG_CONTROLS_FOREACH_INPUT_COLLAPSED_TEXT = '對列表中每壹項'; Blockly.Msg.LANG_CONTROLS_FOREACH_INPUT_COLLAPSED_PREFIX = '對於 '; Blockly.Msg.LANG_CONTROLS_FOREACH_INPUT_COLLAPSED_SUFFIX = ' 列表中的'; Blockly.Msg.LANG_CONTROLS_FOREACH_TOOLTIP = '針對列表中的每壹項運行“執行”區域所包含的代碼塊,' + ' 采用指定變量名引用當前列表項。'; Blockly.Msg.LANG_CONTROLS_GET_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/control#get'; Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_HELPURL = 'http://en.wikipedia.org/wiki/Control_flow'; Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_INPUT_OFLOOP = '循環'; Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK = '中斷'; Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE = '執行下壹個周期'; Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK = '中斷內部循環'; Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE = '跳轉到本循環的其余部分,並且\n' + '執行下壹個周期'; Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_WARNING = '警告:\n' + '本代碼塊只能用於\n' + '循環語句塊'; Blockly.Msg.LANG_CONTROLS_WHILE_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/control#while'; Blockly.Msg.LANG_CONTROLS_WHILE_TITLE = '當'; Blockly.Msg.LANG_CONTROLS_WHILE_INPUT_TEST = '滿足條件'; Blockly.Msg.LANG_CONTROLS_WHILE_INPUT_DO = '執行'; Blockly.Msg.LANG_CONTROLS_WHILE_COLLAPSED_TEXT = '滿足條件'; Blockly.Msg.LANG_CONTROLS_WHILE_TOOLTIP = '“執行”區域中代碼塊被執行的前提是,滿足條件的表達式值為' + '真。'; Blockly.Msg.LANG_CONTROLS_CHOOSE_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/control#choose'; Blockly.Msg.LANG_CONTROLS_CHOOSE_TITLE = '如果' Blockly.Msg.LANG_CONTROLS_CHOOSE_INPUT_TEST = ''; Blockly.Msg.LANG_CONTROLS_CHOOSE_INPUT_THEN_RETURN = '則'; Blockly.Msg.LANG_CONTROLS_CHOOSE_INPUT_ELSE_RETURN = '否則'; Blockly.Msg.LANG_CONTROLS_CHOOSE_COLLAPSED_TEXT = '如果'; Blockly.Msg.LANG_CONTROLS_CHOOSE_TOOLTIP = '如果條件表達式的檢測值為真,' + '則將關聯的求值表達式運算結果傳遞給“則-返回”語句槽;' + '否則將關聯的求值表達式運算結果傳遞給“否則-返回”語句槽;' + '壹般只有壹個返回槽表達式能被求值。'; Blockly.Msg.LANG_CONTROLS_DO_THEN_RETURN_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/control#doreturn'; Blockly.Msg.LANG_CONTROLS_DO_THEN_RETURN_INPUT_DO = '執行模塊'; Blockly.Msg.LANG_CONTROLS_DO_THEN_RETURN_INPUT_RETURN = '返回結果'; Blockly.Msg.LANG_CONTROLS_DO_THEN_RETURN_TOOLTIP = '運行“執行”區域中的代碼塊並返回壹條語句,用於在賦值前插入執行某個過程。'; Blockly.Msg.LANG_CONTROLS_DO_THEN_RETURN_COLLAPSED_TEXT = '執行語句/返回結果'; Blockly.Msg.LANG_CONTROLS_DO_THEN_RETURN_TITLE = '執行並返回'; Blockly.Msg.LANG_CONTROLS_EVAL_BUT_IGNORE_TITLE = '求值但忽視結果' Blockly.Msg.LANG_CONTROLS_EVAL_BUT_IGNORE_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/control#evaluate'; Blockly.Msg.LANG_CONTROLS_EVAL_BUT_COLLAPSED_TEXT = '求值但不返回'; Blockly.Msg.LANG_CONTROLS_EVAL_BUT_IGNORE_TOOLTIP = '運行所連接的代碼塊但不返回運算值,用於調用求值過程但不需要其運算值。'; /* [林恩 13/10/14] 現在刪除。可能回來的某壹天。 Blockly.Msg.LANG_CONTROLS_NOTHING_TITLE = '什麽'; Blockly.Msg.LANG_CONTROLS_NOTHING_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/control#nothing'; Blockly.Msg.LANG_CONTROLS_NOTHING_TOOLTIP = ' 返回 nothing。用來初始化變量或可以插入到返回的插槽中,如果沒有價值需要返回。這是相當於為空或沒有.'; */ Blockly.Msg.LANG_CONTROLS_OPEN_ANOTHER_SCREEN_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/control#openscreen'; Blockly.Msg.LANG_CONTROLS_OPEN_ANOTHER_SCREEN_TITLE = '打開屏幕'; Blockly.Msg.LANG_CONTROLS_OPEN_ANOTHER_SCREEN_INPUT_SCREENNAME = '屏幕名稱'; Blockly.Msg.LANG_CONTROLS_OPEN_ANOTHER_SCREEN_COLLAPSED_TEXT = '打開屏幕'; Blockly.Msg.LANG_CONTROLS_OPEN_ANOTHER_SCREEN_TOOLTIP = '在多屏應用中打開壹個新屏幕。'; Blockly.Msg.LANG_CONTROLS_OPEN_ANOTHER_SCREEN_WITH_START_VALUE_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/control#openscreenwithvalue'; Blockly.Msg.LANG_CONTROLS_OPEN_ANOTHER_SCREEN_WITH_START_VALUE_TITLE = '打開屏幕並傳值'; Blockly.Msg.LANG_CONTROLS_OPEN_ANOTHER_SCREEN_WITH_START_VALUE_INPUT_SCREENNAME = '屏幕名稱'; Blockly.Msg.LANG_CONTROLS_OPEN_ANOTHER_SCREEN_WITH_START_VALUE_INPUT_STARTVALUE = '初始值'; Blockly.Msg.LANG_CONTROLS_OPEN_ANOTHER_SCREEN_WITH_START_VALUE_COLLAPSED_TEXT = '打開屏幕並傳值' Blockly.Msg.LANG_CONTROLS_OPEN_ANOTHER_SCREEN_WITH_START_VALUE_TOOLTIP = '在多屏應用中開啟壹個新屏幕,並' + '向其傳入初始值'; Blockly.Msg.LANG_CONTROLS_GET_START_VALUE_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/control#getstartvalue'; Blockly.Msg.LANG_CONTROLS_GET_START_VALUE_TITLE = '獲取初始值'; Blockly.Msg.LANG_CONTROLS_GET_START_VALUE_INPUT_SCREENNAME = '屏幕名稱'; Blockly.Msg.LANG_CONTROLS_GET_START_VALUE_INPUT_STARTVALUE = '初始值'; Blockly.Msg.LANG_CONTROLS_GET_START_VALUE_COLLAPSED_TEXT = '獲取初始值'; Blockly.Msg.LANG_CONTROLS_GET_START_VALUE_TOOLTIP = '屏幕開啟時返回其傳入值,' + '在多屏應用中開啟動作壹般由其他屏幕引發。如沒有內容傳入,' + '則返回空文本。'; Blockly.Msg.LANG_CONTROLS_CLOSE_SCREEN_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/control#closescreen'; Blockly.Msg.LANG_CONTROLS_CLOSE_SCREEN_TITLE = '關閉屏幕 '; Blockly.Msg.LANG_CONTROLS_CLOSE_SCREEN_COLLAPSED_TEXT = '關閉屏幕 '; Blockly.Msg.LANG_CONTROLS_CLOSE_SCREEN_TOOLTIP = '關閉當前屏幕'; Blockly.Msg.LANG_CONTROLS_CLOSE_SCREEN_WITH_VALUE_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/control#closescreenwithvalue'; Blockly.Msg.LANG_CONTROLS_CLOSE_SCREEN_WITH_VALUE_TITLE = '關閉屏幕並返回值'; Blockly.Msg.LANG_CONTROLS_CLOSE_SCREEN_WITH_VALUE_INPUT_RESULT = '返回值'; Blockly.Msg.LANG_CONTROLS_CLOSE_SCREEN_WITH_VALUE_COLLAPSED_TEXT = '關閉屏幕返回值'; Blockly.Msg.LANG_CONTROLS_CLOSE_SCREEN_WITH_VALUE_TOOLTIP = ' 關閉當前屏幕並向打開此屏幕者返回結果'; Blockly.Msg.LANG_CONTROLS_CLOSE_APPLICATION_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/control#closeapp'; Blockly.Msg.LANG_CONTROLS_CLOSE_APPLICATION_TITLE = '退出程序'; Blockly.Msg.LANG_CONTROLS_CLOSE_APPLICATION_COLLAPSED_TEXT = '退出程序'; Blockly.Msg.LANG_CONTROLS_CLOSE_APPLICATION_TOOLTIP = '關閉所有屏幕並終止程序運行'; Blockly.Msg.LANG_CONTROLS_GET_PLAIN_START_TEXT_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/control#getplainstarttext'; Blockly.Msg.LANG_CONTROLS_GET_PLAIN_START_TEXT_TITLE = '獲取初始文本值'; Blockly.Msg.LANG_CONTROLS_GET_PLAIN_START_TEXT_COLLAPSED_TEXT = '獲取初始文本值'; Blockly.Msg.LANG_CONTROLS_GET_PLAIN_START_TEXT_TOOLTIP = ' 當屏幕被其他應用啟動時返回所傳入的文本值,' + '如沒有內容傳入,則返回空文本值。' + '對於多屏應用,壹般更多采用獲取初始值的方式,而非獲取純文本值。'; Blockly.Msg.LANG_CONTROLS_CLOSE_SCREEN_WITH_PLAIN_TEXT_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/control#closescreenwithplaintext'; Blockly.Msg.LANG_CONTROLS_CLOSE_SCREEN_WITH_PLAIN_TEXT_TITLE = '關閉屏幕並返回文本'; Blockly.Msg.LANG_CONTROLS_CLOSE_SCREEN_WITH_PLAIN_TEXT_INPUT_TEXT = '文本值'; Blockly.Msg.LANG_CONTROLS_CLOSE_SCREEN_WITH_PLAIN_TEXT_COLLAPSED_TEXT = '關閉屏幕返回文本'; Blockly.Msg.LANG_CONTROLS_CLOSE_SCREEN_WITH_PLAIN_TEXT_TOOLTIP = '關閉當前屏幕,並向打開此屏幕的應用返回文本。' + '對於多屏應用,則多采用關閉屏幕返回值的方式,' + '而不采用關閉屏幕返回文本。'; // Logic Blocks. Blockly.Msg.LANG_CATEGORY_LOGIC = '邏輯'; Blockly.Msg.LANG_LOGIC_COMPARE_HELPURL = 'http://en.wikipedia.org/wiki/Inequality _(mathematics)'; Blockly.Msg.LANG_LOGIC_COMPARE_HELPURL_EQ = 'http://appinventor.mit.edu/explore/ai2/support/blocks/logic#='; Blockly.Msg.LANG_LOGIC_COMPARE_HELPURL_NEQ = 'http://appinventor.mit.edu/explore/ai2/support/blocks/logic#not='; Blockly.Msg.LANG_LOGIC_COMPARE_TOOLTIP_EQ = '判斷二對象是否相等,\n' + '對象可為任意類型,不限於數字。'; Blockly.Msg.LANG_LOGIC_COMPARE_TOOLTIP_NEQ = '判斷二對象是否互不相等,對象可為任意類型,不限於數字。'; Blockly.Msg.LANG_LOGIC_COMPARE_TRANSLATED_NAME = '比較'; Blockly.Msg.LANG_LOGIC_COMPARE_EQ = '等於'; Blockly.Msg.LANG_LOGIC_COMPARE_NEQ = '不等於'; Blockly.Msg.LANG_LOGIC_OPERATION_HELPURL_AND = 'http://appinventor.mit.edu/explore/ai2/support/blocks/logic#and'; Blockly.Msg.LANG_LOGIC_OPERATION_HELPURL_OR = 'http://appinventor.mit.edu/explore/ai2/support/blocks/logic#or'; Blockly.Msg.LANG_LOGIC_OPERATION_AND = '並且'; Blockly.Msg.LANG_LOGIC_OPERATION_OR = '或者'; Blockly.Msg.LANG_LOGIC_OPERATION_TOOLTIP_AND = '如所有輸入項皆為真則返回真值。'; Blockly.Msg.LANG_LOGIC_OPERATION_TOOLTIP_OR = '只要有輸入項為真則返回真值。'; Blockly.Msg.LANG_LOGIC_NEGATE_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/logic#not'; Blockly.Msg.LANG_LOGIC_NEGATE_INPUT_NOT = '否定'; Blockly.Msg.LANG_LOGIC_NEGATE_TOOLTIP = '如輸入項為假則返回真值,\n' + '如輸入項為真則返回假值。'; Blockly.Msg.LANG_LOGIC_BOOLEAN_TRUE_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/logic#true'; Blockly.Msg.LANG_LOGIC_BOOLEAN_FALSE_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/logic#false'; Blockly.Msg.LANG_LOGIC_BOOLEAN_TRUE = 'true'; Blockly.Msg.LANG_LOGIC_BOOLEAN_FALSE = 'false'; Blockly.Msg.LANG_LOGIC_BOOLEAN_TOOLTIP_TRUE = '返回true值'; Blockly.Msg.LANG_LOGIC_BOOLEAN_TOOLTIP_FALSE = '返回false值'; // Math Blocks. Blockly.Msg.LANG_CATEGORY_MATH = '數學'; Blockly.Msg.LANG_MATH_NUMBER_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#number'; Blockly.Msg.LANG_MATH_NUMBER_TOOLTIP = '報告所顯示的數字 '; Blockly.Msg.LANG_MATH_MUTATOR_ITEM_INPUT_NUMBER = '數字'; Blockly.Msg.LANG_MATH_COMPARE_HELPURL = ''; Blockly.Msg.LANG_MATH_COMPARE_HELPURL_EQ = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#='; Blockly.Msg.LANG_MATH_COMPARE_HELPURL_NEQ = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#not='; Blockly.Msg.LANG_MATH_COMPARE_HELPURL_LT = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#lt'; Blockly.Msg.LANG_MATH_COMPARE_HELPURL_LTE = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#lte'; Blockly.Msg.LANG_MATH_COMPARE_HELPURL_GT = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#gt'; Blockly.Msg.LANG_MATH_COMPARE_HELPURL_GTE = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#gte'; Blockly.Msg.LANG_MATH_COMPARE_TOOLTIP_EQ = '如二數字相等則返回真值'; Blockly.Msg.LANG_MATH_COMPARE_TOOLTIP_NEQ = '如二數字不等則返回真值'; Blockly.Msg.LANG_MATH_COMPARE_TOOLTIP_LT = '如第壹個數字小於第二個數字,\n' + '則返回true值。'; Blockly.Msg.LANG_MATH_COMPARE_TOOLTIP_LTE = '如第壹個數字小於或等於第二個數字,\n' + '則返回false值。'; Blockly.Msg.LANG_MATH_COMPARE_TOOLTIP_GT = '如第壹個數字大於第二個數字,\n' + '則返回true值。'; Blockly.Msg.LANG_MATH_COMPARE_TOOLTIP_GTE = '如果第壹個數大於或等於第二個數,\n' + '則返回false值。'; Blockly.Msg.LANG_MATH_COMPARE_EQ = '='; Blockly.Msg.LANG_MATH_COMPARE_NEQ = '\u2260'; Blockly.Msg.LANG_MATH_COMPARE_LT = '<'; Blockly.Msg.LANG_MATH_COMPARE_LTE = '\u2264'; Blockly.Msg.LANG_MATH_COMPARE_GT = '>'; Blockly.Msg.LANG_MATH_COMPARE_GTE = '\u2265'; Blockly.Msg.LANG_MATH_ARITHMETIC_HELPURL_ADD = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#add'; Blockly.Msg.LANG_MATH_ARITHMETIC_HELPURL_MINUS = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#subtract'; Blockly.Msg.LANG_MATH_ARITHMETIC_HELPURL_MULTIPLY = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#multiply'; Blockly.Msg.LANG_MATH_ARITHMETIC_HELPURL_DIVIDE = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#divide'; Blockly.Msg.LANG_MATH_ARITHMETIC_HELPURL_POWER = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#exponent'; Blockly.Msg.LANG_MATH_ARITHMETIC_TOOLTIP_ADD = '求二數之和'; Blockly.Msg.LANG_MATH_ARITHMETIC_TOOLTIP_MINUS = '求二數之差'; Blockly.Msg.LANG_MATH_ARITHMETIC_TOOLTIP_MULTIPLY = '求二數乘積'; Blockly.Msg.LANG_MATH_ARITHMETIC_TOOLTIP_DIVIDE = '求二數之商'; Blockly.Msg.LANG_MATH_ARITHMETIC_TOOLTIP_POWER = '求第壹個數的第二個數次方'; Blockly.Msg.LANG_MATH_ARITHMETIC_ADD = '+'; Blockly.Msg.LANG_MATH_ARITHMETIC_MINUS = '-'; Blockly.Msg.LANG_MATH_ARITHMETIC_MULTIPLY = '*'; Blockly.Msg.LANG_MATH_ARITHMETIC_DIVIDE = '/'; Blockly.Msg.LANG_MATH_ARITHMETIC_POWER = '^'; /*Blockly.Msg.LANG_MATH_CHANGE_TITLE_CHANGE = '改變'; Blockly.Msg.LANG_MATH_CHANGE_TITLE_ITEM = '項目'; Blockly.Msg.LANG_MATH_CHANGE_INPUT_BY = '由'; Blockly.Msg.LANG_MATH_CHANGE_TOOLTIP = '添加號碼到變量"%1"。';*/ Blockly.Msg.LANG_MATH_SINGLE_OP_ROOT = '平方根'; Blockly.Msg.LANG_MATH_SINGLE_OP_ABSOLUTE = '絕對值'; Blockly.Msg.LANG_MATH_SINGLE_OP_NEG = '相反值'; Blockly.Msg.LANG_MATH_SINGLE_OP_LN = '自然對方'; Blockly.Msg.LANG_MATH_SINGLE_OP_EXP = 'e的乘方'; Blockly.Msg.LANG_MATH_SINGLE_TOOLTIP_ROOT = '求平方根'; Blockly.Msg.LANG_MATH_SINGLE_HELPURL_ROOT = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#sqrt'; Blockly.Msg.LANG_MATH_SINGLE_TOOLTIP_ABS = '求絕對值'; Blockly.Msg.LANG_MATH_SINGLE_HELPURL_ABS = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#abs'; Blockly.Msg.LANG_MATH_SINGLE_TOOLTIP_NEG = '求相反值'; Blockly.Msg.LANG_MATH_SINGLE_HELPURL_NEG = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#neg'; Blockly.Msg.LANG_MATH_SINGLE_TOOLTIP_LN = '求自然對數值'; Blockly.Msg.LANG_MATH_SINGLE_HELPURL_LN = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#log'; Blockly.Msg.LANG_MATH_SINGLE_TOOLTIP_EXP = '求e的乘方'; Blockly.Msg.LANG_MATH_SINGLE_HELPURL_EXP = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#e'; /*Blockly.Msg.LANG_MATH_SINGLE_TOOLTIP_POW10 = '返回 10 數的力量'; */ Blockly.Msg.LANG_MATH_ROUND_TOOLTIP_ROUND = '就高或或就低取整'; Blockly.Msg.LANG_MATH_ROUND_HELPURL_ROUND = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#round'; Blockly.Msg.LANG_MATH_ROUND_TOOLTIP_CEILING = '將輸入項取整為不低於其的最小數值'; Blockly.Msg.LANG_MATH_ROUND_HELPURL_CEILING = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#ceiling'; Blockly.Msg.LANG_MATH_ROUND_TOOLTIP_FLOOR = '將輸入項取整為不大於其的最大數值'; Blockly.Msg.LANG_MATH_ROUND_HELPURL_FLOOR = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#floor'; Blockly.Msg.LANG_MATH_ROUND_OPERATOR_ROUND = '四舍五入'; Blockly.Msg.LANG_MATH_ROUND_OPERATOR_CEILING = '就高取整'; Blockly.Msg.LANG_MATH_ROUND_OPERATOR_FLOOR = '就低取整'; Blockly.Msg.LANG_MATH_TRIG_SIN = 'sin'; Blockly.Msg.LANG_MATH_TRIG_COS = 'cos'; Blockly.Msg.LANG_MATH_TRIG_TAN = 'tan'; Blockly.Msg.LANG_MATH_TRIG_ASIN = 'asin'; Blockly.Msg.LANG_MATH_TRIG_ACOS = 'acos'; Blockly.Msg.LANG_MATH_TRIG_ATAN = 'atan'; Blockly.Msg.LANG_MATH_TRIG_ATAN2 = 'atan2'; Blockly.Msg.LANG_MATH_TRIG_ATAN2_X = 'x坐標'; Blockly.Msg.LANG_MATH_TRIG_ATAN2_Y = 'y坐標'; Blockly.Msg.LANG_MATH_TRIG_TOOLTIP_SIN = '求正弦值'; Blockly.Msg.LANG_MATH_TRIG_HELPURL_SIN = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#sin'; Blockly.Msg.LANG_MATH_TRIG_TOOLTIP_COS = '求余弦值'; Blockly.Msg.LANG_MATH_TRIG_HELPURL_COS = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#cos'; Blockly.Msg.LANG_MATH_TRIG_TOOLTIP_TAN = '求正切值'; Blockly.Msg.LANG_MATH_TRIG_HELPURL_TAN = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#tan'; Blockly.Msg.LANG_MATH_TRIG_TOOLTIP_ASIN = '由正弦值求角度(-90,+90]'; Blockly.Msg.LANG_MATH_TRIG_HELPURL_ASIN = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#asin'; Blockly.Msg.LANG_MATH_TRIG_TOOLTIP_ACOS = '由余弦值求角度[0, 180)'; Blockly.Msg.LANG_MATH_TRIG_HELPURL_ACOS = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#acos'; Blockly.Msg.LANG_MATH_TRIG_TOOLTIP_ATAN = '由正切值求角度(-90, +90)'; Blockly.Msg.LANG_MATH_TRIG_HELPURL_ATAN = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#atan'; Blockly.Msg.LANG_MATH_TRIG_TOOLTIP_ATAN2 = '由直角坐標求角度(-180, +180]'; Blockly.Msg.LANG_MATH_TRIG_HELPURL_ATAN2 = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#atan2'; Blockly.Msg.LANG_MATH_ONLIST_OPERATOR_MIN = '最小值'; Blockly.Msg.LANG_MATH_ONLIST_OPERATOR_MAX = '最大值'; //TODO: I don't think any of this is useful anymore...Delete? /*Blockly.Msg.LANG_MATH_ONLIST_HELPURL = ''; Blockly.Msg.LANG_MATH_ONLIST_INPUT_OFLIST = 'of list'; Blockly.Msg.LANG_MATH_ONLIST_OPERATOR_SUM = 'sum'; Blockly.Msg.LANG_MATH_ONLIST_OPERATOR_AVERAGE = 'average'; Blockly.Msg.LANG_MATH_ONLIST_OPERATOR_MEDIAN = 'median'; Blockly.Msg.LANG_MATH_ONLIST_OPERATOR_MODE = 'modes'; Blockly.Msg.LANG_MATH_ONLIST_OPERATOR_STD_DEV = 'standard deviation'; Blockly.Msg.LANG_MATH_ONLIST_OPERATOR_RANDOM = 'random item'; Blockly.Msg.LANG_MATH_ONLIST_TOOLTIP_SUM = 'Return the sum of all the numbers in the list.'; Blockly.Msg.LANG_MATH_ONLIST_TOOLTIP_MIN = 'Return the smallest of its arguments..'; Blockly.Msg.LANG_MATH_ONLIST_TOOLTIP_MAX = 'Return the largest of its arguments..'; Blockly.Msg.LANG_MATH_ONLIST_TOOLTIP_AVERAGE = 'Return the arithmetic mean of the list.'; Blockly.Msg.LANG_MATH_ONLIST_TOOLTIP_MEDIAN = 'Return the median number in the list.'; Blockly.Msg.LANG_MATH_ONLIST_TOOLTIP_MODE = 'Return a list of the most common item(s) in the list.'; Blockly.Msg.LANG_MATH_ONLIST_TOOLTIP_STD_DEV = 'Return the standard deviation of the list.'; Blockly.Msg.LANG_MATH_ONLIST_TOOLTIP_RANDOM = 'Return a random element from the list.'; Blockly.Msg.LANG_MATH_CONSTRAIN_HELPURL = 'http://en.wikipedia.org/wiki/Clamping_%28graphics%29'; Blockly.Msg.LANG_MATH_CONSTRAIN_INPUT_CONSTRAIN = 'constrain'; Blockly.Msg.LANG_MATH_CONSTRAIN_INPUT_LOW = 'between (low)'; Blockly.Msg.LANG_MATH_CONSTRAIN_INPUT_HIGH = 'and (high)'; Blockly.Msg.LANG_MATH_CONSTRAIN_TOOLTIP = 'Constrain a number to be between the specified limits (inclusive).'; */ Blockly.Msg.LANG_MATH_DIVIDE = '除以'; Blockly.Msg.LANG_MATH_DIVIDE_OPERATOR_MODULO = '模數'; Blockly.Msg.LANG_MATH_DIVIDE_OPERATOR_REMAINDER = '余數'; Blockly.Msg.LANG_MATH_DIVIDE_OPERATOR_QUOTIENT = '商數'; Blockly.Msg.LANG_MATH_DIVIDE_TOOLTIP_MODULO = '求模數'; Blockly.Msg.LANG_MATH_DIVIDE_HELPURL_MODULO = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#modulo'; Blockly.Msg.LANG_MATH_DIVIDE_TOOLTIP_REMAINDER = '求余數'; Blockly.Msg.LANG_MATH_DIVIDE_HELPURL_REMAINDER = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#remainder'; Blockly.Msg.LANG_MATH_DIVIDE_TOOLTIP_QUOTIENT = '求商數'; Blockly.Msg.LANG_MATH_DIVIDE_HELPURL_QUOTIENT = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#quotient'; Blockly.Msg.LANG_MATH_RANDOM_INT_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#randomint'; Blockly.Msg.LANG_MATH_RANDOM_INT_TITLE_RANDOM = '隨機整數'; Blockly.Msg.LANG_MATH_RANDOM_INT_INPUT_FROM = '範圍從'; Blockly.Msg.LANG_MATH_RANDOM_INT_INPUT_TO = '到'; Blockly.Msg.LANG_MATH_RANDOM_INT_INPUT = '隨機整數從 %1 到 %2 '; Blockly.Msg.LANG_MATH_RANDOM_INT_TOOLTIP = '返回位於上下邊界之間的隨機整數,\n' + '限於2的30次方範圍內'; Blockly.Msg.LANG_MATH_RANDOM_FLOAT_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#randomfrac'; Blockly.Msg.LANG_MATH_RANDOM_FLOAT_TITLE_RANDOM = '隨機小數'; Blockly.Msg.LANG_MATH_RANDOM_FLOAT_TOOLTIP = '返回0和1之間的隨機數值'; Blockly.Msg.LANG_MATH_RANDOM_SEED_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#randomseed'; Blockly.Msg.LANG_MATH_RANDOM_SEED_TITLE_RANDOM = '隨機數種子設定'; Blockly.Msg.LANG_MATH_RANDOM_SEED_INPUT_TO = '為'; Blockly.Msg.LANG_MATH_RANDOM_SEED_TOOLTIP = '為隨機數生成器指定種子數'; Blockly.Msg.LANG_MATH_CONVERT_ANGLES_TITLE_CONVERT = '角度變換'; Blockly.Msg.LANG_MATH_CONVERT_ANGLES_OP_RAD_TO_DEG = '弧度轉角度'; Blockly.Msg.LANG_MATH_CONVERT_ANGLES_OP_DEG_TO_RAD = '角度轉弧度'; Blockly.Msg.LANG_MATH_CONVERT_ANGLES_TOOLTIP_RAD_TO_DEG = '求弧度參數對應的角度值[0, 360)'; Blockly.Msg.LANG_MATH_CONVERT_ANGLES_HELPURL_RAD_TO_DEG = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#convertrad'; Blockly.Msg.LANG_MATH_CONVERT_ANGLES_TOOLTIP_DEG_TO_RAD = '求角度參數對應的弧度值[-\u03C0, +\u03C0)'; Blockly.Msg.LANG_MATH_CONVERT_ANGLES_HELPURL_DEG_TO_RAD = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#convertdeg'; Blockly.Msg.LANG_MATH_FORMAT_AS_DECIMAL_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#format'; Blockly.Msg.LANG_MATH_FORMAT_AS_DECIMAL_TITLE = '求小數值'; Blockly.Msg.LANG_MATH_FORMAT_AS_DECIMAL_INPUT_NUM = '數字'; Blockly.Msg.LANG_MATH_FORMAT_AS_DECIMAL_INPUT_PLACES = '位數'; Blockly.Msg.LANG_MATH_FORMAT_AS_DECIMAL_INPUT = '將數字 %1設為小數形式 位置 %2'; Blockly.Msg.LANG_MATH_FORMAT_AS_DECIMAL_TOOLTIP = '以指定位數返回該數值的小數形式'; Blockly.Msg.LANG_MATH_IS_A_NUMBER_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/math#isnumber'; Blockly.Msg.LANG_MATH_IS_A_NUMBER_INPUT_NUM = '是否為數字?'; Blockly.Msg.LANG_MATH_IS_A_NUMBER_TOOLTIP = '判斷該對象是否為數字類型'; // Text Blocks. Blockly.Msg.LANG_CATEGORY_TEXT = '文本'; Blockly.Msg.LANG_TEXT_TEXT_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/text#string'; Blockly.Msg.LANG_TEXT_TEXT_TOOLTIP = '輸入字符串文本'; Blockly.Msg.LANG_TEXT_TEXT_LEFT_QUOTE = '\u201C'; Blockly.Msg.LANG_TEXT_TEXT_RIGHT_QUOTE = '\u201D'; Blockly.Msg.LANG_TEXT_JOIN_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/text#join'; Blockly.Msg.LANG_TEXT_JOIN_TITLE_CREATEWITH = '創建字符串文本'; Blockly.Msg.LANG_TEXT_JOIN_TOOLTIP = '將所有輸入項合並為壹個單獨的字符串文本,\n' + '如沒有輸入項,則生成空文本。'; Blockly.Msg.LANG_TEXT_JOIN_TITLE_JOIN = '合並文本'; Blockly.Msg.LANG_TEXT_JOIN_ITEM_TITLE_ITEM = '字符串'; Blockly.Msg.LANG_TEXT_JOIN_ITEM_TOOLTIP = ''; Blockly.Msg.LANG_TEXT_APPEND_HELPURL = 'http://www.liv.ac.uk/HPC/HTMLF90Course/HTMLF90CourseNotesnode91.html'; Blockly.Msg.LANG_TEXT_APPEND_TO = '到'; Blockly.Msg.LANG_TEXT_APPEND_APPENDTEXT = '追加文本'; Blockly.Msg.LANG_TEXT_APPEND_VARIABLE = '變量'; Blockly.Msg.LANG_TEXT_APPEND_TOOLTIP = '將文本追加到變量 "%1"'; Blockly.Msg.LANG_TEXT_LENGTH_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/text#length'; Blockly.Msg.LANG_TEXT_LENGTH_INPUT_LENGTH = '求長度'; Blockly.Msg.LANG_TEXT_LENGTH_TOOLTIP = '求該文本中所包含的字母數量(包括空格)'; Blockly.Msg.LANG_TEXT_ISEMPTY_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/text#isempty'; Blockly.Msg.LANG_TEXT_ISEMPTY_INPUT_ISEMPTY = '是否為空'; Blockly.Msg.LANG_TEXT_ISEMPTY_TOOLTIP = '如文本長度為0則返回真值,否則返回假值'; Blockly.Msg.LANG_TEXT_COMPARE_LT = ' <'; Blockly.Msg.LANG_TEXT_COMPARE_EQUAL = ' ='; Blockly.Msg.LANG_TEXT_COMPARE_GT = ' >'; Blockly.Msg.LANG_TEXT_COMPARE_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/text#compare'; Blockly.Msg.LANG_TEXT_COMPARE_INPUT_COMPARE = '比較文本'; Blockly.Msg.LANG_TEXT_COMPARE_TOOLTIP_LT = '檢測text1的首字母順序是否低於text2,\n' + '如果首字母相同,則長度較短的文本順序靠前,\n' + '大寫字符順序優於小寫字符。'; Blockly.Msg.LANG_TEXT_COMPARE_TOOLTIP_EQUAL = '檢測文本字串內容是否相同,即,\n' + '是否由同壹組相同順序的字符組成,與通常的相等概念不同的是,\n' + '當文本字串為數字時,如123和0123,盡管數字相等,\n' + '但其文本不等。'; Blockly.Msg.LANG_TEXT_COMPARE_TOOLTIP_GT = '告之text1的字首順序是否高於text2,\n' + '如首字母相同,則長度較短的文本順序靠前,\n' + '大寫字符順序優於小寫字符。'; /*Blockly.Msg.LANG_TEXT_ENDSTRING_HELPURL = 'http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Farsubex.htm'; Blockly.Msg.LANG_TEXT_ENDSTRING_INPUT = 'letters in text'; Blockly.Msg.LANG_TEXT_ENDSTRING_TOOLTIP = 'Returns specified number of letters at the beginning or end of the text.'; Blockly.Msg.LANG_TEXT_ENDSTRING_OPERATOR_FIRST = 'first'; Blockly.Msg.LANG_TEXT_ENDSTRING_OPERATOR_LAST = 'last'; /*Blockly.Msg.LANG_TEXT_INDEXOF_HELPURL = 'http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Farsubex.htm'; Blockly.Msg.LANG_TEXT_INDEXOF_TITLE_FIND = 'find'; Blockly.Msg.LANG_TEXT_INDEXOF_INPUT_OCCURRENCE = 'occurrence of text'; Blockly.Msg.LANG_TEXT_INDEXOF_INPUT_INTEXT = 'in text'; Blockly.Msg.LANG_TEXT_INDEXOF_TOOLTIP = 'Returns the index of the first/last occurrence\n' + 'of first text in the second text.\n' + 'Returns 0 if text is not found.'; Blockly.Msg.LANG_TEXT_INDEXOF_OPERATOR_FIRST = 'first'; Blockly.Msg.LANG_TEXT_INDEXOF_OPERATOR_LAST = 'last'; /*Blockly.Msg.LANG_TEXT_CHARAT_HELPURL = 'http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Farsubex.htm'; Blockly.Msg.LANG_TEXT_CHARAT_INPUT_AT = 'letter at'; Blockly.Msg.LANG_TEXT_CHARAT_INPUT_INTEXT = 'in text'; Blockly.Msg.LANG_TEXT_CHARAT_TOOLTIP = 'Returns the letter at the specified position.'; */ Blockly.Msg.LANG_TEXT_CHANGECASE_OPERATOR_UPPERCASE = '大寫'; Blockly.Msg.LANG_TEXT_CHANGECASE_OPERATOR_DOWNCASE = '小寫'; Blockly.Msg.LANG_TEXT_CHANGECASE_TOOLTIP_UPPERCASE = '將字符串參數復制並轉為大寫後返回'; Blockly.Msg.LANG_TEXT_CHANGECASE_HELPURL_UPPERCASE = 'http://appinventor.mit.edu/explore/ai2/support/blocks/text#upcase'; Blockly.Msg.LANG_TEXT_CHANGECASE_TOOLTIP_DOWNCASE = '將字符串參數復制並轉為小寫後返回'; Blockly.Msg.LANG_TEXT_CHANGECASE_HELPURL_DOWNCASE = 'http://appinventor.mit.edu/explore/ai2/support/blocks/text#downcase'; Blockly.Msg.LANG_TEXT_TRIM_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/text#trim'; Blockly.Msg.LANG_TEXT_TRIM_TITLE_TRIM = '刪除空格'; Blockly.Msg.LANG_TEXT_TRIM_TOOLTIP = '將字符串參數復制並刪除首尾處的空格後返回'; Blockly.Msg.LANG_TEXT_STARTS_AT_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/text#startsat'; Blockly.Msg.LANG_TEXT_STARTS_AT_INPUT_STARTS_AT = '子串位置'; Blockly.Msg.LANG_TEXT_STARTS_AT_INPUT_TEXT = '文本'; Blockly.Msg.LANG_TEXT_STARTS_AT_INPUT_PIECE = '子串'; Blockly.Msg.LANG_TEXT_STARTS_AT_INPUT = '求子串%2在文本%1中的起始位置'; Blockly.Msg.LANG_TEXT_STARTS_AT_TOOLTIP = '求子串在文本中的起始位置,\n' + '其中1表示文本的起始處,\n ' + '而如子串不在文本中則返回0。'; Blockly.Msg.LANG_TEXT_CONTAINS_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/text#contains'; Blockly.Msg.LANG_TEXT_CONTAINS_INPUT_CONTAINS = '包含子串'; Blockly.Msg.LANG_TEXT_CONTAINS_INPUT_TEXT = '文本'; Blockly.Msg.LANG_TEXT_CONTAINS_INPUT_PIECE = '子串'; Blockly.Msg.LANG_TEXT_CONTAINS_INPUT = '檢查文本%1中是否包含子串%2'; Blockly.Msg.LANG_TEXT_CONTAINS_TOOLTIP = '檢查文本中是否包含該子串'; Blockly.Msg.LANG_TEXT_SPLIT_HELPURL = ''; Blockly.Msg.LANG_TEXT_SPLIT_INPUT_TEXT = '文本'; Blockly.Msg.LANG_TEXT_SPLIT_INPUT_AT = '分隔符'; Blockly.Msg.LANG_TEXT_SPLIT_INPUT_AT_LIST = '分隔符 (列表)'; Blockly.Msg.LANG_TEXT_SPLIT_OPERATOR_SPLIT_AT_FIRST = '分解首項'; Blockly.Msg.LANG_TEXT_SPLIT_OPERATOR_SPLIT_AT_FIRST_OF_ANY = '分解任意首項'; Blockly.Msg.LANG_TEXT_SPLIT_OPERATOR_SPLIT = '分解'; Blockly.Msg.LANG_TEXT_SPLIT_OPERATOR_SPLIT_AT_ANY = '任意分解'; Blockly.Msg.LANG_TEXT_SPLIT_TOOLTIP_SPLIT_AT_FIRST = '在首次出現分隔符的位置將給定文本分解為兩部分,\n' + '並返回包含分隔點前和分隔點後兩部分內容的列表,\n' + '如分解字符串"蘋果,香蕉,櫻桃,狗糧",以逗號作為分隔符,\n' + '將返回壹個包含兩項的列表,其中第壹項內容為"蘋果",第二項內容則為\n' + '"香蕉,櫻桃,狗糧"。\n' + '註意,"蘋果"後面的逗號不在結果中出現,\n' + '因為它起到分隔符的作用。'; Blockly.Msg.LANG_TEXT_SPLIT_HELPURL_SPLIT_AT_FIRST = 'http://appinventor.mit.edu/explore/ai2/support/blocks/text#splitat'; Blockly.Msg.LANG_TEXT_SPLIT_TOOLTIP_SPLIT_AT_FIRST_OF_ANY = '以列表中的任意項作為分隔符,\n' + '在首次出現分隔符的位置將給定文本分解為壹個兩項列表。\n\n' + '如以"(稥,蘋)"作為分隔符分解"我喜歡蘋果香蕉蘋果葡萄",\n' + '將返回壹個兩項列表,其第壹項為"我喜歡",第二項為\n' + '"果香蕉蘋果葡萄"'; Blockly.Msg.LANG_TEXT_SPLIT_HELPURL_SPLIT_AT_FIRST_OF_ANY = 'http://appinventor.mit.edu/explore/ai2/support/blocks/text#splitatfirstofany'; Blockly.Msg.LANG_TEXT_SPLIT_TOOLTIP_SPLIT = '以指定文本作為分隔符,將字符串分解為不同片段,並生成壹個列表作為返回結果。\n' + ' 如以","(逗號)分解"壹,二,三,四",將返回列表"(壹 二 三 四)",\n' + ' 而以"-土豆"作為分隔符分解字符串"壹-土豆,二-土豆,三-土豆,四",則返回列表"(壹 二 三 四)"。' Blockly.Msg.LANG_TEXT_SPLIT_HELPURL_SPLIT = 'http://appinventor.mit.edu/explore/ai2/support/blocks/text#split'; Blockly.Msg.LANG_TEXT_SPLIT_TOOLTIP_SPLIT_AT_ANY = '以分隔符列表中的任意壹項作為分隔符,將給定文本分解為列表,\n' + '並將列表作為處理結果返回。\n' + '如分解字符串"藍莓,香蕉,草莓,狗糧",以壹個含兩元素的列表作為分隔符,\n' + '其中第壹項為逗號,第二項為"莓",則返回列表:\n' + '"(藍 香蕉 草 狗糧)"' Blockly.Msg.LANG_TEXT_SPLIT_HELPURL_SPLIT_AT_ANY = 'http://appinventor.mit.edu/explore/ai2/support/blocks/text#splitatany'; /*.LANG_TEXT_PRINT_HELPURL = 'http://www.liv.ac.uk/HPC/HTMLF90Course/HTMLF90CourseNotesnode91.html'; Blockly.Msg.LANG_TEXT_PRINT_TITLE_PRINT = 'print'; Blockly.Msg.LANG_TEXT_PRINT_TOOLTIP = 'Print the specified text, number or other value.'; /*Blockly.Msg.LANG_TEXT_PROMPT_HELPURL = 'http://www.liv.ac.uk/HPC/HTMLF90Course/HTMLF90CourseNotesnode92.html'; Blockly.Msg.LANG_TEXT_PROMPT_TITLE_PROMPT_FOR = 'prompt for'; Blockly.Msg.LANG_TEXT_PROMPT_TITILE_WITH_MESSAGE = 'with message'; Blockly.Msg.LANG_TEXT_PROMPT_TOOLTIP = 'Prompt for user input with the specified text.'; Blockly.Msg.LANG_TEXT_PROMPT_TYPE_TEXT = 'text'; Blockly.Msg.LANG_TEXT_PROMPT_TYPE_NUMBER = 'number';*/ Blockly.Msg.LANG_TEXT_SPLIT_AT_SPACES_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/text#splitspaces'; Blockly.Msg.LANG_TEXT_SPLIT_AT_SPACES_TITLE = '用空格分解'; Blockly.Msg.LANG_TEXT_SPLIT_AT_TOOLTIP = '以空格作為分隔符,將文本分解為若幹部分。'; Blockly.Msg.LANG_TEXT_SEGMENT_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/text#segment'; Blockly.Msg.LANG_TEXT_SEGMENT_TITLE_SEGMENT = '提取子串'; Blockly.Msg.LANG_TEXT_SEGMENT_INPUT_START = '提取位置'; Blockly.Msg.LANG_TEXT_SEGMENT_INPUT_LENGTH = '提取長度'; Blockly.Msg.LANG_TEXT_SEGMENT_INPUT_TEXT = '文本'; Blockly.Msg.LANG_TEXT_SEGMENT_INPUT = '從文本%1第%2位置提取長度為%3的子串'; Blockly.Msg.LANG_TEXT_SEGMENT_AT_TOOLTIP = '以指定長度、指定位置從指定文本中提取文本片段,\n' + '位置1表示被提取文本的起始處。'; Blockly.Msg.LANG_TEXT_REPLACE_ALL_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/text#replaceall'; Blockly.Msg.LANG_TEXT_REPLACE_ALL_INPUT_SEGMENT = '替換項'; Blockly.Msg.LANG_TEXT_REPLACE_ALL_INPUT_TEXT = '原始文本'; Blockly.Msg.LANG_TEXT_REPLACE_ALL_TITLE_REPLACE_ALL = '全部替換'; Blockly.Msg.LANG_TEXT_REPLACE_ALL_INPUT_REPLACEMENT = '替換為'; Blockly.Msg.LANG_TEXT_REPLACE_ALL_INPUT = '將文本%2中所有%1全部替換為%3'; Blockly.Msg.LANG_TEXT_REPLACE_ALL_TOOLTIP = '返回壹個新文本字符串,其中所包含的替換項內容\n' + '均被替換為指定的字串。'; Blockly.Msg.LANG_CATEGORY_LISTS = '列表 '; Blockly.Msg.LANG_LISTS_CREATE_EMPTY_HELPURL = 'http://en.wikipedia.org/wiki/Linked_list#Empty _lists'; Blockly.Msg.LANG_LISTS_CREATE_EMPTY_TITLE = '創建空列表 '; Blockly.Msg.LANG_LISTS_CREATE_EMPTY_TOOLTIP = '返回壹個項數為零的列表對象'; Blockly.Msg.LANG_LISTS_CREATE_WITH_EMPTY_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/lists#makealist'; Blockly.Msg.LANG_LISTS_CREATE_WITH_TITLE_MAKE_LIST = '創建列表'; Blockly.Msg.LANG_LISTS_CREATE_WITH_TOOLTIP = '創建壹個可包含任意項數的列表'; Blockly.Msg.LANG_LISTS_CREATE_WITH_CONTAINER_TITLE_ADD = '列表'; Blockly.Msg.LANG_LISTS_CREATE_WITH_CONTAINER_TOOLTIP = '重新配置該列表塊,為其增加、刪除或重新排列所包含的區間。'; Blockly.Msg.LANG_LISTS_CREATE_WITH_ITEM_TITLE = '列表項'; Blockly.Msg.LANG_LISTS_CREATE_WITH_ITEM_TOOLTIP = '增加壹個列表項'; Blockly.Msg.LANG_LISTS_ADD_ITEM_TITLE = '列表項'; Blockly.Msg.LANG_LISTS_ADD_ITEM_TOOLTIP = '增加壹個列表項'; Blockly.Msg.LANG_LISTS_ADD_ITEM_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/lists#additems'; Blockly.Msg.LANG_LISTS_SELECT_ITEM_TITLE_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/lists#selectlistitem'; Blockly.Msg.LANG_LISTS_SELECT_ITEM_TITLE_SELECT = '選擇列表項'; Blockly.Msg.LANG_LISTS_SELECT_ITEM_INPUT_LIST = '列表'; Blockly.Msg.LANG_LISTS_SELECT_ITEM_INPUT_INDEX = '索引值'; Blockly.Msg.LANG_LISTS_SELECT_ITEM_INPUT = '選擇列表%1中索引值為%2的列表項'; Blockly.Msg.LANG_LISTS_SELECT_ITEM_TOOLTIP = '求指定位置的列表項'; Blockly.Msg.LANG_LISTS_IS_IN_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/lists#inlist'; Blockly.Msg.LANG_LISTS_IS_IN_TITLE_IS_IN = '是否在列表中?'; Blockly.Msg.LANG_LISTS_IS_IN_INPUT_THING = '對象'; Blockly.Msg.LANG_LISTS_IS_IN_INPUT_LIST = '列表'; Blockly.Msg.LANG_LISTS_IS_IN_INPUT = '檢查查列表%2中是否含列表項%1' Blockly.Msg.LANG_LISTS_IS_IN_TOOLTIP = '如該對象為列表中某壹項則返回真值,' + '否則為假。'; Blockly.Msg.LANG_LISTS_POSITION_IN_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/lists#indexinlist'; Blockly.Msg.LANG_LISTS_POSITION_IN_TITLE_POSITION = '列表項索引值'; Blockly.Msg.LANG_LISTS_POSITION_IN_INPUT_THING = '對象'; Blockly.Msg.LANG_LISTS_POSITION_IN_INPUT_LIST = '列表'; Blockly.Msg.LANG_LISTS_POSITION_IN_INPUT = '求列表項%1在列表%2中的位置'; Blockly.Msg.LANG_LISTS_POSITION_IN_TOOLTIP = '求對象在該列表中的位置,' + '如不在該列表中,則返回0。'; Blockly.Msg.LANG_LISTS_PICK_RANDOM_ITEM_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/lists#pickrandomitem'; Blockly.Msg.LANG_LISTS_PICK_RANDOM_TITLE_PICK_RANDOM = '隨機選取列表項'; Blockly.Msg.LANG_LISTS_PICK_RANDOM_ITEM_INPUT_LIST = '列表'; Blockly.Msg.LANG_LISTS_PICK_RANDOM_TOOLTIP = '從列表中隨機選取壹項'; Blockly.Msg.LANG_LISTS_REPLACE_ITEM_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/lists#replace'; Blockly.Msg.LANG_LISTS_REPLACE_ITEM_TITLE_REPLACE = '替換列表項'; Blockly.Msg.LANG_LISTS_REPLACE_ITEM_INPUT_LIST = '列表'; Blockly.Msg.LANG_LISTS_REPLACE_ITEM_INPUT_INDEX = '索引值'; Blockly.Msg.LANG_LISTS_REPLACE_ITEM_INPUT_REPLACEMENT = '替換為'; Blockly.Msg.LANG_LISTS_REPLACE_ITEM_INPUT = '將列表%1中索引值為%2的列表項替換為%3'; Blockly.Msg.LANG_LISTS_REPLACE_ITEM_TOOLTIP = '替換列表中第n項內容'; Blockly.Msg.LANG_LISTS_REMOVE_ITEM_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/lists#removeitem'; Blockly.Msg.LANG_LISTS_REMOVE_ITEM_TITLE_REMOVE = '刪除列表項'; Blockly.Msg.LANG_LISTS_REMOVE_ITEM_INPUT_LIST = '列表'; Blockly.Msg.LANG_LISTS_REMOVE_ITEM_INPUT_INDEX = '索引值'; Blockly.Msg.LANG_LISTS_REMOVE_ITEM_INPUT = '刪除列表%1中第%2項'; Blockly.Msg.LANG_LISTS_REMOVE_ITEM_TOOLTIP = '刪除指定位置的列表項'; /*Blockly.Msg.LANG_LISTS_REPEAT_HELPURL = 'http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Farsubex.htm'; Blockly.Msg.LANG_LISTS_REPEAT_TITLE_CREATE = '列表 ' 創建與項目 '; Blockly.Msg.LANG_LISTS_REPEAT_INPUT_REPEATED = '重復'; Blockly.Msg.LANG_LISTS_REPEAT_INPUT_TIMES = '時代'; Blockly.Msg.LANG_LISTS_REPEAT_TOOLTIP = '創建壹個列表組成的給定 value\n' + '重復指定的次數的';*/ Blockly.Msg.LANG_LISTS_LENGTH_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/lists#lengthoflist'; Blockly.Msg.LANG_LISTS_LENGTH_INPUT_LENGTH = '求列表長度 '; Blockly.Msg.LANG_LISTS_LENGTH_INPUT_LIST = '列表'; Blockly.Msg.LANG_LISTS_LENGTH_INPUT = '計算列表%1長度'; Blockly.Msg.LANG_LISTS_LENGTH_TOOLTIP = '計算列表項數'; Blockly.Msg.LANG_LISTS_APPEND_LIST_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/lists#append'; Blockly.Msg.LANG_LISTS_APPEND_LIST_TITLE_APPEND = '追加列表'; Blockly.Msg.LANG_LISTS_APPEND_LIST_INPUT_LIST1 = '列表1'; Blockly.Msg.LANG_LISTS_APPEND_LIST_INPUT_LIST2 = '列表2'; Blockly.Msg.LANG_LISTS_APPEND_LIST_INPUT = '將列表%2中所有項追加到列表%1中'; Blockly.Msg.LANG_LISTS_APPEND_LIST_TOOLTIP = '將list2中所有項添加到list1的末尾。添加後,' + 'list1中將包括所有新加入的元素,而list2則不發生變化。'; Blockly.Msg.LANG_LISTS_ADD_ITEMS_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/lists#additems'; Blockly.Msg.LANG_LISTS_ADD_ITEMS_TITLE_ADD = '添加列表項'; Blockly.Msg.LANG_LISTS_ADD_ITEMS_INPUT_LIST = '列表'; Blockly.Msg.LANG_LISTS_ADD_ITEMS_INPUT_ITEM = '列表項'; Blockly.Msg.LANG_LISTS_ADD_ITEMS_INPUT = '將列表項%2加入列表%1中'; Blockly.Msg.LANG_LISTS_ADD_ITEMS_TOOLTIP = '在列表末尾增加列表項'; Blockly.Msg.LANG_LISTS_ADD_ITEMS_CONTAINER_TITLE_ADD = '列表'; Blockly.Msg.LANG_LISTS_ADD_ITEMS_CONTAINER_TOOLTIP = '重新配置該列表塊,增加、刪除或重新排序其中包含的區間'; Blockly.Msg.LANG_LISTS_COPY_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/lists#copy'; Blockly.Msg.LANG_LISTS_COPY_TITLE_COPY = '復制列表'; Blockly.Msg.LANG_LISTS_COPY_INPUT_LIST = '列表'; Blockly.Msg.LANG_LISTS_COPY_TOOLTIP = '復制列表,包括復制其中包含的所有子列表'; Blockly.Msg.LANG_LISTS_IS_LIST_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/lists#isalist'; Blockly.Msg.LANG_LISTS_IS_LIST_TITLE_IS_LIST = '是否為列表?'; Blockly.Msg.LANG_LISTS_IS_LIST_INPUT_THING = '對象'; Blockly.Msg.LANG_LISTS_IS_LIST_TOOLTIP = '檢測該對象是否為列表類型'; Blockly.Msg.LANG_LISTS_TO_CSV_ROW_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/lists#listtocsvrow'; Blockly.Msg.LANG_LISTS_TO_CSV_ROW_TITLE_TO_CSV = '列表轉CSV行'; Blockly.Msg.LANG_LISTS_TO_CSV_ROW_INPUT_LIST = '列表'; Blockly.Msg.LANG_LISTS_TO_CSV_ROW_TOOLTIP = '將列表轉換為表格中的壹行數據,' + '並返回表示行數據的CSV(逗號分隔數值)字符串,數據行中的每壹項被當作壹個字段,' + '在CSV字符串中以雙引號方式標識,' + '各數據項以逗號分隔,且每行末尾' + '均不帶換行符。'; Blockly.Msg.LANG_LISTS_FROM_CSV_ROW_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/lists#listfromcsvrow'; Blockly.Msg.LANG_LISTS_FROM_CSV_ROW_TITLE_FROM_CSV = 'CSV行轉列表'; Blockly.Msg.LANG_LISTS_FROM_CSV_ROW_INPUT_TEXT = 'CSV字符串'; Blockly.Msg.LANG_LISTS_FROM_CSV_ROW_TOOLTIP = '對CSV(逗號分隔數值)格式字符串進行解析,' + '生成壹個包含各字段數據的列表。對於文本行而言,如字段中出現非轉義的換行符則會出錯' + '(實際是指多行字段的情況),而只在整行文本的末端才出現換行符或CRLF則是正確的。'; Blockly.Msg.LANG_LISTS_TO_CSV_TABLE_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/lists#listtocsvtable'; Blockly.Msg.LANG_LISTS_TO_CSV_TABLE_TITLE_TO_CSV = '列表轉CSV'; Blockly.Msg.LANG_LISTS_TO_CSV_TABLE_INPUT_LIST = '列表'; Blockly.Msg.LANG_LISTS_TO_CSV_TABLE_TOOLTIP = '將列表轉換為帶標題行的表格形式,' + '且返回表示該表格的CSV(逗號分隔數值)字符串文本,列表中的每壹項本身' + '還可以作為表示CSV表格行的列表,列表行中的每壹項' + '都可看成是壹個字段,在CSV字符串文本中以雙引號方式進行標識。' + '在返回字符串文本中,數據行中的各項以逗號進行分隔,' + '而各數據行則以CRLF \(\\r\\n\)進行分隔。'; Blockly.Msg.LANG_LISTS_FROM_CSV_TABLE_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/lists#listfromcsvtable'; Blockly.Msg.LANG_LISTS_FROM_CSV_TABLE_TITLE_FROM_CSV = 'CSV轉列表'; Blockly.Msg.LANG_LISTS_FROM_CSV_TABLE_INPUT_TEXT = 'CSV字符串'; Blockly.Msg.LANG_LISTS_FROM_CSV_TABLE_TOOLTIP = '對CSV(逗號分隔數值)格式字符串進行解析,' + '並生成數據行列表,其中的每壹項又都是壹個字段列表,' + '各數據行間分別以換行符\(\\n\)或CRLF \(\\r\\n\)方式分隔。'; Blockly.Msg.LANG_LISTS_INSERT_ITEM_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/lists#insert'; Blockly.Msg.LANG_LISTS_INSERT_TITLE_INSERT_LIST = '插入列表項'; Blockly.Msg.LANG_LISTS_INSERT_INPUT_LIST = '列表'; Blockly.Msg.LANG_LISTS_INSERT_INPUT_INDEX = '插入位置'; Blockly.Msg.LANG_LISTS_INSERT_INPUT_ITEM = '插入項'; Blockly.Msg.LANG_LISTS_INSERT_INPUT = '在列表%1的第%2項處插入列表項%3'; Blockly.Msg.LANG_LISTS_INSERT_TOOLTIP = '在指定位置插入列表項'; Blockly.Msg.LANG_LISTS_IS_EMPTY_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/lists#islistempty'; Blockly.Msg.LANG_LISTS_TITLE_IS_EMPTY = '列表是否為空?'; Blockly.Msg.LANG_LISTS_INPUT_LIST = '列表'; Blockly.Msg.LANG_LISTS_IS_EMPTY_TOOLTIP = '如果列表為空則返回真'; Blockly.Msg.LANG_LISTS_LOOKUP_IN_PAIRS_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/lists#lookuppairs'; Blockly.Msg.LANG_LISTS_LOOKUP_IN_PAIRS_TITLE_LOOKUP_IN_PAIRS = '鍵值對查詢'; Blockly.Msg.LANG_LISTS_LOOKUP_IN_PAIRS_INPUT_KEY = '關鍵字'; Blockly.Msg.LANG_LISTS_LOOKUP_IN_PAIRS_INPUT_PAIRS = '鍵值對'; Blockly.Msg.LANG_LISTS_LOOKUP_IN_PAIRS_INPUT_NOT_FOUND = '無果則返回'; Blockly.Msg.LANG_LISTS_LOOKUP_IN_PAIRS_INPUT = '在鍵值對%2中查找關鍵字%1 如未找到則返回%3'; Blockly.Msg.LANG_LISTS_LOOKUP_IN_PAIRS_TOOLTIP = '返回鍵值對列表中與關鍵字關聯的數值'; /*Blockly.Msg.LANG_LISTS_INDEX_OF_HELPURL = 'http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Farsubex.htm'; Blockly.Msg.LANG_LISTS_INDEX_OF_TITLE_FIND = '找到'; Blockly.Msg.LANG_LISTS_INDEX_OF_INPUT_OCCURRENCE = '的項目發生'; Blockly.Msg.LANG_LISTS_INDEX_OF_INPUT_IN_LIST = '在列表中 '; Blockly.Msg.LANG_LISTS_INDEX_OF_TOOLTIP = '返回的索引的第壹個/最後壹個 occurrence\n' + '的項目這個列表 \n' + '返回 0,如果找不到文本。'; Blockly.Msg.LANG_LISTS_INDEX_OF_FIRST = '第壹'; Blockly.Msg.LANG_LISTS_INDEX_OF_LAST = '最後'; Blockly.Msg.LANG_LISTS_GET_INDEX_HELPURL = 'http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Farsubex.htm'; Blockly.Msg.LANG_LISTS_GET_INDEX_TITLE_GET = 'get item at'; Blockly.Msg.LANG_LISTS_GET_INDEX_INPUT_IN_LIST = 'in list'; Blockly.Msg.LANG_LISTS_GET_INDEX_TOOLTIP = 'Returns the value at the specified position in a list.'; Blockly.Msg.LANG_LISTS_SET_INDEX_HELPURL = 'http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Farsubex.htm'; Blockly.Msg.LANG_LISTS_SET_INDEX_INPUT_SET = 'set item at'; Blockly.Msg.LANG_LISTS_SET_INDEX_INPUT_IN_LIST = 'in list'; Blockly.Msg.LANG_LISTS_SET_INDEX_INPUT_TO = 'to'; Blockly.Msg.LANG_LISTS_SET_INDEX_TOOLTIP = 'Sets the value at the specified position in a list.'; */ // Variables Blocks. Blockly.Msg.LANG_VARIABLES_GLOBAL_DECLARATION_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/variables#global'; Blockly.Msg.LANG_VARIABLES_GLOBAL_DECLARATION_TITLE_INIT = '初始化全局變量'; Blockly.Msg.LANG_VARIABLES_GLOBAL_DECLARATION_NAME = '我的變量'; Blockly.Msg.LANG_VARIABLES_GLOBAL_DECLARATION_TO = '為'; Blockly.Msg.LANG_VARIABLES_GLOBAL_DECLARATION_COLLAPSED_TEXT = '全局變量'; Blockly.Msg.LANG_VARIABLES_GLOBAL_DECLARATION_TOOLTIP = '創建全局變量,並通過掛接的代碼塊賦值'; Blockly.Msg.LANG_VARIABLES_GET_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/variables#get'; Blockly.Msg.LANG_VARIABLES_GET_TITLE_GET = '求'; // Blockly.Msg.LANG_VARIABLES_GET_INPUT_ITEM = '項目'; Blockly.Msg.LANG_VARIABLES_GET_COLLAPSED_TEXT = '求變量值'; Blockly.Msg.LANG_VARIABLES_GET_TOOLTIP = '求變量值'; Blockly.Msg.LANG_VARIABLES_SET_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/variables#set'; Blockly.Msg.LANG_VARIABLES_SET_TITLE_SET = '設'; // Blockly.Msg.LANG_VARIABLES_SET_INPUT_ITEM = '項目'; Blockly.Msg.LANG_VARIABLES_SET_TITLE_TO = '為'; Blockly.Msg.LANG_VARIABLES_SET_COLLAPSED_TEXT = '設變量值'; Blockly.Msg.LANG_VARIABLES_SET_TOOLTIP = '設變量值等於輸入項'; Blockly.Msg.LANG_VARIABLES_VARIABLE = '變量'; Blockly.Msg.LANG_VARIABLES_LOCAL_DECLARATION_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/variables#do'; Blockly.Msg.LANG_VARIABLES_LOCAL_DECLARATION_TITLE_INIT = '初始化局部變量'; Blockly.Msg.LANG_VARIABLES_LOCAL_DECLARATION_DEFAULT_NAME = '我的變量'; Blockly.Msg.LANG_VARIABLES_LOCAL_DECLARATION_INPUT_TO = '為'; Blockly.Msg.LANG_VARIABLES_LOCAL_DECLARATION_IN_DO = '作用範圍'; Blockly.Msg.LANG_VARIABLES_LOCAL_DECLARATION_COLLAPSED_TEXT = '局部變量'; Blockly.Msg.LANG_VARIABLES_LOCAL_DECLARATION_TOOLTIP = '創建指定範圍內語句塊所使用的變量'; Blockly.Msg.LANG_VARIABLES_LOCAL_DECLARATION_TRANSLATED_NAME = '初始化局部變量'; Blockly.Msg.LANG_VARIABLES_LOCAL_DECLARATION_EXPRESSION_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/variables#return'; // 這些別不同之間的語句和表達式 Blockly.Msg.LANG_VARIABLES_LOCAL_DECLARATION_EXPRESSION_TITLE_INIT = '初始化表達式變量'; Blockly.Msg.LANG_VARIABLES_LOCAL_DECLARATION_EXPRESSION_INPUT_NAME = '我的變量'; Blockly.Msg.LANG_VARIABLES_LOCAL_DECLARATION_EXPRESSION_INPUT_TO = '為'; Blockly.Msg.LANG_VARIABLES_LOCAL_DECLARATION_EXPRESSION_IN_RETURN = '作用範圍'; Blockly.Msg.LANG_VARIABLES_LOCAL_DECLARATION_EXPRESSION_COLLAPSED_TEXT = '表達式變量'; Blockly.Msg.LANG_VARIABLES_LOCAL_DECLARATION_EXPRESSION_TOOLTIP = '創建指定表達式所使用的變量'; Blockly.Msg.LANG_VARIABLES_LOCAL_DECLARATION_EXPRESSION_TRANSLATED_NAME = '初始化表達式變量'; Blockly.Msg.LANG_VARIABLES_LOCAL_MUTATOR_CONTAINER_TITLE_LOCAL_NAMES = '輸入項'; Blockly.Msg.LANG_VARIABLES_LOCAL_MUTATOR_CONTAINER_TOOLTIP = ''; Blockly.Msg.LANG_VARIABLES_LOCAL_MUTATOR_ARG_TITLE_NAME = '參數'; Blockly.Msg.LANG_VARIABLES_LOCAL_MUTATOR_ARG_DEFAULT_VARIABLE = 'x'; // Procedures Blocks. Blockly.Msg.LANG_PROCEDURES_DEFNORETURN_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/procedures#do'; Blockly.Msg.LANG_PROCEDURES_DEFNORETURN_DEFINE = '定義過程'; Blockly.Msg.LANG_PROCEDURES_DEFNORETURN_PROCEDURE = '我的過程'; Blockly.Msg.LANG_PROCEDURES_DEFNORETURN_DO = '執行語句'; Blockly.Msg.LANG_PROCEDURES_DEFNORETURN_COLLAPSED_PREFIX = '定義過程'; Blockly.Msg.LANG_PROCEDURES_DEFNORETURN_TOOLTIP = '語句執行完成後,不返回結果'; Blockly.Msg.LANG_PROCEDURES_DOTHENRETURN_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/procedures#doreturn'; Blockly.Msg.LANG_PROCEDURES_DOTHENRETURN_THEN_RETURN = '然後返回'; Blockly.Msg.LANG_PROCEDURES_DOTHENRETURN_DO = '執行語句'; Blockly.Msg.LANG_PROCEDURES_DOTHENRETURN_RETURN = '返回'; Blockly.Msg.LANG_PROCEDURES_DOTHENRETURN_TOOLTIP = '“執行”其中包含的塊並返回壹條語句, 可以實現在過程執行前將返回數據賦值給相關變量'; Blockly.Msg.LANG_PROCEDURES_DOTHENRETURN_COLLAPSED_TEXT = '執行/返回'; Blockly.Msg.LANG_PROCEDURES_DEFRETURN_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/procedures#return'; Blockly.Msg.LANG_PROCEDURES_DEFRETURN_DEFINE = '定義過程'; Blockly.Msg.LANG_PROCEDURES_DEFRETURN_PROCEDURE = Blockly.Msg.LANG_PROCEDURES_DEFNORETURN_PROCEDURE; Blockly.Msg.LANG_PROCEDURES_DEFRETURN_DO = Blockly.Msg.LANG_PROCEDURES_DEFNORETURN_DO; Blockly.Msg.LANG_PROCEDURES_DEFRETURN_RETURN = '返回'; Blockly.Msg.LANG_PROCEDURES_DEFRETURN_COLLAPSED_PREFIX = '定義過程'; Blockly.Msg.LANG_PROCEDURES_DEFRETURN_TOOLTIP = '語句執行完成後,會返回結果'; Blockly.Msg.LANG_PROCEDURES_DEF_DUPLICATE_WARNING = '警告:\n' + '此過程的輸入項\n' + '出現重復'; Blockly.Msg.LANG_PROCEDURES_GET_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/procedures#get'; Blockly.Msg.LANG_PROCEDURES_CALLNORETURN_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/procedures#do'; Blockly.Msg.LANG_PROCEDURES_CALLNORETURN_CALL = '調用'; Blockly.Msg.LANG_PROCEDURES_CALLNORETURN_PROCEDURE = '過程'; Blockly.Msg.LANG_PROCEDURES_CALLNORETURN_COLLAPSED_PREFIX = '調用'; Blockly.Msg.LANG_PROCEDURES_CALLNORETURN_TOOLTIP = '調用無返回值過程'; Blockly.Msg.LANG_PROCEDURES_CALLNORETURN_TRANSLATED_NAME = '調用無返回值過程'; Blockly.Msg.LANG_PROCEDURES_CALLRETURN_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/procedures#return'; Blockly.Msg.LANG_PROCEDURES_CALLRETURN_CALL = Blockly.Msg.LANG_PROCEDURES_CALLNORETURN_CALL; Blockly.Msg.LANG_PROCEDURES_CALLRETURN_PROCEDURE = Blockly.Msg.LANG_PROCEDURES_CALLNORETURN_PROCEDURE; Blockly.Msg.LANG_PROCEDURES_CALLRETURN_COLLAPSED_PREFIX = '調用'; Blockly.Msg.LANG_PROCEDURES_CALLRETURN_TOOLTIP = '調用有返回值過程'; Blockly.Msg.LANG_PROCEDURES_CALLRETURN_TRANSLATED_NAME = '調用有返回值過程'; Blockly.Msg.LANG_PROCEDURES_MUTATORCONTAINER_TITLE = '輸入項'; Blockly.Msg.LANG_PROCEDURES_MUTATORARG_TITLE = '輸入:'; Blockly.Msg.LANG_PROCEDURES_HIGHLIGHT_DEF = '突出顯示過程'; Blockly.Msg.LANG_PROCEDURES_MUTATORCONTAINER_TOOLTIP = ''; Blockly.Msg.LANG_PROCEDURES_MUTATORARG_TOOLTIP = ''; // Components Blocks. Blockly.Msg.LANG_COMPONENT_BLOCK_HELPURL = ''; Blockly.Msg.LANG_COMPONENT_BLOCK_TITLE_WHEN = '當'; Blockly.Msg.LANG_COMPONENT_BLOCK_TITLE_DO = '執行'; Blockly.Msg.LANG_COMPONENT_BLOCK_METHOD_HELPURL = ''; Blockly.Msg.LANG_COMPONENT_BLOCK_METHOD_TITLE_CALL = '調用'; Blockly.Msg.LANG_COMPONENT_BLOCK_GENERIC_METHOD_HELPURL = ''; Blockly.Msg.LANG_COMPONENT_BLOCK_GENERIC_METHOD_TITLE_CALL = '調用'; Blockly.Msg.LANG_COMPONENT_BLOCK_GENERIC_METHOD_TITLE_FOR_COMPONENT = '組件'; Blockly.Msg.LANG_COMPONENT_BLOCK_GETTER_HELPURL = ''; Blockly.Msg.LANG_COMPONENT_BLOCK_GENERIC_GETTER_HELPURL = ''; Blockly.Msg.LANG_COMPONENT_BLOCK_GENERIC_GETTER_TITLE_OF_COMPONENT = '組件'; Blockly.Msg.LANG_COMPONENT_BLOCK_SETTER_HELPURL = ''; Blockly.Msg.LANG_COMPONENT_BLOCK_SETTER_TITLE_SET = '設'; Blockly.Msg.LANG_COMPONENT_BLOCK_SETTER_TITLE_TO = '為'; Blockly.Msg.LANG_COMPONENT_BLOCK_GENERIC_SETTER_HELPURL = ''; Blockly.Msg.LANG_COMPONENT_BLOCK_GENERIC_SETTER_TITLE_SET = '設'; Blockly.Msg.LANG_COMPONENT_BLOCK_GENERIC_SETTER_TITLE_TO = '為'; Blockly.Msg.LANG_COMPONENT_BLOCK_GENERIC_SETTER_TITLE_OF_COMPONENT = '組件'; /////////////////// /* HelpURLs for Component Blocks */ //User Interface Components Blockly.Msg.LANG_COMPONENT_BLOCK_BUTTON_HELPURL = '/reference/components/userinterface.html#Button'; Blockly.Msg.LANG_COMPONENT_BLOCK_BUTTON_PROPERTIES_HELPURL = '/reference/components/userinterface.html#buttonproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_BUTTON_EVENTS_HELPURL = '/reference/components/userinterface.html#buttonevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_CHECKBOX_HELPURL = '/reference/components/userinterface.html#CheckBox'; Blockly.Msg.LANG_COMPONENT_BLOCK_CHECKBOX_PROPERTIES_HELPURL = '/reference/components/userinterface.html#checkboxproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_CHECKBOX_EVENTS_HELPURL = '/reference/components/userinterface.html#checkboxevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_CLOCK_HELPURL = '/reference/components/userinterface.html#Clock'; Blockly.Msg.LANG_COMPONENT_BLOCK_CLOCK_PROPERTIES_HELPURL = '/reference/components/userinterface.html#clockproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_CLOCK_EVENTS_HELPURL = '/reference/components/userinterface.html#clockevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_CLOCK_METHODS_HELPURL = '/reference/components/userinterface.html#clockmethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_IMAGE_HELPURL = '/reference/components/userinterface.html#Image'; Blockly.Msg.LANG_COMPONENT_BLOCK_IMAGE_PROPERTIES_HELPURL = '/reference/components/userinterface.html#imageproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_IMAGE_EVENTS_HELPURL = '/reference/components/userinterface.html#imageevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_IMAGE_METHODS_HELPURL = '/reference/components/userinterface.html#imagemethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_LABEL_HELPURL = '/reference/components/userinterface.html#Label'; Blockly.Msg.LANG_COMPONENT_BLOCK_LABEL_PROPERTIES_HELPURL = '/reference/components/userinterface.html#labelproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_LABEL_EVENTS_HELPURL = '/reference/components/userinterface.html#labelevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_LABEL_METHODS_HELPURL = '/reference/components/userinterface.html#labelmethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_LISTPICKER_HELPURL = '/reference/components/userinterface.html#ListPicker'; Blockly.Msg.LANG_COMPONENT_BLOCK_LISTPICKER_PROPERTIES_HELPURL = '/reference/components/userinterface.html#listpickerproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_LISTPICKER_EVENTS_HELPURL = '/reference/components/userinterface.html#listpickerevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_LISTPICKER_METHODS_HELPURL = '/reference/components/userinterface.html#listpickermethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_NOTIFIER_HELPURL = '/reference/components/userinterface.html#Notifier'; Blockly.Msg.LANG_COMPONENT_BLOCK_NOTIFIER_PROPERTIES_HELPURL = '/reference/components/userinterface.html#notifierproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_NOTIFIER_EVENTS_HELPURL = '/reference/components/userinterface.html#notifierevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_NOTIFIER_METHODS_HELPURL = '/reference/components/userinterface.html#notifiermethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_PASSWORDTEXTBOX_HELPURL = '/reference/components/userinterface.html#PasswordTextBox'; Blockly.Msg.LANG_COMPONENT_BLOCK_PASSWORDTEXTBOX_PROPERTIES_HELPURL = '/reference/components/userinterface.html#pwdboxproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_PASSWORDTEXTBOX_EVENTS_HELPURL = '/reference/components/userinterface.html#pwdboxevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_PASSWORDTEXTBOX_METHODS_HELPURL = '/reference/components/userinterface.html#pwdboxmethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_SCREEN_HELPURL = '/reference/components/userinterface.html#Screen'; Blockly.Msg.LANG_COMPONENT_BLOCK_SCREEN_PROPERTIES_HELPURL = '/reference/components/userinterface.html#screenproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_SCREEN_EVENTS_HELPURL = '/reference/components/userinterface.html#screenevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_SCREEN_METHODS_HELPURL = '/reference/components/userinterface.html#screenmethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_SLIDER_HELPURL = '/reference/components/userinterface.html#Slider'; Blockly.Msg.LANG_COMPONENT_BLOCK_SLIDER_PROPERTIES_HELPURL = '/reference/components/userinterface.html#sliderproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_SLIDER_EVENTS_HELPURL = '/reference/components/userinterface.html#sliderevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_SLIDER_METHODS_HELPURL = '/reference/components/userinterface.html#slidermethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_TEXTBOX_HELPURL = '/reference/components/userinterface.html#TextBox'; Blockly.Msg.LANG_COMPONENT_BLOCK_TEXTBOX_PROPERTIES_HELPURL = '/reference/components/userinterface.html#textboxproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_TEXTBOX_EVENTS_HELPURL = '/reference/components/userinterface.html#textboxevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_TEXTBOX_METHODS_HELPURL = '/reference/components/userinterface.html#textboxmethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_WEBVIEWER_HELPURL = '/reference/components/userinterface.html#WebViewer'; Blockly.Msg.LANG_COMPONENT_BLOCK_WEBVIEWER_PROPERTIES_HELPURL = '/reference/components/userinterface.html#webviewerproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_WEBVIEWER_EVENTS_HELPURL = '/reference/components/userinterface.html#webviewerevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_WEBVIEWER_METHODS_HELPURL = '/reference/components/userinterface.html#webviewermethods'; //Layout components Blockly.Msg.LANG_COMPONENT_BLOCK_HORIZARRANGE_HELPURL = '/reference/components/layout.html#HorizontalArrangement'; Blockly.Msg.LANG_COMPONENT_BLOCK_HORIZARRANGE_PROPERTIES_HELPURL = '/reference/components/layout.html#horizarrangeproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_VERTARRANGE_HELPURL = '/reference/components/layout.html#VerticalArrangement'; Blockly.Msg.LANG_COMPONENT_BLOCK_VERTARRANGE_PROPERTIES_HELPURL = '/reference/components/layout.html#vertarrangeproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_TABLEARRANGE_HELPURL = '/reference/components/layout.html#TableArrangement'; Blockly.Msg.LANG_COMPONENT_BLOCK_TABLEARRANGE_PROPERTIES_HELPURL = '/reference/components/layout.html#tablearrangeproperties'; //Media components Blockly.Msg.LANG_COMPONENT_BLOCK_CAMCORDER_HELPURL = '/reference/components/media.html#Camcorder'; Blockly.Msg.LANG_COMPONENT_BLOCK_CAMCORDER_PROPERTIES_HELPURL = '/reference/components/media.html#camcorderproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_CAMCORDER_EVENTS_HELPURL = '/reference/components/media.html#camcorderevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_CAMCORDER_METHODS_HELPURL = '/reference/components/media.html#camcordermethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_CAMERA_HELPURL = '/reference/components/media.html#Camera'; Blockly.Msg.LANG_COMPONENT_BLOCK_CAMERA_PROPERTIES_HELPURL = '/reference/components/media.html#cameraproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_CAMERA_EVENTS_HELPURL = '/reference/components/media.html#cameraevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_CAMERA_METHODS_HELPURL = '/reference/components/media.html#cameramethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_IMAGEPICKER_HELPURL = '/reference/components/media.html#ImagePicker'; Blockly.Msg.LANG_COMPONENT_BLOCK_IMAGEPICKER_PROPERTIES_HELPURL = '/reference/components/media.html#imagepickerproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_IMAGEPICKER_EVENTS_HELPURL = '/reference/components/media.html#imagepickerevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_IMAGEPICKER_METHODS_HELPURL = '/reference/components/media.html#imagepickermethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_PLAYER_HELPURL = '/reference/components/media.html#Player'; Blockly.Msg.LANG_COMPONENT_BLOCK_PLAYER_PROPERTIES_HELPURL = '/reference/components/media.html#playerproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_PLAYER_EVENTS_HELPURL = '/reference/components/media.html#playerevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_PLAYER_METHODS_HELPURL = '/reference/components/media.html#playermethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_SOUND_HELPURL = '/reference/components/media.html#Sound'; Blockly.Msg.LANG_COMPONENT_BLOCK_SOUND_PROPERTIES_HELPURL = '/reference/components/media.html#soundproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_SOUND_EVENTS_HELPURL = '/reference/components/media.html#soundevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_SOUND_METHODS_HELPURL = '/reference/components/media.html#soundmethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_SOUNDRECORDER_HELPURL = '/reference/components/media.html#SoundRecorder'; Blockly.Msg.LANG_COMPONENT_BLOCK_SOUNDRECORDER_PROPERTIES_HELPURL = '/reference/components/media.html#soundrecorderproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_SOUNDRECORDER_EVENTS_HELPURL = '/reference/components/media.html#soundrecorderevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_SOUNDRECORDER_METHODS_HELPURL = '/reference/components/media.html#soundrecordermethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_SPEECHRECOGNIZER_HELPURL = '/reference/components/media.html#SpeechRecognizer'; Blockly.Msg.LANG_COMPONENT_BLOCK_SPEECHRECOGNIZER_PROPERTIES_HELPURL = '/reference/components/media.html#speechrecognizerproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_SPEECHRECOGNIZER_EVENTS_HELPURL = '/reference/components/media.html#speechrecognizerevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_SPEECHRECOGNIZER_METHODS_HELPURL = '/reference/components/media.html#speechrecognizermethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_TEXTTOSPEECH_HELPURL = '/reference/components/media.html#TextToSpeech'; Blockly.Msg.LANG_COMPONENT_BLOCK_TEXTTOSPEECH_PROPERTIES_HELPURL = '/reference/components/media.html#texttospeechproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_TEXTTOSPEECH_EVENTS_HELPURL = '/reference/components/media.html#texttospeechevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_TEXTTOSPEECH_METHODS_HELPURL = '/reference/components/media.html#texttospeechmethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_VIDEOPLAYER_HELPURL = '/reference/components/media.html#VideoPlayer'; Blockly.Msg.LANG_COMPONENT_BLOCK_VIDEOPLAYER_PROPERTIES_HELPURL = '/reference/components/media.html#videoplayerproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_VIDEOPLAYER_EVENTS_HELPURL = '/reference/components/media.html#videoplayerevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_VIDEOPLAYER_METHODS_HELPURL = '/reference/components/media.html#videoplayermethods'; // Drawing and Animation components Blockly.Msg.LANG_COMPONENT_BLOCK_BALL_HELPURL = '/reference/components/animation.html#Ball'; Blockly.Msg.LANG_COMPONENT_BLOCK_BALL_PROPERTIES_HELPURL = '/reference/components/animation.html#ballproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_BALL_EVENTS_HELPURL = '/reference/components/animation.html#ballevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_BALL_METHODS_HELPURL = '/reference/components/animation.html#ballmethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_CANVAS_HELPURL = '/reference/components/animation.html#Canvas'; Blockly.Msg.LANG_COMPONENT_BLOCK_CANVAS_PROPERTIES_HELPURL = '/reference/components/animation.html#canvasproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_CANVAS_EVENTS_HELPURL = '/reference/components/animation.html#canvasevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_CANVAS_METHODS_HELPURL = '/reference/components/animation.html#canvasmethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_IMAGESPRITE_HELPURL = '/reference/components/animation.html#ImageSprite'; Blockly.Msg.LANG_COMPONENT_BLOCK_IMAGESPRITE_PROPERTIES_HELPURL = '/reference/components/animation.html#imagespriteproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_IMAGESPRITE_EVENTS_HELPURL = '/reference/components/animation.html#imagespriteevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_IMAGESPRITE_METHODS_HELPURL = '/reference/components/animation.html#imagespritemethods'; //Sensor components Blockly.Msg.LANG_COMPONENT_BLOCK_ACCELEROMETERSENSOR_HELPURL = '/reference/components/sensor.html#AccelerometerSensor'; Blockly.Msg.LANG_COMPONENT_BLOCK_ACCELEROMETERSENSOR_PROPERTIES_HELPURL = '/reference/components/sensor.html#accelerometersensorproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_ACCELEROMETERSENSOR_EVENTS_HELPURL = '/reference/components/sensor.html#accelerometersensorevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_ACCELEROMETERSENSOR_METHODS_HELPURL = '/reference/components/sensor.html#accelerometersensormethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_BARCODESCANNER_HELPURL = '/reference/components/sensor.html#BarcodeScanner'; Blockly.Msg.LANG_COMPONENT_BLOCK_BARCODESCANNER_PROPERTIES_HELPURL = '/reference/components/sensor.html#barcodescannerproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_BARCODESCANNER_EVENTS_HELPURL = '/reference/components/sensor.html#barcodescannerevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_BARCODESCANNER_METHODS_HELPURL = '/reference/components/sensor.html#barcodescannermethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_LOCATIONSENSOR_HELPURL = '/reference/components/sensor.html#LocationSensor'; Blockly.Msg.LANG_COMPONENT_BLOCK_LOCATIONSENSOR_PROPERTIES_HELPURL = '/reference/components/sensor.html#locationsensorproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_LOCATIONSENSOR_EVENTS_HELPURL = '/reference/components/sensor.html#locationsensorevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_LOCATIONSENSOR_METHODS_HELPURL = '/reference/components/sensor.html#locationsensormethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_ORIENTATIONSENSOR_HELPURL = '/reference/components/sensor.html#OrientationSensor'; Blockly.Msg.LANG_COMPONENT_BLOCK_ORIENTATIONSENSOR_PROPERTIES_HELPURL = '/reference/components/sensor.html#orientationsensorproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_ORIENTATIONSENSOR_EVENTS_HELPURL = '/reference/components/sensor.html#orientationsensorevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_ORIENTATIONSENSOR_METHODS_HELPURL = '/reference/components/sensor.html#orientationsensormethods'; //Social components Blockly.Msg.LANG_COMPONENT_BLOCK_CONTACTPICKER_HELPURL = '/reference/components/social.html#ContactPicker'; Blockly.Msg.LANG_COMPONENT_BLOCK_CONTACTPICKER_PROPERTIES_HELPURL = '/reference/components/social.html#contactpickerproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_CONTACTPICKER_EVENTS_HELPURL = '/reference/components/social.html#contactpickerevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_CONTACTPICKER_METHODS_HELPURL = '/reference/components/social.html#contactpickermethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_EMAILPICKER_HELPURL = '/reference/components/social.html#EmailPicker'; Blockly.Msg.LANG_COMPONENT_BLOCK_EMAILPICKER_PROPERTIES_HELPURL = '/reference/components/social.html#emailpickerproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_EMAILPICKER_EVENTS_HELPURL = '/reference/components/social.html#emailpickerevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_EMAILPICKER_METHODS_HELPURL = '/reference/components/social.html#emailpickermethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_PHONECALL_HELPURL = '/reference/components/social.html#PhoneCall'; Blockly.Msg.LANG_COMPONENT_BLOCK_PHONECALL_PROPERTIES_HELPURL = '/reference/components/social.html#phonecallproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_PHONECALL_EVENTS_HELPURL = '/reference/components/social.html#phonecallevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_PHONECALL_METHODS_HELPURL = '/reference/components/social.html#phonecallmethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_PHONENUMBERPICKER_HELPURL = '/reference/components/social.html#PhoneNumberPicker'; Blockly.Msg.LANG_COMPONENT_BLOCK_PHONENUMBERPICKER_PROPERTIES_HELPURL = '/reference/components/social.html#phonenumberpickerproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_PHONENUMBERPICKER_EVENTS_HELPURL = '/reference/components/social.html#phonenumberpickerevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_PHONENUMBERPICKER_METHODS_HELPURL = '/reference/components/social.html#phonenumberpickermethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_TEXTING_HELPURL = '/reference/components/social.html#Texting'; Blockly.Msg.LANG_COMPONENT_BLOCK_TEXTING_PROPERTIES_HELPURL = '/reference/components/social.html#textingproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_TEXTING_EVENTS_HELPURL = '/reference/components/social.html#textingevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_TEXTING_METHODS_HELPURL = '/reference/components/social.html#textingmethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_TWITTER_HELPURL = '/reference/components/social.html#Twitter'; Blockly.Msg.LANG_COMPONENT_BLOCK_TWITTER_PROPERTIES_HELPURL = '/reference/components/social.html#twitterproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_TWITTER_EVENTS_HELPURL = '/reference/components/social.html#twitterevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_TWITTER_METHODS_HELPURL = '/reference/components/social.html#twittermethods'; //Storage Components Blockly.Msg.LANG_COMPONENT_BLOCK_FUSIONTABLESCONTROL_HELPURL = '/reference/components/storage.html#FusiontablesControl'; Blockly.Msg.LANG_COMPONENT_BLOCK_FUSIONTABLESCONTROL_PROPERTIES_HELPURL = '/reference/components/storage.html#fusiontablescontrolproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_FUSIONTABLESCONTROL_EVENTS_HELPURL = '/reference/components/storage.html#fusiontablescontrolevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_FUSIONTABLESCONTROL_METHODS_HELPURL = '/reference/components/storage.html#fusiontablescontrolmethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_TINYDB_HELPURL = '/reference/components/storage.html#TinyDB'; Blockly.Msg.LANG_COMPONENT_BLOCK_TINYDB_PROPERTIES_HELPURL = '/reference/components/storage.html#tinydbproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_TINYDB_EVENTS_HELPURL = '/reference/components/storage.html#tinydbevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_TINYDB_METHODS_HELPURL = '/reference/components/storage.html#tinydbmethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_TINYWEBDB_HELPURL = '/reference/components/storage.html#TinyWebDB'; Blockly.Msg.LANG_COMPONENT_BLOCK_TINYWEBDB_PROPERTIES_HELPURL = '/reference/components/storage.html#tinywebdbproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_TINYWEBDB_EVENTS_HELPURL = '/reference/components/storage.html#tinywebdbevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_TINYWEBDB_METHODS_HELPURL = '/reference/components/storage.html#tinywebdbmethods'; //Connectivity components Blockly.Msg.LANG_COMPONENT_BLOCK_ACTIVITYSTARTER_HELPURL = '/reference/components/connectivity.html#ActivityStarter'; Blockly.Msg.LANG_COMPONENT_BLOCK_ACTIVITYSTARTER_PROPERTIES_HELPURL = '/reference/components/connectivity.html#activitystarterproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_ACTIVITYSTARTER_EVENTS_HELPURL = '/reference/components/connectivity.html#activitystarterevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_ACTIVITYSTARTER_METHODS_HELPURL = '/reference/components/connectivity.html#activitystartermethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_BLUETOOTHCLIENT_HELPURL = '/reference/components/connectivity.html#BluetoothClient'; Blockly.Msg.LANG_COMPONENT_BLOCK_BLUETOOTHCLIENT_PROPERTIES_HELPURL = '/reference/components/connectivity.html#bluetoothclientproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_BLUETOOTHCLIENT_EVENTS_HELPURL = '/reference/components/connectivity.html#bluetoothclientevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_BLUETOOTHCLIENT_METHODS_HELPURL = '/reference/components/connectivity.html#bluetoothclientmethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_BLUETOOTHSERVER_HELPURL = '/reference/components/connectivity.html#BluetoothServer'; Blockly.Msg.LANG_COMPONENT_BLOCK_BLUETOOTHSERVER_PROPERTIES_HELPURL = '/reference/components/connectivity.html#bluetoothserverproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_BLUETOOTHSERVER_EVENTS_HELPURL = '/reference/components/connectivity.html#bluetoothserverevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_BLUETOOTHSERVER_METHODS_HELPURL = '/reference/components/connectivity.html#bluetoothservermethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_WEB_HELPURL = '/reference/components/connectivity.html#Web'; Blockly.Msg.LANG_COMPONENT_BLOCK_WEB_PROPERTIES_HELPURL = '/reference/components/connectivity.html#webproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_WEB_EVENTS_HELPURL = '/reference/components/connectivity.html#webevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_WEB_METHODS_HELPURL = '/reference/components/connectivity.html#webmethods'; //Lego mindstorms components Blockly.Msg.LANG_COMPONENT_BLOCK_NXTDIRECT_HELPURL = '/reference/components/legomindstorms.html#NxtDirectCommands'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTDIRECT_PROPERTIES_HELPURL = '/reference/components/legomindstorms.html#nxtdirectproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTDIRECT_METHODS_HELPURL = '/reference/components/legomindstorms.html#nxtdirectmethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTCOLOR_HELPURL = '/reference/components/legomindstorms.html#NxtColorSensor'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTCOLOR_PROPERTIES_HELPURL = '/reference/components/legomindstorms.html#nxtcolorproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTCOLOR_EVENTS_HELPURL = '/reference/components/legomindstorms.html#nxtcolorevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTCOLOR_METHODS_HELPURL = '/reference/components/legomindstorms.html#nxtcolormethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTLIGHT_HELPURL = '/reference/components/legomindstorms.html#NxtLightSensor'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTLIGHT_PROPERTIES_HELPURL = '/reference/components/legomindstorms.html#nxtlightproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTLIGHT_EVENTS_HELPURL = '/reference/components/legomindstorms.html#nxtlightevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTLIGHT_METHODS_HELPURL = '/reference/components/legomindstorms.html#nxtlightmethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTSOUND_HELPURL = '/reference/components/legomindstorms.html#NxtSoundSensor'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTSOUND_PROPERTIES_HELPURL = '/reference/components/legomindstorms.html#nxtsoundproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTSOUND_EVENTS_HELPURL = '/reference/components/legomindstorms.html#nxtsoundevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTSOUND_METHODS_HELPURL = '/reference/components/legomindstorms.html#nxtsoundmethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTTOUCH_HELPURL = '/reference/components/legomindstorms.html#NxtTouchSensor'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTTOUCH_PROPERTIES_HELPURL = '/reference/components/legomindstorms.html#nxttouchproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTTOUCH_EVENTS_HELPURL = '/reference/components/legomindstorms.html#nxttouchevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTTOUCH_METHODS_HELPURL = '/reference/components/legomindstorms.html#nxttouchmethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTULTRASONIC_HELPURL = '/reference/components/legomindstorms.html#NxtUltrasonicSensor'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTULTRASONIC_PROPERTIES_HELPURL = '/reference/components/legomindstorms.html#nxtultrasonicproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTULTRASONIC_EVENTS_HELPURL = '/reference/components/legomindstorms.html#nxtultrasonicevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTULTRASONIC_METHODS_HELPURL = '/reference/components/legomindstorms.html#nxtultrasonicmethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTDRIVE_HELPURL = '/reference/components/legomindstorms.html#NxtDrive'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTDRIVE_PROPERTIES_HELPURL = '/reference/components/legomindstorms.html#nxtdriveproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_NXTDRIVE_METHODS_HELPURL = '/reference/components/legomindstorms.html#nxtdrivemethods'; //Internal components Blockly.Msg.LANG_COMPONENT_BLOCK_GAMECLIENT_HELPURL = '/reference/components/internal.html#GameClient'; Blockly.Msg.LANG_COMPONENT_BLOCK_GAMECLIENT_PROPERTIES_HELPURL = '/reference/components/internal.html#gameclientproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_GAMECLIENT_EVENTS_HELPURL = '/reference/components/internal.html#gameclientevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_GAMECLIENT_METHODS_HELPURL = '/reference/components/internal.html#gameclientmethods'; Blockly.Msg.LANG_COMPONENT_BLOCK_VOTING_HELPURL = '/reference/components/internal.html#Voting'; Blockly.Msg.LANG_COMPONENT_BLOCK_VOTING_PROPERTIES_HELPURL = '/reference/components/internal.html#votingproperties'; Blockly.Msg.LANG_COMPONENT_BLOCK_VOTING_EVENTS_HELPURL = '/reference/components/internal.html#votingevents'; Blockly.Msg.LANG_COMPONENT_BLOCK_VOTING_METHODS_HELPURL = '/reference/components/internal.html#votingmethods'; //Misc Blockly.Msg.SHOW_WARNINGS = "顯示警告"; Blockly.Msg.HIDE_WARNINGS = "隱藏警告"; Blockly.Msg.MISSING_SOCKETS_WARNINGS = "妳應該為模塊的每個端口都填上模塊"; Blockly.Msg.WRONG_TYPE_BLOCK_WARINGS = "這個模塊應該連上事件或者過程模塊"; //Replmgr.js messages Blockly.Msg.REPL_ERROR_FROM_COMPANION ="AI伴侶出現錯誤"; Blockly.Msg.REPL_NETWORK_CONNECTION_ERROR ="發生網絡連接故障"; Blockly.Msg.REPL_NETWORK_ERROR ="網絡故障"; Blockly.Msg.REPL_NETWORK_ERROR_RESTART ="與AI伴侶通信故障,<br />請嘗試重啟伴侶程序並重新連接"; Blockly.Msg.REPL_OK ="確定"; Blockly.Msg.REPL_COMPANION_VERSION_CHECK ="檢查伴侶程序版本"; Blockly.Msg.REPL_COMPANION_OUT_OF_DATE = '伴侶程序已過期,點擊確定鍵升級。'; Blockly.Msg.REPL_EMULATORS ="查看模擬器"; Blockly.Msg.REPL_DEVICES ="設備"; Blockly.Msg.REPL_APPROVE_UPDATE ="屏幕,確認升級"; Blockly.Msg.REPL_NOT_NOW ="現在不"; Blockly.Msg.REPL_COMPANION_OUT_OF_DATE1 ="妳使用的伴侶程序已經過期,<br/><br/>本版App Inventor適用的伴侶程序版本為"; Blockly.Msg.REPL_COMPANION_OUT_OF_DATE_IMMEDIATE ="妳正在使用壹個過期版本的伴侶程序,請盡快升級"; Blockly.Msg.REPL_DISMISS ="放棄"; Blockly.Msg.REPL_SOFTWARE_UPDATE ="軟件升級"; Blockly.Msg.REPL_OK_LOWER ="確定"; Blockly.Msg.REPL_GOT_IT ="升級完成"; Blockly.Msg.REPL_UPDATE_INFO = '正在安裝升級包,請在設備(或模擬器)上檢查確認。<br /><br />註意:升級完成後,請選擇“完成”(不要選打開)。然後在瀏覽器中打開並進入App Inventor,點擊“連接設備”並選擇“重置連接”項。'; Blockly.Msg.REPL_UNABLE_TO_UPDATE ="無法將升級包發送給設備或模擬器"; Blockly.Msg.REPL_UNABLE_TO_LOAD ="無法從App Inventor服務器下載升級包"; Blockly.Msg.REPL_UNABLE_TO_LOAD_NO_RESPOND ="無法App Inventor服務器(服務器沒有響應)加載更新信息"; Blockly.Msg.REPL_NOW_DOWNLOADING ="正在從App Inventor服務器下載升級包,請耐心等待。"; Blockly.Msg.REPL_RUNTIME_ERROR ="運行故障"; Blockly.Msg.REPL_NO_ERROR_FIVE_SECONDS ="<br/><i>註意:</i>&nbsp;5秒鐘後將顯示另壹條錯誤信息。"; Blockly.Msg.REPL_CONNECTING_USB_CABLE ="正在通過USB電纜連接"; Blockly.Msg.REPL_STARTING_EMULATOR ="正在啟動Android模擬器<br/>請等待:可能需要壹至兩分鐘"; Blockly.Msg.REPL_CONNECTING ="連接中..."; Blockly.Msg.REPL_CANCEL ="取消"; Blockly.Msg.REPL_GIVE_UP ="放棄"; Blockly.Msg.REPL_KEEP_TRYING ="重試"; Blockly.Msg.REPL_CONNECTION_FAILURE1 ="連接失敗"; Blockly.Msg.REPL_NO_START_EMULATOR ="無法在模擬器中啟動伴侶程序"; Blockly.Msg.REPL_PLUGGED_IN_Q ="是否已插入電纜?"; Blockly.Msg.REPL_AI_NO_SEE_DEVICE ="AI2沒有看到妳的設備,請確認電纜連接以及驅動程序安裝是否正常。"; Blockly.Msg.REPL_HELPER_Q ="是否運行助手?"; Blockly.Msg.REPL_HELPER_NOT_RUNNING = 'aiStarter助手程序不在執行狀態中,<br />是否需要<a href="http://appinventor.mit.edu" target="_blank">幫助?</a>'; Blockly.Msg.REPL_USB_CONNECTED_WAIT ="已連接USB,請等待"; Blockly.Msg.REPL_SECONDS_ENSURE_RUNNING ="秒,確保相關資源全部加載。"; Blockly.Msg.REPL_EMULATOR_STARTED ="模擬器已運行,請等待"; Blockly.Msg.REPL_STARTING_COMPANION_ON_PHONE ="正在所連接電話設備中啟動伴侶程序"; Blockly.Msg.REPL_STARTING_COMPANION_IN_EMULATOR ="正在模擬器中啟動伴侶程序"; Blockly.Msg.REPL_COMPANION_STARTED_WAITING ="伴侶程序啟動中,請等待"; Blockly.Msg.REPL_VERIFYING_COMPANION ="檢查伴侶程序啟動狀態...."; Blockly.Msg.REPL_CONNECT_TO_COMPANION ="連接伴侶程序"; Blockly.Msg.REPL_TRY_AGAIN1 ="無法連接伴侶程序,請重新連接。"; Blockly.Msg.REPL_YOUR_CODE_IS ="編碼為:"; Blockly.Msg.REPL_DO_YOU_REALLY_Q ="妳真的要這麽做嗎?"; Blockly.Msg.REPL_FACTORY_RESET = "這將使模擬器重置為出廠模式,如果此前升級過伴侶程序,則需要重新升級。"; // Messages from Blockly.js Blockly.Msg.WARNING_DELETE_X_BLOCKS = "你確定要全部刪除 %1 個這些模塊嗎?"; // Blocklyeditor.js Blockly.Msg.GENERATE_YAIL = "生成 Yail"; Blockly.Msg.DO_IT = "實現功能"; Blockly.Msg.CAN_NOT_DO_IT = "不能實現功能"; Blockly.Msg.CONNECT_TO_DO_IT = '你必須要連接AI伴侶或者模擬器才能使用"實現功能"'; } }; // Initalize language definition to English Blockly.Msg.zh_tw.switch_language_to_chinese_tw.init();
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ 'use strict'; const gulp = require('gulp'); const filter = require('gulp-filter'); const es = require('event-stream'); const gulpeslint = require('gulp-eslint'); const tsfmt = require('typescript-formatter'); const VinylFile = require('vinyl'); const vfs = require('vinyl-fs'); const path = require('path'); const fs = require('fs'); const pall = require('p-all'); const task = require('./lib/task'); /** * Hygiene works by creating cascading subsets of all our files and * passing them through a sequence of checks. Here are the current subsets, * named according to the checks performed on them. Each subset contains * the following one, as described in mathematical notation: * * all ⊃ eol ⊇ indentation ⊃ copyright ⊃ typescript */ const all = [ '*', 'build/**/*', 'extensions/**/*', 'scripts/**/*', 'src/**/*', 'test/**/*', '!test/**/out/**', '!**/node_modules/**' ]; const indentationFilter = [ '**', // except specific files '!ThirdPartyNotices.txt', '!LICENSE.{txt,rtf}', '!LICENSES.chromium.html', '!**/LICENSE', '!src/vs/nls.js', '!src/vs/nls.build.js', '!src/vs/css.js', '!src/vs/css.build.js', '!src/vs/loader.js', '!src/vs/base/common/insane/insane.js', '!src/vs/base/common/marked/marked.js', '!src/vs/base/node/terminateProcess.sh', '!src/vs/base/node/cpuUsage.sh', '!test/unit/assert.js', // except specific folders '!test/automation/out/**', '!test/smoke/out/**', '!extensions/vscode-api-tests/testWorkspace/**', '!extensions/vscode-api-tests/testWorkspace2/**', '!build/monaco/**', '!build/win32/**', // except multiple specific files '!**/package.json', '!**/yarn.lock', '!**/yarn-error.log', // except multiple specific folders '!**/codicon/**', '!**/fixtures/**', '!**/lib/**', '!extensions/**/out/**', '!extensions/**/snippets/**', '!extensions/**/syntaxes/**', '!extensions/**/themes/**', '!extensions/**/colorize-fixtures/**', // except specific file types '!src/vs/*/**/*.d.ts', '!src/typings/**/*.d.ts', '!extensions/**/*.d.ts', '!**/*.{svg,exe,png,bmp,scpt,bat,cmd,cur,ttf,woff,eot,md,ps1,template,yaml,yml,d.ts.recipe,ico,icns,plist}', '!build/{lib,download}/**/*.js', '!build/**/*.sh', '!build/azure-pipelines/**/*.js', '!build/azure-pipelines/**/*.config', '!**/Dockerfile', '!**/Dockerfile.*', '!**/*.Dockerfile', '!**/*.dockerfile', '!extensions/markdown-language-features/media/*.js' ]; const copyrightFilter = [ '**', '!**/*.desktop', '!**/*.json', '!**/*.html', '!**/*.template', '!**/*.md', '!**/*.bat', '!**/*.cmd', '!**/*.ico', '!**/*.icns', '!**/*.xml', '!**/*.sh', '!**/*.txt', '!**/*.xpm', '!**/*.opts', '!**/*.disabled', '!**/*.code-workspace', '!**/*.js.map', '!build/**/*.init', '!resources/linux/snap/snapcraft.yaml', '!resources/linux/snap/electron-launch', '!resources/win32/bin/code.js', '!resources/completions/**', '!extensions/markdown-language-features/media/highlight.css', '!extensions/html-language-features/server/src/modes/typescript/*', '!extensions/*/server/bin/*', '!src/vs/editor/test/node/classification/typescript-test.ts', '!scripts/code-web.js' ]; const jsHygieneFilter = [ 'src/**/*.js', 'build/gulpfile.*.js', '!src/vs/loader.js', '!src/vs/css.js', '!src/vs/nls.js', '!src/vs/css.build.js', '!src/vs/nls.build.js', '!src/**/insane.js', '!src/**/marked.js', '!**/test/**' ]; const tsHygieneFilter = [ 'src/**/*.ts', 'test/**/*.ts', 'extensions/**/*.ts', '!**/fixtures/**', '!**/typings/**', '!**/node_modules/**', '!extensions/typescript-basics/test/colorize-fixtures/**', '!extensions/vscode-api-tests/testWorkspace/**', '!extensions/vscode-api-tests/testWorkspace2/**', '!extensions/**/*.test.ts', '!extensions/html-language-features/server/lib/jquery.d.ts' ]; const copyrightHeaderLines = [ '/*---------------------------------------------------------------------------------------------', ' * Copyright (c) Microsoft Corporation. All rights reserved.', ' * Licensed under the MIT License. See License.txt in the project root for license information.', ' *--------------------------------------------------------------------------------------------*/' ]; gulp.task('eslint', () => { return vfs.src(all, { base: '.', follow: true, allowEmpty: true }) .pipe(filter(jsHygieneFilter.concat(tsHygieneFilter))) .pipe(gulpeslint({ configFile: '.eslintrc.json', rulePaths: ['./build/lib/eslint'] })) .pipe(gulpeslint.formatEach('compact')) .pipe(gulpeslint.results(results => { if (results.warningCount > 0 || results.errorCount > 0) { throw new Error('eslint failed with warnings and/or errors'); } })); }); function checkPackageJSON(actualPath) { const actual = require(path.join(__dirname, '..', actualPath)); const rootPackageJSON = require('../package.json'); for (let depName in actual.dependencies) { const depVersion = actual.dependencies[depName]; const rootDepVersion = rootPackageJSON.dependencies[depName]; if (!rootDepVersion) { // missing in root is allowed continue; } if (depVersion !== rootDepVersion) { this.emit('error', `The dependency ${depName} in '${actualPath}' (${depVersion}) is different than in the root package.json (${rootDepVersion})`); } } } const checkPackageJSONTask = task.define('check-package-json', () => { return gulp.src('package.json') .pipe(es.through(function () { checkPackageJSON.call(this, 'remote/package.json'); checkPackageJSON.call(this, 'remote/web/package.json'); })); }); gulp.task(checkPackageJSONTask); function hygiene(some) { let errorCount = 0; const productJson = es.through(function (file) { const product = JSON.parse(file.contents.toString('utf8')); if (product.extensionsGallery) { console.error('product.json: Contains "extensionsGallery"'); errorCount++; } this.emit('data', file); }); const indentation = es.through(function (file) { const lines = file.contents.toString('utf8').split(/\r\n|\r|\n/); file.__lines = lines; lines .forEach((line, i) => { if (/^\s*$/.test(line)) { // empty or whitespace lines are OK } else if (/^[\t]*[^\s]/.test(line)) { // good indent } else if (/^[\t]* \*/.test(line)) { // block comment using an extra space } else { console.error(file.relative + '(' + (i + 1) + ',1): Bad whitespace indentation'); errorCount++; } }); this.emit('data', file); }); const copyrights = es.through(function (file) { const lines = file.__lines; for (let i = 0; i < copyrightHeaderLines.length; i++) { if (lines[i] !== copyrightHeaderLines[i]) { console.error(file.relative + ': Missing or bad copyright statement'); errorCount++; break; } } this.emit('data', file); }); const formatting = es.map(function (file, cb) { tsfmt.processString(file.path, file.contents.toString('utf8'), { verify: false, tsfmt: true, // verbose: true, // keep checkJS happy editorconfig: undefined, replace: undefined, tsconfig: undefined, tsconfigFile: undefined, tsfmtFile: undefined, vscode: undefined, vscodeFile: undefined }).then(result => { let original = result.src.replace(/\r\n/gm, '\n'); let formatted = result.dest.replace(/\r\n/gm, '\n'); if (original !== formatted) { console.error('File not formatted. Run the \'Format Document\' command to fix it:', file.relative); errorCount++; } cb(null, file); }, err => { cb(err); }); }); let input; if (Array.isArray(some) || typeof some === 'string' || !some) { const options = { base: '.', follow: true, allowEmpty: true }; if (some) { input = vfs.src(some, options).pipe(filter(all)); // split this up to not unnecessarily filter all a second time } else { input = vfs.src(all, options); } } else { input = some; } const productJsonFilter = filter('product.json', { restore: true }); const result = input .pipe(filter(f => !f.stat.isDirectory())) .pipe(productJsonFilter) .pipe(process.env['BUILD_SOURCEVERSION'] ? es.through() : productJson) .pipe(productJsonFilter.restore) .pipe(filter(indentationFilter)) .pipe(indentation) .pipe(filter(copyrightFilter)) .pipe(copyrights); const typescript = result .pipe(filter(tsHygieneFilter)) .pipe(formatting); const javascript = result .pipe(filter(jsHygieneFilter.concat(tsHygieneFilter))) .pipe(gulpeslint({ configFile: '.eslintrc.json', rulePaths: ['./build/lib/eslint'] })) .pipe(gulpeslint.formatEach('compact')) .pipe(gulpeslint.results(results => { errorCount += results.warningCount; errorCount += results.errorCount; })); let count = 0; return es.merge(typescript, javascript) .pipe(es.through(function (data) { count++; if (process.env['TRAVIS'] && count % 10 === 0) { process.stdout.write('.'); } this.emit('data', data); }, function () { process.stdout.write('\n'); if (errorCount > 0) { this.emit('error', 'Hygiene failed with ' + errorCount + ' errors. Check \'build/gulpfile.hygiene.js\'.'); } else { this.emit('end'); } })); } function createGitIndexVinyls(paths) { const cp = require('child_process'); const repositoryPath = process.cwd(); const fns = paths.map(relativePath => () => new Promise((c, e) => { const fullPath = path.join(repositoryPath, relativePath); fs.stat(fullPath, (err, stat) => { if (err && err.code === 'ENOENT') { // ignore deletions return c(null); } else if (err) { return e(err); } cp.exec(`git show :${relativePath}`, { maxBuffer: 2000 * 1024, encoding: 'buffer' }, (err, out) => { if (err) { return e(err); } c(new VinylFile({ path: fullPath, base: repositoryPath, contents: out, stat })); }); }); })); return pall(fns, { concurrency: 4 }) .then(r => r.filter(p => !!p)); } gulp.task('hygiene', task.series(checkPackageJSONTask, () => hygiene())); // this allows us to run hygiene as a git pre-commit hook if (require.main === module) { const cp = require('child_process'); process.on('unhandledRejection', (reason, p) => { console.log('Unhandled Rejection at: Promise', p, 'reason:', reason); process.exit(1); }); if (process.argv.length > 2) { hygiene(process.argv.slice(2)).on('error', err => { console.error(); console.error(err); process.exit(1); }); } else { cp.exec('git diff --cached --name-only', { maxBuffer: 2000 * 1024 }, (err, out) => { if (err) { console.error(); console.error(err); process.exit(1); return; } const some = out .split(/\r?\n/) .filter(l => !!l); if (some.length > 0) { console.log('Reading git index versions...'); createGitIndexVinyls(some) .then(vinyls => new Promise((c, e) => hygiene(es.readArray(vinyls)) .on('end', () => c()) .on('error', e))) .catch(err => { console.error(); console.error(err); process.exit(1); }); } }); } }
//TODO: encapsulate back to private function when card design is done //typical sizes: /* portrait: iPhone 4,5 375px iPhone 6 320px iPhone 6+ 414px Galaxy S3 360px landscape: iPhone 4 480px iPhone 5 568px iPhone 6 667px (574px container) iPhone 6+ 736px (574px container) Galaxy S3 640px (574px container) */ const ContainerWidth = { XS: 375, SM: 574, MD: 728, LG: 938, XL: 1148, XXL: 1384 } const Breakpoints = { XS: 0, // Extra small screen / phone SM: 544, // Small screen / phone MD: 768, // Medium screen / tablet LG: 992, // Large screen / desktop XL: 1200, // Extra large screen / wide desktop XXL: 1440, // Extra large screen / wide desktop } const COLUMNS = 14 //since media query defines smaller base font size in typography.scss we need to calculated gutters properly const getGutter = containerOrBrowserWidth => (containerOrBrowserWidth > Breakpoints.SM ? 16 : 14) export default { ContainerWidth : ContainerWidth, getFluidContainerWidth(browserWidth) { return browserWidth - getGutter(browserWidth) }, getContainerWidth(browserWidth) { //should match variables from bootstrap if (browserWidth <= ContainerWidth.SM) { return browserWidth //container becomes fluid for small size } else if (browserWidth > ContainerWidth.SM && browserWidth < Breakpoints.MD) { return ContainerWidth.SM } else if (browserWidth >= Breakpoints.MD && browserWidth < Breakpoints.LG) { return ContainerWidth.MD } else if (browserWidth >= Breakpoints.LG && browserWidth < Breakpoints.XL) { return ContainerWidth.LG } else if (browserWidth >= Breakpoints.XL && browserWidth < Breakpoints.XXL) { return ContainerWidth.XL } else if (browserWidth >= Breakpoints.XXL) { return ContainerWidth.XXL } }, init(containerWidth) { return { //returns width in px of Container's content area (width without paddings) getColumnContentWidth({numberOfCols}) { const oneColPercent = (100 / COLUMNS) / 100 const containerGutter = containerWidth >= Breakpoints.SM ? getGutter(containerWidth) : 0 return containerWidth * (oneColPercent * numberOfCols) - containerGutter } } }, }
// -------------------------------------------------------------------------- \\ // File: Transform.js \\ // Module: Foundation \\ // Author: Neil Jenkins \\ // License: © 2010-2015 FastMail Pty Ltd. MIT Licensed. \\ // -------------------------------------------------------------------------- \\ "use strict"; ( function ( NS, undefined ) { /** Namespace: O.Transform Holds a number of useful functions for transforming values, for use with <O.Binding>. */ NS.Transform = { /** Function: O.Transform.toBoolean Converts the given value to a Boolean Parameter: value - {*} The value to transform. Returns: {Boolean} The numerical value. */ toBoolean: function ( value ) { return !!value; }, /** Function: O.Transform.toString Converts the given value to a String Parameter: value - {*} The value to transform. Returns: {String} The string value. */ toString: function ( value ) { return value != null ? value + '' : ''; }, /** Function: O.Transform.toInt Converts the given value to an integer Parameter: value - {*} The value to transform. Returns: {Number} The integral numerical value. */ toInt: function ( value ) { return parseInt( value, 10 ) || 0; }, /** Function: O.Transform.toFloat Converts the given value to a floating point Number. Parameter: value - {*} The value to transform. Returns: {Number} The numerical value. */ toFloat: function ( value ) { return parseFloat( value ); }, /** Function: O.Transform.invert Converts the given value to a Boolean then inverts it. Parameter: value - {*} The value to transform. Returns: {Boolean} The inverse Boolean value. */ invert: function ( value ) { return !value; }, /** Function: O.Transform#defaultValue Returns a function which will transform `undefined` into the default value, but will pass through any other value untouched. Parameters: value - {*} The default value to use. */ defaultValue: function ( value ) { return function ( v ) { return v !== undefined ? v : value; }; }, /** Function: O.Transform.undefinedToNull Converts an undefined value into null, passes others through unchanged. Parameter: value - {*} The value to transform. Returns: {*} The value or null if the value is undefined. */ undefinedToNull: function ( value ) { return value === undefined ? null : value; }, /** Function: O.Transform.isEqualToValue Returns a function which will compare a given value to the value Parameter: value - {*} The value to compare to. Returns: {Function} A function which compares its first argument to the value given to this function, returning true if equal or false otherwise. Or, if the sync is in reverse, returns the given value if true or undefined if false. */ isEqualToValue: function ( value ) { return function ( syncValue, syncForward ) { return syncForward ? syncValue === value : syncValue ? value : undefined; }; } }; }( O ) );
(function(){ var worker = new ProtocolWorker('web+profile'); navigator.webProfile = { registerProvider: function(name, uri){ navigator.registerProtocolHandler('web+profile', uri + '?%s', name); }, getID: function(){ return worker.request({ action: 'get:id' }).then(function(response){ navigator.webProfile.id = response.id; return response; }) }, authenticate: function(){ if (!this.id) throw 'Not Connected: you must connect before sending Web Profile requests'; }, getProfile: function(username){ /* This should be performed by the browser, platform, or OS so it comes directly from the blockchain instead of relying on a third-party middleman. */ var name = username || this.id; return fetch('https://api.onename.com/v1/users/' + name + '?app-id=11783753c820c2004667f4b17efb376d&app-secret=a31496483fa18b96b39845d66d62d15d37f5eea29aca6f161b2f6bcc0a7d8d91') .then(function(response){ return response.json(); }).then(function(json){ return json[name].profile; }); } }; })();
define([ 'jquery', 'find/app/util/database-name-resolver' ], function($, databaseNameResolver) { return { /** * Get the view document URL for a document in a text index. * @param {String} reference * @param {String} model * @param {Boolean} highlightExpressions * @return {String} */ getHref: function(reference, model, highlightExpressions) { var database = databaseNameResolver.resolveDatabaseNameForDocumentModel(model); return 'api/public/view/viewDocument?' + $.param({ reference: reference, index: database, highlightExpressions: highlightExpressions || null }, true); }, /** * Get the view document URL for a search result triggered by a static content promotion * @param {String} reference Reference of the search result * @return {String} */ getStaticContentPromotionHref: function(reference) { return 'api/public/view/viewStaticContentPromotion?' + $.param({ reference: reference }); } }; });
//Logged in function checkRestricted (UserService, $q, $location) { var deferred = $q.defer(); if (UserService.getToken()) { deferred.resolve(); } else { deferred.reject(); $location.url('/'); } return deferred.promise; } function checkedLoggedIn (UserService, $q, $location) { var deferred = $q.defer(); if (!UserService.getToken()) { deferred.resolve(); } else { deferred.reject(); $location.url('/tasks'); } return deferred.promise; } //Bootstrapping the app angular.module('TasksApp', ['ngMaterial','LocalStorageModule','ngRoute', 'ngMessages']) //Routes .config(['$routeProvider', function($routeProvider){ $routeProvider .when('/', { templateUrl:'views/login.html', resolve: { 'loggedIn': ['UserService', '$q', '$location', checkedLoggedIn] } } ) .when('/signup', { templateUrl:'views/signup.html', resolve: { 'loggedIn': ['UserService', '$q', '$location', checkedLoggedIn] } } ) .when('/tasks', { templateUrl:'views/tasks.html', controller: 'TasksCtrl as tc', resolve: { 'loggedIn': ['UserService', '$q', '$location', checkRestricted] } } ) .otherwise({redirectTo:'/'}); /* resolve: { 'check': function(UserService,$location) { if (UserService.getUserToken()) { return true; } $location.path('/'); return false; } } */ }]) //Themes .config(['$mdThemingProvider',function($mdThemingProvider) { $mdThemingProvider.theme('default') .primaryPalette('blue-grey') .accentPalette('light-green') .backgroundPalette('blue-grey'); // .dark(); }]);
module.exports={A:{A:{"2":"M D H F A B mB"},B:{"1":"K","2":"C E q L O I J"},C:{"1":"0 1 2 3 4 6 8 9 O I J P Q R S T U V W X Y Z a b c d f g h i j k l m n o p N r s t u v w x y z LB BB CB DB EB FB HB IB JB","2":"5 jB AB G M D H F A eB cB","33":"B C E q L"},D:{"1":"0 1 2 3 4 6 8 9 a b c d f g h i j k l m n o p N r s t u v w x y z LB BB CB DB EB FB HB IB JB bB VB PB oB K QB RB SB TB","2":"5 G M D H F A B C E q L O I J P Q R S T U V W X Y Z"},E:{"2":"5 7 G M D H F A B C E UB NB WB XB YB ZB aB e dB KB"},F:{"1":"0 1 2 3 4 8 I J P Q R S T U V W X Y Z a b c d f g h i j k l m n o p N r s t u v w x y z","2":"7 F B C L O fB gB hB iB e MB kB"},G:{"2":"H E NB lB GB nB OB pB qB rB sB tB uB vB wB xB yB KB"},H:{"2":"zB"},I:{"1":"K 4B 5B","2":"AB G 0B 1B 2B 3B GB"},J:{"1":"A","2":"D"},K:{"1":"N","2":"7 A B C e MB"},L:{"1":"K"},M:{"1":"6"},N:{"2":"A B"},O:{"1":"6B"},P:{"1":"G 7B 8B 9B AC BC"},Q:{"1":"CC"},R:{"1":"DC"},S:{"1":"EC"}},B:2,C:"Vibration API"};
/* ---------------- ResponsiveTabs.js Author: Pete Love | www.petelove.com Version: 1.10 ------------------- */ var RESPONSIVEUI = {}; (function($) { RESPONSIVEUI.responsiveTabs = function () { var $tabSets = $('.responsive-tabs'); if (!$tabSets.hasClass('responsive-tabs--enabled')) { // if we haven't already called this function and enabled tabs $tabSets.addClass('responsive-tabs--enabled'); //loop through all sets of tabs on the page var tablistcount = 1; $tabSets.each(function() { var $tabs = $(this); // add tab heading and tab panel classes $tabs.children(':header').addClass('responsive-tabs__heading'); $tabs.children('div').addClass('responsive-tabs__panel'); // determine if markup already identifies the active tab panel for this set of tabs // if not then set first heading and tab to be the active one var $activePanel = $tabs.find('.responsive-tabs__panel--active'); if(!$activePanel.length) { $activePanel = $tabs.find('.responsive-tabs__panel').first().addClass('responsive-tabs__panel--active'); } $tabs.find('.responsive-tabs__panel').not('.responsive-tabs__panel--active').hide().attr('aria-hidden','true'); //hide all except active panel $activePanel.attr('aria-hidden', 'false'); /* make active tab panel hidden for mobile */ $activePanel.addClass('responsive-tabs__panel--closed-accordion-only'); // wrap tabs in container - to be dynamically resized to help prevent page jump var $tabsWrapper = $('<div/>', {'class': 'responsive-tabs-wrapper' }); $tabs.wrap($tabsWrapper); var highestHeight = 0; // determine height of tallest tab panel. Used later to prevent page jump when tabs are clicked $tabs.find('.responsive-tabs__panel').each(function() { var tabHeight = $(this).height(); if (tabHeight > highestHeight) { highestHeight = tabHeight; } }); //create the tab list var $tabList = $('<ul/>', { 'class': 'responsive-tabs__list', 'role': 'tablist' }); //loop through each heading in set var tabcount = 1; $tabs.find('.responsive-tabs__heading').each(function() { var $tabHeading = $(this); var $tabPanel = $(this).next(); $tabHeading.attr('tabindex', 0); // CREATE TAB ITEMS (VISIBLE ON DESKTOP) //create tab list item from heading //associate tab list item with tab panel var $tabListItem = $('<li/>', { 'class': 'responsive-tabs__list__item', id: 'tablist' + tablistcount + '-tab' + tabcount, 'aria-controls': 'tablist' + tablistcount +'-panel' + tabcount, 'role': 'tab', tabindex: 0, text: $tabHeading.text(), keydown: function (objEvent) { if (objEvent.keyCode === 13) { // if user presses 'enter' $tabListItem.click(); } }, click: function() { //Show associated panel //set height of tab container to highest panel height to avoid page jump $tabsWrapper.css('height', highestHeight); // remove hidden mobile class from any other panel as we'll want that panel to be open at mobile size $tabs.find('.responsive-tabs__panel--closed-accordion-only').removeClass('responsive-tabs__panel--closed-accordion-only'); // close current panel and remove active state from its (hidden on desktop) heading $tabs.find('.responsive-tabs__panel--active').toggle().removeClass('responsive-tabs__panel--active').attr('aria-hidden','true').prev().removeClass('responsive-tabs__heading--active'); //make this tab panel active $tabPanel.toggle().addClass('responsive-tabs__panel--active').attr('aria-hidden','false'); //make the hidden heading active $tabHeading.addClass('responsive-tabs__heading--active'); //remove active state from currently active tab list item $tabList.find('.responsive-tabs__list__item--active').removeClass('responsive-tabs__list__item--active'); //make this tab active $tabListItem.addClass('responsive-tabs__list__item--active'); //reset height of tab panels to auto $tabsWrapper.css('height', 'auto'); } }); //associate tab panel with tab list item $tabPanel.attr({ 'role': 'tabpanel', 'aria-labelledby': $tabListItem.attr('id'), id: 'tablist' + tablistcount + '-panel' + tabcount }); // if this is the active panel then make it the active tab item if($tabPanel.hasClass('responsive-tabs__panel--active')) { $tabListItem.addClass('responsive-tabs__list__item--active'); } // add tab item $tabList.append($tabListItem); // TAB HEADINGS (VISIBLE ON MOBILE) // if user presses 'enter' on tab heading trigger the click event $tabHeading.keydown(function(objEvent) { if (objEvent.keyCode === 13) { $tabHeading.click(); } }); //toggle tab panel if click heading (on mobile) $tabHeading.click(function() { // remove any hidden mobile class $tabs.find('.responsive-tabs__panel--closed-accordion-only').removeClass('responsive-tabs__panel--closed-accordion-only'); // if this isn't currently active if (!$tabHeading.hasClass('responsive-tabs__heading--active')){ var oldActivePos, $activeHeading = $tabs.find('.responsive-tabs__heading--active'); // if there is an active heading, get its position if($activeHeading.length) { oldActivePos = $activeHeading.offset().top; } // close currently active panel and remove active state from any hidden heading $tabs.find('.responsive-tabs__panel--active').slideToggle().removeClass('responsive-tabs__panel--active').prev().removeClass('responsive-tabs__heading--active'); //close all tabs $tabs.find('.responsive-tabs__panel').hide().attr('aria-hidden','true'); //open this panel $tabPanel.slideToggle().addClass('responsive-tabs__panel--active').attr('aria-hidden','false'); // make this heading active $tabHeading.addClass('responsive-tabs__heading--active'); var $currentActive = $tabs.find('.responsive-tabs__list__item--active'); //set the active tab list item (for desktop) $currentActive.removeClass('responsive-tabs__list__item--active'); var panelId = $tabPanel.attr('id'); var tabId = panelId.replace('panel','tab'); $('#' + tabId).addClass('responsive-tabs__list__item--active'); //scroll to active heading only if it is below previous one var tabsPos = $tabs.offset().top; var newActivePos = ($tabHeading.offset().top) - 15; if(oldActivePos < newActivePos) { $('html, body').animate({ scrollTop: tabsPos }, 0).animate({ scrollTop: newActivePos }, 400); } } // if this tab panel is already active else { // hide panel but give it special responsive-tabs__panel--closed-accordion-only class so that it can be visible at desktop size $tabPanel.removeClass('responsive-tabs__panel--active').slideToggle(function () { $(this).addClass('responsive-tabs__panel--closed-accordion-only'); }); //remove active heading class $tabHeading.removeClass('responsive-tabs__heading--active'); //don't alter classes on tabs as we want it active if put back to desktop size } }); tabcount ++; }); // add finished tab list to its container $tabs.prepend($tabList); // next set of tabs on page tablistcount ++; }); } }; })(jQuery);
const glob = require('glob'); const fs = require('fs'); const path = require('path'); const request = require('request'); const checkedUrls = { 'src/archive/index.php': '', }; function getUrlContents(url) { return new Promise(function(resolve, reject) { request( url, { followRedirect: false, followAllRedirects: false, headers: { 'Cache-Control': 'no-cache' } }, (error, response, body) => resolve([response.statusCode, body])); }); } function createUrl(file) { return 'http://localhost:8080/' + file.replace('src/', ''); } async function isValidUrl(file, url, id) { let isValid = false; const currentDirectory = path.dirname(file); let targetPath; if (url.startsWith('#')) { targetPath = file; } else { targetPath = path.join(url.startsWith('/') ? 'src' : currentDirectory, url.split('?')[0]); } if (targetPath.endsWith('/')) { targetPath = path.join(targetPath, 'index.php'); } if (checkedUrls[targetPath] !== undefined || fs.existsSync(targetPath)) { if (id) { if (!checkedUrls[targetPath]) { const [statusCode, contents] = await getUrlContents(createUrl(targetPath)); if (statusCode === 200) { checkedUrls[targetPath] = contents; } } const html = checkedUrls[targetPath]; const idExists = new RegExp(`id=["']${id}["']`).test(html); const generatedIds = []; if (!idExists) { const headerPattern = /<h([1-4])>(.+)<\/h\1>/g; let matches; while ((matches = headerPattern.exec(html))) { const generatedId = matches[2] .replace(/<\/?[^\>]+\>/g, '') .replace(/[^\w\d\s\(\.\-]/g, '') .replace(/[\s\(\.]/g, '-') .toLowerCase(); generatedIds.push(generatedId); } } isValid = idExists || generatedIds.indexOf(id) >= 0; } else { isValid = true; if (checkedUrls[targetPath] === undefined) { checkedUrls[targetPath] = ''; } } } return isValid; } async function verifyFile(file) { const regex = /<a.*href=['"]([^'"]+)['"]/g; const [statusCode, contents] = await getUrlContents(createUrl(file)); if (statusCode !== 200) { //console.log(`\u2753 Ignoring ${file} (${statusCode})`); } let matches; let urlCount = 0; let validUrls = []; let invalidUrls = []; let ignoredUrls = []; while ((matches = regex.exec(contents))) { const [urlMatch] = matches.slice(1); const [url, id] = urlMatch.split('#'); const ignoreList = ['mailto:', 'dist/', 'http']; if (ignoreList.some(x => url.startsWith(x)) || (id && id.startsWith('example-'))) { ignoredUrls.push(url); } else { const isValid = await isValidUrl(file, url, id); if (isValid) { validUrls.push(urlMatch); } else { invalidUrls.push(urlMatch); } } urlCount++; } if (invalidUrls.length) { console.log(`\u274C Found errors in ${file}. Invalid URLs found linking to:\n-> ${invalidUrls.join('\n-> ')}`); } else { //console.log(`\u2714 Verified ${validUrls.length} links in ${file} (ignored ${ignoredUrls.length})`); } } async function asyncForEach(array, callback) { for (let index = 0; index < array.length; index++) { await callback(array[index], index, array); } } glob('src/javascript-*/*.php', {}, async (_, files) => await asyncForEach(files, verifyFile));
import Vector from '../../../../src/lib/Vector'; import Utils from '../../../../src/lib/Utils'; import Perlin from '../../../../src/lib/Perlin'; export default class FlowField { constructor(w, h, z, resolution, source, cbInit) { this.ctx; this.width = w; this.height = h; this.field = []; this.resolution = resolution || 10; this.rows = Math.round(w / this.resolution); this.cols = Math.round(h / this.resolution); this.depth = z >= 1 ? z:1; this.zIndex = 0; this.mustRedraw = false; this.isReady = false; this.cbInit = cbInit || null; this.initField(source); } pushZ() { this.zIndex++; if (this.zIndex >= this.depth) { this.zIndex = 0; } this.mustRedraw = true; } lookup(vector) { let x = vector.getX() / this.resolution; let y = vector.getY() / this.resolution; let col = parseInt(Utils.constrain(y, 0, this.cols-1)); let row = parseInt(Utils.constrain(x, 0, this.rows-1)); return this.field[this.zIndex][col][row].copy(); } initField(source) { let type = typeof source; switch (type) { case 'string': if (source === 'special') { this.gridFromSpecial(); } else { this.gridFromImage(source); } break; case 'object': this.gridFromPerlin(source); break; default: console.error("FlowField :: createField: invalid source."); return false; } } createGrid(vectors) { if (!this.ctx) { this.ctx = this.createCanvas(); } this.field = vectors; this.mustRedraw = true; this.isReady = true; if (typeof this.cbInit === 'function') { this.cbInit(); } } gridFromImage(imageSrc) { this.getVectorsFromImage(imageSrc, (vectors) => { this.createGrid(vectors) }); } gridFromPerlin(source) { source = source || {}; let vectors = this.getVectorsFromPerlinNoise(source.seed, source.res); this.createGrid(vectors); } gridFromSpecial() { let vectors = this.getSpecialVectors(); this.createGrid(vectors); } getSpecialVectors() { let vectors = []; for (let z=0; z<this.depth; z++) { vectors[z] = []; for (let i = 0; i<this.cols; i++) { vectors[z][i] = new Array(this.rows); for (let j = 0; j<this.rows; j++) { let angle; let prob = Math.random(); if (prob < 0.85) { angle = Utils.randomRange(0.2, 0.6); } else { angle = Utils.randomRange(-0.9, 0.1); } let vector = new Vector({ x: Math.cos(angle), y: Math.sin(angle) }); vectors[z][i][j] = vector; } } } return vectors; } getVectorsFromPerlinNoise(seed, res) { res = res || {}; res = { x: res.x || 0.02, y: res.y || 0.02, z: res.z || 0.02 }; seed = seed || Math.random(); let noise = new Perlin(); noise.seed(seed); let xOff = 0; let yOff = 0; let zOff = 0; let vectors = []; for (let z=0; z<this.depth; z++) { vectors[z] = []; for (let i = 0; i<this.cols; i++) { yOff = 0; vectors[z][i] = new Array(this.rows); for (let j = 0; j<this.rows; j++) { let noiseVal = noise.noise(xOff, yOff, zOff); let angle = Utils.mapRange(noiseVal, 0, 1, -1, 1); let vector = new Vector({ x: Math.cos(angle), y: Math.sin(angle) }); vectors[z][i][j] = vector; yOff += res.y; } xOff += res.x; } zOff += res.z; } return vectors; } getVectorsFromImage(imageSrc, cb) { let image = new Image(); image.src = imageSrc; image.onload = function() { let canvas = document.createElement("canvas"); let ctx = canvas.getContext("2d"); canvas.width = this.width; canvas.height = this.height; document.getElementsByTagName("BODY")[0].appendChild(canvas); ctx.drawImage(image, 0, 0); let imageData = ctx.getImageData(0, 0, this.width, this.height); let vectors = [[]]; for (let i=0; i<this.cols; i++) { vectors[0][i] = new Array(this.rows); for (let j=0; j<this.rows; j++) { let brightness = this.imageGetBlockValue(imageData, i, j); let angle = Utils.mapRange(brightness, 0, 255, -1, 1); let vector = new Vector({ x: Math.cos(angle), y: Math.sin(angle) }); vectors[0][i][j] = vector; } } cb(vectors); }.bind(this); } imageGetBlockValue(imageData, col, row) { let pixelData = 4; let blockSize = this.resolution * pixelData; let blockSizeSquare = this.resolution * blockSize; let start = (col * blockSize) + row * this.width * blockSize; let end = start + blockSize; let nextOffset = this.cols * blockSize; let cut = start + nextOffset * this.resolution let acum = 0; let y=0; while (start < cut) { for (let i=start; i<end; i++) { acum += imageData.data[i]; y++; } start += nextOffset; end = start + blockSize; } return acum / blockSizeSquare; } debugPaintImageBlock(imageData, col, row) { let pixelData = 4; let blockSize = this.resolution * pixelData; let blockSizeSquare = this.resolution * blockSize; let start = (col * blockSize) + row * this.width * blockSize; let end = start + blockSize; let nextOffset = this.cols * blockSize; let cut = start + nextOffset*this.resolution let acum = 0; let y=0; while (start < cut) { for (let i=start; i<end; i++) { acum += imageData.data[i]; imageData.data[i] = 255; y++; } start += nextOffset; end = start + blockSize; } } drawCell(x, y, a) { let arrowSize = this.resolution / 1.5; let halfRes = this.resolution / 2; let xOffset = (this.resolution - arrowSize) / 2; let arrowColor = "#a3a3a3"; let arrowHeadSize = arrowSize * 10 / 100; // this.ctx.lineWidth = 1; // // this.ctx.setLineDash([5, 15]); // this.ctx.beginPath(); // this.ctx.rect(x, y, this.resolution , this.resolution); // this.ctx.stroke(); // this.ctx.closePath(); this.ctx.save(); this.ctx.translate(x + halfRes, y + halfRes); this.ctx.rotate(a); this.ctx.setLineDash([]); this.ctx.strokeStyle = arrowColor; this.ctx.fillStyle = arrowColor; this.ctx.beginPath(); this.ctx.moveTo(-(arrowSize/2), 0); this.ctx.lineTo((arrowSize/2)-arrowHeadSize, 0); this.ctx.closePath(); this.ctx.stroke(); this.ctx.beginPath(); this.ctx.moveTo((arrowSize/2)-arrowHeadSize, -arrowHeadSize); this.ctx.lineTo((arrowSize/2)-arrowHeadSize, arrowHeadSize); this.ctx.lineTo(arrowSize/2, 0); this.ctx.closePath(); this.ctx.fill(); this.ctx.restore(); } draw() { if (!this.mustRedraw) { return; } let x = 0; let y = 0; this.ctx.clearRect(0, 0, this.width, this.height); for (let i = 0; i<this.cols; i++) { y = i * this.resolution; for (let j = 0; j<this.rows; j++) { x = j * this.resolution; let v = this.field[this.zIndex][i][j]; let angle = v.getAngle(); this.drawCell(x, y, angle); } } this.mustRedraw = false; } createCanvas() { let canvas = document.createElement("canvas"); let width = window.innerWidth; let height = window.innerHeight-4; canvas.height = height; canvas.width = width; canvas.setAttribute("id", "flowField"); canvas.style = "position: absolute; background:transparent; top:0; left:0; z-index:-1"; document.getElementsByTagName("BODY")[0].appendChild(canvas); return canvas.getContext("2d"); } }
// The size of Rectangle, Bound etc. class Size { constructor(width, height) { this.type = 'Size' this.width = width this.height = height } set(width, height) { this.width = width this.height = height } } export default Size
/* Template Name: Color Admin - Responsive Admin Dashboard Template build with Twitter Bootstrap 3.3.2 Version: 1.6.0 Author: Sean Ngu Website: http://www.seantheme.com/color-admin-v1.6/admin/ */ var handleEmailToInput = function() { $('#email-to').tagit({ availableTags: ["c++", "java", "php", "javascript", "ruby", "python", "c"] }); }; var handleEmailContent = function() { $('#wysihtml5').wysihtml5(); }; var EmailCompose = function () { "use strict"; return { //main function init: function () { handleEmailToInput(); handleEmailContent(); } }; }();
var assert = require('assert') var parse = require('../') // test parser assert.equal(parse('***foo***'), '<p><strong><em>foo</em></strong></p>\n') assert.equal(parse('# **blah**'), '<h1><a name="--blah--"></a><strong>blah</strong></h1>\n') assert.equal(parse('Blah blah\n-----'), '<h2><a name="blah-blah"></a>Blah blah</h2>\n') // test sanitizer assert.equal(parse('<a href="blah" id="wat">foo</a>'), '<p><a href="blah">foo</a></p>\n') assert.equal(parse('<a href=blah>foo</a>'), '<p><a href="blah">foo</a></p>\n') assert.equal(parse('<div><i>foo <b>blah</i></b>'), '<div><i>foo <b>blah</b></i></div>') assert.equal(parse('<a class="evil" href="blah">foo</a>'), '<p></p>\n') // highlighter assert.equal(parse('```js\nvar foo = "bar";\n```'), '<pre><code class="lang-js"><span class="hljs-keyword">var</span> foo = <span class="hljs-string">&quot;bar&quot;</span>;\n</code></pre>\n') assert.equal(parse('```sh\n$ test\n```'), '<pre><code class="lang-sh">$ <span class="hljs-built_in">test</span>\n</code></pre>\n') assert.equal(parse('```\n-----\n```'), '<pre><code>-----\n</code></pre>\n') // metadata assert.equal(parse('---\naaa: 123\nbbb: "*456*"\n---\n\n*foo*\n'), '<table>\n<thead>\n<th>\naaa</th>\n<th>\nbbb</th>\n</thead>\n<tbody>\n<td>\n123</td>\n<td>\n*456*</td>\n</tbody>\n</table>\n<p><em>foo</em></p>\n')
const name = 'wizard'; describe("Metro 4 :: Wizard", () => { it('Component Initialization', ()=>{ cy.visit("cypress/"+name+".html"); }) })
module.exports={"title":"R","hex":"276DC3","source":"https://www.r-project.org/logo/","svg":"<svg aria-labelledby=\"simpleicons-r-icon\" role=\"img\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><title id=\"simpleicons-r-icon\">R icon</title><path d=\"M12 18.82c-6.627 0-12-3.598-12-8.037s5.373-8.037 12-8.037 12 3.599 12 8.037-5.373 8.037-12 8.037zm1.837-12.932c-5.038 0-9.121 2.46-9.121 5.495s4.083 5.494 9.12 5.494 8.756-1.682 8.756-5.494-3.718-5.495-8.755-5.495z\"/><path d=\"M18.275 15.194a9.038 9.038 0 0 1 1.149.433 2.221 2.221 0 0 1 .582.416 1.573 1.573 0 0 1 .266.383l2.863 4.826-4.627.002-2.163-4.063a5.229 5.229 0 0 0-.716-.982.753.753 0 0 0-.549-.25h-1.099v5.292l-4.093.001V7.737h8.221s3.744.067 3.744 3.63a3.822 3.822 0 0 1-3.578 3.827zm-1.78-4.526l-2.479-.001v2.298h2.479a1.134 1.134 0 0 0 1.148-1.17 1.07 1.07 0 0 0-1.148-1.127z\"/></svg>"};
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = requirePropFactory; function requirePropFactory(componentNameInError) { if (process.env.NODE_ENV === 'production') { return () => null; } const requireProp = requiredProp => (props, propName, componentName, location, propFullName) => { const propFullNameSafe = propFullName || propName; if (typeof props[propName] !== 'undefined' && !props[requiredProp]) { return new Error(`The prop \`${propFullNameSafe}\` of ` + `\`${componentNameInError}\` must be used on \`${requiredProp}\`.`); } return null; }; return requireProp; }
var fs = require('fs'); var os = require('os'); var blessed = require('blessed'); var multiline = require('multiline'); if (os.platform() === 'win32') { console.log('*************************************************************'); console.log('Hackthon Starter Generator has been disabled on Windows until'); console.log('https://github.com/chjj/blessed is fixed or until I find a'); console.log('better CLI module.'); console.log('*************************************************************'); process.exit(); } var screen = blessed.screen({ autoPadding: true }); screen.key('q', function() { process.exit(0); }); var home = blessed.list({ parent: screen, padding: { top: 2 }, mouse: true, keys: true, fg: 'white', bg: 'blue', selectedFg: 'blue', selectedBg: 'white', items: [ '» REMOVE AUTHENTICATION PROVIDER', '» CHANGE EMAIL SERVICE', '» ADD NODE.JS CLUSTER SUPPORT', '» EXIT' ] }); var homeTitle = blessed.text({ parent: screen, align: 'center', fg: 'blue', bg: 'white', content: 'Hackathon Starter (c) 2014' }); var footer = blessed.text({ parent: screen, bottom: 0, fg: 'white', bg: 'blue', tags: true, content: ' {cyan-fg}<Up/Down>{/cyan-fg} moves | {cyan-fg}<Enter>{/cyan-fg} selects | {cyan-fg}<q>{/cyan-fg} exits' }); var inner = blessed.form({ top: 'center', left: 'center', mouse: true, keys: true, width: 33, height: 10, border: { type: 'line', fg: 'white', bg: 'red' }, fg: 'white', bg: 'red' }); var success = blessed.box({ top: 'center', left: 'center', mouse: true, keys: true, tags: true, width: '50%', height: '40%', border: { type: 'line', fg: 'white', bg: 'green' }, fg: 'white', bg: 'green', padding: 1 }); success.on('keypress', function() { home.focus(); home.remove(success); }); var clusterText = blessed.text({ top: 'top', bg: 'red', fg: 'white', tags: true, content: 'Take advantage of multi-core systems using built-in {underline}cluster{/underline} module.' }); var enable = blessed.button({ parent: inner, bottom: 0, mouse: true, shrink: true, name: 'enable', content: ' ENABLE ', border: { type: 'line', fg: 'white', bg: 'red' }, style: { fg: 'white', bg: 'red', focus: { fg: 'red', bg: 'white' } } }); var disable = blessed.button({ parent: inner, bottom: 0, left: 10, mouse: true, shrink: true, name: 'disable', content: ' DISABLE ', border: { type: 'line', fg: 'white', bg: 'red' }, style: { fg: 'white', bg: 'red', focus: { fg: 'red', bg: 'white' } } }); var cancel = blessed.button({ parent: inner, bottom: 0, left: 21, mouse: true, shrink: true, name: 'cancel', content: ' CANCEL ', border: { type: 'line', fg: 'white', bg: 'red' }, style: { fg: 'white', bg: 'red', focus: { fg: 'red', bg: 'white' } } }); cancel.on('press', function() { home.focus(); home.remove(inner); screen.render(); }); var authForm = blessed.form({ mouse: true, keys: true, fg: 'white', bg: 'blue', padding: { left: 1, right: 1 } }); authForm.on('submit', function() { var passportConfig = fs.readFileSync('config/passport.js').toString().split(os.EOL); var loginTemplate = fs.readFileSync('views/account/login.jade').toString().split(os.EOL); var profileTemplate = fs.readFileSync('views/account/profile.jade').toString().split(os.EOL); var userModel = fs.readFileSync('models/User.js').toString().split(os.EOL); var app = fs.readFileSync('app.js').toString().split(os.EOL); var secrets = fs.readFileSync('config/secrets.js').toString().split(os.EOL); var index = passportConfig.indexOf("var FacebookStrategy = require('passport-facebook').Strategy;"); if (facebookCheckbox.checked && index !== -1) { passportConfig.splice(index, 1); index = passportConfig.indexOf('// Sign in with Facebook.'); passportConfig.splice(index, 47); fs.writeFileSync('config/passport.js', passportConfig.join(os.EOL)); index = loginTemplate.indexOf(" a.btn.btn-block.btn-facebook.btn-social(href='/auth/facebook')"); loginTemplate.splice(index, 3); fs.writeFileSync('views/account/login.jade', loginTemplate.join(os.EOL)); index = profileTemplate.indexOf(" if user.facebook"); profileTemplate.splice(index - 1, 5); fs.writeFileSync('views/account/profile.jade', profileTemplate.join(os.EOL)); index = userModel.indexOf(' facebook: String,'); userModel.splice(index, 1); fs.writeFileSync('models/User.js', userModel.join(os.EOL)); index = app.indexOf("app.get('/auth/facebook', passport.authenticate('facebook', { scope: ['email', 'user_location'] }));"); app.splice(index, 4); fs.writeFileSync('app.js', app.join(os.EOL)); } index = passportConfig.indexOf("var GitHubStrategy = require('passport-github').Strategy;"); if (githubCheckbox.checked && index !== -1) { console.log(index); passportConfig.splice(index, 1); index = passportConfig.indexOf('// Sign in with GitHub.'); passportConfig.splice(index, 48); fs.writeFileSync('config/passport.js', passportConfig.join(os.EOL)); index = loginTemplate.indexOf(" a.btn.btn-block.btn-github.btn-social(href='/auth/github')"); loginTemplate.splice(index, 3); fs.writeFileSync('views/account/login.jade', loginTemplate.join(os.EOL)); index = profileTemplate.indexOf(' if user.github'); profileTemplate.splice(index - 1, 5); fs.writeFileSync('views/account/profile.jade', profileTemplate.join(os.EOL)); index = userModel.indexOf(' github: String,'); userModel.splice(index, 1); fs.writeFileSync('models/User.js', userModel.join(os.EOL)); index = app.indexOf("app.get('/auth/github', passport.authenticate('github'));"); app.splice(index, 4); fs.writeFileSync('app.js', app.join(os.EOL)); } index = passportConfig.indexOf("var GoogleStrategy = require('passport-google-oauth').OAuth2Strategy;"); if (googleCheckbox.checked && index !== -1) { passportConfig.splice(index, 1); index = passportConfig.indexOf('// Sign in with Google.'); passportConfig.splice(index, 46); fs.writeFileSync('config/passport.js', passportConfig.join(os.EOL)); index = loginTemplate.indexOf(" a.btn.btn-block.btn-google-plus.btn-social(href='/auth/google')"); loginTemplate.splice(index, 3); fs.writeFileSync('views/account/login.jade', loginTemplate.join(os.EOL)); index = profileTemplate.indexOf(' if user.google'); profileTemplate.splice(index - 1, 5); fs.writeFileSync('views/account/profile.jade', profileTemplate.join(os.EOL)); index = userModel.indexOf(' google: String,'); userModel.splice(index, 1); fs.writeFileSync('models/User.js', userModel.join(os.EOL)); index = app.indexOf("app.get('/auth/google', passport.authenticate('google', { scope: 'profile email' }));"); app.splice(index, 4); fs.writeFileSync('app.js', app.join(os.EOL)); } index = passportConfig.indexOf("var TwitterStrategy = require('passport-twitter').Strategy;"); if (twitterCheckbox.checked && index !== -1) { passportConfig.splice(index, 1); index = passportConfig.indexOf('// Sign in with Twitter.'); passportConfig.splice(index, 43); fs.writeFileSync('config/passport.js', passportConfig.join(os.EOL)); index = loginTemplate.indexOf(" a.btn.btn-block.btn-twitter.btn-social(href='/auth/twitter')"); loginTemplate.splice(index, 3); fs.writeFileSync('views/account/login.jade', loginTemplate.join(os.EOL)); index = profileTemplate.indexOf(' if user.twitter'); profileTemplate.splice(index - 1, 5); fs.writeFileSync('views/account/profile.jade', profileTemplate.join(os.EOL)); index = userModel.indexOf(' twitter: String,'); userModel.splice(index, 1); fs.writeFileSync('models/User.js', userModel.join(os.EOL)); index = app.indexOf("app.get('/auth/twitter', passport.authenticate('twitter'));"); app.splice(index, 4); fs.writeFileSync('app.js', app.join(os.EOL)); } index = passportConfig.indexOf("var LinkedInStrategy = require('passport-linkedin-oauth2').Strategy;"); if (linkedinCheckbox.checked && index !== -1) { passportConfig.splice(index, 1); index = passportConfig.indexOf('// Sign in with LinkedIn.'); passportConfig.splice(index, 47); fs.writeFileSync('config/passport.js', passportConfig.join(os.EOL)); index = loginTemplate.indexOf(" a.btn.btn-block.btn-linkedin.btn-social(href='/auth/linkedin')"); loginTemplate.splice(index, 3); fs.writeFileSync('views/account/login.jade', loginTemplate.join(os.EOL)); index = profileTemplate.indexOf(' if user.linkedin'); profileTemplate.splice(index - 1, 5); fs.writeFileSync('views/account/profile.jade', profileTemplate.join(os.EOL)); index = userModel.indexOf(' linkedin: String,'); userModel.splice(index, 1); fs.writeFileSync('models/User.js', userModel.join(os.EOL)); index = app.indexOf("app.get('/auth/linkedin', passport.authenticate('linkedin', { state: 'SOME STATE' }));"); app.splice(index, 4); fs.writeFileSync('app.js', app.join(os.EOL)); } index = passportConfig.indexOf("var InstagramStrategy = require('passport-instagram').Strategy;"); if (instagramCheckbox.checked && index !== -1) { passportConfig.splice(index, 1); index = passportConfig.indexOf('// Sign in with Instagram.'); passportConfig.splice(index, 43); fs.writeFileSync('config/passport.js', passportConfig.join(os.EOL)); index = loginTemplate.indexOf(" a.btn.btn-block.btn-instagram.btn-social(href='/auth/instagram')"); loginTemplate.splice(index, 3); fs.writeFileSync('views/account/login.jade', loginTemplate.join(os.EOL)); index = profileTemplate.indexOf(' if user.instagram'); profileTemplate.splice(index - 1, 5); fs.writeFileSync('views/account/profile.jade', profileTemplate.join(os.EOL)); index = app.indexOf("app.get('/auth/instagram', passport.authenticate('instagram'));"); app.splice(index, 4); fs.writeFileSync('app.js', app.join(os.EOL)); userModel.splice(index, 1); fs.writeFileSync('models/User.js', userModel.join(os.EOL)); } home.remove(authForm); home.append(success); success.setContent('Selected authentication providers have been removed from passportConfig.js, User.js, app.js, login.jade and profile.jade!'); success.focus(); screen.render(); }); var authText = blessed.text({ parent: authForm, content: 'Selecting a checkbox removes an authentication provider. If authentication provider is already removed, no action will be taken.', padding: 1, bg: 'magenta', fg: 'white' }); var facebookCheckbox = blessed.checkbox({ parent: authForm, top: 6, mouse: true, fg: 'white', bg: 'blue', content: 'Facebook' }); var githubCheckbox = blessed.checkbox({ parent: authForm, top: 7, mouse: true, fg: 'white', bg: 'blue', content: 'GitHub' }); var googleCheckbox = blessed.checkbox({ parent: authForm, top: 8, mouse: true, fg: 'white', bg: 'blue', content: 'Google' }); var twitterCheckbox = blessed.checkbox({ parent: authForm, top: 9, mouse: true, fg: 'white', bg: 'blue', content: 'Twitter' }); var linkedinCheckbox = blessed.checkbox({ parent: authForm, top: 10, mouse: true, fg: 'white', bg: 'blue', content: 'LinkedIn' }); var instagramCheckbox = blessed.checkbox({ parent: authForm, top: 11, mouse: true, fg: 'white', bg: 'blue', content: 'Instagram' }); var authSubmit = blessed.button({ parent: authForm, top: 13, mouse: true, shrink: true, name: 'submit', content: ' SUBMIT ', style: { fg: 'blue', bg: 'white', focus: { fg: 'white', bg: 'red' } } }); authSubmit.on('press', function() { authForm.submit(); }); var authCancel = blessed.button({ parent: authForm, top: 13, left: 9, mouse: true, shrink: true, name: 'cancel', content: ' CANCEL ', style: { fg: 'blue', bg: 'white', focus: { fg: 'white', bg: 'red' } } }); authCancel.on('press', function() { home.focus(); home.remove(authForm); screen.render(); }); var emailForm = blessed.form({ mouse: true, keys: true, fg: 'white', bg: 'blue', padding: { left: 1, right: 1 } }); emailForm.on('submit', function() { var contactCtrl = fs.readFileSync('controllers/contact.js').toString().split(os.EOL); var userCtrl = fs.readFileSync('controllers/user.js').toString().split(os.EOL); var choice = null; if (sendgridRadio.checked) { choice = 'SendGrid'; } else if (mailgunRadio.checked) { choice = 'Mailgun'; } else if (mandrillRadio.checked) { choice = 'Mandrill'; } var index = contactCtrl.indexOf('var transporter = nodemailer.createTransport({'); contactCtrl.splice(index + 1, 1, " service: '" + choice + "',"); contactCtrl.splice(index + 3, 1, ' user: secrets.' + choice.toLowerCase() +'.user,'); contactCtrl.splice(index + 4, 1, ' pass: secrets.' + choice.toLowerCase() + '.password'); fs.writeFileSync('controllers/contact.js', contactCtrl.join(os.EOL)); index = userCtrl.indexOf(' var transporter = nodemailer.createTransport({'); userCtrl.splice(index + 1, 1, " service: '" + choice + "',"); userCtrl.splice(index + 3, 1, ' user: secrets.' + choice.toLowerCase() + '.user,'); userCtrl.splice(index + 4, 1, ' pass: secrets.' + choice.toLowerCase() + '.password'); index = userCtrl.indexOf(' var transporter = nodemailer.createTransport({', (index + 1)); userCtrl.splice(index + 1, 1, " service: '" + choice + "',"); userCtrl.splice(index + 3, 1, ' user: secrets.' + choice.toLowerCase() + '.user,'); userCtrl.splice(index + 4, 1, ' pass: secrets.' + choice.toLowerCase() + '.password'); fs.writeFileSync('controllers/user.js', userCtrl.join(os.EOL)); home.remove(emailForm); home.append(success); success.setContent('Email Service has been switched to ' + choice); success.focus(); screen.render(); }); var emailText = blessed.text({ parent: emailForm, content: 'Select one of the following email service providers for {underline}contact form{/underline} and {underline}password reset{/underline}.', padding: 1, bg: 'red', fg: 'white', tags: true }); var sendgridRadio = blessed.radiobutton({ parent: emailForm, top: 5, checked: true, mouse: true, fg: 'white', bg: 'blue', content: 'SendGrid' }); var mailgunRadio = blessed.radiobutton({ parent: emailForm, top: 6, mouse: true, fg: 'white', bg: 'blue', content: 'Mailgun' }); var mandrillRadio = blessed.radiobutton({ parent: emailForm, top: 7, mouse: true, fg: 'white', bg: 'blue', content: 'Mandrill' }); var emailSubmit = blessed.button({ parent: emailForm, top: 9, mouse: true, shrink: true, name: 'submit', content: ' SUBMIT ', style: { fg: 'blue', bg: 'white', focus: { fg: 'white', bg: 'red' } } }); emailSubmit.on('press', function() { emailForm.submit(); }); var emailCancel = blessed.button({ parent: emailForm, top: 9, left: 9, mouse: true, shrink: true, name: 'cancel', content: ' CANCEL ', style: { fg: 'blue', bg: 'white', focus: { fg: 'white', bg: 'red' } } }); emailCancel.on('press', function() { home.focus(); home.remove(emailForm); screen.render(); }); home.on('select', function(child, index) { switch (index) { case 0: home.append(authForm); authForm.focus(); screen.render(); break; case 1: home.append(emailForm); emailForm.focus(); break; case 2: addClusterSupport(); home.append(success); success.setContent('New file {underline}cluster_app.js{/underline} has been created. Your app is now able to use more than 1 CPU by running {underline}node cluster_app.js{/underline}, which in turn spawns multiple instances of {underline}app.js{/underline}'); success.focus(); screen.render(); break; default: process.exit(0); } }); screen.render(); function addClusterSupport() { var fileContents = multiline(function() { /* var os = require('os'); var cluster = require('cluster'); cluster.setupMaster({ exec: 'app.js' }); cluster.on('exit', function(worker) { console.log('worker ' + worker.id + ' died'); cluster.fork(); }); for (var i = 0; i < os.cpus().length; i++) { cluster.fork(); } */ }); fs.writeFileSync('cluster_app.js', fileContents); }
import Vue from 'vue'; import store from '~/ide/stores'; import List from '~/ide/components/merge_requests/list.vue'; import { createComponentWithStore } from '../../../helpers/vue_mount_component_helper'; import { mergeRequests } from '../../mock_data'; import { resetStore } from '../../helpers'; describe('IDE merge requests list', () => { const Component = Vue.extend(List); let vm; beforeEach(() => { vm = createComponentWithStore(Component, store, {}); spyOn(vm, 'fetchMergeRequests'); vm.$mount(); }); afterEach(() => { vm.$destroy(); resetStore(vm.$store); }); it('calls fetch on mounted', () => { expect(vm.fetchMergeRequests).toHaveBeenCalledWith({ search: '', type: '', }); }); it('renders loading icon', done => { vm.$store.state.mergeRequests.isLoading = true; vm.$nextTick(() => { expect(vm.$el.querySelector('.loading-container')).not.toBe(null); done(); }); }); it('renders no search results text when search is not empty', done => { vm.search = 'testing'; vm.$nextTick(() => { expect(vm.$el.textContent).toContain('No merge requests found'); done(); }); }); it('clicking on search type, sets currentSearchType and loads merge requests', done => { vm.onSearchFocus(); vm.$nextTick() .then(() => { vm.$el.querySelector('li button').click(); return vm.$nextTick(); }) .then(() => { expect(vm.currentSearchType).toEqual(vm.$options.searchTypes[0]); expect(vm.fetchMergeRequests).toHaveBeenCalledWith({ type: vm.currentSearchType.type, search: '', }); }) .then(done) .catch(done.fail); }); describe('with merge requests', () => { beforeEach(done => { vm.$store.state.mergeRequests.mergeRequests.push({ ...mergeRequests[0], projectPathWithNamespace: 'gitlab-org/gitlab-ce', }); vm.$nextTick(done); }); it('renders list', () => { expect(vm.$el.querySelectorAll('li').length).toBe(1); expect(vm.$el.querySelector('li').textContent).toContain(mergeRequests[0].title); }); }); describe('searchMergeRequests', () => { beforeEach(() => { spyOn(vm, 'loadMergeRequests'); jasmine.clock().install(); }); afterEach(() => { jasmine.clock().uninstall(); }); it('calls loadMergeRequests on input in search field', () => { const event = new Event('input'); vm.$el.querySelector('input').dispatchEvent(event); jasmine.clock().tick(300); expect(vm.loadMergeRequests).toHaveBeenCalled(); }); }); describe('onSearchFocus', () => { it('shows search types', done => { vm.$el.querySelector('input').dispatchEvent(new Event('focus')); expect(vm.hasSearchFocus).toBe(true); expect(vm.showSearchTypes).toBe(true); vm.$nextTick() .then(() => { const expectedSearchTypes = vm.$options.searchTypes.map(x => x.label); const renderedSearchTypes = Array.from(vm.$el.querySelectorAll('li')).map(x => x.textContent.trim(), ); expect(renderedSearchTypes).toEqual(expectedSearchTypes); }) .then(done) .catch(done.fail); }); it('does not show search types, if already has search value', () => { vm.search = 'lorem ipsum'; vm.$el.querySelector('input').dispatchEvent(new Event('focus')); expect(vm.hasSearchFocus).toBe(true); expect(vm.showSearchTypes).toBe(false); }); it('does not show search types, if already has a search type', () => { vm.currentSearchType = {}; vm.$el.querySelector('input').dispatchEvent(new Event('focus')); expect(vm.hasSearchFocus).toBe(true); expect(vm.showSearchTypes).toBe(false); }); it('resets hasSearchFocus when search changes', done => { vm.hasSearchFocus = true; vm.search = 'something else'; vm.$nextTick() .then(() => { expect(vm.hasSearchFocus).toBe(false); }) .then(done) .catch(done.fail); }); }); });
/* eslint max-len: 0 */ import find from "lodash/find"; import findLast from "lodash/findLast"; import isInteger from "lodash/isInteger"; import repeat from "lodash/repeat"; import Buffer from "./buffer"; import * as n from "./node"; import Whitespace from "./whitespace"; import * as t from "babel-types"; const SCIENTIFIC_NOTATION = /e/i; const ZERO_DECIMAL_INTEGER = /\.0+$/; const NON_DECIMAL_LITERAL = /^0[box]/; export type Format = { shouldPrintComment: (comment: string) => boolean; retainLines: boolean; comments: boolean; auxiliaryCommentBefore: string; auxiliaryCommentAfter: string; compact: boolean | "auto"; minified: boolean; quotes: "single" | "double"; concise: boolean; indent: { adjustMultilineComment: boolean; style: string; base: number; } }; export default class Printer { constructor(format, map, tokens) { this.format = format || {}; this._buf = new Buffer(map); this._whitespace = tokens.length > 0 ? new Whitespace(tokens) : null; } format: Format; inForStatementInitCounter: number = 0; _buf: Buffer; _whitespace: Whitespace; _printStack: Array<Node> = []; _indent: number = 0; _insideAux: boolean = false; _printedCommentStarts: Object = {}; _parenPushNewlineState: ?Object = null; _printAuxAfterOnNextUserNode: boolean = false; _printedComments: WeakSet = new WeakSet(); _endsWithInteger = false; _endsWithWord = false; generate(ast) { this.print(ast); this._maybeAddAuxComment(); return this._buf.get(); } /** * Increment indent size. */ indent(): void { if (this.format.compact || this.format.concise) return; this._indent++; } /** * Decrement indent size. */ dedent(): void { if (this.format.compact || this.format.concise) return; this._indent--; } /** * Add a semicolon to the buffer. */ semicolon(force: boolean = false): void { this._maybeAddAuxComment(); this._append(";", !force /* queue */); } /** * Add a right brace to the buffer. */ rightBrace(): void { if (this.format.minified) { this._buf.removeLastSemicolon(); } this.token("}"); } /** * Add a space to the buffer unless it is compact. */ space(force: boolean = false): void { if (this.format.compact) return; if ((this._buf.hasContent() && !this.endsWith(" ") && !this.endsWith("\n")) || force) { this._space(); } } /** * Writes a token that can't be safely parsed without taking whitespace into account. */ word(str: string): void { if (this._endsWithWord) this._space(); this._maybeAddAuxComment(); this._append(str); this._endsWithWord = true; } /** * Writes a number token so that we can validate if it is an integer. */ number(str: string): void { this.word(str); // Integer tokens need special handling because they cannot have '.'s inserted // immediately after them. this._endsWithInteger = isInteger(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str[str.length - 1] !== "."; } /** * Writes a simple token. */ token(str: string): void { // space is mandatory to avoid outputting <!-- // http://javascript.spec.whatwg.org/#comment-syntax if ((str === "--" && this.endsWith("!")) || // Need spaces for operators of the same kind to avoid: `a+++b` (str[0] === "+" && this.endsWith("+")) || (str[0] === "-" && this.endsWith("-")) || // Needs spaces to avoid changing '34' to '34.', which would still be a valid number. (str[0] === "." && this._endsWithInteger)) { this._space(); } this._maybeAddAuxComment(); this._append(str); } /** * Add a newline (or many newlines), maintaining formatting. */ newline(i?: number): void { if (this.format.retainLines || this.format.compact) return; if (this.format.concise) { this.space(); return; } // never allow more than two lines if (this.endsWith("\n\n")) return; if (typeof i !== "number") i = 1; i = Math.min(2, i); if (this.endsWith("{\n") || this.endsWith(":\n")) i--; if (i <= 0) return; for (let j = 0; j < i; j++) { this._newline(); } } endsWith(str: string): boolean { return this._buf.endsWith(str); } removeTrailingNewline(): void { this._buf.removeTrailingNewline(); } source(prop: string, loc: Object): void { this._catchUp(prop, loc); this._buf.source(prop, loc); } withSource(prop: string, loc: Object, cb: () => void): void { this._catchUp(prop, loc); this._buf.withSource(prop, loc, cb); } _space(): void { this._append(" ", true /* queue */); } _newline(): void { this._append("\n", true /* queue */); } _append(str: string, queue: boolean = false) { this._maybeAddParen(str); this._maybeIndent(str); if (queue) this._buf.queue(str); else this._buf.append(str); this._endsWithWord = false; this._endsWithInteger = false; } _maybeIndent(str: string): void { // we've got a newline before us so prepend on the indentation if (this._indent && this.endsWith("\n") && str[0] !== "\n") { this._buf.queue(this._getIndent()); } } _maybeAddParen(str: string): void { // see startTerminatorless() instance method let parenPushNewlineState = this._parenPushNewlineState; if (!parenPushNewlineState) return; this._parenPushNewlineState = null; let i; for (i = 0; i < str.length && str[i] === " "; i++) continue; if (i === str.length) return; const cha = str[i]; if (cha === "\n" || cha === "/") { // we're going to break this terminator expression so we need to add a parentheses this.token("("); this.indent(); parenPushNewlineState.printed = true; } } _catchUp(prop: string, loc: Object) { if (!this.format.retainLines) return; // catch up to this nodes newline if we're behind const pos = loc ? loc[prop] : null; if (pos && pos.line !== null) { const count = pos.line - this._buf.getCurrentLine(); for (let i = 0; i < count; i++) { this._newline(); } } } /** * Get the current indent. */ _getIndent(): string { return repeat(this.format.indent.style, this._indent); } /** * Set some state that will be modified if a newline has been inserted before any * non-space characters. * * This is to prevent breaking semantics for terminatorless separator nodes. eg: * * return foo; * * returns `foo`. But if we do: * * return * foo; * * `undefined` will be returned and not `foo` due to the terminator. */ startTerminatorless(): Object { return this._parenPushNewlineState = { printed: false }; } /** * Print an ending parentheses if a starting one has been printed. */ endTerminatorless(state: Object) { if (state.printed) { this.dedent(); this.newline(); this.token(")"); } } print(node, parent) { if (!node) return; let oldConcise = this.format.concise; if (node._compact) { this.format.concise = true; } let printMethod = this[node.type]; if (!printMethod) { throw new ReferenceError(`unknown node of type ${JSON.stringify(node.type)} with constructor ${JSON.stringify(node && node.constructor.name)}`); } this._printStack.push(node); let oldInAux = this._insideAux; this._insideAux = !node.loc; this._maybeAddAuxComment(this._insideAux && !oldInAux); let needsParens = n.needsParens(node, parent, this._printStack); if (needsParens) this.token("("); this._printLeadingComments(node, parent); let loc = (t.isProgram(node) || t.isFile(node)) ? null : node.loc; this.withSource("start", loc, () => { this[node.type](node, parent); }); this._printTrailingComments(node, parent); if (needsParens) this.token(")"); // end this._printStack.pop(); this.format.concise = oldConcise; this._insideAux = oldInAux; } _maybeAddAuxComment(enteredPositionlessNode) { if (enteredPositionlessNode) this._printAuxBeforeComment(); if (!this._insideAux) this._printAuxAfterComment(); } _printAuxBeforeComment() { if (this._printAuxAfterOnNextUserNode) return; this._printAuxAfterOnNextUserNode = true; const comment = this.format.auxiliaryCommentBefore; if (comment) { this._printComment({ type: "CommentBlock", value: comment }); } } _printAuxAfterComment() { if (!this._printAuxAfterOnNextUserNode) return; this._printAuxAfterOnNextUserNode = false; const comment = this.format.auxiliaryCommentAfter; if (comment) { this._printComment({ type: "CommentBlock", value: comment }); } } getPossibleRaw(node) { if (this.format.minified) return; let extra = node.extra; if (extra && extra.raw != null && extra.rawValue != null && node.value === extra.rawValue) { return extra.raw; } } printJoin(nodes: ?Array, parent: Object, opts = {}) { if (!nodes || !nodes.length) return; if (opts.indent) this.indent(); const newlineOpts = { addNewlines: opts.addNewlines, }; for (let i = 0; i < nodes.length; i++) { const node = nodes[i]; if (!node) continue; if (opts.statement) this._printNewline(true, node, parent, newlineOpts); this.print(node, parent); if (opts.iterator) { opts.iterator(node, i); } if (opts.separator && i < nodes.length - 1) { opts.separator.call(this); } if (opts.statement) this._printNewline(false, node, parent, newlineOpts); } if (opts.indent) this.dedent(); } printAndIndentOnComments(node, parent) { let indent = !!node.leadingComments; if (indent) this.indent(); this.print(node, parent); if (indent) this.dedent(); } printBlock(parent) { let node = parent.body; if (!t.isEmptyStatement(node)) { this.space(); } this.print(node, parent); } _printTrailingComments(node, parent) { this._printComments(this._getComments(false, node, parent)); } _printLeadingComments(node, parent) { this._printComments(this._getComments(true, node, parent)); } printInnerComments(node, indent = true) { if (!node.innerComments) return; if (indent) this.indent(); this._printComments(node.innerComments); if (indent) this.dedent(); } printSequence(nodes, parent, opts = {}) { opts.statement = true; return this.printJoin(nodes, parent, opts); } printList(items, parent, opts = {}) { if (opts.separator == null) { opts.separator = commaSeparator; } return this.printJoin(items, parent, opts); } _printNewline(leading, node, parent, opts) { // Fast path since 'this.newline' does nothing when not tracking lines. if (this.format.retainLines || this.format.compact) return; // Fast path for concise since 'this.newline' just inserts a space when // concise formatting is in use. if (this.format.concise) { this.space(); return; } let lines = 0; if (node.start != null && !node._ignoreUserWhitespace && this._whitespace) { // user node if (leading) { const comments = node.leadingComments; const comment = comments && find(comments, (comment) => !!comment.loc && this.format.shouldPrintComment(comment.value)); lines = this._whitespace.getNewlinesBefore(comment || node); } else { const comments = node.trailingComments; const comment = comments && findLast(comments, (comment) => !!comment.loc && this.format.shouldPrintComment(comment.value)); lines = this._whitespace.getNewlinesAfter(comment || node); } } else { // generated node if (!leading) lines++; // always include at least a single line after if (opts.addNewlines) lines += opts.addNewlines(leading, node) || 0; let needs = n.needsWhitespaceAfter; if (leading) needs = n.needsWhitespaceBefore; if (needs(node, parent)) lines++; // generated nodes can't add starting file whitespace if (!this._buf.hasContent()) lines = 0; } this.newline(lines); } _getComments(leading, node) { // Note, we use a boolean flag here instead of passing in the attribute name as it is faster // because this is called extremely frequently. return (node && (leading ? node.leadingComments : node.trailingComments)) || []; } _printComment(comment) { if (!this.format.shouldPrintComment(comment.value)) return; // Some plugins use this to mark comments as removed using the AST-root 'comments' property, // where they can't manually mutate the AST node comment lists. if (comment.ignore) return; if (this._printedComments.has(comment)) return; this._printedComments.add(comment); if (comment.start != null) { if (this._printedCommentStarts[comment.start]) return; this._printedCommentStarts[comment.start] = true; } // whitespace before this.newline(this._whitespace ? this._whitespace.getNewlinesBefore(comment) : 0); if (!this.endsWith("[") && !this.endsWith("{")) this.space(); let val = comment.type === "CommentLine" ? `//${comment.value}\n` : `/*${comment.value}*/`; // if (comment.type === "CommentBlock" && this.format.indent.adjustMultilineComment) { let offset = comment.loc && comment.loc.start.column; if (offset) { let newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g"); val = val.replace(newlineRegex, "\n"); } let indentSize = Math.max(this._getIndent().length, this._buf.getCurrentColumn()); val = val.replace(/\n(?!$)/g, `\n${repeat(" ", indentSize)}`); } this.withSource("start", comment.loc, () => { this._append(val); }); // whitespace after this.newline((this._whitespace ? this._whitespace.getNewlinesAfter(comment) : 0) + // Subtract one to account for the line force-added above. (comment.type === "CommentLine" ? -1 : 0)); } _printComments(comments?: Array<Object>) { if (!comments || !comments.length) return; for (let comment of comments) { this._printComment(comment); } } } function commaSeparator() { this.token(","); this.space(); } for (let generator of [ require("./generators/template-literals"), require("./generators/expressions"), require("./generators/statements"), require("./generators/classes"), require("./generators/methods"), require("./generators/modules"), require("./generators/types"), require("./generators/flow"), require("./generators/base"), require("./generators/jsx") ]) { Object.assign(Printer.prototype, generator); }
/** * @author alteredq / http://alteredqualia.com/ * @author mrdoob / http://mrdoob.com/ * @author WestLangley / http://github.com/WestLangley */ import { Vector3 } from '../math/Vector3.js'; import { Object3D } from '../core/Object3D.js'; import { LineSegments } from '../objects/LineSegments.js'; import { LineBasicMaterial } from '../materials/LineBasicMaterial.js'; import { Float32BufferAttribute } from '../core/BufferAttribute.js'; import { BufferGeometry } from '../core/BufferGeometry.js'; var _vector = new Vector3(); function SpotLightHelper( light, color ) { Object3D.call( this ); this.light = light; this.light.updateMatrixWorld(); this.matrix = light.matrixWorld; this.matrixAutoUpdate = false; this.color = color; var geometry = new BufferGeometry(); var positions = [ 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, - 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, - 1, 1 ]; for ( var i = 0, j = 1, l = 32; i < l; i ++, j ++ ) { var p1 = ( i / l ) * Math.PI * 2; var p2 = ( j / l ) * Math.PI * 2; positions.push( Math.cos( p1 ), Math.sin( p1 ), 1, Math.cos( p2 ), Math.sin( p2 ), 1 ); } geometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) ); var material = new LineBasicMaterial( { fog: false, toneMapped: false } ); this.cone = new LineSegments( geometry, material ); this.add( this.cone ); this.update(); } SpotLightHelper.prototype = Object.create( Object3D.prototype ); SpotLightHelper.prototype.constructor = SpotLightHelper; SpotLightHelper.prototype.dispose = function () { this.cone.geometry.dispose(); this.cone.material.dispose(); }; SpotLightHelper.prototype.update = function () { this.light.updateMatrixWorld(); var coneLength = this.light.distance ? this.light.distance : 1000; var coneWidth = coneLength * Math.tan( this.light.angle ); this.cone.scale.set( coneWidth, coneWidth, coneLength ); _vector.setFromMatrixPosition( this.light.target.matrixWorld ); this.cone.lookAt( _vector ); if ( this.color !== undefined ) { this.cone.material.color.set( this.color ); } else { this.cone.material.color.copy( this.light.color ); } }; export { SpotLightHelper };
(function() { window.samples.todo_lighted_spinning_cube = { initialize: function(canvas) { var scene = new THREE.Scene(); var camera = new THREE.PerspectiveCamera( 30, sample_defaults.width / sample_defaults.height, 1, 1000 ); camera.position.set(0, 3, 7); camera.lookAt( new THREE.Vector3(0,0,0)); var scale = 2.5; var geometry = new THREE.CubeGeometry( scale, scale, scale ); var material = new THREE.MeshPhongMaterial({ color: 0xdddddd }); var mesh = new THREE.Mesh( geometry, material ); scene.add( mesh ); // ASSIGNMENT var directionalLight = new THREE.DirectionalLight ( 0xffffffff ); directionalLight.position.set(0, 3, 7); scene.add( directionalLight ); // ASSIGNMENT var renderer = new THREE.WebGLRenderer({canvas: canvas, antialias: true}); renderer.setSize( sample_defaults.width, sample_defaults.height ); var instance = { active: false }; function animate() { requestAnimationFrame( animate, canvas ); if(!instance.active || sample_defaults.paused) return; mesh.rotation.y += 0.008; renderer.render( scene, camera ); } animate(); return instance; } }; })();
angular.module('IntrepidJS').directive('ngShare', ['$location', 'i18n', function($location, i18n) { return { restrict: "E", template: "<div class='btn-group'><span data-toggle='dropdown' " + "class='dropdown-toggle pointer'> " + "<i class='fa fa-share-alt fa-fw'></i></span>" + "<ul role='menu' class='dropdown-menu'></ul></div>", replace: true, link: function ($scope, element, attrs) { var path = $location.absUrl().replace($location.url(), ''); var ul = angular.element(element).find('ul'); var doAll = function () { var items = angular.copy(share_widgets); var text = attrs.text ? attrs.text : document.title; var link = attrs.link ? path + attrs.link : $location.absUrl(); ul.empty(); _.each(items, function(w) { w.link = w.link.replace('@text', encodeURIComponent(text)); w.link = w.link.replace('@link', encodeURIComponent(link)); var li = "<li><a href='" + w.link + "' target='_blank'>" + "<i class='" + w.icon + " fa-fw'></i>&nbsp; " + "<span>" + i18n.__('Share on') + " " + w.name + "</span></a></li>"; ul.append(li); }); }; attrs.$observe('text', function(text) { if (text) doAll(); }); attrs.$observe('link', function(link) { if (link) doAll(); }); } }; }]);
module.exports = require('regenerate')().addRange(0x700, 0x70D).addRange(0x70F, 0x74A).addRange(0x74D, 0x74F).addRange(0x860, 0x86A);
module.exports={A:{A:{"2":"H D G E A FB","132":"B"},B:{"1":"C p z J L N I"},C:{"2":"4 aB YB","4":"0 2 3 5 6 8 9 H D G E A B C p z J L N I O P Q R S T U V W X Y Z a c d e f g h i j k l m n o M q r s t u v w x y CB AB","8":"F K SB"},D:{"2":"F K H","4":"0 2 3 5 6 8 9 D G E A B C p z J L N I O P Q R S T U V W X Y Z a c d e f g h i j k l m n o M q r s t u v w x y CB AB MB cB GB b HB IB JB KB"},E:{"2":"1 F K H D G E A B C LB DB NB OB PB QB RB TB"},F:{"2":"1 E B C UB VB WB XB BB ZB EB","4":"2 J L N I O P Q R S T U V W X Y Z a c d e f g h i j k l m n o M q r s t u v w x y"},G:{"2":"DB bB","4":"7 G C dB eB fB gB hB iB jB kB lB mB"},H:{"2":"nB"},I:{"2":"oB pB qB","4":"4 7 F b rB sB tB"},J:{"2":"D","4":"A"},K:{"1":"C EB","2":"1 A B BB","4":"M"},L:{"4":"b"},M:{"4":"0"},N:{"1":"B","2":"A"},O:{"4":"uB"},P:{"4":"F K vB wB"},Q:{"4":"xB"},R:{"4":"yB"}},B:4,C:"DeviceOrientation & DeviceMotion events"};
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ 'use strict'; const msRest = require('ms-rest'); const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; /** * Retrieve the statistics for the account. * * @param {string} resourceGroupName The resource group name. * * @param {string} automationAccountName The automation account name. * * @param {object} [options] Optional Parameters. * * @param {string} [options.filter] The filter to apply on the operation. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} callback - The callback. * * @returns {function} callback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link StatisticsListResult} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ function _listByAutomationAccount(resourceGroupName, automationAccountName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { callback = options; options = null; } if (!callback) { throw new Error('callback cannot be null.'); } let filter = (options && options.filter !== undefined) ? options.filter : undefined; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); } } if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); } if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { throw new Error('filter must be of type string.'); } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } } catch (error) { return callback(error); } // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/statistics'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; if (filter !== null && filter !== undefined) { queryParameters.push('$filter=' + encodeURIComponent(filter)); } queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } // Create HTTP transport objects let httpRequest = new WebResource(); httpRequest.method = 'GET'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; if (this.client.generateClientRequestId) { httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); } if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { httpRequest.headers['accept-language'] = this.client.acceptLanguage; } if(options) { for(let headerName in options['customHeaders']) { if (options['customHeaders'].hasOwnProperty(headerName)) { httpRequest.headers[headerName] = options['customHeaders'][headerName]; } } } httpRequest.body = null; // Send Request return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } let statusCode = response.statusCode; if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); error.response = msRest.stripResponse(response); if (responseBody === '') responseBody = null; let parsedErrorResponse; try { parsedErrorResponse = JSON.parse(responseBody); if (parsedErrorResponse) { let internalError = null; if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; error.code = internalError ? internalError.code : parsedErrorResponse.code; error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + `- "${responseBody}" for the default response.`; return callback(error); } return callback(error); } // Create Result let result = null; if (responseBody === '') responseBody = null; // Deserialize Response if (statusCode === 200) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { let resultMapper = new client.models['StatisticsListResult']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); deserializationError.request = msRest.stripRequest(httpRequest); deserializationError.response = msRest.stripResponse(response); return callback(deserializationError); } } return callback(null, result, httpRequest, response); }); } /** Class representing a StatisticsOperations. */ class StatisticsOperations { /** * Create a StatisticsOperations. * @param {AutomationClient} client Reference to the service client. */ constructor(client) { this.client = client; this._listByAutomationAccount = _listByAutomationAccount; } /** * Retrieve the statistics for the account. * * @param {string} resourceGroupName The resource group name. * * @param {string} automationAccountName The automation account name. * * @param {object} [options] Optional Parameters. * * @param {string} [options.filter] The filter to apply on the operation. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<StatisticsListResult>} - The deserialized result object. * * @reject {Error} - The error object. */ listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * Retrieve the statistics for the account. * * @param {string} resourceGroupName The resource group name. * * @param {string} automationAccountName The automation account name. * * @param {object} [options] Optional Parameters. * * @param {string} [options.filter] The filter to apply on the operation. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {StatisticsListResult} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link StatisticsListResult} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); } } } module.exports = StatisticsOperations;