mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-27 16:08:47 +03:00
Include GPU detection demo
This commit is contained in:
parent
c3208a2e01
commit
a122c0963e
BIN
images/companies/amd.png
Normal file
BIN
images/companies/amd.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
BIN
images/companies/intel.png
Normal file
BIN
images/companies/intel.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 43 KiB |
BIN
images/companies/qualcomm.png
Normal file
BIN
images/companies/qualcomm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
BIN
images/companies/sis.png
Normal file
BIN
images/companies/sis.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 74 KiB |
25
index.html
25
index.html
@ -148,6 +148,31 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div id="gpu-divider" class="ui horizontal divider">
|
||||
DETECT GPU FROM WEBGL DATA (EXPERIMENTAL FEATURE)
|
||||
</div>
|
||||
<div id="gpu-segment" class="ui tall stacked segment">
|
||||
<div class="ui basic segment">
|
||||
<div class="ui equal width stackable internally celled grid">
|
||||
<div class="row">
|
||||
<div class="column">
|
||||
<div class="ui right aligned icon">
|
||||
<i class="microchip icon"></i>
|
||||
GPU
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div class="ui basic segment">
|
||||
<img class="ui tiny centered image" id="gpu-img" src="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div id="gpu-txt"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui horizontal divider">
|
||||
LESS IS MORE
|
||||
</div>
|
||||
|
14
js/script.js
14
js/script.js
@ -1,5 +1,6 @@
|
||||
$(document)
|
||||
.ready(function() {
|
||||
var uaparser = new UAParser();
|
||||
var labels = ['browser.name', 'os.version', 'device.type', 'cpu.arch', 'device.model', 'browser.version', 'device.vendor', 'engine.name', 'engine.version'];
|
||||
var counter = 0;
|
||||
var rotateLabel = function () {
|
||||
@ -79,6 +80,16 @@ $(document)
|
||||
$('#device-txt').text('-');
|
||||
$('#device-img').attr('src', 'images/companies/default.png');
|
||||
}
|
||||
if (result.gpu.vendor) {
|
||||
var vendor = result.gpu.vendor!=undefined?result.gpu.vendor:'-';
|
||||
var model = result.gpu.model!==undefined?result.gpu.model:'-';
|
||||
$('#gpu-txt').html('<span class="ui large label">' + vendor + '</span><span class="ui large label">' + model + '</span>');
|
||||
$('#gpu-img').attr('src', 'images/companies/' + result.gpu.vendor.toLowerCase() + '.png').on('error', function () {
|
||||
$(this).attr('src', 'images/companies/default.png');
|
||||
});
|
||||
} else {
|
||||
$('#gpu-txt').text('-');
|
||||
}
|
||||
$(this).transition('fly up', function () {
|
||||
$(this).transition('pulse');
|
||||
});
|
||||
@ -109,6 +120,9 @@ $(document)
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (!uaparser.getGPU().vendor) {
|
||||
$('#gpu-divider,#gpu-segment').hide();
|
||||
}
|
||||
|
||||
$('.ui.rating').rating();
|
||||
$('#showcase img').popup({
|
||||
|
779
js/ua-parser.js
779
js/ua-parser.js
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user