You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@senssoft.apache.org by rf...@apache.org on 2018/04/13 18:40:22 UTC
[01/13] incubator-senssoft-useralejs git commit: SENSSOFT-250 Create
README for UserALE.js examples directory
Repository: incubator-senssoft-useralejs
Updated Branches:
refs/heads/SENSSOFT-192 1349cadda -> 6302909ec
SENSSOFT-250 Create README for UserALE.js examples directory
Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/commit/fb3d2f56
Tree: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/tree/fb3d2f56
Diff: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/diff/fb3d2f56
Branch: refs/heads/SENSSOFT-192
Commit: fb3d2f568bb4db467febf17f987a84be6a1c6197
Parents: d68bb04
Author: Lewis John McGibbney <le...@gmail.com>
Authored: Fri Sep 1 10:53:14 2017 -0700
Committer: Lewis John McGibbney <le...@gmail.com>
Committed: Fri Sep 1 10:53:14 2017 -0700
----------------------------------------------------------------------
README.md | 24 ++++++++++++++---
example/README.md | 68 +++++++++++++++++++++++++++++++++++++++++++++++++
example/index.html | 5 ++--
example/server.js | 2 +-
4 files changed, 92 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/fb3d2f56/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 56f109b..59b69e0 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,28 @@
-# UserALE.js
+# Apache SensSoft UserALE.js (Incubating)
[](https://builds.apache.org/job/useralejs-ci?)
[](http://www.apache.org/licenses/LICENSE-2.0)
-The official JavaScript client for UserAle.
+The official JavaScript client for [Apache SensSoft UserALE](https://github.com/apache/incubator-senssoft-userale).
Additional documentation can be found at http://senssoft.incubator.apache.org/userale/
+## Prerequsites
+
+```
+npm install gulp
+npm install del
+npm install gulp-eslint
+npm install rollup
+npm install rollup-plugin-json
+npm install gulp-uglify
+npm install gulp-rename
+npm install gulp-mocha
+npm install babel-register
+npm install express
+npm install body-parser
+```
+
## Build
To build UserALE.js:
@@ -54,8 +70,8 @@ Our top priority is to improve the testing system and to complete test coverage.
## Contributing
-Contributions are welcome! Simply submit an issue report for problems you encounter or a pull request for your feature or bug fix. The core team will review it and work with you to incorporate it into UserALE.js.
+Contributions are welcome! Simply [submit an issue report](https://issues.apache.org/jira/browse/senssoft) for problems you encounter or a pull request for your feature or bug fix. The core team will review it and work with you to incorporate it into UserALE.js.
## License
-Copyright © 2017 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Software as a Sensor is a trademark of the Charles Stark Draper Laboratory, Inc.
\ No newline at end of file
+Copyright © 2017 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Software as a Sensor is a trademark of the Charles Stark Draper Laboratory, Inc.
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/fb3d2f56/example/README.md
----------------------------------------------------------------------
diff --git a/example/README.md b/example/README.md
new file mode 100644
index 0000000..fcc9b81
--- /dev/null
+++ b/example/README.md
@@ -0,0 +1,68 @@
+# UserALE.js Example
+
+This directory provides
+ * example usage for UserALE.js within a simple HTML Webpage,
+ * how users can expect to log UserALE events, and
+ * what log events looks like within a simple UserALE logging server.
+
+## Prerequisites
+
+Please see the [Prerequsites](https://github.com/apache/incubator-senssoft-useralejs#prerequsites)
+
+## Running the Logging Server
+
+Assuming you have [node.js](https://nodejs.org/) installed, simply run
+
+```
+node server.js
+```
+
+## Running the Example
+
+Simply open index.html in your browser... you will see a very simply HTML Webpage with a button.
+
+When you click the button, the events will be logged to the server (in memory), logs looks similar to the following
+
+```
+
+[ { target: 'body',
+ path: [ 'body', 'html' ],
+ clientTime: 1504287557492,
+ location: { x: 0, y: 0 },
+ type: 'keydown',
+ userAction: true,
+ details: null,
+ userId: 'example-user',
+ toolVersion: '1.0.0',
+ toolName: 'Apache UserALE.js Example',
+ useraleVersion: '1.0.0' },
+ { target: '#document',
+ path: [ '#document' ],
+ clientTime: 1504287558304,
+ location: { x: 0, y: 0 },
+ type: 'blur',
+ userAction: true,
+ details: { window: true },
+ userId: 'example-user',
+ toolVersion: '1.0.0',
+ toolName: 'Apache UserALE.js Example',
+ useraleVersion: '1.0.0' },
+ { target: '#document',
+ path: [ '#document' ],
+ clientTime: 1504287558304,
+ location: { x: 0, y: 0 },
+ type: 'blur',
+ userAction: true,
+ details: null,
+ userId: 'example-user',
+ toolVersion: '1.0.0',
+ toolName: 'Apache UserALE.js Example',
+ useraleVersion: '1.0.0' },
+ ...
+]
+
+```
+
+## Contributing
+
+Contributions are welcome! Simply [submit an issue report](https://issues.apache.org/jira/browse/senssoft) for problems you encounter or a pull request for your feature or bug fix. The core team will review it and work with you to incorporate it into UserALE.js.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/fb3d2f56/example/index.html
----------------------------------------------------------------------
diff --git a/example/index.html b/example/index.html
index d7cd66a..d293675 100644
--- a/example/index.html
+++ b/example/index.html
@@ -18,10 +18,11 @@ limitations under the License.
<head>
<title>UserAleJS - Example Page</title>
<script
- src="build/userale-0.2.1.min.js"
+ src="../build/userale-1.0.0.min.js"
data-url="http://localhost:8000/"
data-user="example-user"
data-version="1.0.0"
+ data-tool="Apache UserALE.js Example"
></script>
</head>
<body>
@@ -29,4 +30,4 @@ limitations under the License.
<button id="test_button">Click me!</button>
</div>
</body>
-</html>
\ No newline at end of file
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/fb3d2f56/example/server.js
----------------------------------------------------------------------
diff --git a/example/server.js b/example/server.js
index 354219e..8362123 100644
--- a/example/server.js
+++ b/example/server.js
@@ -45,7 +45,7 @@ app.use(function (req, res, next) {
// intercept OPTIONS method
if ('OPTIONS' == req.method) {
- res.send(200);
+ res.sendStatus(200);
}
else {
next();
[06/13] incubator-senssoft-useralejs git commit: SENSSOFT-250 Create
README for UserALE.js examples directory
Posted by rf...@apache.org.
SENSSOFT-250 Create README for UserALE.js examples directory
Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/commit/f2c42190
Tree: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/tree/f2c42190
Diff: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/diff/f2c42190
Branch: refs/heads/SENSSOFT-192
Commit: f2c4219009b9e8045a120827690d9ee80ae6d80c
Parents: 937863f
Author: Lewis John McGibbney <le...@gmail.com>
Authored: Fri Jan 26 11:51:51 2018 -0800
Committer: Lewis John McGibbney <le...@gmail.com>
Committed: Fri Jan 26 11:51:51 2018 -0800
----------------------------------------------------------------------
README.md | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/f2c42190/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 645d791..726e727 100644
--- a/README.md
+++ b/README.md
@@ -9,19 +9,9 @@ Additional documentation can be found at http://senssoft.incubator.apache.org/us
## Prerequsites
+Several dependencies are required, simply execute the following and you are good to go.
```
-npm install gulp
-npm install del
-npm install gulp-eslint
-npm install rollup
-npm install rollup-plugin-json
-npm install gulp-uglify
-npm install gulp-rename
-npm install gulp-mocha
-npm install babel-register
-npm install express
-npm install body-parser
-npm install nodemon
+npm install
```
## Build
[11/13] incubator-senssoft-useralejs git commit: Update master to
1.1.0
Posted by rf...@apache.org.
Update master to 1.1.0
Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/commit/0a51a737
Tree: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/tree/0a51a737
Diff: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/diff/0a51a737
Branch: refs/heads/SENSSOFT-192
Commit: 0a51a7379ef8b032ee0da86deffb57aa8bbac31e
Parents: b29542e
Author: Lewis John McGibbney <le...@gmail.com>
Authored: Tue Feb 20 19:22:23 2018 -0800
Committer: Lewis John McGibbney <le...@gmail.com>
Committed: Tue Feb 20 19:22:23 2018 -0800
----------------------------------------------------------------------
example/index.html | 4 ++--
package.json | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/0a51a737/example/index.html
----------------------------------------------------------------------
diff --git a/example/index.html b/example/index.html
index 4849b9f..d8117d3 100644
--- a/example/index.html
+++ b/example/index.html
@@ -18,10 +18,10 @@ limitations under the License.
<head>
<title>UserAleJS - Example Page</title>
<script
- src="build/userale-1.0.0.min.js"
+ src="build/userale-1.1.0.min.js"
data-url="http://localhost:8000/"
data-user="example-user"
- data-version="1.0.0"
+ data-version="1.1.0"
data-tool="Apache UserALE.js Example"
></script>
</head>
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/0a51a737/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 8da4605..b449531 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "useralejs",
- "version": "1.0.0",
+ "version": "1.1.0",
"description": "UserALE.js is the UserALE client for DOM and JavaScript-based applications. It automatically attaches event handlers to log every user interaction on a web page, including rich JS single-page apps.",
"main": "build/userale.js",
"scripts": {
[03/13] incubator-senssoft-useralejs git commit: Prepare for
UserALE.js 0.1.0 RC#1
Posted by rf...@apache.org.
Prepare for UserALE.js 0.1.0 RC#1
Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/commit/34c0fed4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/tree/34c0fed4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/diff/34c0fed4
Branch: refs/heads/SENSSOFT-192
Commit: 34c0fed4ec0863cf04e8396ddd8884e18d0393e4
Parents: 85837f0
Author: Lewis John McGibbney <le...@gmail.com>
Authored: Thu Jan 18 10:12:44 2018 -0800
Committer: Lewis John McGibbney <le...@gmail.com>
Committed: Thu Jan 18 10:12:44 2018 -0800
----------------------------------------------------------------------
NOTICE | 2 +-
doap-userale.js.rdf | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/34c0fed4/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
index ec44eb1..ba18a16 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
Apache SensSoft UserALE.js
-© Copyright 2016 The Charles Stark Draper Laboratory, Inc. All rights reserved.
+Copyright 2018 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/34c0fed4/doap-userale.js.rdf
----------------------------------------------------------------------
diff --git a/doap-userale.js.rdf b/doap-userale.js.rdf
index 11460c2..914274a 100644
--- a/doap-userale.js.rdf
+++ b/doap-userale.js.rdf
@@ -37,7 +37,7 @@
<release>
<Version>
<name>0.1.0 release</name>
- <created>2017-08-25</created>
+ <created>2018-01-18</created>
<revision>0.1.0</revision>
</Version>
</release>
[10/13] incubator-senssoft-useralejs git commit: Update README with
test execution
Posted by rf...@apache.org.
Update README with test execution
Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/commit/b29542e6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/tree/b29542e6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/diff/b29542e6
Branch: refs/heads/SENSSOFT-192
Commit: b29542e6cc1e74c4caccdeb9ed4191013498e9ee
Parents: 611f710
Author: Lewis John McGibbney <le...@gmail.com>
Authored: Tue Feb 20 19:15:40 2018 -0800
Committer: Lewis John McGibbney <le...@gmail.com>
Committed: Tue Feb 20 19:15:40 2018 -0800
----------------------------------------------------------------------
README.md | 14 ++++++++++++++
1 file changed, 14 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/b29542e6/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 28e4cc3..017666b 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,20 @@ To build UserALE.js:
npm run build
```
+## Test
+
+To test UserALE.js:
+```
+npm run test
+```
+... you should eventually see something as follows
+```
+...
+ 26 passing (837ms)
+ 1 pending
+```
+Any failing tests will also be logged in the terminal. If there are failing tests, please consider [logging an issue in JIRA](https://issues.apache.org/jira/projects/SENSSOFT).
+
## Use and Configure
To include UserALE.js in your project:
[12/13] incubator-senssoft-useralejs git commit: Merge branch
'master' of
https://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs into
SENSSOFT-192
Posted by rf...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs into SENSSOFT-192
Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/commit/4a61c9f7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/tree/4a61c9f7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/diff/4a61c9f7
Branch: refs/heads/SENSSOFT-192
Commit: 4a61c9f7966bef6fee7e0ce892840bb93cb08644
Parents: 1349cad 0a51a73
Author: Rob Foley <rg...@users.noreply.github.com>
Authored: Fri Apr 13 14:38:28 2018 -0400
Committer: Rob Foley <rg...@users.noreply.github.com>
Committed: Fri Apr 13 14:38:28 2018 -0400
----------------------------------------------------------------------
KEYS | 76 +++++
LICENSE | 402 +++++++++++------------
NOTICE | 2 +-
README.md | 29 +-
build/userale-1.0.0.js | 702 ----------------------------------------
build/userale-1.0.0.min.js | 1 -
doap-userale.js.rdf | 2 +-
example/README.md | 68 ++++
example/index.html | 7 +-
example/server.js | 4 +-
package.json | 2 +-
11 files changed, 379 insertions(+), 916 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/4a61c9f7/README.md
----------------------------------------------------------------------
diff --cc README.md
index c19a21e,017666b..8750d55
--- a/README.md
+++ b/README.md
@@@ -3,12 -3,17 +3,19 @@@
[](https://builds.apache.org/job/useralejs-ci?)
[](http://www.apache.org/licenses/LICENSE-2.0)
- The official JavaScript client for UserAle.
+ The official JavaScript client for [Apache SensSoft UserALE](https://github.com/apache/incubator-senssoft-userale).
+UserALE.js is a client side instrumentation library written in JavaScript. It is designed to be an easy-to-use, lightweight, and dependency-free way to quickly gather logs from your web applications.
+
Additional documentation can be found at http://senssoft.incubator.apache.org/userale/
+ ## Prerequsites
+
+ Several dependencies are required, simply execute the following and you are good to go.
+ ```
+ npm install
+ ```
+
## Build
To build UserALE.js:
@@@ -17,18 -22,31 +24,32 @@@
npm run build
```
+ ## Test
+
+ To test UserALE.js:
+ ```
+ npm run test
+ ```
+ ... you should eventually see something as follows
+ ```
+ ...
+ 26 passing (837ms)
+ 1 pending
+ ```
+ Any failing tests will also be logged in the terminal. If there are failing tests, please consider [logging an issue in JIRA](https://issues.apache.org/jira/projects/SENSSOFT).
+
## Use and Configure
-To include UserALE.js in your project:
+To start logging with UserALE.js, you can either include our script in the web application to be logged, or use our WebExtension to gather logs across any page a user visits.
-```
+To instrument a specific project, simply include this script tag on the page:
+
+```html
<script src="/path/to/userale-1.0.0.min.js"></script>
```
+UserALE.js is designed to be easily configured to fit your use case. We use HTML data parameters to pass configuration options to the library. For example, to set the logging URL:
-HTML5 Data Parameters are used to configure UserALE.js. For example, to set the logging URL:
-
-```
+```html
<script src="/path/to/userale-1.0.0.min.js" data-url="http://yourLoggingUrl"></script>
```
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/4a61c9f7/build/userale-1.0.0.js
----------------------------------------------------------------------
diff --cc build/userale-1.0.0.js
index 38b526a,f3d8d67..0000000
deleted file mode 100644,100644
--- a/build/userale-1.0.0.js
+++ /dev/null
@@@ -1,702 -1,533 +1,0 @@@
--(function (exports) {
-- 'use strict';
--
-- var version$1 = "1.0.0";
--
-- /*
-- * Licensed to the Apache Software Foundation (ASF) under one or more
-- * contributor license agreements. See the NOTICE file distributed with
-- * this work for additional information regarding copyright ownership.
-- * The ASF licenses this file to You 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.
-- */
--
-- /**
-- * Extracts the initial configuration settings from the
-- * currently executing script tag.
-- * @return {Object} The extracted configuration object
-- */
-- function getInitialSettings() {
-- var settings = {};
--
-- var script = document.currentScript || (function () {
-- var scripts = document.getElementsByTagName('script');
-- return scripts[scripts.length - 1];
-- })();
--
-- var get = script ? script.getAttribute.bind(script) : function() { return null; };
--
-- settings.autostart = get('data-autostart') === 'false' ? false : true;
-- settings.url = get('data-url') || 'http://localhost:8000';
-- settings.transmitInterval = +get('data-interval') || 5000;
-- settings.logCountThreshold = +get('data-threshold') || 5;
-- settings.userId = get('data-user') || null;
-- settings.version = get('data-version') || null;
-- settings.logDetails = get('data-log-details') === 'true' ? true : false;
-- settings.resolution = +get('data-resolution') || 500;
-- settings.toolName = get('data-tool') || null;
-- settings.userFromParams = get('data-user-from-params') || null;
-- settings.time = timeStampScale(document.createEvent('CustomEvent'));
- settings.sessionID = get('data-session') || 'session_' + String(Date.now());
--
-- return settings;
-- }
--
-- /**
-- * Creates a function to normalize the timestamp of the provided event.
-- * @param {Object} e An event containing a timeStamp property.
-- * @return {timeStampScale~tsScaler} The timestamp normalizing function.
-- */
-- function timeStampScale(e) {
-- if (e.timeStamp && e.timeStamp > 0) {
-- var delta = Date.now() - e.timeStamp;
-- /**
-- * Returns a timestamp depending on various browser quirks.
-- * @param {?Number} ts A timestamp to use for normalization.
-- * @return {Number} A normalized timestamp.
-- */
-- var tsScaler;
--
-- if (delta < 0) {
-- tsScaler = function () {
-- return e.timeStamp / 1000;
-- };
-- } else if (delta > e.timeStamp) {
-- var navStart = performance.timing.navigationStart;
-- tsScaler = function (ts) {
-- return ts + navStart;
-- }
-- } else {
-- tsScaler = function (ts) {
-- return ts;
-- }
-- }
-- } else {
-- tsScaler = function () { return Date.now(); };
-- }
--
-- return tsScaler;
-- }
--
-- /*
-- * Licensed to the Apache Software Foundation (ASF) under one or more
-- * contributor license agreements. See the NOTICE file distributed with
-- * this work for additional information regarding copyright ownership.
-- * The ASF licenses this file to You 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.
-- */
--
-- /**
-- * Shallow merges the first argument with the second.
-- * Retrieves/updates the userid if userFromParams is provided.
-- * @param {Object} config Current configuration object to be merged into.
-- * @param {Object} newConfig Configuration object to merge into the current config.
-- */
-- function configure(config, newConfig) {
-- Object.keys(newConfig).forEach(function(option) {
-- if (option === 'userFromParams') {
-- var userId = getUserIdFromParams(newConfig[option]);
-- if (userId) {
-- config.userId = userId;
-- }
-- }
-- config[option] = newConfig[option];
-- });
-- }
--
-- /**
-- * Attempts to extract the userid from the query parameters of the URL.
-- * @param {string} param The name of the query parameter containing the userid.
-- * @return {string|null} The extracted/decoded userid, or null if none is found.
-- */
-- function getUserIdFromParams(param) {
-- var userField = param;
-- var regex = new RegExp('[?&]' + userField + '(=([^&#]*)|&|#|$)');
-- var results = window.location.href.match(regex);
--
-- if (results && results[2]) {
-- return decodeURIComponent(results[2].replace(/\+/g, ' '));
-- } else {
-- return null;
-- }
-- }
--
-- /*
-- * Licensed to the Apache Software Foundation (ASF) under one or more
-- * contributor license agreements. See the NOTICE file distributed with
-- * this work for additional information regarding copyright ownership.
-- * The ASF licenses this file to You 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.
-- */
--
-- var logs$1;
-- var config$1;
-
- // Interval Logging Globals
- var intervalID;
- var intervalType;
- var intervalPath;
- var intervalTimer;
- var intervalCounter;
- var intervalLog;
-
- var filterHandler = null;
- var mapHandler = null;
-
- /**
- * Assigns a handler to filter logs out of the queue.
- * @param {Function} callback The handler to invoke when logging.
- */
- function setLogFilter(callback) {
- filterHandler = callback;
- }
-
- /**
- * Assigns a handler to transform logs from their default structure.
- * @param {Function} callback The handler to invoke when logging.
- */
- function setLogMapper(callback) {
- mapHandler = callback;
- }
-
--
-- /**
-- * Assigns the config and log container to be used by the logging functions.
-- * @param {Array} newLogs Log container.
-- * @param {Object} newConfig Configuration to use while logging.
-- */
-- function initPackager(newLogs, newConfig) {
-- logs$1 = newLogs;
-- config$1 = newConfig;
- filterHandler = null;
- mapHandler = null;
- intervalID = null;
- intervalType = null;
- intervalPath = null;
- intervalTimer = null;
- intervalCounter = 0;
- intervalLog = null;
-- }
--
-- /**
-- * Transforms the provided event into a log and appends it to the log container.
-- * @param {Object} e The event to be logged.
-- * @param {Function} detailFcn The function to extract additional log parameters from the event.
-- * @return {boolean} Whether the event was logged.
-- */
-- function packageLog(e, detailFcn) {
-- if (!config$1.on) {
-- return false;
-- }
--
-- var details = null;
-- if (detailFcn) {
-- details = detailFcn(e);
-- }
-
- var timeFields = extractTimeFields(
- (e.timeStamp && e.timeStamp > 0) ? config$1.time(e.timeStamp) : Date.now()
- );
--
-- var log = {
-- 'target' : getSelector(e.target),
-- 'path' : buildPath(e),
- 'clientTime' : timeFields.milli,
- 'microTime' : timeFields.micro,
- 'clientTime' : Math.floor((e.timeStamp && e.timeStamp > 0) ? config$1.time(e.timeStamp) : Date.now()),
-- 'location' : getLocation(e),
-- 'type' : e.type,
- 'logType': 'raw',
-- 'userAction' : true,
-- 'details' : details,
-- 'userId' : config$1.userId,
-- 'toolVersion' : config$1.version,
-- 'toolName' : config$1.toolName,
- 'useraleVersion': config$1.useraleVersion,
- 'sessionID': config$1.sessionID
- 'useraleVersion': config$1.useraleVersion
-- };
-
- if ((typeof filterHandler === 'function') && !filterHandler(log)) {
- return false;
- }
-
- if (typeof mapHandler === 'function') {
- log = mapHandler(log);
- }
--
-- logs$1.push(log);
--
-- return true;
- }
-
- /**
- * Extract the millisecond and microsecond portions of a timestamp.
- * @param {Number} timeStamp The timestamp to split into millisecond and microsecond fields.
- * @return {Object} An object containing the millisecond
- * and microsecond portions of the timestamp.
- */
- function extractTimeFields(timeStamp) {
- return {
- milli: Math.floor(timeStamp),
- micro: Number((timeStamp % 1).toFixed(3)),
- };
- }
-
- /**
- * Track intervals and gather details about it.
- * @param {Object} e
- * @return boolean
- */
- function packageIntervalLog(e) {
- var target = getSelector(e.target);
- var path = buildPath(e);
- var type = e.type;
- var timestamp = Math.floor((e.timeStamp && e.timeStamp > 0) ? config$1.time(e.timeStamp) : Date.now());
-
- // Init - this should only happen once on initialization
- if (intervalID == null) {
- intervalID = target;
- intervalType = type;
- intervalPath = path;
- intervalTimer = timestamp;
- intervalCounter = 0;
- }
-
- if (intervalID !== target || intervalType !== type) {
- // When to create log? On transition end
- // @todo Possible for intervalLog to not be pushed in the event the interval never ends...
-
- intervalLog = {
- 'target': intervalID,
- 'path': intervalPath,
- 'count': intervalCounter,
- 'duration': timestamp - intervalTimer, // microseconds
- 'startTime': intervalTimer,
- 'endTime': timestamp,
- 'type': intervalType,
- 'logType': 'interval',
- 'targetChange': intervalID !== target,
- 'typeChange': intervalType !== type,
- 'userAction': false,
- 'userId': config$1.userId,
- 'toolVersion': config$1.version,
- 'toolName': config$1.toolName,
- 'useraleVersion': config$1.useraleVersion,
- 'sessionID': config$1.sessionID
- };
-
- if (typeof filterHandler === 'function' && !filterHandler(intervalLog)) {
- return false;
- }
-
- if (typeof mapHandler === 'function') {
- intervalLog = mapHandler(intervalLog);
- }
-
- logs$1.push(intervalLog);
-
- // Reset
- intervalID = target;
- intervalType = type;
- intervalPath = path;
- intervalTimer = timestamp;
- intervalCounter = 0;
- }
-
- // Interval is still occuring, just update counter
- if (intervalID == target && intervalType == type) {
- intervalCounter = intervalCounter + 1;
- }
-
- return true;
-- }
--
-- /**
-- * Extracts coordinate information from the event
-- * depending on a few browser quirks.
-- * @param {Object} e The event to extract coordinate information from.
-- * @return {Object} An object containing nullable x and y coordinates for the event.
-- */
-- function getLocation(e) {
-- if (e.pageX != null) {
-- return { 'x' : e.pageX, 'y' : e.pageY };
-- } else if (e.clientX != null) {
-- return { 'x' : document.documentElement.scrollLeft + e.clientX, 'y' : document.documentElement.scrollTop + e.clientY };
-- } else {
-- return { 'x' : null, 'y' : null };
-- }
-- }
--
-- /**
-- * Builds a string CSS selector from the provided element
-- * @param {HTMLElement} ele The element from which the selector is built.
-- * @return {string} The CSS selector for the element, or Unknown if it can't be determined.
-- */
-- function getSelector(ele) {
-- if (ele.localName) {
-- return ele.localName + (ele.id ? ('#' + ele.id) : '') + (ele.className ? ('.' + ele.className) : '');
-- } else if (ele.nodeName) {
-- return ele.nodeName + (ele.id ? ('#' + ele.id) : '') + (ele.className ? ('.' + ele.className) : '');
-- } else if (ele && ele.document && ele.location && ele.alert && ele.setInterval) {
-- return "Window";
-- } else {
-- return "Unknown";
-- }
-- }
--
-- /**
-- * Builds an array of elements from the provided event target, to the root element.
-- * @param {Object} e Event from which the path should be built.
-- * @return {HTMLElement[]} Array of elements, starting at the event target, ending at the root element.
-- */
-- function buildPath(e) {
-- var path = [];
-- if (e.path) {
-- path = e.path;
-- } else {
-- var ele = e.target
-- while(ele) {
-- path.push(ele);
-- ele = ele.parentElement;
-- }
-- }
--
-- return selectorizePath(path);
-- }
--
-- /**
-- * Builds a CSS selector path from the provided list of elements.
-- * @param {HTMLElement[]} path Array of HTMLElements from which the path should be built.
-- * @return {string[]} Array of string CSS selectors.
-- */
-- function selectorizePath(path) {
-- var i = 0;
-- var pathEle;
-- var pathSelectors = [];
-- while (pathEle = path[i]) {
-- pathSelectors.push(getSelector(pathEle));
-- ++i;
-- }
-- return pathSelectors;
-- }
--
-- var events;
-- var bufferBools;
-- var bufferedEvents;
- //@todo: Investigate drag events and their behavior
- var intervalEvents = ['click', 'focus', 'blur', 'input', 'change', 'mouseover', 'submit'];
- var windowEvents = ['load', 'blur', 'focus'];
-
- /**
- * Maps an event to an object containing useful information.
- * @param {Object} e Event to extract data from
- */
- function extractMouseEvent(e) {
- return {
- 'clicks' : e.detail,
- 'ctrl' : e.ctrlKey,
- 'alt' : e.altKey,
- 'shift' : e.shiftKey,
- 'meta' : e.metaKey
- };
- }
- var windowEvents;
--
-- /**
-- * Defines the way information is extracted from various events.
-- * Also defines which events we will listen to.
-- * @param {Object} config Configuration object to read from.
-- */
-- function defineDetails(config) {
-- // Events list
-- // Keys are event types
-- // Values are functions that return details object if applicable
-- events = {
- 'click' : extractMouseEvent,
- 'dblclick' : extractMouseEvent,
- 'mousedown' : extractMouseEvent,
- 'mouseup' : extractMouseEvent,
- 'click' : function(e) { return { 'clicks' : e.detail, 'ctrl' : e.ctrlKey, 'alt' : e.altKey, 'shift' : e.shiftKey, 'meta' : e.metaKey }; },
- 'dblclick' : function(e) { return { 'clicks' : e.detail, 'ctrl' : e.ctrlKey, 'alt' : e.altKey, 'shift' : e.shiftKey, 'meta' : e.metaKey }; },
- 'mousedown' : function(e) { return { 'clicks' : e.detail, 'ctrl' : e.ctrlKey, 'alt' : e.altKey, 'shift' : e.shiftKey, 'meta' : e.metaKey }; },
- 'mouseup' : function(e) { return { 'clicks' : e.detail, 'ctrl' : e.ctrlKey, 'alt' : e.altKey, 'shift' : e.shiftKey, 'meta' : e.metaKey }; },
-- 'focus' : null,
-- 'blur' : null,
-- 'input' : config.logDetails ? function(e) { return { 'value' : e.target.value }; } : null,
-- 'change' : config.logDetails ? function(e) { return { 'value' : e.target.value }; } : null,
-- 'dragstart' : null,
-- 'dragend' : null,
-- 'drag' : null,
-- 'drop' : null,
-- 'keydown' : config.logDetails ? function(e) { return { 'key' : e.keyCode, 'ctrl' : e.ctrlKey, 'alt' : e.altKey, 'shift' : e.shiftKey, 'meta' : e.metaKey }; } : null,
-- 'mouseover' : null,
-- 'submit' : null
-- };
--
-- bufferBools = {};
-- bufferedEvents = {
-- 'wheel' : function(e) { return { 'x' : e.deltaX, 'y' : e.deltaY, 'z' : e.deltaZ }; },
-- 'scroll' : function() { return { 'x' : window.scrollX, 'y' : window.scrollY }; },
-- 'resize' : function() { return { 'width' : window.outerWidth, 'height' : window.outerHeight }; }
-- };
-
- windowEvents = ['load', 'blur', 'focus'];
-- }
--
-- /**
-- * Hooks the event handlers for each event type of interest.
-- * @param {Object} config Configuration object to use.
-- * @return {boolean} Whether the operation succeeded
-- */
-- function attachHandlers(config) {
-- defineDetails(config);
--
-- Object.keys(events).forEach(function(ev) {
-- document.addEventListener(ev, function(e) {
-- packageLog(e, events[ev]);
- }, true);
- });
-
- intervalEvents.forEach(function(ev) {
- document.addEventListener(ev, function(e) {
- packageIntervalLog(e);
-- }, true);
-- });
--
-- Object.keys(bufferedEvents).forEach(function(ev) {
-- bufferBools[ev] = true;
--
-- window.addEventListener(ev, function(e) {
-- if (bufferBools[ev]) {
-- bufferBools[ev] = false;
-- packageLog(e, bufferedEvents[ev]);
-- setTimeout(function() { bufferBools[ev] = true; }, config.resolution);
-- }
-- }, true);
-- });
--
-- windowEvents.forEach(function(ev) {
-- window.addEventListener(ev, function(e) {
-- packageLog(e, function() { return { 'window' : true }; });
-- }, true);
-- });
--
-- return true;
-- }
--
-- /*
-- * Licensed to the Apache Software Foundation (ASF) under one or more
-- * contributor license agreements. See the NOTICE file distributed with
-- * this work for additional information regarding copyright ownership.
-- * The ASF licenses this file to You 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.
-- */
-
- var sendIntervalId = null;
--
-- /**
-- * Initializes the log queue processors.
-- * @param {Array} logs Array of logs to append to.
-- * @param {Object} config Configuration object to use when logging.
-- */
-- function initSender(logs, config) {
- if (sendIntervalId !== null) {
- clearInterval(sendIntervalId);
- }
-
- sendIntervalId = sendOnInterval(logs, config);
- sendOnInterval(logs, config);
-- sendOnClose(logs, config);
-- }
--
-- /**
-- * Checks the provided log array on an interval, flushing the logs
-- * if the queue has reached the threshold specified by the provided config.
-- * @param {Array} logs Array of logs to read from.
-- * @param {Object} config Configuration object to be read from.
- * @return {Number} The newly created interval id.
-- */
-- function sendOnInterval(logs, config) {
- return setInterval(function() {
- if (!config.on) {
- return;
- }
-
- setInterval(function() {
-- if (logs.length >= config.logCountThreshold) {
-- sendLogs(logs.slice(0), config.url, 0); // Send a copy
-- logs.splice(0); // Clear array reference (no reassignment)
-- }
-- }, config.transmitInterval);
-- }
--
-- /**
-- * Attempts to flush the remaining logs when the window is closed.
-- * @param {Array} logs Array of logs to be flushed.
-- * @param {Object} config Configuration object to be read from.
-- */
-- function sendOnClose(logs, config) {
- if (!config.on) {
- return;
- }
-
-- if (navigator.sendBeacon) {
-- window.addEventListener('unload', function() {
-- navigator.sendBeacon(config.url, JSON.stringify(logs));
-- });
-- } else {
-- window.addEventListener('beforeunload', function() {
-- if (logs.length > 0) {
-- sendLogs(logs, config.url, 1);
-- }
-- })
-- }
-- }
--
-- /**
-- * Sends the provided array of logs to the specified url,
-- * retrying the request up to the specified number of retries.
-- * @param {Array} logs Array of logs to send.
-- * @param {string} url URL to send the POST request to.
-- * @param {Number} retries Maximum number of attempts to send the logs.
-- */
-- function sendLogs(logs, url, retries) {
-- var req = new XMLHttpRequest();
--
-- var data = JSON.stringify(logs);
--
-- req.open('POST', url);
-- req.setRequestHeader('Content-type', 'application/json;charset=UTF-8');
--
-- req.onreadystatechange = function() {
-- if (req.readyState === 4 && req.status !== 200) {
-- if (retries > 0) {
-- sendLogs(logs, url, retries--);
-- }
-- }
-- };
--
-- req.send(data);
-- }
--
-- var config = {};
-- var logs = [];
-- exports.started = false;
-
-
-- // Start up Userale
-- config.on = false;
-- config.useraleVersion = version$1;
--
-- configure(config, getInitialSettings());
-- initPackager(logs, config);
--
-- if (config.autostart) {
-- setup(config);
-- }
--
-- /**
-- * Hooks the global event listener, and starts up the
-- * logging interval.
-- * @param {Object} config Configuration settings for the logger
-- */
-- function setup(config) {
-- if (!exports.started) {
-- setTimeout(function() {
-- var state = document.readyState;
--
-- if (state === 'interactive' || state === 'complete') {
-- attachHandlers(config);
-- initSender(logs, config);
-- exports.started = config.on = true;
-- } else {
-- setup(config);
-- }
-- }, 100);
-- }
-- }
--
--
-- // Export the Userale API
-- var version = version$1;
--
-- /**
-- * Used to start the logging process if the
-- * autostart configuration option is set to false.
-- */
-- function start() {
-- if (!exports.started) {
-- setup(config);
-- }
--
-- config.on = true;
-- }
--
-- /**
-- * Halts the logging process. Logs will no longer be sent.
-- */
-- function stop() {
-- config.on = false;
-- }
--
-- /**
-- * Updates the current configuration
-- * object with the provided values.
-- * @param {Object} newConfig The configuration options to use.
-- * @return {Object} Returns the updated configuration.
-- */
-- function options(newConfig) {
-- if (newConfig !== undefined) {
-- configure(config, newConfig);
-- }
--
-- return config;
-- }
--
-- /**
-- * Appends a log to the log queue.
-- * @param {Object} customLog The log to append.
-- * @return {boolean} Whether the operation succeeded.
-- */
-- function log(customLog) {
-- if (customLog !== null && typeof customLog === 'object') {
-- logs.push(customLog);
-- return true;
-- } else {
-- return false;
-- }
-- }
--
-- exports.version = version;
-- exports.start = start;
-- exports.stop = stop;
-- exports.options = options;
-- exports.log = log;
- exports.map = setLogMapper;
- exports.filter = setLogFilter;
--
--}((this.userale = this.userale || {})));
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/4a61c9f7/build/userale-1.0.0.min.js
----------------------------------------------------------------------
diff --cc build/userale-1.0.0.min.js
index 6adafeb,5253a54..0000000
deleted file mode 100644,100644
--- a/build/userale-1.0.0.min.js
+++ /dev/null
@@@ -1,1 -1,1 +1,0 @@@
- !function(t){"use strict";function e(t){if(t.timeStamp&&t.timeStamp>0){var e,n=Date.now()-t.timeStamp;if(n<0)e=function(){return t.timeStamp/1e3};else if(n>t.timeStamp){var o=performance.timing.navigationStart;e=function(t){return t+o}}else e=function(t){return t}}else e=function(){return Date.now()};return e}function n(t,e){Object.keys(e).forEach(function(n){if("userFromParams"===n){var r=o(e[n]);r&&(t.userId=r)}t[n]=e[n]})}function o(t){var e=t,n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)"),o=window.location.href.match(n);return o&&o[2]?decodeURIComponent(o[2].replace(/\+/g," ")):null}function r(t){F=t}function u(t){R=t}function a(t,e){if(!T.on)return!1;var n=null;e&&(n=e(t));var o=i(t.timeStamp&&t.timeStamp>0?T.time(t.timeStamp):Date.now()),r={target:c(t.target),path:d(t),clientTime:o.milli,microTime:o.micro,location:s(t),type:t.type,logType:"raw",userAction:!0,details:n,userId:T.userId,toolVersion:T.version,toolName:T.toolName,useraleVersion:T.useraleVersion,sessionID:T.sessionID};
return!("function"==typeof F&&!F(r))&&("function"==typeof R&&(r=R(r)),D.push(r),!0)}function i(t){return{milli:Math.floor(t),micro:Number((t%1).toFixed(3))}}function l(t){var e=c(t.target),n=d(t),o=t.type,r=Math.floor(t.timeStamp&&t.timeStamp>0?T.time(t.timeStamp):Date.now());if(null==k&&(k=e,C=o,K=n,L=r,x=0),k!==e||C!==o){if(V={target:k,path:K,count:x,duration:r-L,startTime:L,endTime:r,type:C,logType:"interval",targetChange:k!==e,typeChange:C!==o,userAction:!1,userId:T.userId,toolVersion:T.version,toolName:T.toolName,useraleVersion:T.useraleVersion,sessionID:T.sessionID},"function"==typeof F&&!F(V))return!1;"function"==typeof R&&(V=R(V)),D.push(V),k=e,C=o,K=n,L=r,x=0}return k==e&&C==o&&(x+=1),!0}function s(t){return null!=t.pageX?{x:t.pageX,y:t.pageY}:null!=t.clientX?{x:document.documentElement.scrollLeft+t.clientX,y:document.documentElement.scrollTop+t.clientY}:{x:null,y:null}}function c(t){return t.localName?t.localName+(t.id?"#"+t.id:"")+(t.className?"."+t.className:""):t.nodeNa
me?t.nodeName+(t.id?"#"+t.id:"")+(t.className?"."+t.className:""):t&&t.document&&t.location&&t.alert&&t.setInterval?"Window":"Unknown"}function d(t){var e=[];if(t.path)e=t.path;else for(var n=t.target;n;)e.push(n),n=n.parentElement;return f(e)}function f(t){for(var e,n=0,o=[];e=t[n];)o.push(c(e)),++n;return o}function m(t){return{clicks:t.detail,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}}function p(t){X={click:m,dblclick:m,mousedown:m,mouseup:m,focus:null,blur:null,input:t.logDetails?function(t){return{value:t.target.value}}:null,change:t.logDetails?function(t){return{value:t.target.value}}:null,dragstart:null,dragend:null,drag:null,drop:null,keydown:t.logDetails?function(t){return{key:t.keyCode,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}}:null,mouseover:null,submit:null},O={},j={wheel:function(t){return{x:t.deltaX,y:t.deltaY,z:t.deltaZ}},scroll:function(){return{x:window.scrollX,y:window.scrollY}},resize:function(){return{width:window.outerWidth,h
eight:window.outerHeight}}}}function h(t){return p(t),Object.keys(X).forEach(function(t){document.addEventListener(t,function(e){a(e,X[t])},!0)}),Y.forEach(function(t){document.addEventListener(t,function(t){l(t)},!0)}),Object.keys(j).forEach(function(e){O[e]=!0,window.addEventListener(e,function(n){O[e]&&(O[e]=!1,a(n,j[e]),setTimeout(function(){O[e]=!0},t.resolution))},!0)}),A.forEach(function(t){window.addEventListener(t,function(t){a(t,function(){return{window:!0}})},!0)}),!0}function g(t,e){null!==B&&clearInterval(B),B=v(t,e),y(t,e)}function v(t,e){return setInterval(function(){e.on&&t.length>=e.logCountThreshold&&(w(t.slice(0),e.url,0),t.splice(0))},e.transmitInterval)}function y(t,e){e.on&&(navigator.sendBeacon?window.addEventListener("unload",function(){navigator.sendBeacon(e.url,JSON.stringify(t))}):window.addEventListener("beforeunload",function(){t.length>0&&w(t,e.url,1)}))}function w(t,e,n){var o=new XMLHttpRequest,r=JSON.stringify(t);o.open("POST",e),o.setRequestHeader("
Content-type","application/json;charset=UTF-8"),o.onreadystatechange=function(){4===o.readyState&&200!==o.status&&n>0&&w(t,e,n--)},o.send(r)}function S(e){t.started||setTimeout(function(){var n=document.readyState;"interactive"===n||"complete"===n?(h(e),g(M,e),t.started=e.on=!0):S(e)},100)}function E(){t.started||S(H),H.on=!0}function I(){H.on=!1}function N(t){return void 0!==t&&n(H,t),H}function b(t){return null!==t&&"object"==typeof t&&(M.push(t),!0)}var D,T,k,C,K,L,x,V,X,O,j,F=null,R=null,Y=["click","focus","blur","input","change","mouseover","submit"],A=["load","blur","focus"],B=null,H={},M=[];t.started=!1,H.on=!1,H.useraleVersion="1.0.0",n(H,function(){var t={},n=document.currentScript||function(){var t=document.getElementsByTagName("script");return t[t.length-1]}(),o=n?n.getAttribute.bind(n):function(){return null};return t.autostart="false"!==o("data-autostart"),t.url=o("data-url")||"http://localhost:8000",t.transmitInterval=+o("data-interval")||5e3,t.logCountThreshold=+o("da
ta-threshold")||5,t.userId=o("data-user")||null,t.version=o("data-version")||null,t.logDetails="true"===o("data-log-details"),t.resolution=+o("data-resolution")||500,t.toolName=o("data-tool")||null,t.userFromParams=o("data-user-from-params")||null,t.time=e(document.createEvent("CustomEvent")),t.sessionID=o("data-session")||"session_"+String(Date.now()),t}()),function(t,e){D=t,T=e,F=null,R=null,k=null,C=null,K=null,L=null,x=0,V=null}(M,H),H.autostart&&S(H);t.version="1.0.0",t.start=E,t.stop=I,t.options=N,t.log=b,t.map=u,t.filter=r}(this.userale=this.userale||{});
-!function(t){"use strict";function e(t){if(t.timeStamp&&t.timeStamp>0){var e,n=Date.now()-t.timeStamp;if(n<0)e=function(){return t.timeStamp/1e3};else if(n>t.timeStamp){var r=performance.timing.navigationStart;e=function(t){return t+r}}else e=function(t){return t}}else e=function(){return Date.now()};return e}function n(t,e){Object.keys(e).forEach(function(n){if("userFromParams"===n){var a=r(e[n]);a&&(t.userId=a)}t[n]=e[n]})}function r(t){var e=t,n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)"),r=window.location.href.match(n);return r&&r[2]?decodeURIComponent(r[2].replace(/\+/g," ")):null}function a(t,e){if(!E.on)return!1;var n=null;e&&(n=e(t));var r={target:l(t.target),path:u(t),clientTime:Math.floor(t.timeStamp&&t.timeStamp>0?E.time(t.timeStamp):Date.now()),location:o(t),type:t.type,userAction:!0,details:n,userId:E.userId,toolVersion:E.version,toolName:E.toolName,useraleVersion:E.useraleVersion};return K.push(r),!0}function o(t){return null!=t.pageX?{x:t.pageX,y:t.pageY}:null!=t.client
X?{x:document.documentElement.scrollLeft+t.clientX,y:document.documentElement.scrollTop+t.clientY}:{x:null,y:null}}function l(t){return t.localName?t.localName+(t.id?"#"+t.id:"")+(t.className?"."+t.className:""):t.nodeName?t.nodeName+(t.id?"#"+t.id:"")+(t.className?"."+t.className:""):t&&t.document&&t.location&&t.alert&&t.setInterval?"Window":"Unknown"}function u(t){var e=[];if(t.path)e=t.path;else for(var n=t.target;n;)e.push(n),n=n.parentElement;return i(e)}function i(t){for(var e,n=0,r=[];e=t[n];)r.push(l(e)),++n;return r}function c(t){S={click:function(t){return{clicks:t.detail,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}},dblclick:function(t){return{clicks:t.detail,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}},mousedown:function(t){return{clicks:t.detail,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}},mouseup:function(t){return{clicks:t.detail,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}},focus:null,blur:null,input:t
.logDetails?function(t){return{value:t.target.value}}:null,change:t.logDetails?function(t){return{value:t.target.value}}:null,dragstart:null,dragend:null,drag:null,drop:null,keydown:t.logDetails?function(t){return{key:t.keyCode,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}}:null,mouseover:null,submit:null},N={},k={wheel:function(t){return{x:t.deltaX,y:t.deltaY,z:t.deltaZ}},scroll:function(){return{x:window.scrollX,y:window.scrollY}},resize:function(){return{width:window.outerWidth,height:window.outerHeight}}},b=["load","blur","focus"]}function s(t){return c(t),Object.keys(S).forEach(function(t){document.addEventListener(t,function(e){a(e,S[t])},!0)}),Object.keys(k).forEach(function(e){N[e]=!0,window.addEventListener(e,function(n){N[e]&&(N[e]=!1,a(n,k[e]),setTimeout(function(){N[e]=!0},t.resolution))},!0)}),b.forEach(function(t){window.addEventListener(t,function(t){a(t,function(){return{window:!0}})},!0)}),!0}function d(t,e){f(t,e),m(t,e)}function f(t,e){setInterval(f
unction(){t.length>=e.logCountThreshold&&(h(t.slice(0),e.url,0),t.splice(0))},e.transmitInterval)}function m(t,e){navigator.sendBeacon?window.addEventListener("unload",function(){navigator.sendBeacon(e.url,JSON.stringify(t))}):window.addEventListener("beforeunload",function(){t.length>0&&h(t,e.url,1)})}function h(t,e,n){var r=new XMLHttpRequest,a=JSON.stringify(t);r.open("POST",e),r.setRequestHeader("Content-type","application/json;charset=UTF-8"),r.onreadystatechange=function(){4===r.readyState&&200!==r.status&&n>0&&h(t,e,n--)},r.send(a)}function p(e){t.started||setTimeout(function(){var n=document.readyState;"interactive"===n||"complete"===n?(s(e),d(T,e),t.started=e.on=!0):p(e)},100)}function y(){t.started||p(I),I.on=!0}function v(){I.on=!1}function g(t){return void 0!==t&&n(I,t),I}function w(t){return null!==t&&"object"==typeof t&&(T.push(t),!0)}var K,E,S,N,k,b,I={},T=[];t.started=!1,I.on=!1,I.useraleVersion="1.0.0",n(I,function(){var t={},n=document.currentScript||function(){var
t=document.getElementsByTagName("script");return t[t.length-1]}(),r=n?n.getAttribute.bind(n):function(){return null};return t.autostart="false"!==r("data-autostart"),t.url=r("data-url")||"http://localhost:8000",t.transmitInterval=+r("data-interval")||5e3,t.logCountThreshold=+r("data-threshold")||5,t.userId=r("data-user")||null,t.version=r("data-version")||null,t.logDetails="true"===r("data-log-details"),t.resolution=+r("data-resolution")||500,t.toolName=r("data-tool")||null,t.userFromParams=r("data-user-from-params")||null,t.time=e(document.createEvent("CustomEvent")),t}()),function(t,e){K=t,E=e}(T,I),I.autostart&&p(I);t.version="1.0.0",t.start=y,t.stop=v,t.options=g,t.log=w}(this.userale=this.userale||{});
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/4a61c9f7/package.json
----------------------------------------------------------------------
[07/13] incubator-senssoft-useralejs git commit: Added lib directory
for compiled userale and minified version.
Posted by rf...@apache.org.
Added lib directory for compiled userale and minified version.
Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/commit/e2ab5f7a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/tree/e2ab5f7a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/diff/e2ab5f7a
Branch: refs/heads/SENSSOFT-192
Commit: e2ab5f7aa68e8b8f92f8e8b61bdd35acdc7e6f92
Parents: f2c4219
Author: msbeard <ms...@apache.org>
Authored: Tue Jan 30 11:05:45 2018 -0500
Committer: msbeard <ms...@apache.org>
Committed: Tue Jan 30 11:05:45 2018 -0500
----------------------------------------------------------------------
lib/userale.js | 533 ++++++++++++++++++++++++++++++++++++++++++++++++
lib/userale.min.js | 1 +
2 files changed, 534 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/e2ab5f7a/lib/userale.js
----------------------------------------------------------------------
diff --git a/lib/userale.js b/lib/userale.js
new file mode 100644
index 0000000..f3d8d67
--- /dev/null
+++ b/lib/userale.js
@@ -0,0 +1,533 @@
+(function (exports) {
+ 'use strict';
+
+ var version$1 = "1.0.0";
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+ /**
+ * Extracts the initial configuration settings from the
+ * currently executing script tag.
+ * @return {Object} The extracted configuration object
+ */
+ function getInitialSettings() {
+ var settings = {};
+
+ var script = document.currentScript || (function () {
+ var scripts = document.getElementsByTagName('script');
+ return scripts[scripts.length - 1];
+ })();
+
+ var get = script ? script.getAttribute.bind(script) : function() { return null; };
+
+ settings.autostart = get('data-autostart') === 'false' ? false : true;
+ settings.url = get('data-url') || 'http://localhost:8000';
+ settings.transmitInterval = +get('data-interval') || 5000;
+ settings.logCountThreshold = +get('data-threshold') || 5;
+ settings.userId = get('data-user') || null;
+ settings.version = get('data-version') || null;
+ settings.logDetails = get('data-log-details') === 'true' ? true : false;
+ settings.resolution = +get('data-resolution') || 500;
+ settings.toolName = get('data-tool') || null;
+ settings.userFromParams = get('data-user-from-params') || null;
+ settings.time = timeStampScale(document.createEvent('CustomEvent'));
+
+ return settings;
+ }
+
+ /**
+ * Creates a function to normalize the timestamp of the provided event.
+ * @param {Object} e An event containing a timeStamp property.
+ * @return {timeStampScale~tsScaler} The timestamp normalizing function.
+ */
+ function timeStampScale(e) {
+ if (e.timeStamp && e.timeStamp > 0) {
+ var delta = Date.now() - e.timeStamp;
+ /**
+ * Returns a timestamp depending on various browser quirks.
+ * @param {?Number} ts A timestamp to use for normalization.
+ * @return {Number} A normalized timestamp.
+ */
+ var tsScaler;
+
+ if (delta < 0) {
+ tsScaler = function () {
+ return e.timeStamp / 1000;
+ };
+ } else if (delta > e.timeStamp) {
+ var navStart = performance.timing.navigationStart;
+ tsScaler = function (ts) {
+ return ts + navStart;
+ }
+ } else {
+ tsScaler = function (ts) {
+ return ts;
+ }
+ }
+ } else {
+ tsScaler = function () { return Date.now(); };
+ }
+
+ return tsScaler;
+ }
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+ /**
+ * Shallow merges the first argument with the second.
+ * Retrieves/updates the userid if userFromParams is provided.
+ * @param {Object} config Current configuration object to be merged into.
+ * @param {Object} newConfig Configuration object to merge into the current config.
+ */
+ function configure(config, newConfig) {
+ Object.keys(newConfig).forEach(function(option) {
+ if (option === 'userFromParams') {
+ var userId = getUserIdFromParams(newConfig[option]);
+ if (userId) {
+ config.userId = userId;
+ }
+ }
+ config[option] = newConfig[option];
+ });
+ }
+
+ /**
+ * Attempts to extract the userid from the query parameters of the URL.
+ * @param {string} param The name of the query parameter containing the userid.
+ * @return {string|null} The extracted/decoded userid, or null if none is found.
+ */
+ function getUserIdFromParams(param) {
+ var userField = param;
+ var regex = new RegExp('[?&]' + userField + '(=([^&#]*)|&|#|$)');
+ var results = window.location.href.match(regex);
+
+ if (results && results[2]) {
+ return decodeURIComponent(results[2].replace(/\+/g, ' '));
+ } else {
+ return null;
+ }
+ }
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+ var logs$1;
+ var config$1;
+
+ /**
+ * Assigns the config and log container to be used by the logging functions.
+ * @param {Array} newLogs Log container.
+ * @param {Object} newConfig Configuration to use while logging.
+ */
+ function initPackager(newLogs, newConfig) {
+ logs$1 = newLogs;
+ config$1 = newConfig;
+ }
+
+ /**
+ * Transforms the provided event into a log and appends it to the log container.
+ * @param {Object} e The event to be logged.
+ * @param {Function} detailFcn The function to extract additional log parameters from the event.
+ * @return {boolean} Whether the event was logged.
+ */
+ function packageLog(e, detailFcn) {
+ if (!config$1.on) {
+ return false;
+ }
+
+ var details = null;
+ if (detailFcn) {
+ details = detailFcn(e);
+ }
+
+ var log = {
+ 'target' : getSelector(e.target),
+ 'path' : buildPath(e),
+ 'clientTime' : Math.floor((e.timeStamp && e.timeStamp > 0) ? config$1.time(e.timeStamp) : Date.now()),
+ 'location' : getLocation(e),
+ 'type' : e.type,
+ 'userAction' : true,
+ 'details' : details,
+ 'userId' : config$1.userId,
+ 'toolVersion' : config$1.version,
+ 'toolName' : config$1.toolName,
+ 'useraleVersion': config$1.useraleVersion
+ };
+
+ logs$1.push(log);
+
+ return true;
+ }
+
+ /**
+ * Extracts coordinate information from the event
+ * depending on a few browser quirks.
+ * @param {Object} e The event to extract coordinate information from.
+ * @return {Object} An object containing nullable x and y coordinates for the event.
+ */
+ function getLocation(e) {
+ if (e.pageX != null) {
+ return { 'x' : e.pageX, 'y' : e.pageY };
+ } else if (e.clientX != null) {
+ return { 'x' : document.documentElement.scrollLeft + e.clientX, 'y' : document.documentElement.scrollTop + e.clientY };
+ } else {
+ return { 'x' : null, 'y' : null };
+ }
+ }
+
+ /**
+ * Builds a string CSS selector from the provided element
+ * @param {HTMLElement} ele The element from which the selector is built.
+ * @return {string} The CSS selector for the element, or Unknown if it can't be determined.
+ */
+ function getSelector(ele) {
+ if (ele.localName) {
+ return ele.localName + (ele.id ? ('#' + ele.id) : '') + (ele.className ? ('.' + ele.className) : '');
+ } else if (ele.nodeName) {
+ return ele.nodeName + (ele.id ? ('#' + ele.id) : '') + (ele.className ? ('.' + ele.className) : '');
+ } else if (ele && ele.document && ele.location && ele.alert && ele.setInterval) {
+ return "Window";
+ } else {
+ return "Unknown";
+ }
+ }
+
+ /**
+ * Builds an array of elements from the provided event target, to the root element.
+ * @param {Object} e Event from which the path should be built.
+ * @return {HTMLElement[]} Array of elements, starting at the event target, ending at the root element.
+ */
+ function buildPath(e) {
+ var path = [];
+ if (e.path) {
+ path = e.path;
+ } else {
+ var ele = e.target
+ while(ele) {
+ path.push(ele);
+ ele = ele.parentElement;
+ }
+ }
+
+ return selectorizePath(path);
+ }
+
+ /**
+ * Builds a CSS selector path from the provided list of elements.
+ * @param {HTMLElement[]} path Array of HTMLElements from which the path should be built.
+ * @return {string[]} Array of string CSS selectors.
+ */
+ function selectorizePath(path) {
+ var i = 0;
+ var pathEle;
+ var pathSelectors = [];
+ while (pathEle = path[i]) {
+ pathSelectors.push(getSelector(pathEle));
+ ++i;
+ }
+ return pathSelectors;
+ }
+
+ var events;
+ var bufferBools;
+ var bufferedEvents;
+ var windowEvents;
+
+ /**
+ * Defines the way information is extracted from various events.
+ * Also defines which events we will listen to.
+ * @param {Object} config Configuration object to read from.
+ */
+ function defineDetails(config) {
+ // Events list
+ // Keys are event types
+ // Values are functions that return details object if applicable
+ events = {
+ 'click' : function(e) { return { 'clicks' : e.detail, 'ctrl' : e.ctrlKey, 'alt' : e.altKey, 'shift' : e.shiftKey, 'meta' : e.metaKey }; },
+ 'dblclick' : function(e) { return { 'clicks' : e.detail, 'ctrl' : e.ctrlKey, 'alt' : e.altKey, 'shift' : e.shiftKey, 'meta' : e.metaKey }; },
+ 'mousedown' : function(e) { return { 'clicks' : e.detail, 'ctrl' : e.ctrlKey, 'alt' : e.altKey, 'shift' : e.shiftKey, 'meta' : e.metaKey }; },
+ 'mouseup' : function(e) { return { 'clicks' : e.detail, 'ctrl' : e.ctrlKey, 'alt' : e.altKey, 'shift' : e.shiftKey, 'meta' : e.metaKey }; },
+ 'focus' : null,
+ 'blur' : null,
+ 'input' : config.logDetails ? function(e) { return { 'value' : e.target.value }; } : null,
+ 'change' : config.logDetails ? function(e) { return { 'value' : e.target.value }; } : null,
+ 'dragstart' : null,
+ 'dragend' : null,
+ 'drag' : null,
+ 'drop' : null,
+ 'keydown' : config.logDetails ? function(e) { return { 'key' : e.keyCode, 'ctrl' : e.ctrlKey, 'alt' : e.altKey, 'shift' : e.shiftKey, 'meta' : e.metaKey }; } : null,
+ 'mouseover' : null,
+ 'submit' : null
+ };
+
+ bufferBools = {};
+ bufferedEvents = {
+ 'wheel' : function(e) { return { 'x' : e.deltaX, 'y' : e.deltaY, 'z' : e.deltaZ }; },
+ 'scroll' : function() { return { 'x' : window.scrollX, 'y' : window.scrollY }; },
+ 'resize' : function() { return { 'width' : window.outerWidth, 'height' : window.outerHeight }; }
+ };
+
+ windowEvents = ['load', 'blur', 'focus'];
+ }
+
+ /**
+ * Hooks the event handlers for each event type of interest.
+ * @param {Object} config Configuration object to use.
+ * @return {boolean} Whether the operation succeeded
+ */
+ function attachHandlers(config) {
+ defineDetails(config);
+
+ Object.keys(events).forEach(function(ev) {
+ document.addEventListener(ev, function(e) {
+ packageLog(e, events[ev]);
+ }, true);
+ });
+
+ Object.keys(bufferedEvents).forEach(function(ev) {
+ bufferBools[ev] = true;
+
+ window.addEventListener(ev, function(e) {
+ if (bufferBools[ev]) {
+ bufferBools[ev] = false;
+ packageLog(e, bufferedEvents[ev]);
+ setTimeout(function() { bufferBools[ev] = true; }, config.resolution);
+ }
+ }, true);
+ });
+
+ windowEvents.forEach(function(ev) {
+ window.addEventListener(ev, function(e) {
+ packageLog(e, function() { return { 'window' : true }; });
+ }, true);
+ });
+
+ return true;
+ }
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+ /**
+ * Initializes the log queue processors.
+ * @param {Array} logs Array of logs to append to.
+ * @param {Object} config Configuration object to use when logging.
+ */
+ function initSender(logs, config) {
+ sendOnInterval(logs, config);
+ sendOnClose(logs, config);
+ }
+
+ /**
+ * Checks the provided log array on an interval, flushing the logs
+ * if the queue has reached the threshold specified by the provided config.
+ * @param {Array} logs Array of logs to read from.
+ * @param {Object} config Configuration object to be read from.
+ */
+ function sendOnInterval(logs, config) {
+ setInterval(function() {
+ if (logs.length >= config.logCountThreshold) {
+ sendLogs(logs.slice(0), config.url, 0); // Send a copy
+ logs.splice(0); // Clear array reference (no reassignment)
+ }
+ }, config.transmitInterval);
+ }
+
+ /**
+ * Attempts to flush the remaining logs when the window is closed.
+ * @param {Array} logs Array of logs to be flushed.
+ * @param {Object} config Configuration object to be read from.
+ */
+ function sendOnClose(logs, config) {
+ if (navigator.sendBeacon) {
+ window.addEventListener('unload', function() {
+ navigator.sendBeacon(config.url, JSON.stringify(logs));
+ });
+ } else {
+ window.addEventListener('beforeunload', function() {
+ if (logs.length > 0) {
+ sendLogs(logs, config.url, 1);
+ }
+ })
+ }
+ }
+
+ /**
+ * Sends the provided array of logs to the specified url,
+ * retrying the request up to the specified number of retries.
+ * @param {Array} logs Array of logs to send.
+ * @param {string} url URL to send the POST request to.
+ * @param {Number} retries Maximum number of attempts to send the logs.
+ */
+ function sendLogs(logs, url, retries) {
+ var req = new XMLHttpRequest();
+
+ var data = JSON.stringify(logs);
+
+ req.open('POST', url);
+ req.setRequestHeader('Content-type', 'application/json;charset=UTF-8');
+
+ req.onreadystatechange = function() {
+ if (req.readyState === 4 && req.status !== 200) {
+ if (retries > 0) {
+ sendLogs(logs, url, retries--);
+ }
+ }
+ };
+
+ req.send(data);
+ }
+
+ var config = {};
+ var logs = [];
+ exports.started = false;
+
+
+ // Start up Userale
+ config.on = false;
+ config.useraleVersion = version$1;
+
+ configure(config, getInitialSettings());
+ initPackager(logs, config);
+
+ if (config.autostart) {
+ setup(config);
+ }
+
+ /**
+ * Hooks the global event listener, and starts up the
+ * logging interval.
+ * @param {Object} config Configuration settings for the logger
+ */
+ function setup(config) {
+ if (!exports.started) {
+ setTimeout(function() {
+ var state = document.readyState;
+
+ if (state === 'interactive' || state === 'complete') {
+ attachHandlers(config);
+ initSender(logs, config);
+ exports.started = config.on = true;
+ } else {
+ setup(config);
+ }
+ }, 100);
+ }
+ }
+
+
+ // Export the Userale API
+ var version = version$1;
+
+ /**
+ * Used to start the logging process if the
+ * autostart configuration option is set to false.
+ */
+ function start() {
+ if (!exports.started) {
+ setup(config);
+ }
+
+ config.on = true;
+ }
+
+ /**
+ * Halts the logging process. Logs will no longer be sent.
+ */
+ function stop() {
+ config.on = false;
+ }
+
+ /**
+ * Updates the current configuration
+ * object with the provided values.
+ * @param {Object} newConfig The configuration options to use.
+ * @return {Object} Returns the updated configuration.
+ */
+ function options(newConfig) {
+ if (newConfig !== undefined) {
+ configure(config, newConfig);
+ }
+
+ return config;
+ }
+
+ /**
+ * Appends a log to the log queue.
+ * @param {Object} customLog The log to append.
+ * @return {boolean} Whether the operation succeeded.
+ */
+ function log(customLog) {
+ if (customLog !== null && typeof customLog === 'object') {
+ logs.push(customLog);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ exports.version = version;
+ exports.start = start;
+ exports.stop = stop;
+ exports.options = options;
+ exports.log = log;
+
+}((this.userale = this.userale || {})));
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/e2ab5f7a/lib/userale.min.js
----------------------------------------------------------------------
diff --git a/lib/userale.min.js b/lib/userale.min.js
new file mode 100644
index 0000000..5253a54
--- /dev/null
+++ b/lib/userale.min.js
@@ -0,0 +1 @@
+!function(t){"use strict";function e(t){if(t.timeStamp&&t.timeStamp>0){var e,n=Date.now()-t.timeStamp;if(n<0)e=function(){return t.timeStamp/1e3};else if(n>t.timeStamp){var r=performance.timing.navigationStart;e=function(t){return t+r}}else e=function(t){return t}}else e=function(){return Date.now()};return e}function n(t,e){Object.keys(e).forEach(function(n){if("userFromParams"===n){var a=r(e[n]);a&&(t.userId=a)}t[n]=e[n]})}function r(t){var e=t,n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)"),r=window.location.href.match(n);return r&&r[2]?decodeURIComponent(r[2].replace(/\+/g," ")):null}function a(t,e){if(!E.on)return!1;var n=null;e&&(n=e(t));var r={target:l(t.target),path:u(t),clientTime:Math.floor(t.timeStamp&&t.timeStamp>0?E.time(t.timeStamp):Date.now()),location:o(t),type:t.type,userAction:!0,details:n,userId:E.userId,toolVersion:E.version,toolName:E.toolName,useraleVersion:E.useraleVersion};return K.push(r),!0}function o(t){return null!=t.pageX?{x:t.pageX,y:t.pageY}:null!=t.clientX
?{x:document.documentElement.scrollLeft+t.clientX,y:document.documentElement.scrollTop+t.clientY}:{x:null,y:null}}function l(t){return t.localName?t.localName+(t.id?"#"+t.id:"")+(t.className?"."+t.className:""):t.nodeName?t.nodeName+(t.id?"#"+t.id:"")+(t.className?"."+t.className:""):t&&t.document&&t.location&&t.alert&&t.setInterval?"Window":"Unknown"}function u(t){var e=[];if(t.path)e=t.path;else for(var n=t.target;n;)e.push(n),n=n.parentElement;return i(e)}function i(t){for(var e,n=0,r=[];e=t[n];)r.push(l(e)),++n;return r}function c(t){S={click:function(t){return{clicks:t.detail,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}},dblclick:function(t){return{clicks:t.detail,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}},mousedown:function(t){return{clicks:t.detail,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}},mouseup:function(t){return{clicks:t.detail,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}},focus:null,blur:null,input:t.
logDetails?function(t){return{value:t.target.value}}:null,change:t.logDetails?function(t){return{value:t.target.value}}:null,dragstart:null,dragend:null,drag:null,drop:null,keydown:t.logDetails?function(t){return{key:t.keyCode,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}}:null,mouseover:null,submit:null},N={},k={wheel:function(t){return{x:t.deltaX,y:t.deltaY,z:t.deltaZ}},scroll:function(){return{x:window.scrollX,y:window.scrollY}},resize:function(){return{width:window.outerWidth,height:window.outerHeight}}},b=["load","blur","focus"]}function s(t){return c(t),Object.keys(S).forEach(function(t){document.addEventListener(t,function(e){a(e,S[t])},!0)}),Object.keys(k).forEach(function(e){N[e]=!0,window.addEventListener(e,function(n){N[e]&&(N[e]=!1,a(n,k[e]),setTimeout(function(){N[e]=!0},t.resolution))},!0)}),b.forEach(function(t){window.addEventListener(t,function(t){a(t,function(){return{window:!0}})},!0)}),!0}function d(t,e){f(t,e),m(t,e)}function f(t,e){setInterval(fu
nction(){t.length>=e.logCountThreshold&&(h(t.slice(0),e.url,0),t.splice(0))},e.transmitInterval)}function m(t,e){navigator.sendBeacon?window.addEventListener("unload",function(){navigator.sendBeacon(e.url,JSON.stringify(t))}):window.addEventListener("beforeunload",function(){t.length>0&&h(t,e.url,1)})}function h(t,e,n){var r=new XMLHttpRequest,a=JSON.stringify(t);r.open("POST",e),r.setRequestHeader("Content-type","application/json;charset=UTF-8"),r.onreadystatechange=function(){4===r.readyState&&200!==r.status&&n>0&&h(t,e,n--)},r.send(a)}function p(e){t.started||setTimeout(function(){var n=document.readyState;"interactive"===n||"complete"===n?(s(e),d(T,e),t.started=e.on=!0):p(e)},100)}function y(){t.started||p(I),I.on=!0}function v(){I.on=!1}function g(t){return void 0!==t&&n(I,t),I}function w(t){return null!==t&&"object"==typeof t&&(T.push(t),!0)}var K,E,S,N,k,b,I={},T=[];t.started=!1,I.on=!1,I.useraleVersion="1.0.0",n(I,function(){var t={},n=document.currentScript||function(){var
t=document.getElementsByTagName("script");return t[t.length-1]}(),r=n?n.getAttribute.bind(n):function(){return null};return t.autostart="false"!==r("data-autostart"),t.url=r("data-url")||"http://localhost:8000",t.transmitInterval=+r("data-interval")||5e3,t.logCountThreshold=+r("data-threshold")||5,t.userId=r("data-user")||null,t.version=r("data-version")||null,t.logDetails="true"===r("data-log-details"),t.resolution=+r("data-resolution")||500,t.toolName=r("data-tool")||null,t.userFromParams=r("data-user-from-params")||null,t.time=e(document.createEvent("CustomEvent")),t}()),function(t,e){K=t,E=e}(T,I),I.autostart&&p(I);t.version="1.0.0",t.start=y,t.stop=v,t.options=g,t.log=w}(this.userale=this.userale||{});
\ No newline at end of file
[04/13] incubator-senssoft-useralejs git commit: Prepare for
UserALE.js 0.1.0 RC#1
Posted by rf...@apache.org.
Prepare for UserALE.js 0.1.0 RC#1
Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/commit/7c5b2be3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/tree/7c5b2be3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/diff/7c5b2be3
Branch: refs/heads/SENSSOFT-192
Commit: 7c5b2be3203ad976e8ae622bb6ffcdba1e95a9d4
Parents: 34c0fed
Author: Lewis John McGibbney <le...@gmail.com>
Authored: Thu Jan 18 10:14:53 2018 -0800
Committer: Lewis John McGibbney <le...@gmail.com>
Committed: Thu Jan 18 10:14:53 2018 -0800
----------------------------------------------------------------------
KEYS | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/7c5b2be3/KEYS
----------------------------------------------------------------------
diff --git a/KEYS b/KEYS
new file mode 100644
index 0000000..3aa1683
--- /dev/null
+++ b/KEYS
@@ -0,0 +1,76 @@
+This file contains the PGP keys of various Apache developers.
+Please don't use them for email unless you have to. Their main
+purpose is code signing.
+
+Apache users: pgp < KEYS
+Apache developers:
+ (pgpk -ll <your name> && pgpk -xa <your name>) >> this file.
+ or
+ (gpg --fingerprint --list-sigs <your name>
+ && gpg --armor --export <your name>) >> this file.
+
+Apache developers: please ensure that your key is also available via the
+PGP keyservers (such as pgpkeys.mit.edu).
+
+
+----------------------------------------------------------------
+
+pub 4096R/48BAEBF6 2013-10-28
+ Key fingerprint = DB7B 5199 121C 08A5 C8F4 052B 3A47 17F0 48BA EBF6
+uid Lewis John McGibbney (CODE SIGNING KEY) <le...@apache.org>
+sig 3 48BAEBF6 2013-10-28 Lewis John McGibbney (CODE SIGNING KEY) <le...@apache.org>
+sub 4096R/88149F13 2013-10-28
+sig 48BAEBF6 2013-10-28 Lewis John McGibbney (CODE SIGNING KEY) <le...@apache.org>
+
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.11 (GNU/Linux)
+
+mQINBFJub9kBEADL8yTpP+Q78Hfy/GubY9q7MJPTvdKgbZiBFr8Xv7S2/cbm5hZm
+5pXNOBuuED95IgtlZ6q0K4QNjmbR6iEruw06kFN7nWmu2PnIDz85+qqmK78ri2k7
+zzM1zcM22kbu6DV0UQx9JWEVX+JkKa/y03aZ4JcxiTDMg76AmP6MhcnhNuQqCdZU
+Dgo8KN4JSRKtFbiojqhSslR0lu6RVmdFQvviSaSX9BLxed/cOHdaO8ex7g5fLs8N
+JLZUO/TAWDZJvULGvs/mOtAsbvDPjr2ej/sYaXVD8vvB31mDzgcQ26mXMG/z2NoP
+XgYQCUFiHb5FxCmkM5EYQYCvLlZFTO4vXf08o6nlc5TKQsfl8a3KIoIWIom05843
+Ru7zhckZ1M9x69MWH7LbYhFB0GI9C7gxFe5d5m6F654gQe8AUN71rFwQ8NjODPeB
+NC3QBMMllir3MDnJMM29juAhR29JpshwOx9UY8VmG9stzv1S18Z0PRkdnhnJgC8+
+i32OxAnCmbjPtpiYS1WQQ04Ozr+A8ojSr+5KwCoYYNOtNWsoOc35BZUC1mqdjulv
+engDauCpZH0POxQQQmQHsk4zB3hGOO/AA3Uef/AYxIVa5hxM3eHqOSXBXMnyK5qn
+jz0olTkKsMShKuMWOi0NFznYfKGJtETh5MjV+Y3dNBZ8E4jEjAjca6fxvwARAQAB
+tDxMZXdpcyBKb2huIE1jR2liYm5leSAoQ09ERSBTSUdOSU5HIEtFWSkgPGxld2lz
+bWNAYXBhY2hlLm9yZz6JAjgEEwECACIFAlJub9kCGwMGCwkIBwMCBhUIAgkKCwQW
+AgMBAh4BAheAAAoJEDpHF/BIuuv24zsQAKX4W/T8yoCszgeABU73yJ9z73PxSORR
+N3rNjk4LM36b/HzISwo6xcG789hxD2ooN9fYS21WEA8dzLH0IUT3LVM7ccsfCiKu
+OUCCvzcdFYFlNXps1U/2utiIk/M9Nn23Hzr7B20qsfinfPECOQZRgvejCKMJq+UN
+ZtBfzIdd+JnqpTiVFP/XDKEKoV1h62/V+Nc3ZT5oExRM4gMmIfALMm2fWKSPfV0W
+hyBeOauVap9uPleRxtUbqVEHT7YUsbi36thu7OZDHshxmNwQpByUos9GdtkpknHU
+tDVjAlgbd526DqGlUMje/Xj3KUmjuHjxG9Y3VHGEMAsZu5YzwceYxC6hChwIASaf
+egqbcSDfYB28hSI2+dpaSdoBMPE741lSs4icsuTFb4OTzqvYwnUDK8BWs2CM4vs+
+nMCbNMTzXzJttPwNdbsRn8bdu6vd3TuvBbdYelyLmQN/z2B8ErjSpGwQDY2B6wXm
+Jyd1FpDeCEeSuvel/AnbcF3lOcfJukdN5//ns29c2EM3YZhdTD8gkGWduC9I0zD8
+XmSc819V7uO4hRNJJBc+Jb/kYVXQWzz9N3iXTg/uSD/GYEKTuCYAWG1jJvWOkN0S
+HhNYtZs4J7B4q8Yb71+tqMOIbln2x7bbAMDt+ds0sfkhHYJbFW1JA4pZ7kQPRe0g
+dok5byksAITluQINBFJub9kBEADJzskj9a5ANGeXo8aCVKU8ZgiXhTBOX79Yq2+w
+/LEmtkILmSmgvlFvLbYX7DHK8J9w7W9tOcn/cMsNzidEyEtZQRzafYl9stsrFkhZ
+XzkU7GoIe6GY2ijGu/RG92hjALjgCKb6vodhqIU3hnJ9VnaqIoTjBkGivvHp0d4f
+F32Hi3irsTtzSaUXbK+ih2a3Xcih009ajjRaP3Y4z8c24BPRHtJPXn91j6jm4yx1
+9+D3cEvfzxfz5E3qeEg8NEnJngRgi0et8ko2Ac4H9TOH60NJAIz85kq/JYxLmYSw
+FQRP6E26oISA5sjf6xRh2vmc8mRAImESWl9UbugGWV4XlvvWgDEVf2O+TQVE1rbN
+9V2g/lG+y6QXDLXH6UsnoEHkp4svt8/XLqewazKG1H4ac+PK5zSNHOCNyQylhQtb
+LcWqlQqsPsEz29hlddSy7Xrp/CueZgGUH/8HI9/SqJrBvtLPiO473b6BGCXONS9U
+yuJtiWlrcDHE/cZEgLZjNK8XTyYeSS5civz7VyqM2av0m59UIzTIfbnqjJVrxxfo
+arwjgC8hV/WhrwdRGt9/TjfDaj1ynKjtoey2zBFhnVzjmEgmpKffXZsIrFCa5BxR
+rYo+WketKNHy4FswwcoznHDmr+0AMIrbKL27LeTAr9BK0aG6MKxcC8A34yVMfa1/
+CXAWZwARAQABiQIfBBgBAgAJBQJSbm/ZAhsMAAoJEDpHF/BIuuv2G98P/2PLJiZD
+KneXkwtwk45cGzleTQHRXCJc0kiysf5ggVVSF2u9dK5uANDNTr3qjYoop5ky3gjM
+/EoCZUFMwM42tZqQwFefUakepuM9fa8F1ke+UDqKd2UwTkT4sq7witkSdC7ME81V
+etbJNGniM6sPytbmRPyNMu+hxobTZojUqDTd/u4W/tthg+WQrI+DDXaOt3/AjWg0
+F9zjyDeurSTHi4KNV1VEH6d2vqO/Wxes4Wil2Wmri1fefafo/H0HtciAdQWAr43h
+wqGH8vvFFoKgqgMKbn9sXhF4ZK6AFp+EfgiAWzzcrQodWkOk0LEsPDB0Rz4DOncQ
+bEmH5Z/+vKaSCsIl+nQKrcwqRnB6XOTc9Ibr8fVcQk7aK5nGROg3+2tiuyJ4XvZR
+bhPOAIsRH6Qj4aUUsHk2Fb601pVOv9nF+uTIw14sJeKAim5Znslv0d+7zVWeNsWX
+99ALKibjH0RwS6p3b5TPDc8oSBBQK0eEU9Osug2D0iWU4jO5m3UzdTu4/XIbTvrX
+wpZike26qO1z4LedncZhFV8e9ylEBwGhObr7/W91E8Fw8kBdDNt7Lm/IDZkF1uSW
+CxS+NsK871+gxIsxfmgEzO8sh8wEVEU8nJcSu0Q3VamqzwCFqp3+99eJeK7Aoghv
+U4mpCUPzJn0b//0ghg/s1QfpYW0sT6iCPWd1
+=Q6l+
+-----END PGP PUBLIC KEY BLOCK-----
[13/13] incubator-senssoft-useralejs git commit: Bumped version
Posted by rf...@apache.org.
Bumped version
Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/commit/6302909e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/tree/6302909e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/diff/6302909e
Branch: refs/heads/SENSSOFT-192
Commit: 6302909ec569ee49563a61fa86d056a2236d465c
Parents: 4a61c9f
Author: Rob Foley <rg...@users.noreply.github.com>
Authored: Fri Apr 13 14:40:03 2018 -0400
Committer: Rob Foley <rg...@users.noreply.github.com>
Committed: Fri Apr 13 14:40:03 2018 -0400
----------------------------------------------------------------------
build/UserAleWebExtension/content.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/6302909e/build/UserAleWebExtension/content.js
----------------------------------------------------------------------
diff --git a/build/UserAleWebExtension/content.js b/build/UserAleWebExtension/content.js
index 51b5f10..9a96e39 100644
--- a/build/UserAleWebExtension/content.js
+++ b/build/UserAleWebExtension/content.js
@@ -14,7 +14,7 @@ var prefix = 'USERALE_';
var CONFIG_CHANGE = prefix + 'CONFIG_CHANGE';
var ADD_LOG = prefix + 'ADD_LOG';
-var version$1 = "1.0.0";
+var version$1 = "1.1.0";
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
[02/13] incubator-senssoft-useralejs git commit: Updated copyright
attribution
Posted by rf...@apache.org.
Updated copyright attribution
Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/commit/85837f09
Tree: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/tree/85837f09
Diff: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/diff/85837f09
Branch: refs/heads/SENSSOFT-192
Commit: 85837f0969b0fdc3b65a86e50a27fb0f6efc252d
Parents: d68bb04
Author: Rob Foley <rg...@users.noreply.github.com>
Authored: Fri Dec 1 12:50:09 2017 -0500
Committer: Rob Foley <rg...@users.noreply.github.com>
Committed: Fri Dec 1 12:50:09 2017 -0500
----------------------------------------------------------------------
LICENSE | 402 ++++++++++++++++++++++++++++-----------------------------
NOTICE | 2 +-
README.md | 2 +-
3 files changed, 203 insertions(+), 203 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/85837f09/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
index 1a083a4..0c1292f 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,201 +1,201 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2016 The Charles Stark Draper Laboratory, Inc.
-
- 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.
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ © Copyright 2016 The Charles Stark Draper Laboratory, Inc. All rights reserved.
+
+ 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.
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/85837f09/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
index c72e4d5..ec44eb1 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
Apache SensSoft UserALE.js
-Copyright 2017 The Apache Software Foundation
+© Copyright 2016 The Charles Stark Draper Laboratory, Inc. All rights reserved.
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/85837f09/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 56f109b..b94821e 100644
--- a/README.md
+++ b/README.md
@@ -58,4 +58,4 @@ Contributions are welcome! Simply submit an issue report for problems you encou
## License
-Copyright © 2017 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Software as a Sensor is a trademark of the Charles Stark Draper Laboratory, Inc.
\ No newline at end of file
+© Copyright 2016 The Charles Stark Draper Laboratory, Inc. All rights reserved., Licensed under the Apache License, Version 2.0. Software as a Sensor is a trademark of the Charles Stark Draper Laboratory, Inc.
\ No newline at end of file
[05/13] incubator-senssoft-useralejs git commit: SENSSOFT-250 Create
README for UserALE.js examples directory
Posted by rf...@apache.org.
SENSSOFT-250 Create README for UserALE.js examples directory
Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/commit/937863f8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/tree/937863f8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/diff/937863f8
Branch: refs/heads/SENSSOFT-192
Commit: 937863f896279e689cecca29f3f71ef604af5c44
Parents: fb3d2f5 7c5b2be
Author: Lewis John McGibbney <le...@gmail.com>
Authored: Fri Jan 26 11:01:28 2018 -0800
Committer: Lewis John McGibbney <le...@gmail.com>
Committed: Fri Jan 26 11:01:28 2018 -0800
----------------------------------------------------------------------
KEYS | 76 +++++++++
LICENSE | 402 +++++++++++++++++++++++------------------------
NOTICE | 2 +-
README.md | 1 +
doap-userale.js.rdf | 2 +-
example/README.md | 2 +-
example/index.html | 2 +-
example/server.js | 2 +-
8 files changed, 283 insertions(+), 206 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/937863f8/README.md
----------------------------------------------------------------------
diff --cc README.md
index 59b69e0,b94821e..645d791
--- a/README.md
+++ b/README.md
@@@ -7,22 -7,6 +7,23 @@@ The official JavaScript client for [Apa
Additional documentation can be found at http://senssoft.incubator.apache.org/userale/
+## Prerequsites
+
+```
+npm install gulp
+npm install del
+npm install gulp-eslint
+npm install rollup
+npm install rollup-plugin-json
+npm install gulp-uglify
+npm install gulp-rename
+npm install gulp-mocha
+npm install babel-register
+npm install express
+npm install body-parser
++npm install nodemon
+```
+
## Build
To build UserALE.js:
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/937863f8/example/README.md
----------------------------------------------------------------------
diff --cc example/README.md
index fcc9b81,0000000..a0fb452
mode 100644,000000..100644
--- a/example/README.md
+++ b/example/README.md
@@@ -1,68 -1,0 +1,68 @@@
+# UserALE.js Example
+
+This directory provides
+ * example usage for UserALE.js within a simple HTML Webpage,
+ * how users can expect to log UserALE events, and
+ * what log events looks like within a simple UserALE logging server.
+
+## Prerequisites
+
+Please see the [Prerequsites](https://github.com/apache/incubator-senssoft-useralejs#prerequsites)
+
+## Running the Logging Server
+
+Assuming you have [node.js](https://nodejs.org/) installed, simply run
+
+```
- node server.js
++npm run example:watch
+```
+
+## Running the Example
+
+Simply open index.html in your browser... you will see a very simply HTML Webpage with a button.
+
+When you click the button, the events will be logged to the server (in memory), logs looks similar to the following
+
+```
+
+[ { target: 'body',
+ path: [ 'body', 'html' ],
+ clientTime: 1504287557492,
+ location: { x: 0, y: 0 },
+ type: 'keydown',
+ userAction: true,
+ details: null,
+ userId: 'example-user',
+ toolVersion: '1.0.0',
+ toolName: 'Apache UserALE.js Example',
+ useraleVersion: '1.0.0' },
+ { target: '#document',
+ path: [ '#document' ],
+ clientTime: 1504287558304,
+ location: { x: 0, y: 0 },
+ type: 'blur',
+ userAction: true,
+ details: { window: true },
+ userId: 'example-user',
+ toolVersion: '1.0.0',
+ toolName: 'Apache UserALE.js Example',
+ useraleVersion: '1.0.0' },
+ { target: '#document',
+ path: [ '#document' ],
+ clientTime: 1504287558304,
+ location: { x: 0, y: 0 },
+ type: 'blur',
+ userAction: true,
+ details: null,
+ userId: 'example-user',
+ toolVersion: '1.0.0',
+ toolName: 'Apache UserALE.js Example',
+ useraleVersion: '1.0.0' },
+ ...
+]
+
+```
+
+## Contributing
+
+Contributions are welcome! Simply [submit an issue report](https://issues.apache.org/jira/browse/senssoft) for problems you encounter or a pull request for your feature or bug fix. The core team will review it and work with you to incorporate it into UserALE.js.
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/937863f8/example/index.html
----------------------------------------------------------------------
diff --cc example/index.html
index d293675,d7cd66a..4849b9f
--- a/example/index.html
+++ b/example/index.html
@@@ -18,7 -18,7 +18,7 @@@ limitations under the License
<head>
<title>UserAleJS - Example Page</title>
<script
- src="../build/userale-1.0.0.min.js"
- src="build/userale-0.2.1.min.js"
++ src="build/userale-1.0.0.min.js"
data-url="http://localhost:8000/"
data-user="example-user"
data-version="1.0.0"
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/937863f8/example/server.js
----------------------------------------------------------------------
diff --cc example/server.js
index 8362123,354219e..5d5cc63
--- a/example/server.js
+++ b/example/server.js
@@@ -58,7 -58,7 +58,7 @@@ app.set('view engine', 'jade')
app.get('/', function (req, res) {
-- res.sendfile('index.html', { root: __dirname });
++ res.sendFile('index.html', { root: __dirname });
});
app.post('/', function (req, res) {
[08/13] incubator-senssoft-useralejs git commit: build directory were
dist files go
Posted by rf...@apache.org.
build directory were dist files go
Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/commit/b656f6af
Tree: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/tree/b656f6af
Diff: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/diff/b656f6af
Branch: refs/heads/SENSSOFT-192
Commit: b656f6af8ad9d3042b6ad7768e0d7dbbe614cb08
Parents: e2ab5f7
Author: msbeard <ms...@apache.org>
Authored: Mon Feb 12 10:37:30 2018 -0500
Committer: msbeard <ms...@apache.org>
Committed: Mon Feb 12 10:37:30 2018 -0500
----------------------------------------------------------------------
.gitignore | 1 -
build/userale-1.0.0.js | 533 ++++++++++++++++++++++++++++++++++++++++
build/userale-1.0.0.min.js | 1 +
lib/userale.js | 533 ----------------------------------------
lib/userale.min.js | 1 -
5 files changed, 534 insertions(+), 535 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/b656f6af/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 8ed5199..4c0ed70 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,5 @@
.idea
/node_modules/*
-/build/*
/logs/*
/.git/*
npm-debug.log
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/b656f6af/build/userale-1.0.0.js
----------------------------------------------------------------------
diff --git a/build/userale-1.0.0.js b/build/userale-1.0.0.js
new file mode 100644
index 0000000..f3d8d67
--- /dev/null
+++ b/build/userale-1.0.0.js
@@ -0,0 +1,533 @@
+(function (exports) {
+ 'use strict';
+
+ var version$1 = "1.0.0";
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+ /**
+ * Extracts the initial configuration settings from the
+ * currently executing script tag.
+ * @return {Object} The extracted configuration object
+ */
+ function getInitialSettings() {
+ var settings = {};
+
+ var script = document.currentScript || (function () {
+ var scripts = document.getElementsByTagName('script');
+ return scripts[scripts.length - 1];
+ })();
+
+ var get = script ? script.getAttribute.bind(script) : function() { return null; };
+
+ settings.autostart = get('data-autostart') === 'false' ? false : true;
+ settings.url = get('data-url') || 'http://localhost:8000';
+ settings.transmitInterval = +get('data-interval') || 5000;
+ settings.logCountThreshold = +get('data-threshold') || 5;
+ settings.userId = get('data-user') || null;
+ settings.version = get('data-version') || null;
+ settings.logDetails = get('data-log-details') === 'true' ? true : false;
+ settings.resolution = +get('data-resolution') || 500;
+ settings.toolName = get('data-tool') || null;
+ settings.userFromParams = get('data-user-from-params') || null;
+ settings.time = timeStampScale(document.createEvent('CustomEvent'));
+
+ return settings;
+ }
+
+ /**
+ * Creates a function to normalize the timestamp of the provided event.
+ * @param {Object} e An event containing a timeStamp property.
+ * @return {timeStampScale~tsScaler} The timestamp normalizing function.
+ */
+ function timeStampScale(e) {
+ if (e.timeStamp && e.timeStamp > 0) {
+ var delta = Date.now() - e.timeStamp;
+ /**
+ * Returns a timestamp depending on various browser quirks.
+ * @param {?Number} ts A timestamp to use for normalization.
+ * @return {Number} A normalized timestamp.
+ */
+ var tsScaler;
+
+ if (delta < 0) {
+ tsScaler = function () {
+ return e.timeStamp / 1000;
+ };
+ } else if (delta > e.timeStamp) {
+ var navStart = performance.timing.navigationStart;
+ tsScaler = function (ts) {
+ return ts + navStart;
+ }
+ } else {
+ tsScaler = function (ts) {
+ return ts;
+ }
+ }
+ } else {
+ tsScaler = function () { return Date.now(); };
+ }
+
+ return tsScaler;
+ }
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+ /**
+ * Shallow merges the first argument with the second.
+ * Retrieves/updates the userid if userFromParams is provided.
+ * @param {Object} config Current configuration object to be merged into.
+ * @param {Object} newConfig Configuration object to merge into the current config.
+ */
+ function configure(config, newConfig) {
+ Object.keys(newConfig).forEach(function(option) {
+ if (option === 'userFromParams') {
+ var userId = getUserIdFromParams(newConfig[option]);
+ if (userId) {
+ config.userId = userId;
+ }
+ }
+ config[option] = newConfig[option];
+ });
+ }
+
+ /**
+ * Attempts to extract the userid from the query parameters of the URL.
+ * @param {string} param The name of the query parameter containing the userid.
+ * @return {string|null} The extracted/decoded userid, or null if none is found.
+ */
+ function getUserIdFromParams(param) {
+ var userField = param;
+ var regex = new RegExp('[?&]' + userField + '(=([^&#]*)|&|#|$)');
+ var results = window.location.href.match(regex);
+
+ if (results && results[2]) {
+ return decodeURIComponent(results[2].replace(/\+/g, ' '));
+ } else {
+ return null;
+ }
+ }
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+ var logs$1;
+ var config$1;
+
+ /**
+ * Assigns the config and log container to be used by the logging functions.
+ * @param {Array} newLogs Log container.
+ * @param {Object} newConfig Configuration to use while logging.
+ */
+ function initPackager(newLogs, newConfig) {
+ logs$1 = newLogs;
+ config$1 = newConfig;
+ }
+
+ /**
+ * Transforms the provided event into a log and appends it to the log container.
+ * @param {Object} e The event to be logged.
+ * @param {Function} detailFcn The function to extract additional log parameters from the event.
+ * @return {boolean} Whether the event was logged.
+ */
+ function packageLog(e, detailFcn) {
+ if (!config$1.on) {
+ return false;
+ }
+
+ var details = null;
+ if (detailFcn) {
+ details = detailFcn(e);
+ }
+
+ var log = {
+ 'target' : getSelector(e.target),
+ 'path' : buildPath(e),
+ 'clientTime' : Math.floor((e.timeStamp && e.timeStamp > 0) ? config$1.time(e.timeStamp) : Date.now()),
+ 'location' : getLocation(e),
+ 'type' : e.type,
+ 'userAction' : true,
+ 'details' : details,
+ 'userId' : config$1.userId,
+ 'toolVersion' : config$1.version,
+ 'toolName' : config$1.toolName,
+ 'useraleVersion': config$1.useraleVersion
+ };
+
+ logs$1.push(log);
+
+ return true;
+ }
+
+ /**
+ * Extracts coordinate information from the event
+ * depending on a few browser quirks.
+ * @param {Object} e The event to extract coordinate information from.
+ * @return {Object} An object containing nullable x and y coordinates for the event.
+ */
+ function getLocation(e) {
+ if (e.pageX != null) {
+ return { 'x' : e.pageX, 'y' : e.pageY };
+ } else if (e.clientX != null) {
+ return { 'x' : document.documentElement.scrollLeft + e.clientX, 'y' : document.documentElement.scrollTop + e.clientY };
+ } else {
+ return { 'x' : null, 'y' : null };
+ }
+ }
+
+ /**
+ * Builds a string CSS selector from the provided element
+ * @param {HTMLElement} ele The element from which the selector is built.
+ * @return {string} The CSS selector for the element, or Unknown if it can't be determined.
+ */
+ function getSelector(ele) {
+ if (ele.localName) {
+ return ele.localName + (ele.id ? ('#' + ele.id) : '') + (ele.className ? ('.' + ele.className) : '');
+ } else if (ele.nodeName) {
+ return ele.nodeName + (ele.id ? ('#' + ele.id) : '') + (ele.className ? ('.' + ele.className) : '');
+ } else if (ele && ele.document && ele.location && ele.alert && ele.setInterval) {
+ return "Window";
+ } else {
+ return "Unknown";
+ }
+ }
+
+ /**
+ * Builds an array of elements from the provided event target, to the root element.
+ * @param {Object} e Event from which the path should be built.
+ * @return {HTMLElement[]} Array of elements, starting at the event target, ending at the root element.
+ */
+ function buildPath(e) {
+ var path = [];
+ if (e.path) {
+ path = e.path;
+ } else {
+ var ele = e.target
+ while(ele) {
+ path.push(ele);
+ ele = ele.parentElement;
+ }
+ }
+
+ return selectorizePath(path);
+ }
+
+ /**
+ * Builds a CSS selector path from the provided list of elements.
+ * @param {HTMLElement[]} path Array of HTMLElements from which the path should be built.
+ * @return {string[]} Array of string CSS selectors.
+ */
+ function selectorizePath(path) {
+ var i = 0;
+ var pathEle;
+ var pathSelectors = [];
+ while (pathEle = path[i]) {
+ pathSelectors.push(getSelector(pathEle));
+ ++i;
+ }
+ return pathSelectors;
+ }
+
+ var events;
+ var bufferBools;
+ var bufferedEvents;
+ var windowEvents;
+
+ /**
+ * Defines the way information is extracted from various events.
+ * Also defines which events we will listen to.
+ * @param {Object} config Configuration object to read from.
+ */
+ function defineDetails(config) {
+ // Events list
+ // Keys are event types
+ // Values are functions that return details object if applicable
+ events = {
+ 'click' : function(e) { return { 'clicks' : e.detail, 'ctrl' : e.ctrlKey, 'alt' : e.altKey, 'shift' : e.shiftKey, 'meta' : e.metaKey }; },
+ 'dblclick' : function(e) { return { 'clicks' : e.detail, 'ctrl' : e.ctrlKey, 'alt' : e.altKey, 'shift' : e.shiftKey, 'meta' : e.metaKey }; },
+ 'mousedown' : function(e) { return { 'clicks' : e.detail, 'ctrl' : e.ctrlKey, 'alt' : e.altKey, 'shift' : e.shiftKey, 'meta' : e.metaKey }; },
+ 'mouseup' : function(e) { return { 'clicks' : e.detail, 'ctrl' : e.ctrlKey, 'alt' : e.altKey, 'shift' : e.shiftKey, 'meta' : e.metaKey }; },
+ 'focus' : null,
+ 'blur' : null,
+ 'input' : config.logDetails ? function(e) { return { 'value' : e.target.value }; } : null,
+ 'change' : config.logDetails ? function(e) { return { 'value' : e.target.value }; } : null,
+ 'dragstart' : null,
+ 'dragend' : null,
+ 'drag' : null,
+ 'drop' : null,
+ 'keydown' : config.logDetails ? function(e) { return { 'key' : e.keyCode, 'ctrl' : e.ctrlKey, 'alt' : e.altKey, 'shift' : e.shiftKey, 'meta' : e.metaKey }; } : null,
+ 'mouseover' : null,
+ 'submit' : null
+ };
+
+ bufferBools = {};
+ bufferedEvents = {
+ 'wheel' : function(e) { return { 'x' : e.deltaX, 'y' : e.deltaY, 'z' : e.deltaZ }; },
+ 'scroll' : function() { return { 'x' : window.scrollX, 'y' : window.scrollY }; },
+ 'resize' : function() { return { 'width' : window.outerWidth, 'height' : window.outerHeight }; }
+ };
+
+ windowEvents = ['load', 'blur', 'focus'];
+ }
+
+ /**
+ * Hooks the event handlers for each event type of interest.
+ * @param {Object} config Configuration object to use.
+ * @return {boolean} Whether the operation succeeded
+ */
+ function attachHandlers(config) {
+ defineDetails(config);
+
+ Object.keys(events).forEach(function(ev) {
+ document.addEventListener(ev, function(e) {
+ packageLog(e, events[ev]);
+ }, true);
+ });
+
+ Object.keys(bufferedEvents).forEach(function(ev) {
+ bufferBools[ev] = true;
+
+ window.addEventListener(ev, function(e) {
+ if (bufferBools[ev]) {
+ bufferBools[ev] = false;
+ packageLog(e, bufferedEvents[ev]);
+ setTimeout(function() { bufferBools[ev] = true; }, config.resolution);
+ }
+ }, true);
+ });
+
+ windowEvents.forEach(function(ev) {
+ window.addEventListener(ev, function(e) {
+ packageLog(e, function() { return { 'window' : true }; });
+ }, true);
+ });
+
+ return true;
+ }
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+ /**
+ * Initializes the log queue processors.
+ * @param {Array} logs Array of logs to append to.
+ * @param {Object} config Configuration object to use when logging.
+ */
+ function initSender(logs, config) {
+ sendOnInterval(logs, config);
+ sendOnClose(logs, config);
+ }
+
+ /**
+ * Checks the provided log array on an interval, flushing the logs
+ * if the queue has reached the threshold specified by the provided config.
+ * @param {Array} logs Array of logs to read from.
+ * @param {Object} config Configuration object to be read from.
+ */
+ function sendOnInterval(logs, config) {
+ setInterval(function() {
+ if (logs.length >= config.logCountThreshold) {
+ sendLogs(logs.slice(0), config.url, 0); // Send a copy
+ logs.splice(0); // Clear array reference (no reassignment)
+ }
+ }, config.transmitInterval);
+ }
+
+ /**
+ * Attempts to flush the remaining logs when the window is closed.
+ * @param {Array} logs Array of logs to be flushed.
+ * @param {Object} config Configuration object to be read from.
+ */
+ function sendOnClose(logs, config) {
+ if (navigator.sendBeacon) {
+ window.addEventListener('unload', function() {
+ navigator.sendBeacon(config.url, JSON.stringify(logs));
+ });
+ } else {
+ window.addEventListener('beforeunload', function() {
+ if (logs.length > 0) {
+ sendLogs(logs, config.url, 1);
+ }
+ })
+ }
+ }
+
+ /**
+ * Sends the provided array of logs to the specified url,
+ * retrying the request up to the specified number of retries.
+ * @param {Array} logs Array of logs to send.
+ * @param {string} url URL to send the POST request to.
+ * @param {Number} retries Maximum number of attempts to send the logs.
+ */
+ function sendLogs(logs, url, retries) {
+ var req = new XMLHttpRequest();
+
+ var data = JSON.stringify(logs);
+
+ req.open('POST', url);
+ req.setRequestHeader('Content-type', 'application/json;charset=UTF-8');
+
+ req.onreadystatechange = function() {
+ if (req.readyState === 4 && req.status !== 200) {
+ if (retries > 0) {
+ sendLogs(logs, url, retries--);
+ }
+ }
+ };
+
+ req.send(data);
+ }
+
+ var config = {};
+ var logs = [];
+ exports.started = false;
+
+
+ // Start up Userale
+ config.on = false;
+ config.useraleVersion = version$1;
+
+ configure(config, getInitialSettings());
+ initPackager(logs, config);
+
+ if (config.autostart) {
+ setup(config);
+ }
+
+ /**
+ * Hooks the global event listener, and starts up the
+ * logging interval.
+ * @param {Object} config Configuration settings for the logger
+ */
+ function setup(config) {
+ if (!exports.started) {
+ setTimeout(function() {
+ var state = document.readyState;
+
+ if (state === 'interactive' || state === 'complete') {
+ attachHandlers(config);
+ initSender(logs, config);
+ exports.started = config.on = true;
+ } else {
+ setup(config);
+ }
+ }, 100);
+ }
+ }
+
+
+ // Export the Userale API
+ var version = version$1;
+
+ /**
+ * Used to start the logging process if the
+ * autostart configuration option is set to false.
+ */
+ function start() {
+ if (!exports.started) {
+ setup(config);
+ }
+
+ config.on = true;
+ }
+
+ /**
+ * Halts the logging process. Logs will no longer be sent.
+ */
+ function stop() {
+ config.on = false;
+ }
+
+ /**
+ * Updates the current configuration
+ * object with the provided values.
+ * @param {Object} newConfig The configuration options to use.
+ * @return {Object} Returns the updated configuration.
+ */
+ function options(newConfig) {
+ if (newConfig !== undefined) {
+ configure(config, newConfig);
+ }
+
+ return config;
+ }
+
+ /**
+ * Appends a log to the log queue.
+ * @param {Object} customLog The log to append.
+ * @return {boolean} Whether the operation succeeded.
+ */
+ function log(customLog) {
+ if (customLog !== null && typeof customLog === 'object') {
+ logs.push(customLog);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ exports.version = version;
+ exports.start = start;
+ exports.stop = stop;
+ exports.options = options;
+ exports.log = log;
+
+}((this.userale = this.userale || {})));
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/b656f6af/build/userale-1.0.0.min.js
----------------------------------------------------------------------
diff --git a/build/userale-1.0.0.min.js b/build/userale-1.0.0.min.js
new file mode 100644
index 0000000..5253a54
--- /dev/null
+++ b/build/userale-1.0.0.min.js
@@ -0,0 +1 @@
+!function(t){"use strict";function e(t){if(t.timeStamp&&t.timeStamp>0){var e,n=Date.now()-t.timeStamp;if(n<0)e=function(){return t.timeStamp/1e3};else if(n>t.timeStamp){var r=performance.timing.navigationStart;e=function(t){return t+r}}else e=function(t){return t}}else e=function(){return Date.now()};return e}function n(t,e){Object.keys(e).forEach(function(n){if("userFromParams"===n){var a=r(e[n]);a&&(t.userId=a)}t[n]=e[n]})}function r(t){var e=t,n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)"),r=window.location.href.match(n);return r&&r[2]?decodeURIComponent(r[2].replace(/\+/g," ")):null}function a(t,e){if(!E.on)return!1;var n=null;e&&(n=e(t));var r={target:l(t.target),path:u(t),clientTime:Math.floor(t.timeStamp&&t.timeStamp>0?E.time(t.timeStamp):Date.now()),location:o(t),type:t.type,userAction:!0,details:n,userId:E.userId,toolVersion:E.version,toolName:E.toolName,useraleVersion:E.useraleVersion};return K.push(r),!0}function o(t){return null!=t.pageX?{x:t.pageX,y:t.pageY}:null!=t.clientX
?{x:document.documentElement.scrollLeft+t.clientX,y:document.documentElement.scrollTop+t.clientY}:{x:null,y:null}}function l(t){return t.localName?t.localName+(t.id?"#"+t.id:"")+(t.className?"."+t.className:""):t.nodeName?t.nodeName+(t.id?"#"+t.id:"")+(t.className?"."+t.className:""):t&&t.document&&t.location&&t.alert&&t.setInterval?"Window":"Unknown"}function u(t){var e=[];if(t.path)e=t.path;else for(var n=t.target;n;)e.push(n),n=n.parentElement;return i(e)}function i(t){for(var e,n=0,r=[];e=t[n];)r.push(l(e)),++n;return r}function c(t){S={click:function(t){return{clicks:t.detail,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}},dblclick:function(t){return{clicks:t.detail,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}},mousedown:function(t){return{clicks:t.detail,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}},mouseup:function(t){return{clicks:t.detail,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}},focus:null,blur:null,input:t.
logDetails?function(t){return{value:t.target.value}}:null,change:t.logDetails?function(t){return{value:t.target.value}}:null,dragstart:null,dragend:null,drag:null,drop:null,keydown:t.logDetails?function(t){return{key:t.keyCode,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}}:null,mouseover:null,submit:null},N={},k={wheel:function(t){return{x:t.deltaX,y:t.deltaY,z:t.deltaZ}},scroll:function(){return{x:window.scrollX,y:window.scrollY}},resize:function(){return{width:window.outerWidth,height:window.outerHeight}}},b=["load","blur","focus"]}function s(t){return c(t),Object.keys(S).forEach(function(t){document.addEventListener(t,function(e){a(e,S[t])},!0)}),Object.keys(k).forEach(function(e){N[e]=!0,window.addEventListener(e,function(n){N[e]&&(N[e]=!1,a(n,k[e]),setTimeout(function(){N[e]=!0},t.resolution))},!0)}),b.forEach(function(t){window.addEventListener(t,function(t){a(t,function(){return{window:!0}})},!0)}),!0}function d(t,e){f(t,e),m(t,e)}function f(t,e){setInterval(fu
nction(){t.length>=e.logCountThreshold&&(h(t.slice(0),e.url,0),t.splice(0))},e.transmitInterval)}function m(t,e){navigator.sendBeacon?window.addEventListener("unload",function(){navigator.sendBeacon(e.url,JSON.stringify(t))}):window.addEventListener("beforeunload",function(){t.length>0&&h(t,e.url,1)})}function h(t,e,n){var r=new XMLHttpRequest,a=JSON.stringify(t);r.open("POST",e),r.setRequestHeader("Content-type","application/json;charset=UTF-8"),r.onreadystatechange=function(){4===r.readyState&&200!==r.status&&n>0&&h(t,e,n--)},r.send(a)}function p(e){t.started||setTimeout(function(){var n=document.readyState;"interactive"===n||"complete"===n?(s(e),d(T,e),t.started=e.on=!0):p(e)},100)}function y(){t.started||p(I),I.on=!0}function v(){I.on=!1}function g(t){return void 0!==t&&n(I,t),I}function w(t){return null!==t&&"object"==typeof t&&(T.push(t),!0)}var K,E,S,N,k,b,I={},T=[];t.started=!1,I.on=!1,I.useraleVersion="1.0.0",n(I,function(){var t={},n=document.currentScript||function(){var
t=document.getElementsByTagName("script");return t[t.length-1]}(),r=n?n.getAttribute.bind(n):function(){return null};return t.autostart="false"!==r("data-autostart"),t.url=r("data-url")||"http://localhost:8000",t.transmitInterval=+r("data-interval")||5e3,t.logCountThreshold=+r("data-threshold")||5,t.userId=r("data-user")||null,t.version=r("data-version")||null,t.logDetails="true"===r("data-log-details"),t.resolution=+r("data-resolution")||500,t.toolName=r("data-tool")||null,t.userFromParams=r("data-user-from-params")||null,t.time=e(document.createEvent("CustomEvent")),t}()),function(t,e){K=t,E=e}(T,I),I.autostart&&p(I);t.version="1.0.0",t.start=y,t.stop=v,t.options=g,t.log=w}(this.userale=this.userale||{});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/b656f6af/lib/userale.js
----------------------------------------------------------------------
diff --git a/lib/userale.js b/lib/userale.js
deleted file mode 100644
index f3d8d67..0000000
--- a/lib/userale.js
+++ /dev/null
@@ -1,533 +0,0 @@
-(function (exports) {
- 'use strict';
-
- var version$1 = "1.0.0";
-
- /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
- /**
- * Extracts the initial configuration settings from the
- * currently executing script tag.
- * @return {Object} The extracted configuration object
- */
- function getInitialSettings() {
- var settings = {};
-
- var script = document.currentScript || (function () {
- var scripts = document.getElementsByTagName('script');
- return scripts[scripts.length - 1];
- })();
-
- var get = script ? script.getAttribute.bind(script) : function() { return null; };
-
- settings.autostart = get('data-autostart') === 'false' ? false : true;
- settings.url = get('data-url') || 'http://localhost:8000';
- settings.transmitInterval = +get('data-interval') || 5000;
- settings.logCountThreshold = +get('data-threshold') || 5;
- settings.userId = get('data-user') || null;
- settings.version = get('data-version') || null;
- settings.logDetails = get('data-log-details') === 'true' ? true : false;
- settings.resolution = +get('data-resolution') || 500;
- settings.toolName = get('data-tool') || null;
- settings.userFromParams = get('data-user-from-params') || null;
- settings.time = timeStampScale(document.createEvent('CustomEvent'));
-
- return settings;
- }
-
- /**
- * Creates a function to normalize the timestamp of the provided event.
- * @param {Object} e An event containing a timeStamp property.
- * @return {timeStampScale~tsScaler} The timestamp normalizing function.
- */
- function timeStampScale(e) {
- if (e.timeStamp && e.timeStamp > 0) {
- var delta = Date.now() - e.timeStamp;
- /**
- * Returns a timestamp depending on various browser quirks.
- * @param {?Number} ts A timestamp to use for normalization.
- * @return {Number} A normalized timestamp.
- */
- var tsScaler;
-
- if (delta < 0) {
- tsScaler = function () {
- return e.timeStamp / 1000;
- };
- } else if (delta > e.timeStamp) {
- var navStart = performance.timing.navigationStart;
- tsScaler = function (ts) {
- return ts + navStart;
- }
- } else {
- tsScaler = function (ts) {
- return ts;
- }
- }
- } else {
- tsScaler = function () { return Date.now(); };
- }
-
- return tsScaler;
- }
-
- /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
- /**
- * Shallow merges the first argument with the second.
- * Retrieves/updates the userid if userFromParams is provided.
- * @param {Object} config Current configuration object to be merged into.
- * @param {Object} newConfig Configuration object to merge into the current config.
- */
- function configure(config, newConfig) {
- Object.keys(newConfig).forEach(function(option) {
- if (option === 'userFromParams') {
- var userId = getUserIdFromParams(newConfig[option]);
- if (userId) {
- config.userId = userId;
- }
- }
- config[option] = newConfig[option];
- });
- }
-
- /**
- * Attempts to extract the userid from the query parameters of the URL.
- * @param {string} param The name of the query parameter containing the userid.
- * @return {string|null} The extracted/decoded userid, or null if none is found.
- */
- function getUserIdFromParams(param) {
- var userField = param;
- var regex = new RegExp('[?&]' + userField + '(=([^&#]*)|&|#|$)');
- var results = window.location.href.match(regex);
-
- if (results && results[2]) {
- return decodeURIComponent(results[2].replace(/\+/g, ' '));
- } else {
- return null;
- }
- }
-
- /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
- var logs$1;
- var config$1;
-
- /**
- * Assigns the config and log container to be used by the logging functions.
- * @param {Array} newLogs Log container.
- * @param {Object} newConfig Configuration to use while logging.
- */
- function initPackager(newLogs, newConfig) {
- logs$1 = newLogs;
- config$1 = newConfig;
- }
-
- /**
- * Transforms the provided event into a log and appends it to the log container.
- * @param {Object} e The event to be logged.
- * @param {Function} detailFcn The function to extract additional log parameters from the event.
- * @return {boolean} Whether the event was logged.
- */
- function packageLog(e, detailFcn) {
- if (!config$1.on) {
- return false;
- }
-
- var details = null;
- if (detailFcn) {
- details = detailFcn(e);
- }
-
- var log = {
- 'target' : getSelector(e.target),
- 'path' : buildPath(e),
- 'clientTime' : Math.floor((e.timeStamp && e.timeStamp > 0) ? config$1.time(e.timeStamp) : Date.now()),
- 'location' : getLocation(e),
- 'type' : e.type,
- 'userAction' : true,
- 'details' : details,
- 'userId' : config$1.userId,
- 'toolVersion' : config$1.version,
- 'toolName' : config$1.toolName,
- 'useraleVersion': config$1.useraleVersion
- };
-
- logs$1.push(log);
-
- return true;
- }
-
- /**
- * Extracts coordinate information from the event
- * depending on a few browser quirks.
- * @param {Object} e The event to extract coordinate information from.
- * @return {Object} An object containing nullable x and y coordinates for the event.
- */
- function getLocation(e) {
- if (e.pageX != null) {
- return { 'x' : e.pageX, 'y' : e.pageY };
- } else if (e.clientX != null) {
- return { 'x' : document.documentElement.scrollLeft + e.clientX, 'y' : document.documentElement.scrollTop + e.clientY };
- } else {
- return { 'x' : null, 'y' : null };
- }
- }
-
- /**
- * Builds a string CSS selector from the provided element
- * @param {HTMLElement} ele The element from which the selector is built.
- * @return {string} The CSS selector for the element, or Unknown if it can't be determined.
- */
- function getSelector(ele) {
- if (ele.localName) {
- return ele.localName + (ele.id ? ('#' + ele.id) : '') + (ele.className ? ('.' + ele.className) : '');
- } else if (ele.nodeName) {
- return ele.nodeName + (ele.id ? ('#' + ele.id) : '') + (ele.className ? ('.' + ele.className) : '');
- } else if (ele && ele.document && ele.location && ele.alert && ele.setInterval) {
- return "Window";
- } else {
- return "Unknown";
- }
- }
-
- /**
- * Builds an array of elements from the provided event target, to the root element.
- * @param {Object} e Event from which the path should be built.
- * @return {HTMLElement[]} Array of elements, starting at the event target, ending at the root element.
- */
- function buildPath(e) {
- var path = [];
- if (e.path) {
- path = e.path;
- } else {
- var ele = e.target
- while(ele) {
- path.push(ele);
- ele = ele.parentElement;
- }
- }
-
- return selectorizePath(path);
- }
-
- /**
- * Builds a CSS selector path from the provided list of elements.
- * @param {HTMLElement[]} path Array of HTMLElements from which the path should be built.
- * @return {string[]} Array of string CSS selectors.
- */
- function selectorizePath(path) {
- var i = 0;
- var pathEle;
- var pathSelectors = [];
- while (pathEle = path[i]) {
- pathSelectors.push(getSelector(pathEle));
- ++i;
- }
- return pathSelectors;
- }
-
- var events;
- var bufferBools;
- var bufferedEvents;
- var windowEvents;
-
- /**
- * Defines the way information is extracted from various events.
- * Also defines which events we will listen to.
- * @param {Object} config Configuration object to read from.
- */
- function defineDetails(config) {
- // Events list
- // Keys are event types
- // Values are functions that return details object if applicable
- events = {
- 'click' : function(e) { return { 'clicks' : e.detail, 'ctrl' : e.ctrlKey, 'alt' : e.altKey, 'shift' : e.shiftKey, 'meta' : e.metaKey }; },
- 'dblclick' : function(e) { return { 'clicks' : e.detail, 'ctrl' : e.ctrlKey, 'alt' : e.altKey, 'shift' : e.shiftKey, 'meta' : e.metaKey }; },
- 'mousedown' : function(e) { return { 'clicks' : e.detail, 'ctrl' : e.ctrlKey, 'alt' : e.altKey, 'shift' : e.shiftKey, 'meta' : e.metaKey }; },
- 'mouseup' : function(e) { return { 'clicks' : e.detail, 'ctrl' : e.ctrlKey, 'alt' : e.altKey, 'shift' : e.shiftKey, 'meta' : e.metaKey }; },
- 'focus' : null,
- 'blur' : null,
- 'input' : config.logDetails ? function(e) { return { 'value' : e.target.value }; } : null,
- 'change' : config.logDetails ? function(e) { return { 'value' : e.target.value }; } : null,
- 'dragstart' : null,
- 'dragend' : null,
- 'drag' : null,
- 'drop' : null,
- 'keydown' : config.logDetails ? function(e) { return { 'key' : e.keyCode, 'ctrl' : e.ctrlKey, 'alt' : e.altKey, 'shift' : e.shiftKey, 'meta' : e.metaKey }; } : null,
- 'mouseover' : null,
- 'submit' : null
- };
-
- bufferBools = {};
- bufferedEvents = {
- 'wheel' : function(e) { return { 'x' : e.deltaX, 'y' : e.deltaY, 'z' : e.deltaZ }; },
- 'scroll' : function() { return { 'x' : window.scrollX, 'y' : window.scrollY }; },
- 'resize' : function() { return { 'width' : window.outerWidth, 'height' : window.outerHeight }; }
- };
-
- windowEvents = ['load', 'blur', 'focus'];
- }
-
- /**
- * Hooks the event handlers for each event type of interest.
- * @param {Object} config Configuration object to use.
- * @return {boolean} Whether the operation succeeded
- */
- function attachHandlers(config) {
- defineDetails(config);
-
- Object.keys(events).forEach(function(ev) {
- document.addEventListener(ev, function(e) {
- packageLog(e, events[ev]);
- }, true);
- });
-
- Object.keys(bufferedEvents).forEach(function(ev) {
- bufferBools[ev] = true;
-
- window.addEventListener(ev, function(e) {
- if (bufferBools[ev]) {
- bufferBools[ev] = false;
- packageLog(e, bufferedEvents[ev]);
- setTimeout(function() { bufferBools[ev] = true; }, config.resolution);
- }
- }, true);
- });
-
- windowEvents.forEach(function(ev) {
- window.addEventListener(ev, function(e) {
- packageLog(e, function() { return { 'window' : true }; });
- }, true);
- });
-
- return true;
- }
-
- /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
- /**
- * Initializes the log queue processors.
- * @param {Array} logs Array of logs to append to.
- * @param {Object} config Configuration object to use when logging.
- */
- function initSender(logs, config) {
- sendOnInterval(logs, config);
- sendOnClose(logs, config);
- }
-
- /**
- * Checks the provided log array on an interval, flushing the logs
- * if the queue has reached the threshold specified by the provided config.
- * @param {Array} logs Array of logs to read from.
- * @param {Object} config Configuration object to be read from.
- */
- function sendOnInterval(logs, config) {
- setInterval(function() {
- if (logs.length >= config.logCountThreshold) {
- sendLogs(logs.slice(0), config.url, 0); // Send a copy
- logs.splice(0); // Clear array reference (no reassignment)
- }
- }, config.transmitInterval);
- }
-
- /**
- * Attempts to flush the remaining logs when the window is closed.
- * @param {Array} logs Array of logs to be flushed.
- * @param {Object} config Configuration object to be read from.
- */
- function sendOnClose(logs, config) {
- if (navigator.sendBeacon) {
- window.addEventListener('unload', function() {
- navigator.sendBeacon(config.url, JSON.stringify(logs));
- });
- } else {
- window.addEventListener('beforeunload', function() {
- if (logs.length > 0) {
- sendLogs(logs, config.url, 1);
- }
- })
- }
- }
-
- /**
- * Sends the provided array of logs to the specified url,
- * retrying the request up to the specified number of retries.
- * @param {Array} logs Array of logs to send.
- * @param {string} url URL to send the POST request to.
- * @param {Number} retries Maximum number of attempts to send the logs.
- */
- function sendLogs(logs, url, retries) {
- var req = new XMLHttpRequest();
-
- var data = JSON.stringify(logs);
-
- req.open('POST', url);
- req.setRequestHeader('Content-type', 'application/json;charset=UTF-8');
-
- req.onreadystatechange = function() {
- if (req.readyState === 4 && req.status !== 200) {
- if (retries > 0) {
- sendLogs(logs, url, retries--);
- }
- }
- };
-
- req.send(data);
- }
-
- var config = {};
- var logs = [];
- exports.started = false;
-
-
- // Start up Userale
- config.on = false;
- config.useraleVersion = version$1;
-
- configure(config, getInitialSettings());
- initPackager(logs, config);
-
- if (config.autostart) {
- setup(config);
- }
-
- /**
- * Hooks the global event listener, and starts up the
- * logging interval.
- * @param {Object} config Configuration settings for the logger
- */
- function setup(config) {
- if (!exports.started) {
- setTimeout(function() {
- var state = document.readyState;
-
- if (state === 'interactive' || state === 'complete') {
- attachHandlers(config);
- initSender(logs, config);
- exports.started = config.on = true;
- } else {
- setup(config);
- }
- }, 100);
- }
- }
-
-
- // Export the Userale API
- var version = version$1;
-
- /**
- * Used to start the logging process if the
- * autostart configuration option is set to false.
- */
- function start() {
- if (!exports.started) {
- setup(config);
- }
-
- config.on = true;
- }
-
- /**
- * Halts the logging process. Logs will no longer be sent.
- */
- function stop() {
- config.on = false;
- }
-
- /**
- * Updates the current configuration
- * object with the provided values.
- * @param {Object} newConfig The configuration options to use.
- * @return {Object} Returns the updated configuration.
- */
- function options(newConfig) {
- if (newConfig !== undefined) {
- configure(config, newConfig);
- }
-
- return config;
- }
-
- /**
- * Appends a log to the log queue.
- * @param {Object} customLog The log to append.
- * @return {boolean} Whether the operation succeeded.
- */
- function log(customLog) {
- if (customLog !== null && typeof customLog === 'object') {
- logs.push(customLog);
- return true;
- } else {
- return false;
- }
- }
-
- exports.version = version;
- exports.start = start;
- exports.stop = stop;
- exports.options = options;
- exports.log = log;
-
-}((this.userale = this.userale || {})));
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/b656f6af/lib/userale.min.js
----------------------------------------------------------------------
diff --git a/lib/userale.min.js b/lib/userale.min.js
deleted file mode 100644
index 5253a54..0000000
--- a/lib/userale.min.js
+++ /dev/null
@@ -1 +0,0 @@
-!function(t){"use strict";function e(t){if(t.timeStamp&&t.timeStamp>0){var e,n=Date.now()-t.timeStamp;if(n<0)e=function(){return t.timeStamp/1e3};else if(n>t.timeStamp){var r=performance.timing.navigationStart;e=function(t){return t+r}}else e=function(t){return t}}else e=function(){return Date.now()};return e}function n(t,e){Object.keys(e).forEach(function(n){if("userFromParams"===n){var a=r(e[n]);a&&(t.userId=a)}t[n]=e[n]})}function r(t){var e=t,n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)"),r=window.location.href.match(n);return r&&r[2]?decodeURIComponent(r[2].replace(/\+/g," ")):null}function a(t,e){if(!E.on)return!1;var n=null;e&&(n=e(t));var r={target:l(t.target),path:u(t),clientTime:Math.floor(t.timeStamp&&t.timeStamp>0?E.time(t.timeStamp):Date.now()),location:o(t),type:t.type,userAction:!0,details:n,userId:E.userId,toolVersion:E.version,toolName:E.toolName,useraleVersion:E.useraleVersion};return K.push(r),!0}function o(t){return null!=t.pageX?{x:t.pageX,y:t.pageY}:null!=t.clientX
?{x:document.documentElement.scrollLeft+t.clientX,y:document.documentElement.scrollTop+t.clientY}:{x:null,y:null}}function l(t){return t.localName?t.localName+(t.id?"#"+t.id:"")+(t.className?"."+t.className:""):t.nodeName?t.nodeName+(t.id?"#"+t.id:"")+(t.className?"."+t.className:""):t&&t.document&&t.location&&t.alert&&t.setInterval?"Window":"Unknown"}function u(t){var e=[];if(t.path)e=t.path;else for(var n=t.target;n;)e.push(n),n=n.parentElement;return i(e)}function i(t){for(var e,n=0,r=[];e=t[n];)r.push(l(e)),++n;return r}function c(t){S={click:function(t){return{clicks:t.detail,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}},dblclick:function(t){return{clicks:t.detail,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}},mousedown:function(t){return{clicks:t.detail,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}},mouseup:function(t){return{clicks:t.detail,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}},focus:null,blur:null,input:t.
logDetails?function(t){return{value:t.target.value}}:null,change:t.logDetails?function(t){return{value:t.target.value}}:null,dragstart:null,dragend:null,drag:null,drop:null,keydown:t.logDetails?function(t){return{key:t.keyCode,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey}}:null,mouseover:null,submit:null},N={},k={wheel:function(t){return{x:t.deltaX,y:t.deltaY,z:t.deltaZ}},scroll:function(){return{x:window.scrollX,y:window.scrollY}},resize:function(){return{width:window.outerWidth,height:window.outerHeight}}},b=["load","blur","focus"]}function s(t){return c(t),Object.keys(S).forEach(function(t){document.addEventListener(t,function(e){a(e,S[t])},!0)}),Object.keys(k).forEach(function(e){N[e]=!0,window.addEventListener(e,function(n){N[e]&&(N[e]=!1,a(n,k[e]),setTimeout(function(){N[e]=!0},t.resolution))},!0)}),b.forEach(function(t){window.addEventListener(t,function(t){a(t,function(){return{window:!0}})},!0)}),!0}function d(t,e){f(t,e),m(t,e)}function f(t,e){setInterval(fu
nction(){t.length>=e.logCountThreshold&&(h(t.slice(0),e.url,0),t.splice(0))},e.transmitInterval)}function m(t,e){navigator.sendBeacon?window.addEventListener("unload",function(){navigator.sendBeacon(e.url,JSON.stringify(t))}):window.addEventListener("beforeunload",function(){t.length>0&&h(t,e.url,1)})}function h(t,e,n){var r=new XMLHttpRequest,a=JSON.stringify(t);r.open("POST",e),r.setRequestHeader("Content-type","application/json;charset=UTF-8"),r.onreadystatechange=function(){4===r.readyState&&200!==r.status&&n>0&&h(t,e,n--)},r.send(a)}function p(e){t.started||setTimeout(function(){var n=document.readyState;"interactive"===n||"complete"===n?(s(e),d(T,e),t.started=e.on=!0):p(e)},100)}function y(){t.started||p(I),I.on=!0}function v(){I.on=!1}function g(t){return void 0!==t&&n(I,t),I}function w(t){return null!==t&&"object"==typeof t&&(T.push(t),!0)}var K,E,S,N,k,b,I={},T=[];t.started=!1,I.on=!1,I.useraleVersion="1.0.0",n(I,function(){var t={},n=document.currentScript||function(){var
t=document.getElementsByTagName("script");return t[t.length-1]}(),r=n?n.getAttribute.bind(n):function(){return null};return t.autostart="false"!==r("data-autostart"),t.url=r("data-url")||"http://localhost:8000",t.transmitInterval=+r("data-interval")||5e3,t.logCountThreshold=+r("data-threshold")||5,t.userId=r("data-user")||null,t.version=r("data-version")||null,t.logDetails="true"===r("data-log-details"),t.resolution=+r("data-resolution")||500,t.toolName=r("data-tool")||null,t.userFromParams=r("data-user-from-params")||null,t.time=e(document.createEvent("CustomEvent")),t}()),function(t,e){K=t,E=e}(T,I),I.autostart&&p(I);t.version="1.0.0",t.start=y,t.stop=v,t.options=g,t.log=w}(this.userale=this.userale||{});
\ No newline at end of file
[09/13] incubator-senssoft-useralejs git commit: Update README with
correct year.
Posted by rf...@apache.org.
Update README with correct year.
Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/commit/611f7104
Tree: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/tree/611f7104
Diff: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/diff/611f7104
Branch: refs/heads/SENSSOFT-192
Commit: 611f7104ec7fe8b3d4afe3c34cc658a29a9e3f85
Parents: b656f6a
Author: Lewis John McGibbney <le...@gmail.com>
Authored: Tue Feb 20 19:06:25 2018 -0800
Committer: Lewis John McGibbney <le...@gmail.com>
Committed: Tue Feb 20 19:06:25 2018 -0800
----------------------------------------------------------------------
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/611f7104/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 726e727..28e4cc3 100644
--- a/README.md
+++ b/README.md
@@ -65,4 +65,4 @@ Contributions are welcome! Simply [submit an issue report](https://issues.apach
## License
-Copyright © 2017 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Software as a Sensor is a trademark of the Charles Stark Draper Laboratory, Inc.
+Apache SensSoft UserALE.js is provided under Apache License version 2.0. See LICENSE file for more details. Software as a Sensor is a trademark of the Charles Stark Draper Laboratory, Inc.
\ No newline at end of file