Skip to content
This repository was archived by the owner on May 18, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions lib/assets/javascripts/ios-checkboxes/ios-checkboxes.js.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
# iPhone-style Checkboxes Coffee plugin
# Copyright Thomas Reynolds, licensed GPL & MIT

unless $.browser?
userAgent = navigator.userAgent || ""

jQuery.uaMatch = (ua) ->
ua = ua.toLowerCase()

match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
/(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) ||
/(msie) ([\w.]+)/.exec( ua ) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) ||
[]

return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
}

matched = jQuery.uaMatch( userAgent )

jQuery.browser = {}

if matched.browser
jQuery.browser[ matched.browser ] = true
jQuery.browser.version = matched.version

if jQuery.browser.webkit
jQuery.browser.safari = true

class iOSCheckbox
constructor: (elem, options) ->
@elem = $(elem)
Expand Down