Skip to content

Commit

Permalink
Remove browser vars from global
Browse files Browse the repository at this point in the history
  • Loading branch information
wwilsman committed Jan 31, 2015
1 parent b6c13f2 commit cfddceb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions dropkick.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@

(function( window, document, undefined ) {

window.isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( navigator.userAgent );
window.isIframe = (window.parent != window.self && location.host === parent.location.host);
var isIE = navigator.appVersion.indexOf("MSIE")!=-1;

var

// Browser testing stuff
isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( navigator.userAgent ),
isIframe = (window.parent != window.self && location.host === parent.location.host),
isIE = navigator.appVersion.indexOf("MSIE")!=-1,

// The Dropkick Object
Dropkick = function( sel, opts ) {
var i;

// Prevent DK on mobile
if ( window.isMobile && opts && !opts.mobile ) {
if ( isMobile && opts && !opts.mobile ) {
return false;
}

Expand Down Expand Up @@ -292,7 +294,7 @@ Dropkick.prototype = {

if ( Dropkick.uid === 0 ) {
document.addEventListener( "click", Dropkick.onDocClick );
if ( window.isIframe ){
if ( isIframe ){
parent.document.addEventListener( "click", Dropkick.onDocClick );
}
}
Expand Down
Loading

0 comments on commit cfddceb

Please sign in to comment.