Visual improvements on classic template

This commit is contained in:
lowlighter
2021-03-21 18:54:39 +01:00
parent 08d43c2dbd
commit 18c7fa1138
3 changed files with 6 additions and 11 deletions

View File

@@ -28,14 +28,14 @@
}
/**Formatter */
export function format(n, {sign = false, unit = true} = {}) {
export function format(n, {sign = false, unit = true, fixed} = {}) {
if (unit) {
for (const {u, v} of [{u:"b", v:10**9}, {u:"m", v:10**6}, {u:"k", v:10**3}]) {
if (n/v >= 1)
return `${(sign)&&(n > 0) ? "+" : ""}${(n/v).toFixed(2).substr(0, 4).replace(/[.]0*$/, "")}${u}`
return `${(sign)&&(n > 0) ? "+" : ""}${(n/v).toFixed(fixed ?? 2).substr(0, 4).replace(/[.]0*$/, "")}${u}`
}
}
return `${(sign)&&(n > 0) ? "+" : ""}${n}`
return `${(sign)&&(n > 0) ? "+" : ""}${fixed ? n.toFixed(fixed) : n}`
}
/**Bytes formatter */

View File

@@ -36,7 +36,7 @@
<% } else { %>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M13.03 8.22a.75.75 0 010 1.06l-4.25 4.25a.75.75 0 01-1.06 0L3.47 9.28a.75.75 0 011.06-1.06l2.97 2.97V3.75a.75.75 0 011.5 0v7.44l2.97-2.97a.75.75 0 011.06 0z"></path></svg>
<% } %>
<%= f(plugins.stock.delta.toFixed(2), {sign:true}) %> (<%= f((100*plugins.stock.delta/plugins.stock.price).toFixed(2), {sign:true}) %>%)
<%= f(plugins.stock.delta, {sign:true, fixed:2}) %> (<%= f(100*plugins.stock.delta/plugins.stock.price, {sign:true, fixed:2}) %>%)
</div>
</section>
</div>

View File

@@ -132,7 +132,7 @@
/* Labels */
.label {
background-color: #F1F8FF;
background-color: #58A6FF30;
color: #0366D6;
padding: 0 10px;
font-weight: 500;
@@ -143,11 +143,6 @@
font-size: 12px;
}
.label:hover {
background-color: #DDEEFF;
cursor: pointer;
}
/* Habits */
.habits {
margin: 0;
@@ -498,7 +493,7 @@
.repository .name span:last-child {
color: #666666;
font-size: 13px;
font-size: 10px;
}
.repository .description {