Browse Source

Update visibly.js to 5b271d2c.

pull/113/head
Evan Theurer 11 years ago
parent
commit
d7094aa634
  1. 27
      static/js/libs/visibly.js

27
static/js/libs/visibly.js

@ -1,7 +1,7 @@
/*! /*!
* visibly - v0.6 Aug 2011 - Page Visibility API Polyfill * visibly - v0.7 Page Visibility API Polyfill
* http://github.com/addyosmani * http://github.com/addyosmani
* Copyright (c) 2011 Addy Osmani * Copyright (c) 2011-2014 Addy Osmani
* Dual licensed under the MIT and GPL licenses. * Dual licensed under the MIT and GPL licenses.
* *
* Methods supported: * Methods supported:
@ -11,7 +11,7 @@
* visibly.visibilityState() * visibly.visibilityState()
* visibly.visibilitychange(callback(state)); * visibly.visibilitychange(callback(state));
*/ */
// https://raw.githubusercontent.com/addyosmani/visibly.js/5b271d2cf71dd21805b7dc0ded7ef97ac764307e/visibly.js
;(function () { ;(function () {
window.visibly = { window.visibly = {
@ -27,14 +27,14 @@
cachedPrefix:"", cachedPrefix:"",
fn:null, fn:null,
onVisible: function (fn) { onVisible: function (_callback) {
if(typeof fn == 'function' ){ if(typeof _callback == 'function' ){
this.visibleCallbacks.push(fn); this.visibleCallbacks.push(_callback);
} }
}, },
onHidden: function (fn) { onHidden: function (_callback) {
if(typeof fn == 'function' ){ if(typeof _callback == 'function' ){
this.hiddenCallbacks.push(fn); this.hiddenCallbacks.push(_callback);
} }
}, },
getPrefix:function(){ getPrefix:function(){
@ -74,10 +74,13 @@
}, },
isSupported: function (index) { isSupported: function (index) {
return ((this.cachedPrefix + this.props[2]) in this.q); return ((this._getPropName(2)) in this.q);
},
_getPropName:function(index) {
return (this.cachedPrefix == "" ? this.props[index].substring(0, 1).toLowerCase() + this.props[index].substring(1) : this.cachedPrefix + this.props[index]);
}, },
_getProp:function(index){ _getProp:function(index){
return this.q[this.cachedPrefix + this.props[index]]; return this.q[this._getPropName(index)];
}, },
_execute: function (index) { _execute: function (index) {
if (index) { if (index) {
@ -112,7 +115,7 @@
} }
} }
} else { /*switch support based on prefix detected earlier*/ } else { /*switch support based on prefix detected earlier*/
this.q.addEventListener(this.cachedPrefix + this.props[1], function () { this.q.addEventListener(this._getPropName(1), function () {
window.visibly._nativeSwitch.apply(window.visibly, arguments); window.visibly._nativeSwitch.apply(window.visibly, arguments);
}, 1); }, 1);
} }

Loading…
Cancel
Save