Update to version 2.0.0-alpha.2

This commit is contained in:
Faisal Salman
2023-03-29 22:44:48 +07:00
parent 6e98b2e975
commit 38a6b53883
9 changed files with 81 additions and 948 deletions

View File

@@ -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

File diff suppressed because one or more lines are too long