@@ -20,9 +20,13 @@ class Cpuinfo {
20
20
let divide = Math . floor ( data . cores / 2 ) ;
21
21
this . divide = divide ;
22
22
23
+ let cpuName = data . manufacturer + data . brand ;
24
+ cpuName = cpuName . substr ( 0 , 30 ) ;
25
+ cpuName . substr ( 0 , Math . min ( cpuName . length , cpuName . lastIndexOf ( " " ) ) ) ;
26
+
23
27
let innercontainer = document . createElement ( "div" ) ;
24
28
innercontainer . setAttribute ( "id" , "mod_cpuinfo_innercontainer" ) ;
25
- innercontainer . innerHTML = `<h1>CPU USAGE<i>${ data . manufacturer } ${ data . brand } </i></h1>
29
+ innercontainer . innerHTML = `<h1>CPU USAGE<i>${ cpuName } </i></h1>
26
30
<div>
27
31
<h1># <em>1</em> - <em>${ divide } </em><br>
28
32
<i id="mod_cpuinfo_usagecounter0">Avg. --%</i></h1>
@@ -35,8 +39,8 @@ class Cpuinfo {
35
39
</div>
36
40
<div>
37
41
<div>
38
- <h1>TEMP<br>
39
- <i id="mod_cpuinfo_temp">--°C</i></h1>
42
+ <h1>${ ( process . platform === "win32" ) ? "CORES" : " TEMP" } <br>
43
+ <i id="mod_cpuinfo_temp">${ ( process . platform === "win32" ) ? "XX" : " --°C" } </i></h1>
40
44
</div>
41
45
<div>
42
46
<h1>MIN<br>
@@ -96,15 +100,17 @@ class Cpuinfo {
96
100
97
101
// Init updater
98
102
this . updateCPUload ( ) ;
99
- this . updateCPUtemp ( ) ;
103
+ if ( process . platform !== "win32" ) { this . updateCPUtemp ( ) ; }
100
104
this . updateCPUspeed ( ) ;
101
105
this . updateCPUtasks ( ) ;
102
106
this . loadUpdater = setInterval ( ( ) => {
103
107
this . updateCPUload ( ) ;
104
108
} , 500 ) ;
105
- this . tempUpdater = setInterval ( ( ) => {
106
- this . updateCPUtemp ( ) ;
107
- } , 2000 ) ;
109
+ if ( process . platform !== "win32" ) {
110
+ this . tempUpdater = setInterval ( ( ) => {
111
+ this . updateCPUtemp ( ) ;
112
+ } , 2000 ) ;
113
+ }
108
114
this . speedUpdater = setInterval ( ( ) => {
109
115
this . updateCPUspeed ( ) ;
110
116
} , 1000 ) ;
@@ -118,7 +124,7 @@ class Cpuinfo {
118
124
let average = [ [ ] , [ ] ] ;
119
125
120
126
if ( ! data . cpus ) return ; // Prevent memleak in rare case where systeminformation takes extra time to retrieve CPU info (see github issue #216)
121
-
127
+
122
128
data . cpus . forEach ( ( e , i ) => {
123
129
this . series [ i ] . append ( new Date ( ) . getTime ( ) , e . load ) ;
124
130
0 commit comments