mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-12-31 19:39:08 +03:00
Update to version 2.0.0-alpha.2
This commit is contained in:
13
js/script.js
13
js/script.js
@@ -14,8 +14,7 @@ $(document)
|
||||
rotateLabel();
|
||||
setInterval(rotateLabel, 3000);
|
||||
|
||||
var updateDemo = function (ua) {
|
||||
var result = UAParser(ua);
|
||||
var updateDemo = function (result) {
|
||||
if(!result) return;
|
||||
$('#ua-txt').transition('flip vertical', function () {
|
||||
$(this).text(result.ua);
|
||||
@@ -101,7 +100,9 @@ $(document)
|
||||
});
|
||||
});
|
||||
}
|
||||
updateDemo();
|
||||
UAParser().withClientHints().then(function(result) {
|
||||
updateDemo(result);
|
||||
});
|
||||
|
||||
var i;
|
||||
var values = [];
|
||||
@@ -112,17 +113,17 @@ $(document)
|
||||
values: values,
|
||||
onChange: function (val) {
|
||||
$('#ua-txt-info').text('For a given user-agent:');
|
||||
updateDemo(val);
|
||||
updateDemo(UAParser(val));
|
||||
}
|
||||
});
|
||||
$('#demo-btn').click(function() {
|
||||
$('#ua-txt-info').text('For a given user-agent:');
|
||||
updateDemo($('input[name=custom-ua]').val());
|
||||
updateDemo(UAParser($('input[name=custom-ua]').val()));
|
||||
});
|
||||
$('input[name=custom-ua]').keypress(function (e) {
|
||||
if (e.which == 13) {
|
||||
$('#ua-txt-info').text('For a given user-agent:');
|
||||
updateDemo($(this).val());
|
||||
updateDemo(UAParser($(this).val()));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
928
js/ua-parser.js
Executable file → Normal file
928
js/ua-parser.js
Executable file → Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user