forked from kobotoolbox/enketo-express
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added: add-to-homescreen dialog for some mobile browsers,
closes kobotoolbox#173
- Loading branch information
Showing
11 changed files
with
145 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,36 @@ | ||
'use strict'; | ||
|
||
var browser; | ||
|
||
/** | ||
* It is a sad state of affairs that we need this. | ||
*/ | ||
var os; | ||
var ua = navigator.userAgent; | ||
var platform = navigator.platform; | ||
|
||
browser = { | ||
isChrome: function() { | ||
var matchedChrome = navigator.userAgent.match( /Chrome\/(\d+)/ ); | ||
var matchedEdge = navigator.userAgent.match( /Edge\// ); | ||
var matchedChrome = /chrome|crios\/(\d+)/i.test( ua ); | ||
var matchedEdge = /edge\//i.test( ua ); | ||
// MS Edge pretends to be Chrome 42: | ||
// https://msdn.microsoft.com/en-us/library/hh869301%28v=vs.85%29.aspx | ||
return !matchedEdge && matchedChrome; | ||
}, | ||
isOnIos: function() { | ||
return /iPad|iPhone|iPod/i.test( navigator.platform ); | ||
isSafari: function() { | ||
return /^((?!chrome|android|fxios|crios|ucbrowser).)*safari/i.test( ua ); | ||
}, | ||
isFirefox: function() { | ||
return /firefox|fxios/i.test( ua ); | ||
} | ||
}; | ||
|
||
os = { | ||
isIos: function() { | ||
return /iPad|iPhone|iPod/i.test( ua ); | ||
}, | ||
isAndroid: function() { | ||
return /android/i.test( ua ); | ||
} | ||
}; | ||
|
||
module.exports = { | ||
browser: browser | ||
browser: browser, | ||
os: os | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters