-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
63 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/*! | ||
* tui-code-snippet.js | ||
* @version 1.5.1 | ||
* @version 1.5.2 | ||
* @author NHN. FE Development Lab <[email protected]> | ||
* @license MIT | ||
*/ | ||
|
@@ -1825,65 +1825,75 @@ return /******/ (function(modules) { // webpackBootstrap | |
version: 0 | ||
}; | ||
|
||
var nav = window.navigator; | ||
var appName = nav.appName.replace(/\s/g, '_'); | ||
var userAgent = nav.userAgent; | ||
|
||
var rIE = /MSIE\s([0-9]+[.0-9]*)/; | ||
var rIE11 = /Trident.*rv:11\./; | ||
var rEdge = /Edge\/(\d+)\./; | ||
var versionRegex = { | ||
firefox: /Firefox\/(\d+)\./, | ||
chrome: /Chrome\/(\d+)\./, | ||
safari: /Version\/([\d.]+).*Safari\/(\d+)/ | ||
}; | ||
if (window && window.navigator) { | ||
detectBrowser(); | ||
} | ||
|
||
var key, tmp; | ||
/** | ||
* Detect the browser. | ||
* @private | ||
*/ | ||
function detectBrowser() { | ||
var nav = window.navigator; | ||
var appName = nav.appName.replace(/\s/g, '_'); | ||
var userAgent = nav.userAgent; | ||
|
||
var rIE = /MSIE\s([0-9]+[.0-9]*)/; | ||
var rIE11 = /Trident.*rv:11\./; | ||
var rEdge = /Edge\/(\d+)\./; | ||
var versionRegex = { | ||
firefox: /Firefox\/(\d+)\./, | ||
chrome: /Chrome\/(\d+)\./, | ||
safari: /Version\/([\d.]+).*Safari\/(\d+)/ | ||
}; | ||
|
||
var detector = { | ||
Microsoft_Internet_Explorer: function() { // eslint-disable-line camelcase | ||
var detectedVersion = userAgent.match(rIE); | ||
var key, tmp; | ||
|
||
if (detectedVersion) { // ie8 ~ ie10 | ||
browser.msie = true; | ||
browser.version = parseFloat(detectedVersion[1]); | ||
} else { // no version information | ||
browser.others = true; | ||
} | ||
}, | ||
Netscape: function() { // eslint-disable-line complexity | ||
var detected = false; | ||
|
||
if (rIE11.exec(userAgent)) { | ||
browser.msie = true; | ||
browser.version = 11; | ||
detected = true; | ||
} else if (rEdge.exec(userAgent)) { | ||
browser.edge = true; | ||
browser.version = userAgent.match(rEdge)[1]; | ||
detected = true; | ||
} else { | ||
for (key in versionRegex) { | ||
if (versionRegex.hasOwnProperty(key)) { | ||
tmp = userAgent.match(versionRegex[key]); | ||
if (tmp && tmp.length > 1) { // eslint-disable-line max-depth | ||
browser[key] = detected = true; | ||
browser.version = parseFloat(tmp[1] || 0); | ||
break; | ||
var detector = { | ||
Microsoft_Internet_Explorer: function() { // eslint-disable-line camelcase | ||
var detectedVersion = userAgent.match(rIE); | ||
|
||
if (detectedVersion) { // ie8 ~ ie10 | ||
browser.msie = true; | ||
browser.version = parseFloat(detectedVersion[1]); | ||
} else { // no version information | ||
browser.others = true; | ||
} | ||
}, | ||
Netscape: function() { // eslint-disable-line complexity | ||
var detected = false; | ||
|
||
if (rIE11.exec(userAgent)) { | ||
browser.msie = true; | ||
browser.version = 11; | ||
detected = true; | ||
} else if (rEdge.exec(userAgent)) { | ||
browser.edge = true; | ||
browser.version = userAgent.match(rEdge)[1]; | ||
detected = true; | ||
} else { | ||
for (key in versionRegex) { | ||
if (versionRegex.hasOwnProperty(key)) { | ||
tmp = userAgent.match(versionRegex[key]); | ||
if (tmp && tmp.length > 1) { // eslint-disable-line max-depth | ||
browser[key] = detected = true; | ||
browser.version = parseFloat(tmp[1] || 0); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
if (!detected) { | ||
browser.others = true; | ||
} | ||
} | ||
if (!detected) { | ||
browser.others = true; | ||
} | ||
} | ||
}; | ||
}; | ||
|
||
var fn = detector[appName]; | ||
var fn = detector[appName]; | ||
|
||
if (fn) { | ||
detector[appName](); | ||
if (fn) { | ||
detector[appName](); | ||
} | ||
} | ||
|
||
module.exports = browser; | ||
|
Oops, something went wrong.