Skip to content

Updating fork.#2

Merged
bhamodi merged 29 commits intobhamodi:masterfrom
gabceb:master
Apr 11, 2015
Merged

Updating fork.#2
bhamodi merged 29 commits intobhamodi:masterfrom
gabceb:master

Conversation

@bhamodi
Copy link
Owner

@bhamodi bhamodi commented Apr 11, 2015

No description provided.

bhamodi and others added 29 commits December 12, 2014 11:38
…orrect identification of all Blackberry and Kindle browers
Support iOS, Kindle and BlackBerry Mobile Devices
Fixes two compatibility issues:

  1. Inside wrapped browserify modules, `this` does not refer to `window`,
     it's the `exports` object. Since it doesn't really make sense to use
     this plugin in environments that don't have a window.navigator object,
     the code now just references 'window' directly.

  2. The plugin did a global export if AMD wasn't detected, which assumed
     there was a global jQuery object. The added `module.exports`-detection
     uses `require` to pull in jQuery instead.
Support for node/browserify
I've chosen `jQBrowser()` as this is the jQuery.browser plugin,
and
because I cannot think of an uncommon but descriptive name for it,
for I do not want to pollute the common namespace.
By optionally going jQuery free, this allows a new use-case: detecting a
browser from an arbitrary UA. However, because the majority of cases
will involve detecting the current browser, default to the UA if the
function is called without passing parameters. When using jQuery, the UA
is always provided.
This required a tad bit of restructuring, mainly making the browser
matching a part of the function and not outside of it. This also
prevents the code from running twice if jQuery is loaded and the
function is called.

It may be that we want the function to be called on page load
regardless. In that case, the changes required are trivial.
add the `uaMatch` function to the returned object for use if desired
Added 'require' to the require test so you can differentiate with other tests
bhamodi added a commit that referenced this pull request Apr 11, 2015
@bhamodi bhamodi merged commit 43f7c32 into bhamodi:master Apr 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants