mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-27 16:08:47 +03:00
Rewrite util.extend to a clone version
This commit is contained in:
parent
20ea67ed1d
commit
792dc0246a
2
dist/ua-parser.min.js
vendored
2
dist/ua-parser.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/ua-parser.pack.js
vendored
2
dist/ua-parser.pack.js
vendored
File diff suppressed because one or more lines are too long
@ -45,12 +45,15 @@
|
||||
|
||||
var util = {
|
||||
extend : function (regexes, extensions) {
|
||||
for (var i in extensions) {
|
||||
if ("browser cpu device engine os".indexOf(i) !== -1 && extensions[i].length % 2 === 0) {
|
||||
regexes[i] = extensions[i].concat(regexes[i]);
|
||||
var margedRegexes = {};
|
||||
for (var i in regexes) {
|
||||
if (extensions[i] && extensions[i].length % 2 === 0) {
|
||||
margedRegexes[i] = extensions[i].concat(regexes[i]);
|
||||
} else {
|
||||
margedRegexes[i] = regexes[i];
|
||||
}
|
||||
}
|
||||
return regexes;
|
||||
return margedRegexes;
|
||||
},
|
||||
has : function (str1, str2) {
|
||||
if (typeof str1 === "string") {
|
||||
@ -531,7 +534,7 @@
|
||||
/(alcatel|geeksphone|huawei|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i
|
||||
// Alcatel/GeeksPhone/Huawei/Lenovo/Nexian/Panasonic/Sony
|
||||
], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [
|
||||
|
||||
|
||||
/(nexus\s9)/i // HTC Nexus 9
|
||||
], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [
|
||||
|
||||
@ -651,7 +654,7 @@
|
||||
], [VENDOR, MODEL, [TYPE, MOBILE]], [
|
||||
/(i-STYLE2.1)/i // i-mobile i-STYLE 2.1
|
||||
], [[MODEL, 'i-STYLE 2.1'], [VENDOR, 'i-mobile'], [TYPE, MOBILE]], [
|
||||
|
||||
|
||||
/(mobiistar touch LAI 512)/i // mobiistar touch LAI 512
|
||||
], [[MODEL, 'Touch LAI 512'], [VENDOR, 'mobiistar'], [TYPE, MOBILE]], [
|
||||
|
||||
@ -794,7 +797,6 @@
|
||||
ua = uastring;
|
||||
return this;
|
||||
};
|
||||
this.setUA(ua);
|
||||
return this;
|
||||
};
|
||||
|
||||
@ -853,7 +855,7 @@
|
||||
}
|
||||
|
||||
// jQuery/Zepto specific (optional)
|
||||
// Note:
|
||||
// Note:
|
||||
// In AMD env the global scope should be kept clean, but jQuery is an exception.
|
||||
// jQuery always exports to global scope, unless jQuery.noConflict(true) is used,
|
||||
// and we should catch that.
|
||||
|
Loading…
x
Reference in New Issue
Block a user