update Piwik to version 2.16 (fixes #91)
This commit is contained in:
parent
296343bf3b
commit
d885a4baa9
5833 changed files with 418860 additions and 226988 deletions
348
www/analytics/libs/bower_components/ngDialog/js/ngDialog.js
vendored
Normal file
348
www/analytics/libs/bower_components/ngDialog/js/ngDialog.js
vendored
Normal file
|
|
@ -0,0 +1,348 @@
|
|||
/*
|
||||
* ngDialog - easy modals and popup windows
|
||||
* http://github.com/likeastore/ngDialog
|
||||
* (c) 2013 MIT License, https://likeastore.com
|
||||
*/
|
||||
|
||||
(function (window, angular, undefined) {
|
||||
'use strict';
|
||||
|
||||
var module = angular.module('ngDialog', []);
|
||||
|
||||
var $el = angular.element;
|
||||
var isDef = angular.isDefined;
|
||||
var style = (document.body || document.documentElement).style;
|
||||
var animationEndSupport = isDef(style.animation) || isDef(style.WebkitAnimation) || isDef(style.MozAnimation) || isDef(style.MsAnimation) || isDef(style.OAnimation);
|
||||
var animationEndEvent = 'animationend webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend';
|
||||
var forceBodyReload = false;
|
||||
|
||||
module.provider('ngDialog', function () {
|
||||
var defaults = this.defaults = {
|
||||
className: 'ngdialog-theme-default',
|
||||
plain: false,
|
||||
showClose: true,
|
||||
closeByDocument: true,
|
||||
closeByEscape: true,
|
||||
appendTo: false
|
||||
};
|
||||
|
||||
this.setForceBodyReload = function (_useIt) {
|
||||
forceBodyReload = _useIt || false;
|
||||
};
|
||||
|
||||
this.setDefaults = function (newDefaults) {
|
||||
angular.extend(defaults, newDefaults);
|
||||
};
|
||||
|
||||
var globalID = 0, dialogsCount = 0, closeByDocumentHandler, defers = {};
|
||||
|
||||
this.$get = ['$document', '$templateCache', '$compile', '$q', '$http', '$rootScope', '$timeout', '$window', '$controller',
|
||||
function ($document, $templateCache, $compile, $q, $http, $rootScope, $timeout, $window, $controller) {
|
||||
var $body = $document.find('body');
|
||||
if (forceBodyReload) {
|
||||
$rootScope.$on('$locationChangeSuccess', function () {
|
||||
$body = $document.find('body');
|
||||
});
|
||||
}
|
||||
|
||||
var privateMethods = {
|
||||
onDocumentKeydown: function (event) {
|
||||
if (event.keyCode === 27) {
|
||||
publicMethods.close('$escape');
|
||||
}
|
||||
},
|
||||
|
||||
setBodyPadding: function (width) {
|
||||
var originalBodyPadding = parseInt(($body.css('padding-right') || 0), 10);
|
||||
$body.css('padding-right', (originalBodyPadding + width) + 'px');
|
||||
$body.data('ng-dialog-original-padding', originalBodyPadding);
|
||||
},
|
||||
|
||||
resetBodyPadding: function () {
|
||||
var originalBodyPadding = $body.data('ng-dialog-original-padding');
|
||||
if (originalBodyPadding) {
|
||||
$body.css('padding-right', originalBodyPadding + 'px');
|
||||
} else {
|
||||
$body.css('padding-right', '');
|
||||
}
|
||||
},
|
||||
|
||||
closeDialog: function ($dialog, value) {
|
||||
var id = $dialog.attr('id');
|
||||
if (typeof window.Hammer !== 'undefined') {
|
||||
window.Hammer($dialog[0]).off('tap', closeByDocumentHandler);
|
||||
} else {
|
||||
$dialog.unbind('click');
|
||||
}
|
||||
|
||||
if (dialogsCount === 1) {
|
||||
$body.unbind('keydown');
|
||||
}
|
||||
|
||||
if (!$dialog.hasClass("ngdialog-closing")){
|
||||
dialogsCount -= 1;
|
||||
}
|
||||
|
||||
if (animationEndSupport) {
|
||||
$dialog.unbind(animationEndEvent).bind(animationEndEvent, function () {
|
||||
$dialog.scope().$destroy();
|
||||
$dialog.remove();
|
||||
if (dialogsCount === 0) {
|
||||
$body.removeClass('ngdialog-open');
|
||||
privateMethods.resetBodyPadding();
|
||||
}
|
||||
$rootScope.$broadcast('ngDialog.closed', $dialog);
|
||||
}).addClass('ngdialog-closing');
|
||||
} else {
|
||||
$dialog.scope().$destroy();
|
||||
$dialog.remove();
|
||||
if (dialogsCount === 0) {
|
||||
$body.removeClass('ngdialog-open');
|
||||
privateMethods.resetBodyPadding();
|
||||
}
|
||||
$rootScope.$broadcast('ngDialog.closed', $dialog);
|
||||
}
|
||||
if (defers[id]) {
|
||||
defers[id].resolve({
|
||||
id: id,
|
||||
value: value,
|
||||
$dialog: $dialog,
|
||||
remainingDialogs: dialogsCount
|
||||
});
|
||||
delete defers[id];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var publicMethods = {
|
||||
|
||||
/*
|
||||
* @param {Object} options:
|
||||
* - template {String} - id of ng-template, url for partial, plain string (if enabled)
|
||||
* - plain {Boolean} - enable plain string templates, default false
|
||||
* - scope {Object}
|
||||
* - controller {String}
|
||||
* - className {String} - dialog theme class
|
||||
* - showClose {Boolean} - show close button, default true
|
||||
* - closeByEscape {Boolean} - default true
|
||||
* - closeByDocument {Boolean} - default true
|
||||
*
|
||||
* @return {Object} dialog
|
||||
*/
|
||||
open: function (opts) {
|
||||
var self = this;
|
||||
var options = angular.copy(defaults);
|
||||
|
||||
opts = opts || {};
|
||||
angular.extend(options, opts);
|
||||
|
||||
globalID += 1;
|
||||
|
||||
self.latestID = 'ngdialog' + globalID;
|
||||
|
||||
var defer;
|
||||
defers[self.latestID] = defer = $q.defer();
|
||||
|
||||
var scope = angular.isObject(options.scope) ? options.scope.$new() : $rootScope.$new();
|
||||
var $dialog, $dialogParent;
|
||||
|
||||
$q.when(loadTemplate(options.template)).then(function (template) {
|
||||
template = angular.isString(template) ?
|
||||
template :
|
||||
template.data && angular.isString(template.data) ?
|
||||
template.data :
|
||||
'';
|
||||
|
||||
$templateCache.put(options.template, template);
|
||||
|
||||
if (options.showClose) {
|
||||
template += '<div class="ngdialog-close"></div>';
|
||||
}
|
||||
|
||||
self.$result = $dialog = $el('<div id="ngdialog' + globalID + '" class="ngdialog"></div>');
|
||||
$dialog.html('<div class="ngdialog-overlay"></div><div class="ngdialog-content">' + template + '</div>');
|
||||
|
||||
if (options.data && angular.isString(options.data)) {
|
||||
var firstLetter = options.data.replace(/^\s*/, '')[0];
|
||||
scope.ngDialogData = (firstLetter === '{' || firstLetter === '[') ? angular.fromJson(options.data) : options.data;
|
||||
} else if (options.data && angular.isObject(options.data)) {
|
||||
scope.ngDialogData = angular.fromJson(angular.toJson(options.data));
|
||||
}
|
||||
|
||||
if (options.controller && (angular.isString(options.controller) || angular.isArray(options.controller) || angular.isFunction(options.controller))) {
|
||||
var controllerInstance = $controller(options.controller, {
|
||||
$scope: scope,
|
||||
$element: $dialog
|
||||
});
|
||||
$dialog.data('$ngDialogControllerController', controllerInstance);
|
||||
}
|
||||
|
||||
if (options.className) {
|
||||
$dialog.addClass(options.className);
|
||||
}
|
||||
|
||||
if (options.appendTo && angular.isString(options.appendTo)) {
|
||||
$dialogParent = angular.element(document.querySelector(options.appendTo));
|
||||
} else {
|
||||
$dialogParent = $body;
|
||||
}
|
||||
|
||||
scope.closeThisDialog = function (value) {
|
||||
privateMethods.closeDialog($dialog, value);
|
||||
};
|
||||
|
||||
$timeout(function () {
|
||||
$compile($dialog)(scope);
|
||||
|
||||
var widthDiffs = $window.innerWidth - $body.prop('clientWidth');
|
||||
$body.addClass('ngdialog-open');
|
||||
var scrollBarWidth = widthDiffs - ($window.innerWidth - $body.prop('clientWidth'));
|
||||
if (scrollBarWidth > 0) {
|
||||
privateMethods.setBodyPadding(scrollBarWidth);
|
||||
}
|
||||
$dialogParent.append($dialog);
|
||||
$rootScope.$broadcast('ngDialog.opened', $dialog);
|
||||
});
|
||||
|
||||
if (options.closeByEscape) {
|
||||
$body.bind('keydown', privateMethods.onDocumentKeydown);
|
||||
}
|
||||
|
||||
closeByDocumentHandler = function (event) {
|
||||
var isOverlay = options.closeByDocument ? $el(event.target).hasClass('ngdialog-overlay') : false;
|
||||
var isCloseBtn = $el(event.target).hasClass('ngdialog-close');
|
||||
|
||||
if (isOverlay || isCloseBtn) {
|
||||
publicMethods.close($dialog.attr('id'), isCloseBtn ? '$closeButton' : '$document');
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof window.Hammer !== 'undefined') {
|
||||
window.Hammer($dialog[0]).on('tap', closeByDocumentHandler);
|
||||
} else {
|
||||
$dialog.bind('click', closeByDocumentHandler);
|
||||
}
|
||||
|
||||
dialogsCount += 1;
|
||||
|
||||
return publicMethods;
|
||||
});
|
||||
|
||||
return {
|
||||
id: 'ngdialog' + globalID,
|
||||
closePromise: defer.promise,
|
||||
close: function(value) {
|
||||
privateMethods.closeDialog($dialog, value);
|
||||
}
|
||||
};
|
||||
|
||||
function loadTemplate (tmpl) {
|
||||
if (!tmpl) {
|
||||
return 'Empty template';
|
||||
}
|
||||
|
||||
if (angular.isString(tmpl) && options.plain) {
|
||||
return tmpl;
|
||||
}
|
||||
|
||||
return $templateCache.get(tmpl) || $http.get(tmpl, { cache: true });
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* @param {Object} options:
|
||||
* - template {String} - id of ng-template, url for partial, plain string (if enabled)
|
||||
* - plain {Boolean} - enable plain string templates, default false
|
||||
* - scope {Object}
|
||||
* - controller {String}
|
||||
* - className {String} - dialog theme class
|
||||
* - showClose {Boolean} - show close button, default true
|
||||
* - closeByEscape {Boolean} - default false
|
||||
* - closeByDocument {Boolean} - default false
|
||||
*
|
||||
* @return {Object} dialog
|
||||
*/
|
||||
openConfirm: function (opts) {
|
||||
var defer = $q.defer();
|
||||
|
||||
var options = {
|
||||
closeByEscape: false,
|
||||
closeByDocument: false
|
||||
};
|
||||
angular.extend(options, opts);
|
||||
|
||||
options.scope = angular.isObject(options.scope) ? options.scope.$new() : $rootScope.$new();
|
||||
options.scope.confirm = function (value) {
|
||||
defer.resolve(value);
|
||||
openResult.close(value);
|
||||
};
|
||||
|
||||
var openResult = publicMethods.open(options);
|
||||
openResult.closePromise.then(function (data) {
|
||||
if (data) {
|
||||
return defer.reject(data.value);
|
||||
}
|
||||
return defer.reject();
|
||||
});
|
||||
|
||||
return defer.promise;
|
||||
},
|
||||
|
||||
/*
|
||||
* @param {String} id
|
||||
* @return {Object} dialog
|
||||
*/
|
||||
close: function (id, value) {
|
||||
var $dialog = $el(document.getElementById(id));
|
||||
|
||||
if ($dialog.length) {
|
||||
privateMethods.closeDialog($dialog, value);
|
||||
} else {
|
||||
publicMethods.closeAll(value);
|
||||
}
|
||||
|
||||
return publicMethods;
|
||||
},
|
||||
|
||||
closeAll: function (value) {
|
||||
var $all = document.querySelectorAll('.ngdialog');
|
||||
|
||||
angular.forEach($all, function (dialog) {
|
||||
privateMethods.closeDialog($el(dialog), value);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return publicMethods;
|
||||
}];
|
||||
});
|
||||
|
||||
module.directive('ngDialog', ['ngDialog', function (ngDialog) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
scope : {
|
||||
ngDialogScope : '='
|
||||
},
|
||||
link: function (scope, elem, attrs) {
|
||||
elem.on('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var ngDialogScope = angular.isDefined(scope.ngDialogScope) ? scope.ngDialogScope : 'noScope';
|
||||
angular.isDefined(attrs.ngDialogClosePrevious) && ngDialog.close(attrs.ngDialogClosePrevious);
|
||||
|
||||
ngDialog.open({
|
||||
template: attrs.ngDialog,
|
||||
className: attrs.ngDialogClass,
|
||||
controller: attrs.ngDialogController,
|
||||
scope: ngDialogScope ,
|
||||
data: attrs.ngDialogData,
|
||||
showClose: attrs.ngDialogShowClose === 'false' ? false : true,
|
||||
closeByDocument: attrs.ngDialogCloseByDocument === 'false' ? false : true,
|
||||
closeByEscape: attrs.ngDialogCloseByEscape === 'false' ? false : true
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
}]);
|
||||
|
||||
})(window, window.angular);
|
||||
2
www/analytics/libs/bower_components/ngDialog/js/ngDialog.min.js
vendored
Normal file
2
www/analytics/libs/bower_components/ngDialog/js/ngDialog.min.js
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
/*! ng-dialog - v0.2.14 (https://github.com/likeastore/ngDialog) */
|
||||
!function(a,b){"use strict";var c=b.module("ngDialog",[]),d=b.element,e=b.isDefined,f=(document.body||document.documentElement).style,g=e(f.animation)||e(f.WebkitAnimation)||e(f.MozAnimation)||e(f.MsAnimation)||e(f.OAnimation),h="animationend webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend",i=!1;c.provider("ngDialog",function(){var c=this.defaults={className:"ngdialog-theme-default",plain:!1,showClose:!0,closeByDocument:!0,closeByEscape:!0,appendTo:!1};this.setForceBodyReload=function(a){i=a||!1},this.setDefaults=function(a){b.extend(c,a)};var e,f=0,j=0,k={};this.$get=["$document","$templateCache","$compile","$q","$http","$rootScope","$timeout","$window","$controller",function(l,m,n,o,p,q,r,s,t){var u=l.find("body");i&&q.$on("$locationChangeSuccess",function(){u=l.find("body")});var v={onDocumentKeydown:function(a){27===a.keyCode&&w.close("$escape")},setBodyPadding:function(a){var b=parseInt(u.css("padding-right")||0,10);u.css("padding-right",b+a+"px"),u.data("ng-dialog-original-padding",b)},resetBodyPadding:function(){var a=u.data("ng-dialog-original-padding");a?u.css("padding-right",a+"px"):u.css("padding-right","")},closeDialog:function(b,c){var d=b.attr("id");"undefined"!=typeof a.Hammer?a.Hammer(b[0]).off("tap",e):b.unbind("click"),1===j&&u.unbind("keydown"),b.hasClass("ngdialog-closing")||(j-=1),g?b.unbind(h).bind(h,function(){b.scope().$destroy(),b.remove(),0===j&&(u.removeClass("ngdialog-open"),v.resetBodyPadding()),q.$broadcast("ngDialog.closed",b)}).addClass("ngdialog-closing"):(b.scope().$destroy(),b.remove(),0===j&&(u.removeClass("ngdialog-open"),v.resetBodyPadding()),q.$broadcast("ngDialog.closed",b)),k[d]&&(k[d].resolve({id:d,value:c,$dialog:b,remainingDialogs:j}),delete k[d])}},w={open:function(g){function h(a){return a?b.isString(a)&&l.plain?a:m.get(a)||p.get(a,{cache:!0}):"Empty template"}var i=this,l=b.copy(c);g=g||{},b.extend(l,g),f+=1,i.latestID="ngdialog"+f;var x;k[i.latestID]=x=o.defer();var y,z,A=b.isObject(l.scope)?l.scope.$new():q.$new();return o.when(h(l.template)).then(function(c){if(c=b.isString(c)?c:c.data&&b.isString(c.data)?c.data:"",m.put(l.template,c),l.showClose&&(c+='<div class="ngdialog-close"></div>'),i.$result=y=d('<div id="ngdialog'+f+'" class="ngdialog"></div>'),y.html('<div class="ngdialog-overlay"></div><div class="ngdialog-content">'+c+"</div>"),l.data&&b.isString(l.data)){var g=l.data.replace(/^\s*/,"")[0];A.ngDialogData="{"===g||"["===g?b.fromJson(l.data):l.data}else l.data&&b.isObject(l.data)&&(A.ngDialogData=b.fromJson(b.toJson(l.data)));if(l.controller&&(b.isString(l.controller)||b.isArray(l.controller)||b.isFunction(l.controller))){var h=t(l.controller,{$scope:A,$element:y});y.data("$ngDialogControllerController",h)}return l.className&&y.addClass(l.className),z=l.appendTo&&b.isString(l.appendTo)?b.element(document.querySelector(l.appendTo)):u,A.closeThisDialog=function(a){v.closeDialog(y,a)},r(function(){n(y)(A);var a=s.innerWidth-u.prop("clientWidth");u.addClass("ngdialog-open");var b=a-(s.innerWidth-u.prop("clientWidth"));b>0&&v.setBodyPadding(b),z.append(y),q.$broadcast("ngDialog.opened",y)}),l.closeByEscape&&u.bind("keydown",v.onDocumentKeydown),e=function(a){var b=l.closeByDocument?d(a.target).hasClass("ngdialog-overlay"):!1,c=d(a.target).hasClass("ngdialog-close");(b||c)&&w.close(y.attr("id"),c?"$closeButton":"$document")},"undefined"!=typeof a.Hammer?a.Hammer(y[0]).on("tap",e):y.bind("click",e),j+=1,w}),{id:"ngdialog"+f,closePromise:x.promise,close:function(a){v.closeDialog(y,a)}}},openConfirm:function(a){var c=o.defer(),d={closeByEscape:!1,closeByDocument:!1};b.extend(d,a),d.scope=b.isObject(d.scope)?d.scope.$new():q.$new(),d.scope.confirm=function(a){c.resolve(a),e.close(a)};var e=w.open(d);return e.closePromise.then(function(a){return a?c.reject(a.value):c.reject()}),c.promise},close:function(a,b){var c=d(document.getElementById(a));return c.length?v.closeDialog(c,b):w.closeAll(b),w},closeAll:function(a){var c=document.querySelectorAll(".ngdialog");b.forEach(c,function(b){v.closeDialog(d(b),a)})}};return w}]}),c.directive("ngDialog",["ngDialog",function(a){return{restrict:"A",scope:{ngDialogScope:"="},link:function(c,d,e){d.on("click",function(d){d.preventDefault();var f=b.isDefined(c.ngDialogScope)?c.ngDialogScope:"noScope";b.isDefined(e.ngDialogClosePrevious)&&a.close(e.ngDialogClosePrevious),a.open({template:e.ngDialog,className:e.ngDialogClass,controller:e.ngDialogController,scope:f,data:e.ngDialogData,showClose:"false"===e.ngDialogShowClose?!1:!0,closeByDocument:"false"===e.ngDialogCloseByDocument?!1:!0,closeByEscape:"false"===e.ngDialogCloseByEscape?!1:!0})})}}}])}(window,window.angular);
|
||||
Loading…
Add table
Add a link
Reference in a new issue