mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-27 07:58:45 +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 = {
|
var util = {
|
||||||
extend : function (regexes, extensions) {
|
extend : function (regexes, extensions) {
|
||||||
for (var i in extensions) {
|
var margedRegexes = {};
|
||||||
if ("browser cpu device engine os".indexOf(i) !== -1 && extensions[i].length % 2 === 0) {
|
for (var i in regexes) {
|
||||||
regexes[i] = extensions[i].concat(regexes[i]);
|
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) {
|
has : function (str1, str2) {
|
||||||
if (typeof str1 === "string") {
|
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|(?=;\s)sony)[_\s-]?([\w-]+)*/i
|
||||||
// Alcatel/GeeksPhone/Huawei/Lenovo/Nexian/Panasonic/Sony
|
// Alcatel/GeeksPhone/Huawei/Lenovo/Nexian/Panasonic/Sony
|
||||||
], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [
|
], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [
|
||||||
|
|
||||||
/(nexus\s9)/i // HTC Nexus 9
|
/(nexus\s9)/i // HTC Nexus 9
|
||||||
], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [
|
], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
@ -651,7 +654,7 @@
|
|||||||
], [VENDOR, MODEL, [TYPE, MOBILE]], [
|
], [VENDOR, MODEL, [TYPE, MOBILE]], [
|
||||||
/(i-STYLE2.1)/i // i-mobile i-STYLE 2.1
|
/(i-STYLE2.1)/i // i-mobile i-STYLE 2.1
|
||||||
], [[MODEL, 'i-STYLE 2.1'], [VENDOR, 'i-mobile'], [TYPE, MOBILE]], [
|
], [[MODEL, 'i-STYLE 2.1'], [VENDOR, 'i-mobile'], [TYPE, MOBILE]], [
|
||||||
|
|
||||||
/(mobiistar touch LAI 512)/i // mobiistar touch LAI 512
|
/(mobiistar touch LAI 512)/i // mobiistar touch LAI 512
|
||||||
], [[MODEL, 'Touch LAI 512'], [VENDOR, 'mobiistar'], [TYPE, MOBILE]], [
|
], [[MODEL, 'Touch LAI 512'], [VENDOR, 'mobiistar'], [TYPE, MOBILE]], [
|
||||||
|
|
||||||
@ -794,7 +797,6 @@
|
|||||||
ua = uastring;
|
ua = uastring;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
this.setUA(ua);
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -853,7 +855,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// jQuery/Zepto specific (optional)
|
// jQuery/Zepto specific (optional)
|
||||||
// Note:
|
// Note:
|
||||||
// In AMD env the global scope should be kept clean, but jQuery is an exception.
|
// 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,
|
// jQuery always exports to global scope, unless jQuery.noConflict(true) is used,
|
||||||
// and we should catch that.
|
// and we should catch that.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user