#54 code clean up
parent
0d67bdd530
commit
f8af7762a6
@ -1,32 +0,0 @@
|
||||
<template>
|
||||
<v-container>
|
||||
<v-row class="text-center">
|
||||
<v-col cols="12">
|
||||
<v-img
|
||||
:src="require('../assets/logo.png')"
|
||||
class="my-3"
|
||||
contain
|
||||
height="200"
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
<v-col class="mb-4">
|
||||
<h1 class="display-2 font-weight-bold mb-3">
|
||||
paperdash.io Display
|
||||
</h1>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'HelloWorld',
|
||||
|
||||
data: () => ({
|
||||
ecosystem: [],
|
||||
importantLinks: [],
|
||||
whatsNext: [],
|
||||
}),
|
||||
}
|
||||
</script>
|
@ -0,0 +1,77 @@
|
||||
import Vue from 'vue'
|
||||
|
||||
// usage: {{ file.size | prettyBytes }}
|
||||
Vue.filter('prettyBytes', function (num) {
|
||||
// jacked from: https://github.com/sindresorhus/pretty-bytes
|
||||
if (typeof num !== 'number' || isNaN(num)) {
|
||||
throw new TypeError('Expected a number')
|
||||
}
|
||||
|
||||
var exponent
|
||||
var unit
|
||||
var neg = num < 0
|
||||
var units = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
||||
|
||||
if (neg) {
|
||||
num = -num
|
||||
}
|
||||
|
||||
if (num < 1) {
|
||||
return (neg ? '-' : '') + num + ' B'
|
||||
}
|
||||
|
||||
exponent = Math.min(Math.floor(Math.log(num) / Math.log(1000)), units.length - 1)
|
||||
num = (num / Math.pow(1000, exponent)).toFixed(2) * 1
|
||||
unit = units[exponent]
|
||||
|
||||
return (neg ? '-' : '') + num + ' ' + unit
|
||||
})
|
||||
|
||||
/**
|
||||
* Vue filter to round the decimal to the given place.
|
||||
* http://jsfiddle.net/bryan_k/3ova17y9/
|
||||
*
|
||||
* @param {String} value The value string.
|
||||
* @param {Number} decimals The number of decimal places.
|
||||
*/
|
||||
Vue.filter('round', function (value, decimals) {
|
||||
if (!value) {
|
||||
value = 0
|
||||
}
|
||||
|
||||
if (!decimals) {
|
||||
decimals = 0
|
||||
}
|
||||
|
||||
value = Math.round(value * Math.pow(10, decimals)) / Math.pow(10, decimals)
|
||||
return value
|
||||
})
|
||||
|
||||
/**
|
||||
* usage: {{ wifi.rssi | wifiIcon(wifi.secure) }}
|
||||
* @param {Number} rssi rssi value
|
||||
* @param {Boolean} secure Is wifi protected
|
||||
*/
|
||||
Vue.filter('wifiIcon', function (rssi, secure) {
|
||||
let icon = '$signalWifi'
|
||||
|
||||
// strength
|
||||
if (rssi >= -67) {
|
||||
icon += 4
|
||||
} else if (rssi >= -70) {
|
||||
icon += 3
|
||||
} else if (rssi >= -80) {
|
||||
icon += 2
|
||||
} else if (rssi >= -90) {
|
||||
icon += 1
|
||||
} else {
|
||||
icon += 0
|
||||
}
|
||||
|
||||
// secure
|
||||
if (secure !== 0 && rssi >= -90) {
|
||||
icon += 'Lock'
|
||||
}
|
||||
|
||||
return icon
|
||||
})
|
Loading…
Reference in New Issue