summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolargo <nicolas@nicolargo.com>2017-01-07 15:56:32 +0100
committernicolargo <nicolas@nicolargo.com>2017-01-07 15:56:32 +0100
commit4223e21c1f5b82ee8c016fb99c4cee9e210a3edc (patch)
tree03ff4ead9828c1ce0a5990ed905ef2c6051c75aa
parent6b4219cea99f1d8068cdfe46f601bf2aee262e53 (diff)
parente259d32f021c7c34ae90ee026169d5f0857d9e2e (diff)
Merge branch 'develop' of https://github.com/nicolargo/glances into develop
-rw-r--r--glances/outputs/static/html/help.html4
-rw-r--r--glances/outputs/static/html/stats.html2
-rw-r--r--glances/outputs/static/js/controllers.js4
-rw-r--r--glances/outputs/static/public/help.html4
-rw-r--r--glances/outputs/static/public/js/main.min.js4
-rw-r--r--glances/outputs/static/public/js/vendor.min.js7083
-rw-r--r--glances/outputs/static/public/stats.html2
-rw-r--r--glances/plugins/glances_help.py5
8 files changed, 4296 insertions, 2812 deletions
diff --git a/glances/outputs/static/html/help.html b/glances/outputs/static/html/help.html
index ecb64150..f42a36ed 100644
--- a/glances/outputs/static/html/help.html
+++ b/glances/outputs/static/html/help.html
@@ -59,6 +59,10 @@
<div class="col-sm-12 col-lg-6">{{help.show_hide_irq}}</div>
</div>
<div class="row">
+ <div class="col-sm-12 col-lg-6">{{help.enable_disable_gpu}}</div>
+ <div class="col-sm-12 col-lg-6">{{help.enable_disable_mean_gpu}}</div>
+</div>
+<div class="row">
<div class="col-sm-12 col-lg-6">{{help.enable_disable_quick_look}}</div>
<div class="col-sm-12 col-lg-6"></div>
</div>
diff --git a/glances/outputs/static/html/stats.html b/glances/outputs/static/html/stats.html
index b0b021a1..cc5a2f38 100644
--- a/glances/outputs/static/html/stats.html
+++ b/glances/outputs/static/html/stats.html
@@ -35,7 +35,7 @@
<div class="col-sm-6 col-md-4 col-lg-3" ng-if="!arguments.disable_mem">
<section id="mem" class="plugin" ng-include src="'plugins/mem.html'"></section>
</div>
- <div class="hidden-xs hidden-sm col-md-4 col-lg-3" ng-if="!arguments.disable_mem && statsGpu.gpus.length == 0">
+ <div class="hidden-xs hidden-sm col-md-4 col-lg-3" ng-if="!arguments.disable_mem && !(!arguments.disable_gpu && statsGpu.gpus.length > 0)">
<section id="mem_more" class="plugin" ng-include src="'plugins/mem_more.html'"></section>
</div>
<div class="col-sm-6 col-md-4 col-lg-3" ng-if="!arguments.disable_memswap">
diff --git a/glances/outputs/static/js/controllers.js b/glances/outputs/static/js/controllers.js
index 6da7299e..7cc65165 100644
--- a/glances/outputs/static/js/controllers.js
+++ b/glances/outputs/static/js/controllers.js
@@ -184,6 +184,10 @@ glancesApp.controller('statsController', function ($scope, $rootScope, $interval
// 6 => Enable/disable mean gpu
$scope.arguments.meangpu = !$scope.arguments.meangpu;
break;
+ case $event.shiftKey && $event.keyCode == keycodes.g:
+ // G => Enable/disable gpu
+ $scope.arguments.disable_gpu = !$scope.arguments.disable_gpu;
+ break;
case $event.shiftKey && $event.keyCode == keycodes.FIVE:
$scope.arguments.disable_quicklook = !$scope.arguments.disable_quicklook;
$scope.arguments.disable_cpu = !$scope.arguments.disable_cpu;
diff --git a/glances/outputs/static/public/help.html b/glances/outputs/static/public/help.html
index ecb64150..f42a36ed 100644
--- a/glances/outputs/static/public/help.html
+++ b/glances/outputs/static/public/help.html
@@ -59,6 +59,10 @@
<div class="col-sm-12 col-lg-6">{{help.show_hide_irq}}</div>
</div>
<div class="row">
+ <div class="col-sm-12 col-lg-6">{{help.enable_disable_gpu}}</div>
+ <div class="col-sm-12 col-lg-6">{{help.enable_disable_mean_gpu}}</div>
+</div>
+<div class="row">
<div class="col-sm-12 col-lg-6">{{help.enable_disable_quick_look}}</div>
<div class="col-sm-12 col-lg-6"></div>
</div>
diff --git a/glances/outputs/static/public/js/main.min.js b/glances/outputs/static/public/js/main.min.js
index cd35183e..b89039d9 100644
--- a/glances/outputs/static/public/js/main.min.js
+++ b/glances/outputs/static/public/js/main.min.js
@@ -216,6 +216,10 @@ glancesApp.controller('statsController', ["$scope", "$rootScope", "$interval", "
// 6 => Enable/disable mean gpu
$scope.arguments.meangpu = !$scope.arguments.meangpu;
break;
+ case $event.shiftKey && $event.keyCode == keycodes.g:
+ // G => Enable/disable gpu
+ $scope.arguments.disable_gpu = !$scope.arguments.disable_gpu;
+ break;
case $event.shiftKey && $event.keyCode == keycodes.FIVE:
$scope.arguments.disable_quicklook = !$scope.arguments.disable_quicklook;
$scope.arguments.disable_cpu = !$scope.arguments.disable_cpu;
diff --git a/glances/outputs/static/public/js/vendor.min.js b/glances/outputs/static/public/js/vendor.min.js
index db4b128d..7c1b5af7 100644
--- a/glances/outputs/static/public/js/vendor.min.js
+++ b/glances/outputs/static/public/js/vendor.min.js
@@ -1,5 +1,5 @@
/**
- * @license AngularJS v1.5.8
+ * @license AngularJS v1.6.1
* (c) 2010-2016 Google, Inc. http://angularjs.org
* License: MIT
*/
@@ -57,7 +57,7 @@ function minErr(module, ErrorConstructor) {
return match;
});
- message += '\nhttp://errors.angularjs.org/1.5.8/' +
+ message += '\nhttp://errors.angularjs.org/1.6.1/' +
(module ? module + '/' : '') + code;
for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
@@ -69,99 +69,102 @@ function minErr(module, ErrorConstructor) {
};
}
-/* We need to tell jshint what variables are being exported */
-/* global angular: true,
- msie: true,
- jqLite: true,
- jQuery: true,
- slice: true,
- splice: true,
- push: true,
- toString: true,
- ngMinErr: true,
- angularModule: true,
- uid: true,
- REGEX_STRING_REGEXP: true,
- VALIDITY_STATE_PROPERTY: true,
-
- lowercase: true,
- uppercase: true,
- manualLowercase: true,
- manualUppercase: true,
- nodeName_: true,
- isArrayLike: true,
- forEach: true,
- forEachSorted: true,
- reverseParams: true,
- nextUid: true,
- setHashKey: true,
- extend: true,
- toInt: true,
- inherit: true,
- merge: true,
- noop: true,
- identity: true,
- valueFn: true,
- isUndefined: true,
- isDefined: true,
- isObject: true,
- isBlankObject: true,
- isString: true,
- isNumber: true,
- isDate: true,
- isArray: true,
- isFunction: true,
- isRegExp: true,
- isWindow: true,
- isScope: true,
- isFile: true,
- isFormData: true,
- isBlob: true,
- isBoolean: true,
- isPromiseLike: true,
- trim: true,
- escapeForRegexp: true,
- isElement: true,
- makeMap: true,
- includes: true,
- arrayRemove: true,
- copy: true,
- equals: true,
- csp: true,
- jq: true,
- concat: true,
- sliceArgs: true,
- bind: true,
- toJsonReplacer: true,
- toJson: true,
- fromJson: true,
- convertTimezoneToLocal: true,
- timezoneToOffset: true,
- startingTag: true,
- tryDecodeURIComponent: true,
- parseKeyValue: true,
- toKeyValue: true,
- encodeUriSegment: true,
- encodeUriQuery: true,
- angularInit: true,
- bootstrap: true,
- getTestability: true,
- snake_case: true,
- bindJQuery: true,
- assertArg: true,
- assertArgFn: true,
- assertNotHasOwnProperty: true,
- getter: true,
- getBlockNodes: true,
- hasOwnProperty: true,
- createMap: true,
-
- NODE_TYPE_ELEMENT: true,
- NODE_TYPE_ATTRIBUTE: true,
- NODE_TYPE_TEXT: true,
- NODE_TYPE_COMMENT: true,
- NODE_TYPE_DOCUMENT: true,
- NODE_TYPE_DOCUMENT_FRAGMENT: true,
+/* We need to tell ESLint what variables are being exported */
+/* exported
+ angular,
+ msie,
+ jqLite,
+ jQuery,
+ slice,
+ splice,
+ push,
+ toString,
+ ngMinErr,
+ angularModule,
+ uid,
+ REGEX_STRING_REGEXP,
+ VALIDITY_STATE_PROPERTY,
+
+ lowercase,
+ uppercase,
+ manualLowercase,
+ manualUppercase,
+ nodeName_,
+ isArrayLike,
+ forEach,
+ forEachSorted,
+ reverseParams,
+ nextUid,
+ setHashKey,
+ extend,
+ toInt,
+ inherit,
+ merge,
+ noop,
+ identity,
+ valueFn,
+ isUndefined,
+ isDefined,
+ isObject,
+ isBlankObject,
+ isString,
+ isNumber,
+ isNumberNaN,
+ isDate,
+ isArray,
+ isFunction,
+ isRegExp,
+ isWindow,
+ isScope,
+ isFile,
+ isFormData,
+ isBlob,
+ isBoolean,
+ isPromiseLike,
+ trim,
+ escapeForRegexp,
+ isElement,
+ makeMap,
+ includes,
+ arrayRemove,
+ copy,
+ equals,
+ csp,
+ jq,
+ concat,
+ sliceArgs,
+ bind,
+ toJsonReplacer,
+ toJson,
+ fromJson,
+ convertTimezoneToLocal,
+ timezoneToOffset,
+ startingTag,
+ tryDecodeURIComponent,
+ parseKeyValue,
+ toKeyValue,
+ encodeUriSegment,
+ encodeUriQuery,
+ angularInit,
+ bootstrap,
+ getTestability,
+ snake_case,
+ bindJQuery,
+ assertArg,
+ assertArgFn,
+ assertNotHasOwnProperty,
+ getter,
+ getBlockNodes,
+ hasOwnProperty,
+ createMap,
+ stringify,
+
+ NODE_TYPE_ELEMENT,
+ NODE_TYPE_ATTRIBUTE,
+ NODE_TYPE_TEXT,
+ NODE_TYPE_COMMENT,
+ NODE_TYPE_DOCUMENT,
+ NODE_TYPE_DOCUMENT_FRAGMENT
*/
////////////////////////////////////
@@ -188,23 +191,57 @@ var REGEX_STRING_REGEXP = /^\/(.+)\/([a-z]*)$/;
// This is used so that it's possible for internal tests to create mock ValidityStates.
var VALIDITY_STATE_PROPERTY = 'validity';
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
+/**
+ * @ngdoc function
+ * @name angular.lowercase
+ * @module ng
+ * @kind function
+ *
+ * @deprecated
+ * sinceVersion="1.5.0"
+ * removeVersion="1.7.0"
+ * Use [String.prototype.toLowerCase](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase) instead.
+ *
+ * @description Converts the specified string to lowercase.
+ * @param {string} string String to be converted to lowercase.
+ * @returns {string} Lowercased string.
+ */
var lowercase = function(string) {return isString(string) ? string.toLowerCase() : string;};
+
+/**
+ * @ngdoc function
+ * @name angular.uppercase
+ * @module ng
+ * @kind function
+ *
+ * @deprecated
+ * sinceVersion="1.5.0"
+ * removeVersion="1.7.0"
+ * Use [String.prototype.toUpperCase](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase) instead.
+ *
+ * @description Converts the specified string to uppercase.
+ * @param {string} string String to be converted to uppercase.
+ * @returns {string} Uppercased string.
+ */
var uppercase = function(string) {return isString(string) ? string.toUpperCase() : string;};
var manualLowercase = function(s) {
- /* jshint bitwise: false */
+ /* eslint-disable no-bitwise */
return isString(s)
? s.replace(/[A-Z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) | 32);})
: s;
+ /* eslint-enable */
};
var manualUppercase = function(s) {
- /* jshint bitwise: false */
+ /* eslint-disable no-bitwise */
return isString(s)
? s.replace(/[a-z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) & ~32);})
: s;
+ /* eslint-enable */
};
@@ -233,6 +270,7 @@ var
angularModule,
uid = 0;
+// Support: IE 9-11 only
/**
* documentMode is an IE-only property
* http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx
@@ -259,12 +297,12 @@ function isArrayLike(obj) {
// Support: iOS 8.2 (not reproducible in simulator)
// "length" in obj used to prevent JIT error (gh-11508)
- var length = "length" in Object(obj) && obj.length;
+ var length = 'length' in Object(obj) && obj.length;
// NodeList objects (with `item` method) and
// other objects with suitable length characteristics are array-like
return isNumber(length) &&
- (length >= 0 && ((length - 1) in obj || obj instanceof Array) || typeof obj.item == 'function');
+ (length >= 0 && ((length - 1) in obj || obj instanceof Array) || typeof obj.item === 'function');
}
@@ -308,9 +346,7 @@ function forEach(obj, iterator, context) {
if (obj) {
if (isFunction(obj)) {
for (key in obj) {
- // Need to check if hasOwnProperty exists,
- // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function
- if (key != 'prototype' && key != 'length' && key != 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {
+ if (key !== 'prototype' && key !== 'length' && key !== 'name' && obj.hasOwnProperty(key)) {
iterator.call(context, obj[key], key, obj);
}
}
@@ -479,6 +515,11 @@ function toInt(str) {
return parseInt(str, 10);
}
+var isNumberNaN = Number.isNaN || function isNumberNaN(num) {
+ // eslint-disable-next-line no-self-compare
+ return num !== num;
+};
+
function inherit(parent, extra) {
return extend(Object.create(parent), extra);
@@ -662,7 +703,7 @@ function isDate(value) {
* @kind function
*
* @description
- * Determines if a reference is an `Array`.
+ * Determines if a reference is an `Array`. Alias of Array.isArray.
*
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is an `Array`.
@@ -738,7 +779,7 @@ function isPromiseLike(obj) {
}
-var TYPED_ARRAY_REGEXP = /^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array\]$/;
+var TYPED_ARRAY_REGEXP = /^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array]$/;
function isTypedArray(value) {
return value && isNumber(value.length) && TYPED_ARRAY_REGEXP.test(toString.call(value));
}
@@ -756,8 +797,10 @@ var trim = function(value) {
// http://docs.closure-library.googlecode.com/git/local_closure_goog_string_string.js.source.html#line1021
// Prereq: s is a string.
var escapeForRegexp = function(s) {
- return s.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1').
- replace(/\x08/g, '\\x08');
+ return s
+ .replace(/([-()[\]{}+?*.$^|,:#<!\\])/g, '\\$1')
+ // eslint-disable-next-line no-control-regex
+ .replace(/\x08/g, '\\x08');
};
@@ -797,7 +840,7 @@ function nodeName_(element) {
}
function includes(array, obj) {
- return Array.prototype.indexOf.call(array, obj) != -1;
+ return Array.prototype.indexOf.call(array, obj) !== -1;
}
function arrayRemove(array, value) {
@@ -836,7 +879,7 @@ function arrayRemove(array, value) {
* @returns {*} The copy or updated `destination`, if `destination` was specified.
*
* @example
- <example module="copyExample">
+ <example module="copyExample" name="angular-copy">
<file name="index.html">
<div ng-controller="ExampleController">
<form novalidate class="simple-form">
@@ -879,10 +922,10 @@ function copy(source, destination) {
if (destination) {
if (isTypedArray(destination) || isArrayBuffer(destination)) {
- throw ngMinErr('cpta', "Can't copy! TypedArray destination cannot be mutated.");
+ throw ngMinErr('cpta', 'Can\'t copy! TypedArray destination cannot be mutated.');
}
if (source === destination) {
- throw ngMinErr('cpi', "Can't copy! Source and destination are identical.");
+ throw ngMinErr('cpi', 'Can\'t copy! Source and destination are identical.');
}
// Empty the destination object
@@ -948,7 +991,7 @@ function copy(source, destination) {
if (isWindow(source) || isScope(source)) {
throw ngMinErr('cpws',
- "Can't copy! Making copies of Window or Scope instances is not supported.");
+ 'Can\'t copy! Making copies of Window or Scope instances is not supported.');
}
var needsRecurse = false;
@@ -981,10 +1024,13 @@ function copy(source, destination) {
return new source.constructor(copyElement(source.buffer), source.byteOffset, source.length);
case '[object ArrayBuffer]':
- //Support: IE10
+ // Support: IE10
if (!source.slice) {
+ // If we're in this case we know the environment supports ArrayBuffer
+ /* eslint-disable no-undef */
var copied = new ArrayBuffer(source.byteLength);
new Uint8Array(copied).set(new Uint8Array(source));
+ /* eslint-enable */
return copied;
}
return source.slice(0);
@@ -996,7 +1042,7 @@ function copy(source, destination) {
return new source.constructor(source.valueOf());
case '[object RegExp]':
- var re = new RegExp(source.source, source.toString().match(/[^\/]*$/)[0]);
+ var re = new RegExp(source.source, source.toString().match(/[^/]*$/)[0]);
re.lastIndex = source.lastIndex;
return re;
@@ -1067,7 +1113,6 @@ function copy(source, destination) {
angular.module('equalsExample', []).controller('ExampleController', ['$scope', function($scope) {
$scope.user1 = {};
$scope.user2 = {};
- $scope.result;
$scope.compare = function() {
$scope.result = angular.equals($scope.user1, $scope.user2);
};
@@ -1078,12 +1123,13 @@ function copy(source, destination) {
function equals(o1, o2) {
if (o1 === o2) return true;
if (o1 === null || o2 === null) return false;
+ // eslint-disable-next-line no-self-compare
if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN
var t1 = typeof o1, t2 = typeof o2, length, key, keySet;
- if (t1 == t2 && t1 == 'object') {
+ if (t1 === t2 && t1 === 'object') {
if (isArray(o1)) {
if (!isArray(o2)) return false;
- if ((length = o1.length) == o2.length) {
+ if ((length = o1.length) === o2.length) {
for (key = 0; key < length; key++) {
if (!equals(o1[key], o2[key])) return false;
}
@@ -1094,7 +1140,7 @@ function equals(o1, o2) {
return equals(o1.getTime(), o2.getTime());
} else if (isRegExp(o1)) {
if (!isRegExp(o2)) return false;
- return o1.toString() == o2.toString();
+ return o1.toString() === o2.toString();
} else {
if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) ||
isArray(o2) || isDate(o2) || isRegExp(o2)) return false;
@@ -1142,9 +1188,8 @@ var csp = function() {
function noUnsafeEval() {
try {
- /* jshint -W031, -W054 */
+ // eslint-disable-next-line no-new, no-new-func
new Function('');
- /* jshint +W031, +W054 */
return false;
} catch (e) {
return true;
@@ -1196,7 +1241,8 @@ var jq = function() {
var i, ii = ngAttrPrefixes.length, prefix, name;
for (i = 0; i < ii; ++i) {
prefix = ngAttrPrefixes[i];
- if (el = window.document.querySelector('[' + prefix.replace(':', '\\:') + 'jq]')) {
+ el = window.document.querySelector('[' + prefix.replace(':', '\\:') + 'jq]');
+ if (el) {
name = el.getAttribute(prefix + 'jq');
break;
}
@@ -1214,7 +1260,6 @@ function sliceArgs(args, startIndex) {
}
-/* jshint -W101 */
/**
* @ngdoc function
* @name angular.bind
@@ -1232,7 +1277,6 @@ function sliceArgs(args, startIndex) {
* @param {...*} args Optional arguments to be prebound to the `fn` function call.
* @returns {function()} Function that wraps the `fn` with all the specified bindings.
*/
-/* jshint +W101 */
function bind(self, fn) {
var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];
if (isFunction(fn) && !(fn instanceof RegExp)) {
@@ -1281,7 +1325,7 @@ function toJsonReplacer(key, value) {
* Serializes input into a JSON-formatted string. Properties with leading $$ characters will be
* stripped since angular uses this notation internally.
*
- * @param {Object|Array|Date|string|number} obj Input to be serialized into JSON.
+ * @param {Object|Array|Date|string|number|boolean} obj Input to be serialized into JSON.
* @param {boolean|number} [pretty=2] If set to true, the JSON output will contain newlines and whitespace.
* If set to an integer, the JSON output will contain that many spaces per indentation.
* @returns {string|undefined} JSON-ified string representing `obj`.
@@ -1337,10 +1381,11 @@ function fromJson(json) {
var ALL_COLONS = /:/g;
function timezoneToOffset(timezone, fallback) {
+ // Support: IE 9-11 only, Edge 13-14+
// IE/Edge do not "understand" colon (`:`) in timezone
timezone = timezone.replace(ALL_COLONS, '');
var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
- return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
+ return isNumberNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
}
@@ -1368,13 +1413,13 @@ function startingTag(element) {
// turns out IE does not let you set .html() on elements which
// are not allowed to have children. So we just ignore it.
element.empty();
- } catch (e) {}
+ } catch (e) { /* empty */ }
var elemHtml = jqLite('<div>').append(element).html();
try {
return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) :
elemHtml.
match(/^(<[^>]+>)/)[1].
- replace(/^<([\w\-]+)/, function(match, nodeName) {return '<' + lowercase(nodeName);});
+ replace(/^<([\w-]+)/, function(match, nodeName) {return '<' + lowercase(nodeName);});
} catch (e) {
return lowercase(elemHtml);
}
@@ -1407,7 +1452,7 @@ function tryDecodeURIComponent(value) {
*/
function parseKeyValue(/**string*/keyValue) {
var obj = {};
- forEach((keyValue || "").split('&'), function(keyValue) {
+ forEach((keyValue || '').split('&'), function(keyValue) {
var splitPoint, key, val;
if (keyValue) {
key = keyValue = keyValue.replace(/\+/g,'%20');
@@ -1472,7 +1517,7 @@ function encodeUriSegment(val) {
* 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 / "/" / "?" )
+ * query = *( pchar / "/" / "?" )
* pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
* pct-encoded = "%" HEXDIG HEXDIG
@@ -1502,6 +1547,36 @@ function getNgAttribute(element, ngAttr) {
return null;
}
+function allowAutoBootstrap(document) {
+ if (!document.currentScript) {
+ return true;
+ }
+ var src = document.currentScript.getAttribute('src');
+ var link = document.createElement('a');
+ link.href = src;
+ if (document.location.origin === link.origin) {
+ // Same-origin resources are always allowed, even for non-whitelisted schemes.
+ return true;
+ }
+ // Disabled bootstrapping unless angular.js was loaded from a known scheme used on the web.
+ // This is to prevent angular.js bundled with browser extensions from being used to bypass the
+ // content security policy in web pages and other browser extensions.
+ switch (link.protocol) {
+ case 'http:':
+ case 'https:':
+ case 'ftp:':
+ case 'blob:':
+ case 'file:':
+ case 'data:':
+ return true;
+ default:
+ return false;
+ }
+}
+
+// Cached as it has to run during loading so that document.currentScript is available.
+var isAutoBootstrapAllowed = allowAutoBootstrap(window.document);
+
/**
* @ngdoc directive
* @name ngApp
@@ -1545,7 +1620,7 @@ function getNgAttribute(element, ngAttr) {
*
* `ngApp` is the easiest, and most common way to bootstrap an application.
*
- <example module="ngAppDemo">
+ <example module="ngAppDemo" name="ng-app">
<file name="index.html">
<div ng-controller="ngAppDemoController">
I can add: {{a}} + {{b}} = {{ a+b }}
@@ -1561,7 +1636,7 @@ function getNgAttribute(element, ngAttr) {
*
* Using `ngStrictDi`, you would see something like this:
*
- <example ng-app-included="true">
+ <example ng-app-included="true" name="strict-di">
<file name="index.html">
<div ng-app="ngAppStrictDemo" ng-strict-di>
<div ng-controller="GoodController1">
@@ -1610,7 +1685,7 @@ function getNgAttribute(element, ngAttr) {
}])
.controller('GoodController2', GoodController2);
function GoodController2($scope) {
- $scope.name = "World";
+ $scope.name = 'World';
}
GoodController2.$inject = ['$scope'];
</file>
@@ -1660,7 +1735,12 @@ function angularInit(element, bootstrap) {
}
});
if (appElement) {
- config.strictDi = getNgAttribute(appElement, "strict-di") !== null;
+ if (!isAutoBootstrapAllowed) {
+ window.console.error('Angular: disabling automatic bootstrap. <script> protocol indicates ' +
+ 'an extension, document.location.href does not match.');
+ return;
+ }
+ config.strictDi = getNgAttribute(appElement, 'strict-di') !== null;
bootstrap(appElement, module ? [module] : [], config);
}
}
@@ -1738,7 +1818,7 @@ function bootstrap(element, modules, config) {
// Encode angle brackets to prevent input from being sanitized to empty string #8683.
throw ngMinErr(
'btstrpd',
- "App already bootstrapped with this element '{0}'",
+ 'App already bootstrapped with this element \'{0}\'',
tag.replace(/</,'&lt;').replace(/>/,'&gt;'));
}
@@ -1867,7 +1947,7 @@ function bindJQuery() {
jQuery.cleanData = function(elems) {
var events;
for (var i = 0, elem; (elem = elems[i]) != null; i++) {
- events = jQuery._data(elem, "events");
+ events = jQuery._data(elem, 'events');
if (events && events.$destroy) {
jQuery(elem).triggerHandler('$destroy');
}
@@ -1889,7 +1969,7 @@ function bindJQuery() {
*/
function assertArg(arg, name, reason) {
if (!arg) {
- throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required"));
+ throw ngMinErr('areq', 'Argument \'{0}\' is {1}', (name || '?'), (reason || 'required'));
}
return arg;
}
@@ -1911,7 +1991,7 @@ function assertArgFn(arg, name, acceptArrayAnnotation) {
*/
function assertNotHasOwnProperty(name, context) {
if (name === 'hasOwnProperty') {
- throw ngMinErr('badname', "hasOwnProperty is not a valid {0} name", context);
+ throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
}
}
@@ -1981,6 +2061,27 @@ function createMap() {
return Object.create(null);
}
+function stringify(value) {
+ if (value == null) { // null || undefined
+ return '';
+ }
+ switch (typeof value) {
+ case 'string':
+ break;
+ case 'number':
+ value = '' + value;
+ break;
+ default:
+ if (hasCustomToString(value) && !isArray(value) && !isDate(value)) {
+ value = value.toString();
+ } else {
+ value = toJson(value);
+ }
+ }
+
+ return value;
+}
+
var NODE_TYPE_ELEMENT = 1;
var NODE_TYPE_ATTRIBUTE = 2;
var NODE_TYPE_TEXT = 3;
@@ -2079,9 +2180,9 @@ function setupModuleLoader(window) {
}
return ensure(modules, name, function() {
if (!requires) {
- throw $injectorMinErr('nomod', "Module '{0}' is not available! You either misspelled " +
- "the module name or forgot to load it. If registering a module ensure that you " +
- "specify the dependencies as the second argument.", name);
+ throw $injectorMinErr('nomod', 'Module \'{0}\' is not available! You either misspelled ' +
+ 'the module name or forgot to load it. If registering a module ensure that you ' +
+ 'specify the dependencies as the second argument.', name);
}
/** @type {!Array.<Array.<*>>} */
@@ -2191,7 +2292,7 @@ function setupModuleLoader(window) {
* @description
* See {@link auto.$provide#decorator $provide.decorator()}.
*/
- decorator: invokeLaterAndSetModuleName('$provide', 'decorator'),
+ decorator: invokeLaterAndSetModuleName('$provide', 'decorator', configBlocks),
/**
* @ngdoc method
@@ -2337,10 +2438,11 @@ function setupModuleLoader(window) {
* @param {string} method
* @returns {angular.Module}
*/
- function invokeLaterAndSetModuleName(provider, method) {
+ function invokeLaterAndSetModuleName(provider, method, queue) {
+ if (!queue) queue = invokeQueue;
return function(recipeName, factoryFunction) {
if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name;
- invokeQueue.push([provider, method, arguments]);
+ queue.push([provider, method, arguments]);
return moduleInstance;
};
}
@@ -2416,7 +2518,6 @@ function toDebugString(obj) {
formDirective,
scriptDirective,
selectDirective,
- styleDirective,
optionDirective,
ngBindDirective,
ngBindHtmlDirective,
@@ -2470,6 +2571,7 @@ function toDebugString(obj) {
$ControllerProvider,
$DateProvider,
$DocumentProvider,
+ $$IsDocumentHiddenProvider,
$ExceptionHandlerProvider,
$FilterProvider,
$$ForceReflowProvider,
@@ -2519,11 +2621,13 @@ function toDebugString(obj) {
* - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
*/
var version = {
- full: '1.5.8', // all of these placeholder strings will be replaced by grunt's
- major: 1, // package task
- minor: 5,
- dot: 8,
- codeName: 'arbitrary-fallbacks'
+ // These placeholder strings will be replaced by grunt's `build` task.
+ // They need to be double- or single-quoted.
+ full: '1.6.1',
+ major: 1,
+ minor: 6,
+ dot: 1,
+ codeName: 'promise-rectification'
};
@@ -2556,9 +2660,12 @@ function publishExternalAPI(angular) {
'uppercase': uppercase,
'callbacks': {$$counter: 0},
'getTestability': getTestability,
+ 'reloadWithDebugInfo': reloadWithDebugInfo,
'$$minErr': minErr,
'$$csp': csp,
- 'reloadWithDebugInfo': reloadWithDebugInfo
+ '$$encodeUriSegment': encodeUriSegment,
+ '$$encodeUriQuery': encodeUriQuery,
+ '$$stringify': stringify
});
angularModule = setupModuleLoader(window);
@@ -2577,7 +2684,6 @@ function publishExternalAPI(angular) {
form: formDirective,
script: scriptDirective,
select: selectDirective,
- style: styleDirective,
option: optionDirective,
ngBind: ngBindDirective,
ngBindHtml: ngBindHtmlDirective,
@@ -2633,6 +2739,7 @@ function publishExternalAPI(angular) {
$cacheFactory: $CacheFactoryProvider,
$controller: $ControllerProvider,
$document: $DocumentProvider,
+ $$isDocumentHidden: $$IsDocumentHiddenProvider,
$exceptionHandler: $ExceptionHandlerProvider,
$filter: $FilterProvider,
$$forceReflow: $$ForceReflowProvider,
@@ -2678,11 +2785,10 @@ function publishExternalAPI(angular) {
* Or gives undesired access to variables likes document or window? *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* global JQLitePrototype: true,
- addEventListenerFn: true,
- removeEventListenerFn: true,
+/* global
+ JQLitePrototype: true,
BOOLEAN_ATTR: true,
- ALIASED_ATTR: true,
+ ALIASED_ATTR: true
*/
//////////////////////////////////
@@ -2724,7 +2830,7 @@ function publishExternalAPI(angular) {
* - [`after()`](http://api.jquery.com/after/)
* - [`append()`](http://api.jquery.com/append/)
* - [`attr()`](http://api.jquery.com/attr/) - Does not support functions as parameters
- * - [`bind()`](http://api.jquery.com/bind/) - Does not support namespaces, selectors or eventData
+ * - [`bind()`](http://api.jquery.com/bind/) (_deprecated_, use [`on()`](http://api.jquery.com/on/)) - Does not support namespaces, selectors or eventData
* - [`children()`](http://api.jquery.com/children/) - Does not support selectors
* - [`clone()`](http://api.jquery.com/clone/)