Include GPU detection demo

This commit is contained in:
Faisal Salman 2021-04-18 13:51:41 +07:00
parent c3208a2e01
commit a122c0963e
7 changed files with 452 additions and 410 deletions

BIN
images/companies/amd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
images/companies/intel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
images/companies/sis.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

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

View File

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

File diff suppressed because it is too large Load Diff