summaryrefslogtreecommitdiffstats
path: root/3rdparty
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-03-21 16:35:12 +0100
committerBernhard Posselt <nukeawhale@gmail.com>2013-03-21 16:35:12 +0100
commit634dadbe551044fcb2789cc29238af4da52fd2dd (patch)
tree0f3459d41d21f4d128bfe0d5d9a8053ef9d3002c /3rdparty
parentbc7b72cc46cb047d76f4d2a976a81d1b904f0072 (diff)
removed moved libs
Diffstat (limited to '3rdparty')
-rw-r--r--3rdparty/Pimple/Pimple.php202
-rw-r--r--3rdparty/js/angular-ui/.gitignore3
-rw-r--r--3rdparty/js/angular-ui/.travis.yml10
-rw-r--r--3rdparty/js/angular-ui/angular-ui.js1316
-rw-r--r--3rdparty/js/angular/angular.js14406
-rw-r--r--3rdparty/js/jasmine-1.2.0/MIT.LICENSE20
-rw-r--r--3rdparty/js/jasmine-1.2.0/jasmine-html.js616
-rw-r--r--3rdparty/js/jasmine-1.2.0/jasmine.css81
-rw-r--r--3rdparty/js/jasmine-1.2.0/jasmine.js2529
-rw-r--r--3rdparty/js/moment.min.js6
10 files changed, 0 insertions, 19189 deletions
diff --git a/3rdparty/Pimple/Pimple.php b/3rdparty/Pimple/Pimple.php
deleted file mode 100644
index cb1acd5e0..000000000
--- a/3rdparty/Pimple/Pimple.php
+++ /dev/null
@@ -1,202 +0,0 @@
-<?php
-
-/*
- * This file is part of Pimple.
- *
- * Copyright (c) 2009 Fabien Potencier
- *
- * 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.
- */
-
-/**
- * Pimple main class.
- *
- * @package pimple
- * @author Fabien Potencier
- */
-class Pimple implements ArrayAccess
-{
- private $values;
-
- /**
- * Instantiate the container.
- *
- * Objects and parameters can be passed as argument to the constructor.
- *
- * @param array $values The parameters or objects.
- */
- public function __construct (array $values = array())
- {
- $this->values = $values;
- }
-
- /**
- * Sets a parameter or an object.
- *
- * Objects must be defined as Closures.
- *
- * Allowing any PHP callable leads to difficult to debug problems
- * as function names (strings) are callable (creating a function with
- * the same a name as an existing parameter would break your container).
- *
- * @param string $id The unique identifier for the parameter or object
- * @param mixed $value The value of the parameter or a closure to defined an object
- */
- public function offsetSet($id, $value)
- {
- $this->values[$id] = $value;
- }
-
- /**
- * Gets a parameter or an object.
- *
- * @param string $id The unique identifier for the parameter or object
- *
- * @return mixed The value of the parameter or an object
- *
- * @throws InvalidArgumentException if the identifier is not defined
- */
- public function offsetGet($id)
- {
- if (!array_key_exists($id, $this->values)) {
- throw new InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
- }
-
- $isFactory = is_object($this->values[$id]) && method_exists($this->values[$id], '__invoke');
-
- return $isFactory ? $this->values[$id]($this) : $this->values[$id];
- }
-
- /**
- * Checks if a parameter or an object is set.
- *
- * @param string $id The unique identifier for the parameter or object
- *
- * @return Boolean
- */
- public function offsetExists($id)
- {
- return array_key_exists($id, $this->values);
- }
-
- /**
- * Unsets a parameter or an object.
- *
- * @param string $id The unique identifier for the parameter or object
- */
- public function offsetUnset($id)
- {
- unset($this->values[$id]);
- }
-
- /**
- * Returns a closure that stores the result of the given closure for
- * uniqueness in the scope of this instance of Pimple.
- *
- * @param Closure $callable A closure to wrap for uniqueness
- *
- * @return Closure The wrapped closure
- */
- public function share(Closure $callable)
- {
- return function ($c) use ($callable) {
- static $object;
-
- if (null === $object) {
- $object = $callable($c);
- }
-
- return $object;
- };
- }
-
- /**
- * Protects a callable from being interpreted as a service.
- *
- * This is useful when you want to store a callable as a parameter.
- *
- * @param Closure $callable A closure to protect from being evaluated
- *
- * @return Closure The protected closure
- */
- public function protect(Closure $callable)
- {
- return function ($c) use ($callable) {
- return $callable;
- };
- }
-
- /**
- * Gets a parameter or the closure defining an object.
- *
- * @param string $id The unique identifier for the parameter or object
- *
- * @return mixed The value of the parameter or the closure defining an object
- *
- * @throws InvalidArgumentException if the identifier is not defined
- */
- public function raw($id)
- {
- if (!array_key_exists($id, $this->values)) {
- throw new InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
- }
-
- return $this->values[$id];
- }
-
- /**
- * Extends an object definition.
- *
- * Useful when you want to extend an existing object definition,
- * without necessarily loading that object.
- *
- * @param string $id The unique identifier for the object
- * @param Closure $callable A closure to extend the original
- *
- * @return Closure The wrapped closure
- *
- * @throws InvalidArgumentException if the identifier is not defined
- */
- public function extend($id, Closure $callable)
- {
- if (!array_key_exists($id, $this->values)) {
- throw new InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
- }
-
- $factory = $this->values[$id];
-
- if (!($factory instanceof Closure)) {
- throw new InvalidArgumentException(sprintf('Identifier "%s" does not contain an object definition.', $id));
- }
-
- return $this->values[$id] = function ($c) use ($callable, $factory) {
- return $callable($factory($c), $c);
- };
- }
-
- /**
- * Returns all defined value names.
- *
- * @return array An array of value names
- */
- public function keys()
- {
- return array_keys($this->values);
- }
-}
diff --git a/3rdparty/js/angular-ui/.gitignore b/3rdparty/js/angular-ui/.gitignore
deleted file mode 100644
index 0dd3b7486..000000000
--- a/3rdparty/js/angular-ui/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-node_modules
-*.coffee.js
-.idea \ No newline at end of file
diff --git a/3rdparty/js/angular-ui/.travis.yml b/3rdparty/js/angular-ui/.travis.yml
deleted file mode 100644
index 549e24a85..000000000
--- a/3rdparty/js/angular-ui/.travis.yml
+++ /dev/null
@@ -1,10 +0,0 @@
- language: node_js
- node_js:
- - "0.8"
-
- before_script:
- - export DISPLAY=:99.0
- - sh -e /etc/init.d/xvfb start
- - npm install -g grunt@0.3.x testacular@0.2.x
-
- script: "grunt" \ No newline at end of file
diff --git a/3rdparty/js/angular-ui/angular-ui.js b/3rdparty/js/angular-ui/angular-ui.js
deleted file mode 100644
index 235587081..000000000
--- a/3rdparty/js/angular-ui/angular-ui.js
+++ /dev/null
@@ -1,1316 +0,0 @@
-/**
- * AngularUI - The companion suite for AngularJS
- * @version v0.3.2 - 2012-12-04
- * @link http://angular-ui.github.com
- * @license MIT License, http://www.opensource.org/licenses/MIT
- */
-
-
-angular.module('ui.config', []).value('ui.config', {});
-angular.module('ui.filters', ['ui.config']);
-angular.module('ui.directives', ['ui.config']);
-angular.module('ui', ['ui.filters', 'ui.directives', 'ui.config']);
-
-/*
- jQuery UI Sortable plugin wrapper
-
- @param [ui-sortable] {object} Options to pass to $.fn.sortable() merged onto ui.config
-*/
-
-angular.module('ui.directives').directive('uiSortable', [
- 'ui.config', function(uiConfig) {
- var options;
- options = {};
- if (uiConfig.sortable != null) {
- angular.extend(options, uiConfig.sortable);
- }
- return {
- require: '?ngModel',
- link: function(scope, element, attrs, ngModel) {
- var onStart, onUpdate, opts, _start, _update;
- opts = angular.extend({}, options, scope.$eval(attrs.uiOptions));
- if (ngModel != null) {
- onStart = function(e, ui) {
- return ui.item.data('ui-sortable-start', ui.item.index());
- };
- onUpdate = function(e, ui) {
- var end, start;
- start = ui.item.data('ui-sortable-start');
- end = ui.item.index();
- ngModel.$modelValue.splice(end, 0, ngModel.$modelValue.splice(start, 1)[0]);
- return scope.$apply();
- };
- _start = opts.start;
- opts.start = function(e, ui) {
- onStart(e, ui);
- if (typeof _start === "function") {
- _start(e, ui);
- }
- return scope.$apply();
- };
- _update = opts.update;
- opts.update = function(e, ui) {
- onUpdate(e, ui);
- if (typeof _update === "function") {
- _update(e, ui);
- }
- return scope.$apply();
- };
- }
- return element.sortable(opts);
- }
- };
- }
-]);
-
-/**
- * General-purpose jQuery wrapper. Simply pass the plugin name as the expression.
- *
- * It is possible to specify a default set of parameters for each jQuery plugin.
- * Under the jq key, namespace each plugin by that which will be passed to ui-jq.
- * Unfortunately, at this time you can only pre-define the first parameter.
- * @example { jq : { datepicker : { showOn:'click' } } }
- *
- * @param ui-jq {string} The $elm.[pluginName]() to call.
- * @param [ui-options] {mixed} Expression to be evaluated and passed as options to the function
- * Multiple parameters can be separated by commas
- * Set {ngChange:false} to disable passthrough support for change events ( since angular watches 'input' events, not 'change' events )
- *
- * @example <input ui-jq="datepicker" ui-options="{showOn:'click'},secondParameter,thirdParameter">
- */
-angular.module('ui.directives').directive('uiJq', ['ui.config', function (uiConfig) {
- return {
- restrict: 'A',
- compile: function (tElm, tAttrs) {
- if (!angular.isFunction(tElm[tAttrs.uiJq])) {
- throw new Error('ui-jq: The "' + tAttrs.uiJq + '" function does not exist');
- }
- var options = uiConfig.jq && uiConfig.jq[tAttrs.uiJq];
- return function (scope, elm, attrs) {
- var linkOptions = [], ngChange = 'change';
-
- if (attrs.uiOptions) {
- linkOptions = scope.$eval('[' + attrs.uiOptions + ']');
- if (angular.isObject(options) && angular.isObject(linkOptions[0])) {
- linkOptions[0] = angular.extend(options, linkOptions[0]);
- }
- } else if (options) {
- linkOptions = [options];
- }
- if (attrs.ngModel && elm.is('select,input,textarea')) {
- if (linkOptions && angular.isObject(linkOptions[0]) && linkOptions[0].ngChange !== undefined) {
- ngChange = linkOptions[0].ngChange;
- }
- if (ngChange) {
- elm.on(ngChange, function () {
- elm.trigger('input');
- });
- }
- }
- elm[attrs.uiJq].apply(elm, linkOptions);
- };
- }
- };
-}]);
-
-/**
- * General-purpose Event binding. Bind any event not natively supported by Angular
- * Pass an object with keynames for events to ui-event
- * Allows $event object and $params object to be passed
- *
- * @example <input ui-event="{ focus : 'counter++', blur : 'someCallback()' }">
- * @example <input ui-event="{ myCustomEvent : 'myEventHandler($event, $params)'}">
- *
- * @param ui-event {string|object literal} The event to bind to as a string or a hash of events with their callbacks
- */
-angular.module('ui.directives').directive('uiEvent', ['$parse',
- function ($parse) {
- return function (scope, elm, attrs) {
- var events = scope.$eval(attrs.uiEvent);
- angular.forEach(events, function (uiEvent, eventName) {
- var fn = $parse(uiEvent);
- elm.bind(eventName, function (evt) {
- var params = Array.prototype.slice.call(arguments);
- //Take out first paramater (event object);
- params = params.splice(1);
- scope.$apply(function () {
- fn(scope, {$event: evt, $params: params});
- });
- });
- });
- };
- }]);
-
-/*
- Attaches jquery-ui input mask onto input element
- */
-angular.module('ui.directives').directive('uiMask', [
- function () {
- return {
- require:'ngModel',
- link:function ($scope, element, attrs, controller) {
-
- /* We override the render method to run the jQuery mask plugin
- */
- controller.$render = function () {
- var value = controller.$viewValue || '';
- element.val(value);
- element.mask($scope.$eval(attrs.uiMask));
- };
-
- /* Add a parser that extracts the masked value into the model but only if the mask is valid
- */
- controller.$parsers.push(function (value) {
- //the second check (or) is only needed due to the fact that element.isMaskValid() will keep returning undefined
- //until there was at least one key event
- var isValid = element.isMaskValid() || angular.isUndefined(element.isMaskValid()) && element.val().length>0;
- controller.$setValidity('mask', isValid);
- return isValid ? value : undefined;
- });
-
- /* When keyup, update the view value
- */
- element.bind('keyup', function () {
- $scope.$apply(function () {
- controller.$setViewValue(element.mask());
- });
- });
- }
- };
- }
-]);
-
-angular.module('ui.directives')
-.directive('uiModal', ['$timeout', function($timeout) {
- return {
- restrict: 'EAC',
- require: 'ngModel',
- link: function(scope, elm, attrs, model) {
- //helper so you don't have to type class="modal hide"
- elm.addClass('modal hide');
- elm.on( 'shown', function() {
- elm.find( "[autofocus]" ).focus();
- });
- scope.$watch(attrs.ngModel, function(value) {
- elm.modal(value && 'show' || 'hide');
- });
- //If bootstrap animations are enabled, listen to 'shown' and 'hidden' events
- elm.on(jQuery.support.transition && 'shown' || 'show', function() {
- $timeout(function() {
- model.$setViewValue(true);
- });
- });
- elm.on(jQuery.support.transition && 'hidden' || 'hide', function() {
- $timeout(function() {
- model.$setViewValue(false);
- });
- });
- }
- };
-}]);
-/**
- * Add a clear button to form inputs to reset their value
- */
-angular.module('ui.directives').directive('uiReset', ['ui.config', function (uiConfig) {
- var resetValue = null;
- if (uiConfig.reset !== undefined)
- resetValue = uiConfig.reset;
- return {
- require: 'ngModel',
- link: function (scope, elm, attrs, ctrl) {
- var aElement;
- aElement = angular.element('<a class="ui-reset" />');
- elm.wrap('<span class="ui-resetwrap" />').after(aElement);
- aElement.bind('click', function (e) {
- e.preventDefault();
- scope.$apply(function () {
- if (attrs.uiReset)
- ctrl.$setViewValue(scope.$eval(attrs.uiReset));
- else
- ctrl.$setViewValue(resetValue);
- ctrl.$render();
- });
- });
- }
- };
-}]);
-
-(function () {
- var app = angular.module('ui.directives');
-
- //Setup map events from a google map object to trigger on a given element too,
- //then we just use ui-event to catch events from an element
- function bindMapEvents(scope, eventsStr, googleObject, element) {
- angular.forEach(eventsStr.split(' '), function (eventName) {
- //Prefix all googlemap events with 'map-', so eg 'click'
- //for the googlemap doesn't interfere with a normal 'click' event
- var $event = { type: 'map-' + eventName };
- google.maps.event.addListener(googleObject, eventName, function (evt) {
- element.trigger(angular.extend({}, $event, evt));
- //We create an $apply if it isn't happening. we need better support for this
- //We don't want to use timeout because tons of these events fire at once,
- //and we only need one $apply
- if (!scope.$$phase) scope.$apply();
- });
- });
- }
-
- app.directive('uiMap',
- ['ui.config', '$parse', function (uiConfig, $parse) {
-
- var mapEvents = 'bounds_changed center_changed click dblclick drag dragend ' +
- 'dragstart heading_changed idle maptypeid_changed mousemove mouseout ' +
- 'mouseover projection_changed resize rightclick tilesloaded tilt_changed ' +
- 'zoom_changed';
- var options = uiConfig.map || {};
-
- return {
- restrict: 'A',
- //doesn't work as E for unknown reason
- link: function (scope, elm, attrs) {
- var opts = angular.extend({}, options, scope.$eval(attrs.uiOptions));
- var map = new google.maps.Map(elm[0], opts);
- var model = $parse(attrs.uiMap);
-
- //Set scope variable for the map
- model.assign(scope, map);
-
- bindMapEvents(scope, mapEvents, map, elm);
- }
- };
- }]);
-
- app.directive('uiMapInfoWindow',
- ['ui.config', '$parse', '$compile', function (uiConfig, $parse, $compile) {
-
- var infoWindowEvents = 'closeclick content_change domready ' +
- 'position_changed zindex_changed';
- var options = uiConfig.mapInfoWindow || {};
-
- return {
- link: function (scope, elm, attrs) {
- var opts = angular.extend({}, options, scope.$eval(attrs.uiOptions));
- opts.content = elm[0];
- var model = $parse(attrs.uiMapInfoWindow);
- var infoWindow = model(scope);
-
- if (!infoWindow) {
- infoWindow = new google.maps.InfoWindow(opts);
- model.assign(scope, infoWindow);
- }
-
- bindMapEvents(scope, infoWindowEvents, infoWindow, elm);
-
- /* The info window's contents dont' need to be on the dom anymore,
- google maps has them stored. So we just replace the infowindow element
- with an empty div. (we don't just straight remove it from the dom because
- straight removing things from the dom can mess up angular) */
- elm.replaceWith('<div></div>');
-
- //Decorate infoWindow.open to $compile contents before opening
- var _open = infoWindow.open;
- infoWindow.open = function open(a1, a2, a3, a4, a5, a6) {
- $compile(elm.contents())(scope);
- _open.call(infoWindow, a1, a2, a3, a4, a5, a6);
- };
- }
- };
- }]);
-
- /*
- * Map overlay directives all work the same. Take map marker for example
- * <ui-map-marker="myMarker"> will $watch 'myMarker' and each time it changes,
- * it will hook up myMarker's events to the directive dom element. Then
- * ui-event will be able to catch all of myMarker's events. Super simple.
- */
- function mapOverlayDirective(directiveName, events) {
- app.directive(directiveName, [function () {
- return {
- restrict: 'A',
- link: function (scope, elm, attrs) {
- scope.$watch(attrs[directiveName], function (newObject) {
- bindMapEvents(scope, events, newObject, elm);
- });
- }
- };
- }]);
- }
-
- mapOverlayDirective('uiMapMarker',
- 'animation_changed click clickable_changed cursor_changed ' +
- 'dblclick drag dragend draggable_changed dragstart flat_changed icon_changed ' +
- 'mousedown mouseout mouseover mouseup position_changed rightclick ' +
- 'shadow_changed shape_changed title_changed visible_changed zindex_changed');
-
- mapOverlayDirective('uiMapPolyline',
- 'click dblclick mousedown mousemove mouseout mouseover mouseup rightclick');
-
- mapOverlayDirective('uiMapPolygon',
- 'click dblclick mousedown mousemove mouseout mouseover mouseup rightclick');
-
- mapOverlayDirective('uiMapRectangle',
- 'bounds_changed click dblclick mousedown mousemove mouseout mouseover ' +
- 'mouseup rightclick');
-
- mapOverlayDirective('uiMapCircle',
- 'center_changed click dblclick mousedown mousemove ' +
- 'mouseout mouseover mouseup radius_changed rightclick');
-
- mapOverlayDirective('uiMapGroundOverlay',
- 'click dblclick');
-
-})();
-angular.module('ui.directives').factory('keypressHelper', ['$parse', function keypress($parse){
- var keysByCode = {
- 8: 'backspace',
- 9: 'tab',
- 13: 'enter',
- 27: 'esc',
- 32: 'space',
- 33: 'pageup',
- 34: 'pagedown',
- 35: 'end',
- 36: 'home',
- 37: 'left',
- 38: 'up',
- 39: 'right',
- 40: 'down',
- 45: 'insert',
- 46: 'delete'
- };
-
- var capitaliseFirstLetter = function (string) {
- return string.charAt(0).toUpperCase() + string.slice(1);
- };
-
- return function(mode, scope, elm, attrs) {
- var params, combinations = [];
- params = scope.$eval(attrs['ui'+capitaliseFirstLetter(mode)]);
-
- // Prepare combinations for simple checking
- angular.forEach(params, function (v, k) {
- var combination, expression;
- expression = $parse(v);
-
- angular.forEach(k.split(' '), function(variation) {
- combination = {
- expression: expression,
- keys: {}
- };
- angular.forEach(variation.split('-'), function (value) {
- combination.keys[value] = true;
- });
- combinations.push(combination);
- });
- });
-
- // Check only matching of pressed keys one of the conditions
- elm.bind(mode, function (event) {
- // No need to do that inside the cycle
- var altPressed = event.metaKey || event.altKey;
- var ctrlPressed = event.ctrlKey;
- var shiftPressed = event.shiftKey;
- var keyCode = event.keyCode;
-
- // normalize keycodes
- if (mode === 'keypress' && !shiftPressed && keyCode >= 97 && keyCode <= 122) {
- keyCode = keyCode - 32;
- }
-
- // Iterate over prepared combinations
- angular.forEach(combinations, function (combination) {
-
- var mainKeyPressed = (combination.keys[keysByCode[event.keyCode]] || combination.keys[event.keyCode.toString()]) || false;
-
- var altRequired = combination.keys.alt || false;
- var ctrlRequired = combination.keys.ctrl || false;
- var shiftRequired = combination.keys.shift || false;
-
- if (
- mainKeyPressed &&
- ( altRequired == altPressed ) &&
- ( ctrlRequired == ctrlPressed ) &&
- ( shiftRequired == shiftPressed )
- ) {
- // Run the function
- scope.$apply(function () {
- combination.expression(scope, { '$event': event });
- });
- }
- });
- });
- };
-}]);
-
-/**
- * Bind one or more handlers to particular keys or their combination
- * @param hash {mixed} keyBindings Can be an object or string where keybinding expression of keys or keys combinations and AngularJS Exspressions are set. Object syntax: "{ keys1: expression1 [, keys2: expression2 [ , ... ]]}". String syntax: ""expression1 on keys1 [ and expression2 on keys2 [ and ... ]]"". Expression is an AngularJS Expression, and key(s) are dash-separated combinations of keys and modifiers (one or many, if any. Order does not matter). Supported modifiers are 'ctrl', 'shift', 'alt' and key can be used either via its keyCode (13 for Return) or name. Named keys are 'backspace', 'tab', 'enter', 'esc', 'space', 'pageup', 'pagedown', 'end', 'home', 'left', 'up', 'right', 'down', 'insert', 'delete'.
- * @example <input ui-keypress="{enter:'x = 1', 'ctrl-shift-space':'foo()', 'shift-13':'bar()'}" /> <input ui-keypress="foo = 2 on ctrl-13 and bar('hello') on shift-esc" />
- **/
-angular.module('ui.directives').directive('uiKeydown', ['keypressHelper', function(keypressHelper){
- return {
- link: function (scope, elm, attrs) {
- keypressHelper('keydown', scope, elm, attrs);
- }
- };
-}]);
-
-angular.module('ui.directives').directive('uiKeypress', ['keypressHelper', function(keypressHelper){
- return {
- link: function (scope, elm, attrs) {
- keypressHelper('keypress', scope, elm, attrs);
- }
- };
-}]);
-
-angular.module('ui.directives').directive('uiKeyup', ['keypressHelper', function(keypressHelper){
- return {
- link: function (scope, elm, attrs) {
- keypressHelper('keyup', scope, elm, attrs);
- }
- };
-}]);
-/**
- * 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 ui-validate="myValidatorFunction">
- * @example <input ui-validate="{foo : validateFoo, bar : validateBar}">
- *
- * @param ui-validate {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.
- */
-angular.module('ui.directives').directive('uiValidate', function () {
-
- return {
- restrict: 'A',
- require: 'ngModel',
- link: function (scope, elm, attrs, ctrl) {
-
- var validateFn, validateExpr = attrs.uiValidate;
-
- validateExpr = scope.$eval(validateExpr);
- if (!validateExpr) {
- return;
- }
-
- if (angular.isFunction(validateExpr)) {
- validateExpr = { validator: validateExpr };
- }
-
- angular.forEach(validateExpr, function (validatorFn, key) {
- validateFn = function (valueToValidate) {
- if (validatorFn(valueToValidate)) {
- ctrl.$setValidity(key, true);
- return valueToValidate;
- } else {
- ctrl.$setValidity(key, false);
- return undefined;
- }
- };
- ctrl.$formatters.push(validateFn);
- ctrl.$parsers.push(validateFn);
- });
- }
- };
-});
-/**
- * Animates the injection of new DOM elements by simply creating the DOM with a class and then immediately removing it
- * Animations must be done using CSS3 transitions, but provide excellent flexibility
- *
- * @todo Add proper support for animating out
- * @param [options] {mixed} Can be an object with multiple options, or a string with the animation class
- * class {string} the CSS class(es) to use. For example, 'ui-hide' might be an excellent alternative class.
- * @example <li ng-repeat="item in items" ui-animate=" 'ui-hide' ">{{item}}</li>
- */
-angular.module('ui.directives').directive('uiAnimate', ['ui.config', '$timeout', function (uiConfig, $timeout) {
- var options = {};
- if (angular.isString(uiConfig.animate)) {
- options['class'] = uiConfig.animate;
- } else if (uiConfig.animate) {
- options = uiConfig.animate;
- }
- return {
- restrict: 'A', // supports using directive as element, attribute and class
- link: function ($scope, element, attrs) {
- var opts = {};
- if (attrs.uiAnimate) {
- opts = $scope.$eval(attrs.uiAnimate);
- if (angular.isString(opts)) {
- opts = {'class': opts};
- }
- }
- opts = angular.extend({'class': 'ui-animate'}, options, opts);
-
- element.addClass(opts['class']);
- $timeout(function () {
- element.removeClass(opts['class']);
- }, 20, false);
- }
- };
-}]);
-
-
-/**
- * Enhanced Select2 Dropmenus
- *
- * @AJAX Mode - When in this mode, your value will be an object (or array of objects) of the data used by Select2
- * This change is so that you do not have to do an additional query yourself on top of Select2's own query
- * @params [options] {object} The configuration options passed to $.fn.select2(). Refer to the documentation
- */
-angular.module('ui.directives').directive('uiSelect2', ['ui.config', '$http', function (uiConfig, $http) {
- var options = {};
- if (uiConfig.select2) {
- angular.extend(options, uiConfig.select2);
- }
- return {
- require: '?ngModel',
- compile: function (tElm, tAttrs) {
- var watch,
- repeatOption,
- repeatAttr,
- isSelect = tElm.is('select'),
- isMultiple = (tAttrs.multiple !== undefined);
-
- // Enable watching of the options dataset if in use
- if (tElm.is('select')) {
- repeatOption = tElm.find('option[ng-repeat], option[data-ng-repeat]');
-
- if (repeatOption.length) {
- repeatAttr = repeatOption.attr('ng-repeat') || repeatOption.attr('data-ng-repeat');
- watch = jQuery.trim(repeatAttr.split('|')[0]).split(' ').pop();
- }
- }
-
- return function (scope, elm, attrs, controller) {
- // instance-specific options
- var opts = angular.extend({}, options, scope.$eval(attrs.uiSelect2));
-
- if (isSelect) {
- // Use <select multiple> instead
- delete opts.multiple;
- delete opts.initSelection;
- } else if (isMultiple) {
- opts.multiple = true;
- }
-
- if (controller) {
- // Watch the model for programmatic changes
- controller.$render = function () {
- if (isSelect) {
- elm.select2('val', controller.$modelValue);
- } else {
- if (isMultiple && !controller.$modelValue) {
- elm.select2('data', []);
- } else {
- elm.select2('data', controller.$modelValue);
- }
- }
- };
-
-
- // Watch the options dataset for changes
- if (watch) {
- scope.$watch(watch, function (newVal, oldVal, scope) {
- if (!newVal) return;
- // Delayed so that the options have time to be rendered
- setTimeout(function () {
- elm.select2('val', controller.$viewValue);
- // Refresh angular to remove the superfluous option
- elm.trigger('change');
- });
- });
- }
-
- if (!isSelect) {
- // Set the view and model value and update the angular template manually for the ajax/multiple select2.
- elm.bind("change", function () {
- scope.$apply(function () {
- controller.$setViewValue(elm.select2('data'));
- });
- });
-
- if (opts.initSelection) {
- var initSelection = opts.initSelection;
- opts.initSelection = function (element, callback) {
- initSelection(element, function (value) {
- controller.$setViewValue(value);
- callback(value);
- });
- };
- }
- }
- }
-
- attrs.$observe('disabled', function (value) {
- elm.select2(value && 'disable' || 'enable');
- });
-
- scope.$watch(attrs.ngMultiple, function(newVal) {
- elm.select2(opts);
- });
-
- // Set initial value since Angular doesn't
- elm.val(scope.$eval(attrs.ngModel));
-
- // Initialize the plugin late so that the injected DOM does not disrupt the template compiler
- setTimeout(function () {
- elm.select2(opts);
- });
- };
- }
- };
-}]);
-
-/*global angular, CodeMirror, Error*/
-/**
- * Binds a CodeMirror widget to a <textarea> el