forked from academiadocodigo/TBGWebCharts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LiquidFillGaugeJS.pas
146 lines (130 loc) · 8.96 KB
/
LiquidFillGaugeJS.pas
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
unit LiquidFillGaugeJS;
Interface
uses Interfaces, Classes;
type
TLiquidFillGaugeJS = class(TInterfacedObject, iModelJS)
private
FCDN: Boolean;
FPack: TStringList;
public
constructor Create;
destructor Destroy; override;
class function New: iModelJS;
procedure LiquidFillGauge_1;
function PackJS: String;
function CDN(Value: Boolean): iModelJS;
function Credenciais(Value: iModelCredenciais): iModelJS;
end;
implementation
uses
SysUtils,
Utilities.Encoder;
{ TLiquidFillGaugeJS }
function TLiquidFillGaugeJS.CDN(Value: Boolean): iModelJS;
begin
Result := Self;
FCDN := Value;
end;
constructor TLiquidFillGaugeJS.Create;
begin
FPack := TStringList.Create;
end;
function TLiquidFillGaugeJS.Credenciais(Value: iModelCredenciais): iModelJS;
begin
Result := Self;
end;
destructor TLiquidFillGaugeJS.Destroy;
begin
FreeAndNil(FPack);
inherited;
end;
class function TLiquidFillGaugeJS.New: iModelJS;
begin
Result := Self.Create;
end;
procedure TLiquidFillGaugeJS.LiquidFillGauge_1;
begin
FPack.Add(
'PHNjcmlwdD4NCi8qIQ0KICogQGxpY2Vuc2UgT3BlbiBzb3VyY2UgdW5kZXIgQlNEIDItY2xhdXNlIChodHRwOi8vY2hvb3NlYWxpY2Vuc2UuY29tL2xpY2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NvdW50KSsyKnQueSpNYXRoLlBJKSl9KS55MShmdW5jdGlvbih0KXtyZXR1cm4gMipmK3N9KTpxO3ZhciB2PWUud2F2ZUFuaW1hdGU/VigxKTowO0IudHJhbnNpdGlvbigpLmR1cmF0aW9uKDApLnRyYW5zaXRpb24oKS5kdXJhdGlvbihlLndhdmVBbmlt');
FPack.Add(
'YXRlP2Uud2F2ZUFuaW1hdGVUaW1lKigxLUIuYXR0cigiVCIpKTplLndhdmVSaXNlVGltZSkuZWFzZSgibGluZWFyIikuYXR0cigiZCIsbCkuYXR0cigidHJhbnNmb3JtIiwidHJhbnNsYXRlKCIrdisiLDApIikuYXR0cigiVCIsIjEiKS5lYWNoKCJlbmQiLGZ1bmN0');
FPack.Add(
'aW9uKCl7ZS53YXZlQW5pbWF0ZSYmKEIuYXR0cigidHJhbnNmb3JtIiwidHJhbnNsYXRlKCIrVigwKSsiLDApIiksVyhlLndhdmVBbmltYXRlVGltZSkpfSksei50cmFuc2l0aW9uKCkuZHVyYXRpb24oZS53YXZlUmlzZVRpbWUpLmF0dHIoInRyYW5zZm9ybSIsInRy');
FPack.Add('YW5zbGF0ZSgiK2srIiwiK3UrIikiKX19fQ0KPC9zY3JpcHQ+DQo=');
end;
function TLiquidFillGaugeJS.PackJS: String;
var
I: Integer;
begin
if FCDN then
Result := '<script src="https://thuliobittencourt.com/tbgwebcharts/liquidFillGauge.min.js"></script>'
else
begin
LiquidFillGauge_1;
for I := 0 to Pred(FPack.Count) do
Result := Result + TUtilitiesEncoder.Base64Decode(FPack[I]);
end;
end;
end.