Socialify

Folder ..

Viewing script.js
46 lines (41 loc) • 1.3 KB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
$(document).ready(function(){
    const os = require('os');
    const si = require('systeminformation');
    $('#ram').html((os.totalmem())/(1024*1024*1024))
    si.cpu(function(data) {
        $('#manufacturer').html(data.manufacturer)
        $('#model').html(data.brand)
    });
    si.graphics(function(data) {
        console.log(data)
        $('#resx').html(data.displays[0].resolutionx)
        $('#resy').html(data.displays[0].resolutiony)
        $('#display').html(data.displays[0].model)
        $('#graphics').html(data.controllers[0].model)
    });
    $('#cores').html((os.cpus().length))
    $('#speed').html((os.cpus()[0].speed)/1000)
    $('#type').html(os.arch())
});

const shell = require('electron').shell;

// assuming $ is jQuery
$(document).on('click', 'a[href^="http"]', function(event) {
    event.preventDefault();
    shell.openExternal(this.href);
});


(function () {
    // Retrieve remote BrowserWindow
    const {BrowserWindow} = require('electron').remote

    function init() {
        // Close app
        document.getElementById("close").addEventListener("click", (e) => {
            var window = BrowserWindow.getFocusedWindow();
            window.close();
        });
    };

    document.onreadystatechange =  () => {
        if (document.readyState == "complete") {
            init();
        }
    };
})();