mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-18 09:21:57 +00:00
Added HTML, CSS and JS for new user interface
This commit is contained in:
parent
568180d7b2
commit
22d5839d60
143
res/configuration.html
Normal file
143
res/configuration.html
Normal file
@ -0,0 +1,143 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>AMS reader - configuration</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/css/application.css"/>
|
||||
</head>
|
||||
<body class="bg-light">
|
||||
<main role="main" class="container">
|
||||
<div class="d-flex align-items-center p-3 my-2 text-white-50 bg-purple rounded shadow">
|
||||
<div class="lh-100">
|
||||
<h6 class="mb-0 text-white lh-100">AMS reader - configuration</h6>
|
||||
<small>v1.0.0</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-lg-4">
|
||||
<div class="my-2 p-3 bg-white rounded shadow">
|
||||
<h6 class="border-bottom border-gray pb-2 mb-4">WiFi</h6>
|
||||
<div class="row form-group">
|
||||
<label class="col-3">SSID</label>
|
||||
<div class="col-9">
|
||||
<input type="text" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
<label class="col-3">Password</label>
|
||||
<div class="col-9">
|
||||
<input type="password" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="my-3 p-3 bg-white rounded shadow">
|
||||
<h6 class="border-bottom border-gray pb-2 mb-4">AMS meter</h6>
|
||||
<div class="row form-group">
|
||||
<label class="col-4">Meter type</label>
|
||||
<div class="col-8">
|
||||
<select class="form-control">
|
||||
<option value=""></option>
|
||||
<option value="1">Kaifa</option>
|
||||
<option value="2">Aidon</option>
|
||||
<option value="3">Kamstrup</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
<label class="col-4">Fuse size</label>
|
||||
<div class="col-8">
|
||||
<select class="form-control">
|
||||
<option value=""></option>
|
||||
<option value="25">25A</option>
|
||||
<option value="32">32A</option>
|
||||
<option value="40">40A</option>
|
||||
<option value="50">50A</option>
|
||||
<option value="63">63A</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-4">
|
||||
<div class="my-2 p-3 bg-white rounded shadow">
|
||||
<h6 class="border-bottom border-gray pb-2 mb-4">MQTT</h6>
|
||||
<div class="row form-group">
|
||||
<label class="col-4">Hostname</label>
|
||||
<div class="col-8">
|
||||
<input type="text" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
<label class="col-4">Port</label>
|
||||
<div class="col-8">
|
||||
<input type="text" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
<label class="col-4">Client ID</label>
|
||||
<div class="col-8">
|
||||
<input type="text" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
<label class="col-4">Topic</label>
|
||||
<div class="col-8">
|
||||
<input type="text" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
<label class="col-4">Username</label>
|
||||
<div class="col-8">
|
||||
<input type="text" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
<label class="col-4">Password</label>
|
||||
<div class="col-8">
|
||||
<input type="password" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-4">
|
||||
<div class="my-2 p-3 bg-white rounded shadow">
|
||||
<h6 class="border-bottom border-gray pb-2 mb-4">Web server</h6>
|
||||
<div class="row form-group">
|
||||
<label class="col-4">Security</label>
|
||||
<div class="col-8">
|
||||
<select class="form-control">
|
||||
<option value="0">None</option>
|
||||
<option value="1">Only configuration</option>
|
||||
<option value="2">Everything</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
<label class="col-4">Username</label>
|
||||
<div class="col-8">
|
||||
<input type="text" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
<label class="col-4">Password</label>
|
||||
<div class="col-8">
|
||||
<input type="password" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="row form-group">
|
||||
<div class="col-6">
|
||||
<a href="/" class="btn btn-outline-secondary">Back</a>
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
<button class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
44
res/css/application.css
Normal file
44
res/css/application.css
Normal file
@ -0,0 +1,44 @@
|
||||
.bg-purple {
|
||||
background-color: var(--purple);
|
||||
}
|
||||
|
||||
|
||||
.GaugeMeter {
|
||||
position: Relative;
|
||||
text-align: Center;
|
||||
overflow: Hidden;
|
||||
cursor: Default;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.GaugeMeter SPAN, .GaugeMeter B {
|
||||
width: 54%;
|
||||
position: Absolute;
|
||||
text-align: Center;
|
||||
display: Inline-Block;
|
||||
color: RGBa(0,0,0,.8);
|
||||
font-weight: 100;
|
||||
font-family: "Open Sans", Arial;
|
||||
overflow: Hidden;
|
||||
white-space: NoWrap;
|
||||
text-overflow: Ellipsis;
|
||||
margin: 0 23%;
|
||||
}
|
||||
|
||||
.GaugeMeter[data-style="Semi"] B {
|
||||
width: 80%;
|
||||
margin: 0 10%;
|
||||
}
|
||||
|
||||
.GaugeMeter S, .GaugeMeter U {
|
||||
text-decoration: None;
|
||||
font-size: .60em;
|
||||
font-weight: 200;
|
||||
opacity: .6;
|
||||
}
|
||||
|
||||
.GaugeMeter B {
|
||||
color: #000;
|
||||
font-weight: 200;
|
||||
opacity: .8;
|
||||
}
|
||||
7
res/css/bootstrap.min.css
vendored
Normal file
7
res/css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
72
res/index.html
Normal file
72
res/index.html
Normal file
@ -0,0 +1,72 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>AMS reader - configuration</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/css/application.css"/>
|
||||
<script src="/js/jquery.min.js"></script>
|
||||
<script src="/js/GaugeMeter.js"></script>
|
||||
</head>
|
||||
<body class="bg-light">
|
||||
<main role="main" class="container">
|
||||
<div class="d-flex align-items-center p-3 my-2 text-white-50 bg-purple rounded shadow">
|
||||
<div class="lh-100">
|
||||
<h6 class="mb-0 text-white lh-100">AMS reader - configuration</h6>
|
||||
<small>v1.0.0</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="my-3 p-3 bg-white rounded shadow">
|
||||
<h6 class="border-bottom border-gray pb-2 mb-4">Current meter values</h6>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="text-center">
|
||||
<div class="GaugeMeter rounded"
|
||||
data-size="200px"
|
||||
data-text_size="0.11"
|
||||
data-width="25"
|
||||
data-style="Arch"
|
||||
data-theme="Green-Gold-Red"
|
||||
data-animationstep="0"
|
||||
data-animate_gauge_colors="1"
|
||||
|
||||
data-percent="55"
|
||||
data-text="20.1"
|
||||
data-label="Consumption"
|
||||
data-append="kW"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="row">
|
||||
<div class="col-2">P1</div>
|
||||
<div class="col-5 text-right">232.4V</div>
|
||||
<div class="col-5 text-right">19.23A</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-2">P2</div>
|
||||
<div class="col-5 text-right">234.1V</div>
|
||||
<div class="col-5 text-right">22.53A</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-2">P3</div>
|
||||
<div class="col-5 text-right">228.9V</div>
|
||||
<div class="col-5 text-right">17.83A</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="row form-group">
|
||||
<div class="col-6">
|
||||
<a href="https://github.com/gskjold/AmsToMqttBridge/releases" class="btn btn-outline-secondary">Release notes</a>
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
<a href="/configuration.html" class="btn btn-primary">Configuration</a>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<script src="/js/meter.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
276
res/js/GaugeMeter.js
Normal file
276
res/js/GaugeMeter.js
Normal file
@ -0,0 +1,276 @@
|
||||
;
|
||||
/*
|
||||
* AshAlom Gauge Meter. Version 2.0.0
|
||||
* Copyright AshAlom.com All rights reserved.
|
||||
* https://github.com/AshAlom/GaugeMeter <- Deleted!
|
||||
* https://github.com/githubsrinath/GaugeMeter <- Backup original.
|
||||
*
|
||||
* Original created by Dr Ash Alom
|
||||
*
|
||||
* This is a bug fixed and modified version of the AshAlom Gauge Meter.
|
||||
* Copyright 2018 Michael Wolf (Mictronics)
|
||||
* https://github.com/mictronics/GaugeMeter
|
||||
*
|
||||
*/
|
||||
!function ($) {
|
||||
$.fn.gaugeMeter = function (t) {
|
||||
var defaults = $.extend({
|
||||
id: "",
|
||||
percent: 0,
|
||||
used: null,
|
||||
min: null,
|
||||
total: null,
|
||||
size: 100,
|
||||
prepend: "",
|
||||
append: "",
|
||||
theme: "Red-Gold-Green",
|
||||
color: "",
|
||||
back: "RGBa(0,0,0,.06)",
|
||||
width: 3,
|
||||
style: "Full",
|
||||
stripe: "0",
|
||||
animationstep: 1,
|
||||
animate_gauge_colors: false,
|
||||
animate_text_colors: false,
|
||||
label: "",
|
||||
label_color: "Black",
|
||||
text: "",
|
||||
text_size: 0.22,
|
||||
fill: "",
|
||||
showvalue: false
|
||||
}, t);
|
||||
return this.each(function () {
|
||||
|
||||
function getThemeColor(e) {
|
||||
var t = "#2C94E0";
|
||||
return e || (e = 1e-14),
|
||||
"Red-Gold-Green" === option.theme && (e > 0 && (t = "#d90000"), e > 10 && (t = "#e32100"), e > 20 && (t = "#f35100"), e > 30 && (t = "#ff8700"), e > 40 && (t = "#ffb800"), e > 50 && (t = "#ffd900"), e > 60 && (t = "#dcd800"), e > 70 && (t = "#a6d900"), e > 80 && (t = "#69d900"), e > 90 && (t = "#32d900")),
|
||||
"Green-Gold-Red" === option.theme && (e > 0 && (t = "#32d900"), e > 10 && (t = "#69d900"), e > 20 && (t = "#a6d900"), e > 30 && (t = "#dcd800"), e > 40 && (t = "#ffd900"), e > 50 && (t = "#ffb800"), e > 60 && (t = "#ff8700"), e > 70 && (t = "#f35100"), e > 80 && (t = "#e32100"), e > 90 && (t = "#d90000")),
|
||||
"Green-Red" === option.theme && (e > 0 && (t = "#32d900"), e > 10 && (t = "#41c900"), e > 20 && (t = "#56b300"), e > 30 && (t = "#6f9900"), e > 40 && (t = "#8a7b00"), e > 50 && (t = "#a75e00"), e > 60 && (t = "#c24000"), e > 70 && (t = "#db2600"), e > 80 && (t = "#f01000"), e > 90 && (t = "#ff0000")),
|
||||
"Red-Green" === option.theme && (e > 0 && (t = "#ff0000"), e > 10 && (t = "#f01000"), e > 20 && (t = "#db2600"), e > 30 && (t = "#c24000"), e > 40 && (t = "#a75e00"), e > 50 && (t = "#8a7b00"), e > 60 && (t = "#6f9900"), e > 70 && (t = "#56b300"), e > 80 && (t = "#41c900"), e > 90 && (t = "#32d900")),
|
||||
"DarkBlue-LightBlue" === option.theme && (e > 0 && (t = "#2c94e0"), e > 10 && (t = "#2b96e1"), e > 20 && (t = "#2b99e4"), e > 30 && (t = "#2a9ce7"), e > 40 && (t = "#28a0e9"), e > 50 && (t = "#26a4ed"), e > 60 && (t = "#25a8f0"), e > 70 && (t = "#24acf3"), e > 80 && (t = "#23aff5"), e > 90 && (t = "#21b2f7")),
|
||||
"LightBlue-DarkBlue" === option.theme && (e > 0 && (t = "#21b2f7"), e > 10 && (t = "#23aff5"), e > 20 && (t = "#24acf3"), e > 30 && (t = "#25a8f0"), e > 40 && (t = "#26a4ed"), e > 50 && (t = "#28a0e9"), e > 60 && (t = "#2a9ce7"), e > 70 && (t = "#2b99e4"), e > 80 && (t = "#2b96e1"), e > 90 && (t = "#2c94e0")),
|
||||
"DarkRed-LightRed" === option.theme && (e > 0 && (t = "#d90000"), e > 10 && (t = "#dc0000"), e > 20 && (t = "#e00000"), e > 30 && (t = "#e40000"), e > 40 && (t = "#ea0000"), e > 50 && (t = "#ee0000"), e > 60 && (t = "#f30000"), e > 70 && (t = "#f90000"), e > 80 && (t = "#fc0000"), e > 90 && (t = "#ff0000")),
|
||||
"LightRed-DarkRed" === option.theme && (e > 0 && (t = "#ff0000"), e > 10 && (t = "#fc0000"), e > 20 && (t = "#f90000"), e > 30 && (t = "#f30000"), e > 40 && (t = "#ee0000"), e > 50 && (t = "#ea0000"), e > 60 && (t = "#e40000"), e > 70 && (t = "#e00000"), e > 80 && (t = "#dc0000"), e > 90 && (t = "#d90000")),
|
||||
"DarkGreen-LightGreen" === option.theme && (e > 0 && (t = "#32d900"), e > 10 && (t = "#33db00"), e > 20 && (t = "#34df00"), e > 30 && (t = "#34e200"), e > 40 && (t = "#36e700"), e > 50 && (t = "#37ec00"), e > 60 && (t = "#38f100"), e > 70 && (t = "#38f600"), e > 80 && (t = "#39f900"), e > 90 && (t = "#3afc00")),
|
||||
"LightGreen-DarkGreen" === option.theme && (e > 0 && (t = "#3afc00"), e > 10 && (t = "#39f900"), e > 20 && (t = "#38f600"), e > 30 && (t = "#38f100"), e > 40 && (t = "#37ec00"), e > 50 && (t = "#36e700"), e > 60 && (t = "#34e200"), e > 70 && (t = "#34df00"), e > 80 && (t = "#33db00"), e > 90 && (t = "#32d900")),
|
||||
"DarkGold-LightGold" === option.theme && (e > 0 && (t = "#ffb800"), e > 10 && (t = "#ffba00"), e > 20 && (t = "#ffbd00"), e > 30 && (t = "#ffc200"), e > 40 && (t = "#ffc600"), e > 50 && (t = "#ffcb00"), e > 60 && (t = "#ffcf00"), e > 70 && (t = "#ffd400"), e > 80 && (t = "#ffd600"), e > 90 && (t = "#ffd900")),
|
||||
"LightGold-DarkGold" === option.theme && (e > 0 && (t = "#ffd900"), e > 10 && (t = "#ffd600"), e > 20 && (t = "#ffd400"), e > 30 && (t = "#ffcf00"), e > 40 && (t = "#ffcb00"), e > 50 && (t = "#ffc600"), e > 60 && (t = "#ffc200"), e > 70 && (t = "#ffbd00"), e > 80 && (t = "#ffba00"), e > 90 && (t = "#ffb800")),
|
||||
"White" === option.theme && (t = "#fff"),
|
||||
"Black" === option.theme && (t = "#000"),
|
||||
t;
|
||||
}
|
||||
/* The label below gauge. */
|
||||
function createLabel(t, a) {
|
||||
if(t.children("b").length === 0){
|
||||
$("<b></b>").appendTo(t).html(option.label).css({
|
||||
"line-height": option.size + 5 * a + "px",
|
||||
color: option.label_color
|
||||
});
|
||||
}
|
||||
}
|
||||
/* Prepend and append text, the gauge text or percentage value. */
|
||||
function createSpanTag(t) {
|
||||
var fgcolor = "";
|
||||
if (option.animate_text_colors === true){
|
||||
fgcolor = option.fgcolor;
|
||||
}
|
||||
var child = t.children("span");
|
||||
if(child.length !== 0){
|
||||
child.html(r).css({color: fgcolor});
|
||||
return;
|
||||
}
|
||||
if(option.text_size <= 0.0 || Number.isNaN(option.text_size)){
|
||||
option.text_size = 0.22;
|
||||
}
|
||||
if(option.text_size > 0.5){
|
||||
option.text_size = 0.5;
|
||||
}
|
||||
$("<span></span>").appendTo(t).html(r).css({
|
||||
"line-height": option.size + "px",
|
||||
"font-size": option.text_size * option.size + "px",
|
||||
color: fgcolor
|
||||
});
|
||||
}
|
||||
/* Get data attributes as options from div tag. Fall back to defaults when not exists. */
|
||||
function getDataAttr(t) {
|
||||
$.each(dataAttr, function (index, element) {
|
||||
if(t.data(element) !== undefined && t.data(element) !== null){
|
||||
option[element] = t.data(element);
|
||||
} else {
|
||||
option[element] = $(defaults).attr(element);
|
||||
}
|
||||
|
||||
if(element === "fill"){
|
||||
s = option[element];
|
||||
}
|
||||
|
||||
if((element === "size" ||
|
||||
element === "width" ||
|
||||
element === "animationstep" ||
|
||||
element === "stripe"
|
||||
) && !Number.isInteger(option[element])){
|
||||
option[element] = parseInt(option[element]);
|
||||
}
|
||||
|
||||
if(element === "text_size"){
|
||||
option[element] = parseFloat(option[element]);
|
||||
}
|
||||
});
|
||||
}
|
||||
/* Draws the gauge. */
|
||||
function drawGauge(a) {
|
||||
if(M < 0) M = 0;
|
||||
if(M > 100) M = 100;
|
||||
var lw = option.width < 1 || isNaN(option.width) ? option.size / 20 : option.width;
|
||||
g.clearRect(0, 0, b.width, b.height);
|
||||
g.beginPath();
|
||||
g.arc(m, v, x, G, k, !1);
|
||||
if(s){
|
||||
g.fillStyle = option.fill;
|
||||
g.fill();
|
||||
}
|
||||
g.lineWidth = lw;
|
||||
g.strokeStyle = option.back;
|
||||
option.stripe > parseInt(0) ? g.setLineDash([option.stripe], 1) : g.lineCap = "round";
|
||||
g.stroke();
|
||||
g.beginPath();
|
||||
g.arc(m, v, x, -I, P * a - I, !1);
|
||||
g.lineWidth = lw;
|
||||
g.strokeStyle = option.fgcolor;
|
||||
g.stroke();
|
||||
c > M && (M += z, requestAnimationFrame(function(){
|
||||
drawGauge(Math.min(M, c) / 100);
|
||||
}, p));
|
||||
}
|
||||
|
||||
$(this).attr("data-id", $(this).attr("id"));
|
||||
var r,
|
||||
dataAttr = ["percent",
|
||||
"used",
|
||||
"min",
|
||||
"total",
|
||||
"size",
|
||||
"prepend",
|
||||
"append",
|
||||
"theme",
|
||||
"color",
|
||||
"back",
|
||||
"width",
|
||||
"style",
|
||||
"stripe",
|
||||
"animationstep",
|
||||
"animate_gauge_colors",
|
||||
"animate_text_colors",
|
||||
"label",
|
||||
"label_color",
|
||||
"text",
|
||||
"text_size",
|
||||
"fill",
|
||||
"showvalue"],
|
||||
option = {},
|
||||
c = 0,
|
||||
p = $(this),
|
||||
s = false;
|
||||
p.addClass("gaugeMeter");
|
||||
getDataAttr(p);
|
||||
|
||||
if(Number.isInteger(option.used) && Number.isInteger(option.total)){
|
||||
var u = option.used;
|
||||
var t = option.total;
|
||||
if(Number.isInteger(option.min)) {
|
||||
if(option.min < 0) {
|
||||
t -= option.min;
|
||||
u -= option.min;
|
||||
}
|
||||
}
|
||||
c = u / (t / 100);
|
||||
} else {
|
||||
if(Number.isInteger(option.percent)){
|
||||
c = option.percent;
|
||||
} else {
|
||||
c = parseInt(defaults.percent);
|
||||
}
|
||||
}
|
||||
if(c < 0) c = 0;
|
||||
if(c > 100) c = 100;
|
||||
|
||||
if( option.text !== "" && option.text !== null && option.text !== undefined){
|
||||
if(option.append !== "" && option.append !== null && option.append !== undefined){
|
||||
r = option.text + "<u>" + option.append + "</u>";
|
||||
} else {
|
||||
r = option.text;
|
||||
}
|
||||
if(option.prepend !== "" && option.prepend !== null && option.prepend !== undefined){
|
||||
r = "<s>" + option.prepend + "</s>" + r;
|
||||
}
|
||||
} else {
|
||||
if(defaults.showvalue === true || option.showvalue === true){
|
||||
r = option.used;
|
||||
} else {
|
||||
r = c.toString();
|
||||
}
|
||||
if(option.prepend !== "" && option.prepend !== null && option.prepend !== undefined){
|
||||
r = "<s>" + option.prepend + "</s>" + r;
|
||||
}
|
||||
|
||||
if(option.append !== "" && option.append !== null && option.append !== undefined){
|
||||
r = r + "<u>" + option.append + "</u>";
|
||||
}
|
||||
}
|
||||
|
||||
option.fgcolor = getThemeColor(c);
|
||||
if(option.color !== "" && option.color !== null && option.color !== undefined){
|
||||
option.fgcolor = option.color;
|
||||
}
|
||||
|
||||
if(option.animate_gauge_colors === true){
|
||||
option.fgcolor = getThemeColor(c);
|
||||
}
|
||||
createSpanTag(p);
|
||||
|
||||
if(option.style !== "" && option.style !== null && option.style !== undefined){
|
||||
createLabel(p, option.size / 13);
|
||||
}
|
||||
|
||||
$(this).width(option.size + "px");
|
||||
|
||||
var b = $("<canvas></canvas>").attr({width: option.size, height: option.size}).get(0),
|
||||
g = b.getContext("2d"),
|
||||
m = b.width / 2,
|
||||
v = b.height / 2,
|
||||
_ = 360 * option.percent,
|
||||
x = (_ * (Math.PI / 180), b.width / 2.5),
|
||||
k = 2.3 * Math.PI,
|
||||
G = 0,
|
||||
M = 0 === option.animationstep ? c : 0,
|
||||
z = Math.max(option.animationstep, 0),
|
||||
P = 2 * Math.PI,
|
||||
I = Math.PI / 2,
|
||||
R = option.style;
|
||||
var child = $(this).children("canvas");
|
||||
if(child.length !== 0){
|
||||
/* Replace existing canvas when new percentage was written. */
|
||||
child.replaceWith(b);
|
||||
} else {
|
||||
/* Initially create canvas. */
|
||||
$(b).appendTo($(this));
|
||||
}
|
||||
|
||||
if ("Semi" === R){
|
||||
k = 2 * Math.PI;
|
||||
G = 3.13;
|
||||
P = 1 * Math.PI;
|
||||
I = Math.PI / .996;
|
||||
}
|
||||
if ("Arch" === R){
|
||||
k = 2.195 * Math.PI;
|
||||
G = 1, G = 655.99999;
|
||||
P = 1.4 * Math.PI;
|
||||
I = Math.PI / .8335;
|
||||
}
|
||||
drawGauge(M / 100);
|
||||
});
|
||||
};
|
||||
}
|
||||
(jQuery);
|
||||
2
res/js/jquery.min.js
vendored
Normal file
2
res/js/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
11
res/js/meter.js
Normal file
11
res/js/meter.js
Normal file
@ -0,0 +1,11 @@
|
||||
$(function() {
|
||||
$(".GaugeMeter").gaugeMeter();
|
||||
|
||||
$('.update').on('click', function() {
|
||||
var el = $(".GaugeMeter");
|
||||
el.data('percent', 75);
|
||||
el.data('text', '33.8');
|
||||
el.gaugeMeter();
|
||||
console.log(el);
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user