Skip to content

Commit

Permalink
refs matomo-org#6545 do not request live information in case tab is n…
Browse files Browse the repository at this point in the history
…ot active

At first I used the window.blur/focus events but noticed it would also
stop refreshing if tab is active but browser window is not active. I
reckon many people might want to leave the browser open in one window
and follow the live visitors while working on something else. That's
why we should use the page visibility API which is supported by most
browsers (I think not in <= IE9). I used a different library first
but noticed it adds many event listeners like mousemove etc and it can
make Piwik slow so used the visibility.js library in the end. If someone
uses an old browser nothing will change compared to before so that
should be ok. In a next version we could initiate a refresh immediately
once the browser tab becomes active again.
  • Loading branch information
tsteur committed Nov 9, 2014
1 parent 3e81595 commit 21ec2fa
Show file tree
Hide file tree
Showing 16 changed files with 961 additions and 3 deletions.
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"jquery-mousewheel": "~3.1.12",
"jquery-placeholder": "~2.0.8",
"jquery.scrollTo": "~1.4.13",
"chroma-js": "~0.6.0"
"chroma-js": "~0.6.0",
"visibilityjs": "~1.2.1"
},
"license": "GPLv3 or later",
"ignore": [
Expand Down
32 changes: 32 additions & 0 deletions libs/bower_components/visibilityjs/.bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "visibilityjs",
"version": "1.2.1",
"homepage": "https://github.com/ai/visibilityjs",
"authors": [
"Andrey A.I. Sitnik <[email protected]>"
],
"description": "Wrapper for the Page Visibility API",
"license": "MIT",
"main": [
"lib/visibility.core.js",
"lib/visibility.timers.js"
],
"ignore": [
"package.json",
"*.gemspec",
"Cakefile",
"test",
"*.rb",
".*"
],
"_release": "1.2.1",
"_resolution": {
"type": "version",
"tag": "1.2.1",
"commit": "97c8ea0defd6737de911647598d6e195ff177e39"
},
"_source": "git://github.com/ai/visibility.js.git",
"_target": "~1.2.1",
"_originalSource": "visibilityjs",
"_direct": true
}
71 changes: 71 additions & 0 deletions libs/bower_components/visibilityjs/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
### 1.2.1 “Discoverer 6, again”
* Fix Bower config by Misha Ponizil.

### 1.2.0 “Discoverer 5, spy”
* Allow to use in CommonJS.
* Release npm package.
* Reduce library size to 10 %.
* Allow to use latest version from master in Ruby Bundler.
* Method `hidden()` now always return boolean.
* Change repository URL to `github.com/ai/visibilityjs`.

## 1.1.0 “Explorer 6, photo”
* Prevent to run timer often, that it’s interval, when visibility was changed.
* Allow to install by Bower package manager.
* Change license to MIT.
* Reduce library size.

## 1.0.0 “Discoverer 2, stable”
* Remove jQuery.Chrono integration.
* Remove outdated Firefox prefix.

## 0.6.2 “Pioneer 4, American Sun”
* Decrease files size (by compressible code and UnglifyJS 2).
* Remove unnecessary vendor prefixes from fallback.

## 0.6.1 “Vanguard 2, weather”
* Remove unnecessary vendor prefixes.

## 0.6 “Luna 1, Mechta”
* Methods onVisible and afterPrerendering return listener ID (by mcfedr).
* Fix documentation (by Erwänn Mest).

## 0.5 “SCORE, communication”
* Split library to core and timers modules.
* Allow to unbind change listener.
* Use common logic in change(), afterPrerendering() and onVisible().

## 0.4.5 “Pioneer 3, closer”
* Fix gem assets directory.
* Update development dependencies.

## 0.4.4 “Pioneer 1, deeper into space”
* Remove non-ASCII symbols from gemspec.
* Print testing URL in test task.

## 0.4.3 “Explorer 4, short”
* Fix gemspec issue with Bundler.

## 0.4.2 “Sputnik 3, real”
* Reorder code to show first public and common methods.
* Use node.js Cake instead of Ruby’s Rake to build tasks.
* Move to Mocha, Chai and Sinon.JS for tests.
* Move autogenerated minified to GitHub downloads.

## 0.4.1 “Explorer 3, repeat”
* Fix documentation and gemspec.

## 0.4 “Vanguard 1, alternative”
* Add fallback API support by focus/blur hack to all browsers.

## 0.3 “Explorer 1, answer”
* Rename gem to visibilityjs.
* Fix gem integration with Asset Pipeline paths.

## 0.2 “Sputnik 2, Laika”
* Rename support() to isSupported() and notPrerender() to afterPrerendering().
* Fix IE 6 and 7 support.
* Documentation fixes by Peter Zotov.

## 0.1 “Sputnik 1, the first”
* Initial release.
20 changes: 20 additions & 0 deletions libs/bower_components/visibilityjs/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright 2011 Andrey Sitnik <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit 21ec2fa

Please sign in to comment.